summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/current.txt16
-rw-r--r--core/java/android/app/DatePickerDialog.java23
-rw-r--r--core/java/android/app/TimePickerDialog.java24
-rw-r--r--core/java/android/content/pm/ApplicationInfo.java20
-rw-r--r--core/java/android/content/pm/PackageParser.java6
-rw-r--r--core/java/android/view/LayoutInflater.java9
-rw-r--r--core/java/android/view/View.java126
-rw-r--r--core/java/android/view/ViewConfiguration.java54
-rw-r--r--core/java/android/view/ViewStub.java28
-rw-r--r--core/java/android/webkit/WebView.java7
-rw-r--r--core/java/android/webkit/WebViewClassic.java71
-rw-r--r--core/java/android/webkit/WebViewProvider.java2
-rw-r--r--core/java/android/widget/NumberPicker.java60
-rw-r--r--core/res/res/layout-sw600dp/keyguard_screen_password_portrait.xml2
-rw-r--r--core/res/res/layout/date_picker_holo.xml6
-rw-r--r--core/res/res/layout/time_picker_holo.xml6
-rw-r--r--core/res/res/values/attrs_manifest.xml3
-rw-r--r--core/res/res/values/public.xml3
-rwxr-xr-xcore/res/res/values/strings.xml2
-rw-r--r--core/res/res/values/styles.xml2
-rw-r--r--data/fonts/Android.mk29
-rw-r--r--data/fonts/fallback_fonts-ja.xml96
-rw-r--r--data/fonts/fallback_fonts.xml5
-rw-r--r--data/fonts/fonts.mk4
-rw-r--r--docs/html/guide/guide_toc.cs21
-rw-r--r--docs/html/resources/resources_toc.cs13
-rw-r--r--docs/html/shareables/training/LocationAware.zipbin0 -> 36317 bytes
-rw-r--r--docs/html/training/location/currentlocation.jd155
-rw-r--r--docs/html/training/location/geocoding.jd98
-rw-r--r--docs/html/training/location/index.jd51
-rw-r--r--docs/html/training/location/locationmanager.jd90
-rw-r--r--media/java/android/media/AudioService.java5
-rw-r--r--media/java/android/media/MediaCodec.java1
-rw-r--r--media/jni/android_media_MediaCodec.cpp5
-rw-r--r--services/java/com/android/server/am/ActivityManagerService.java13
-rw-r--r--services/sensorservice/SensorService.cpp11
-rw-r--r--tests/BiDiTests/AndroidManifest.xml4
37 files changed, 836 insertions, 235 deletions
diff --git a/api/current.txt b/api/current.txt
index ea93c62..b08705e 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -596,7 +596,7 @@ package android {
field public static final int layerType = 16843604; // 0x1010354
field public static final int layout = 16842994; // 0x10100f2
field public static final int layoutAnimation = 16842988; // 0x10100ec
- field public static final int layoutDirection = 16843689; // 0x10103a9
+ field public static final int layoutDirection = 16843690; // 0x10103aa
field public static final int layout_above = 16843140; // 0x1010184
field public static final int layout_alignBaseline = 16843142; // 0x1010186
field public static final int layout_alignBottom = 16843146; // 0x101018a
@@ -618,10 +618,10 @@ package android {
field public static final int layout_height = 16842997; // 0x10100f5
field public static final int layout_margin = 16842998; // 0x10100f6
field public static final int layout_marginBottom = 16843002; // 0x10100fa
- field public static final int layout_marginEnd = 16843693; // 0x10103ad
+ field public static final int layout_marginEnd = 16843694; // 0x10103ae
field public static final int layout_marginLeft = 16842999; // 0x10100f7
field public static final int layout_marginRight = 16843001; // 0x10100f9
- field public static final int layout_marginStart = 16843692; // 0x10103ac
+ field public static final int layout_marginStart = 16843693; // 0x10103ad
field public static final int layout_marginTop = 16843000; // 0x10100f8
field public static final int layout_row = 16843643; // 0x101037b
field public static final int layout_rowSpan = 16843644; // 0x101037c
@@ -717,10 +717,10 @@ package android {
field public static final int packageNames = 16843649; // 0x1010381
field public static final int padding = 16842965; // 0x10100d5
field public static final int paddingBottom = 16842969; // 0x10100d9
- field public static final int paddingEnd = 16843691; // 0x10103ab
+ field public static final int paddingEnd = 16843692; // 0x10103ac
field public static final int paddingLeft = 16842966; // 0x10100d6
field public static final int paddingRight = 16842968; // 0x10100d8
- field public static final int paddingStart = 16843690; // 0x10103aa
+ field public static final int paddingStart = 16843691; // 0x10103ab
field public static final int paddingTop = 16842967; // 0x10100d7
field public static final int panelBackground = 16842846; // 0x101005e
field public static final int panelColorBackground = 16842849; // 0x1010061
@@ -931,6 +931,7 @@ package android {
field public static final int summaryColumn = 16843426; // 0x10102a2
field public static final int summaryOff = 16843248; // 0x10101f0
field public static final int summaryOn = 16843247; // 0x10101ef
+ field public static final int supportsRtl = 16843688; // 0x10103a8
field public static final int supportsUploading = 16843419; // 0x101029b
field public static final int switchMinWidth = 16843632; // 0x1010370
field public static final int switchPadding = 16843633; // 0x1010371
@@ -1000,7 +1001,7 @@ package android {
field public static final int textColorTertiary = 16843282; // 0x1010212
field public static final int textColorTertiaryInverse = 16843283; // 0x1010213
field public static final int textCursorDrawable = 16843618; // 0x1010362
- field public static final int textDirection = 16843688; // 0x10103a8
+ field public static final int textDirection = 16843689; // 0x10103a9
field public static final int textEditNoPasteWindowLayout = 16843541; // 0x1010315
field public static final int textEditPasteWindowLayout = 16843540; // 0x1010314
field public static final int textEditSideNoPasteWindowLayout = 16843615; // 0x101035f
@@ -6131,6 +6132,7 @@ package android.content.pm {
field public static final int FLAG_STOPPED = 2097152; // 0x200000
field public static final int FLAG_SUPPORTS_LARGE_SCREENS = 2048; // 0x800
field public static final int FLAG_SUPPORTS_NORMAL_SCREENS = 1024; // 0x400
+ field public static final int FLAG_SUPPORTS_RTL = 1073741824; // 0x40000000
field public static final int FLAG_SUPPORTS_SCREEN_DENSITIES = 8192; // 0x2000
field public static final int FLAG_SUPPORTS_SMALL_SCREENS = 512; // 0x200
field public static final int FLAG_SUPPORTS_XLARGE_SCREENS = 524288; // 0x80000
@@ -24103,9 +24105,11 @@ package android.view {
ctor public ViewStub(android.content.Context, android.util.AttributeSet);
ctor public ViewStub(android.content.Context, android.util.AttributeSet, int);
method public int getInflatedId();
+ method public android.view.LayoutInflater getLayoutInflater();
method public int getLayoutResource();
method public android.view.View inflate();
method public void setInflatedId(int);
+ method public void setLayoutInflater(android.view.LayoutInflater);
method public void setLayoutResource(int);
method public void setOnInflateListener(android.view.ViewStub.OnInflateListener);
}
diff --git a/core/java/android/app/DatePickerDialog.java b/core/java/android/app/DatePickerDialog.java
index bf8fde0..c62e5cf 100644
--- a/core/java/android/app/DatePickerDialog.java
+++ b/core/java/android/app/DatePickerDialog.java
@@ -92,8 +92,7 @@ public class DatePickerDialog extends AlertDialog implements OnClickListener,
mCallBack = callBack;
Context themeContext = getContext();
- setButton(BUTTON_POSITIVE, themeContext.getText(R.string.date_time_set), this);
- setButton(BUTTON_NEGATIVE, themeContext.getText(R.string.cancel), (OnClickListener) null);
+ setButton(BUTTON_POSITIVE, themeContext.getText(R.string.date_time_done), this);
setIcon(0);
setTitle(R.string.date_picker_dialog_title);
@@ -106,11 +105,7 @@ public class DatePickerDialog extends AlertDialog implements OnClickListener,
}
public void onClick(DialogInterface dialog, int which) {
- if (mCallBack != null) {
- mDatePicker.clearFocus();
- mCallBack.onDateSet(mDatePicker, mDatePicker.getYear(),
- mDatePicker.getMonth(), mDatePicker.getDayOfMonth());
- }
+ tryNotifyDateSet();
}
public void onDateChanged(DatePicker view, int year,
@@ -138,6 +133,20 @@ public class DatePickerDialog extends AlertDialog implements OnClickListener,
mDatePicker.updateDate(year, monthOfYear, dayOfMonth);
}
+ private void tryNotifyDateSet() {
+ if (mCallBack != null) {
+ mDatePicker.clearFocus();
+ mCallBack.onDateSet(mDatePicker, mDatePicker.getYear(),
+ mDatePicker.getMonth(), mDatePicker.getDayOfMonth());
+ }
+ }
+
+ @Override
+ protected void onStop() {
+ tryNotifyDateSet();
+ super.onStop();
+ }
+
@Override
public Bundle onSaveInstanceState() {
Bundle state = super.onSaveInstanceState();
diff --git a/core/java/android/app/TimePickerDialog.java b/core/java/android/app/TimePickerDialog.java
index 353b415..d773bc8 100644
--- a/core/java/android/app/TimePickerDialog.java
+++ b/core/java/android/app/TimePickerDialog.java
@@ -96,9 +96,7 @@ public class TimePickerDialog extends AlertDialog
setTitle(R.string.time_picker_dialog_title);
Context themeContext = getContext();
- setButton(BUTTON_POSITIVE, themeContext.getText(R.string.date_time_set), this);
- setButton(BUTTON_NEGATIVE, themeContext.getText(R.string.cancel),
- (OnClickListener) null);
+ setButton(BUTTON_POSITIVE, themeContext.getText(R.string.date_time_done), this);
LayoutInflater inflater =
(LayoutInflater) themeContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
@@ -114,11 +112,7 @@ public class TimePickerDialog extends AlertDialog
}
public void onClick(DialogInterface dialog, int which) {
- if (mCallback != null) {
- mTimePicker.clearFocus();
- mCallback.onTimeSet(mTimePicker, mTimePicker.getCurrentHour(),
- mTimePicker.getCurrentMinute());
- }
+ tryNotifyTimeSet();
}
public void updateTime(int hourOfDay, int minutOfHour) {
@@ -130,6 +124,20 @@ public class TimePickerDialog extends AlertDialog
/* do nothing */
}
+ private void tryNotifyTimeSet() {
+ if (mCallback != null) {
+ mTimePicker.clearFocus();
+ mCallback.onTimeSet(mTimePicker, mTimePicker.getCurrentHour(),
+ mTimePicker.getCurrentMinute());
+ }
+ }
+
+ @Override
+ protected void onStop() {
+ tryNotifyTimeSet();
+ super.onStop();
+ }
+
@Override
public Bundle onSaveInstanceState() {
Bundle state = super.onSaveInstanceState();
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index 65a8750..cbabc7c 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -291,6 +291,17 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
public static final int FLAG_STOPPED = 1<<21;
/**
+ * Value for {@link #flags}: true when the application is willing to support
+ * RTL (right to left). All activities will inherit this value.
+ *
+ * Set from the {@link android.R.attr#supportsRtl} attribute in the
+ * activity's manifest.
+ *
+ * Default value is false (no support for RTL).
+ */
+ public static final int FLAG_SUPPORTS_RTL = 1<<22;
+
+ /**
* Value for {@link #flags}: Set to true if the application has been
* installed using the forward lock option.
*
@@ -466,8 +477,17 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
if (uiOptions != 0) {
pw.println(prefix + "uiOptions=0x" + Integer.toHexString(uiOptions));
}
+ pw.println(prefix + "supportsRtl=" + (hasRtlSupport() ? "true" : "false"));
super.dumpBack(pw, prefix);
}
+
+ /**
+ * @return true if "supportsRtl" has been set to true in the AndroidManifest
+ * @hide
+ */
+ public boolean hasRtlSupport() {
+ return (flags & FLAG_SUPPORTS_RTL) == FLAG_SUPPORTS_RTL;
+ }
public static class DisplayNameComparator
implements Comparator<ApplicationInfo> {
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index eb8536f..a79b86a 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -1761,6 +1761,12 @@ public class PackageParser {
ai.flags |= ApplicationInfo.FLAG_LARGE_HEAP;
}
+ if (sa.getBoolean(
+ com.android.internal.R.styleable.AndroidManifestApplication_supportsRtl,
+ false /* default is no RTL support*/)) {
+ ai.flags |= ApplicationInfo.FLAG_SUPPORTS_RTL;
+ }
+
String str;
str = sa.getNonConfigurationString(
com.android.internal.R.styleable.AndroidManifestApplication_permission, 0);
diff --git a/core/java/android/view/LayoutInflater.java b/core/java/android/view/LayoutInflater.java
index 3c0ee12..26a5b26 100644
--- a/core/java/android/view/LayoutInflater.java
+++ b/core/java/android/view/LayoutInflater.java
@@ -583,7 +583,14 @@ public abstract class LayoutInflater {
Object[] args = mConstructorArgs;
args[1] = attrs;
- return constructor.newInstance(args);
+
+ final View view = constructor.newInstance(args);
+ if (view instanceof ViewStub) {
+ // always use ourselves when inflating ViewStub later
+ final ViewStub viewStub = (ViewStub) view;
+ viewStub.setLayoutInflater(this);
+ }
+ return view;
} catch (NoSuchMethodException e) {
InflateException ie = new InflateException(attrs.getPositionDescription()
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index cecb445..c40a7d5 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -10015,6 +10015,13 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
}
/**
+ * Return true if the application tag in the AndroidManifest has set "supportRtl" to true
+ */
+ private boolean hasRtlSupport() {
+ return mContext.getApplicationInfo().hasRtlSupport();
+ }
+
+ /**
* Resolve and cache the layout direction. LTR is set initially. This is implicitly supposing
* that the parent directionality can and will be resolved before its children.
* Will call {@link View#onResolvedLayoutDirectionChanged} when resolution is done.
@@ -10023,30 +10030,32 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
// Clear any previous layout direction resolution
mPrivateFlags2 &= ~LAYOUT_DIRECTION_RESOLVED_MASK;
- // Set resolved depending on layout direction
- switch (getLayoutDirection()) {
- case LAYOUT_DIRECTION_INHERIT:
- // If this is root view, no need to look at parent's layout dir.
- if (canResolveLayoutDirection()) {
- ViewGroup viewGroup = ((ViewGroup) mParent);
+ if (hasRtlSupport()) {
+ // Set resolved depending on layout direction
+ switch (getLayoutDirection()) {
+ case LAYOUT_DIRECTION_INHERIT:
+ // If this is root view, no need to look at parent's layout dir.
+ if (canResolveLayoutDirection()) {
+ ViewGroup viewGroup = ((ViewGroup) mParent);
- if (viewGroup.getResolvedLayoutDirection() == LAYOUT_DIRECTION_RTL) {
+ if (viewGroup.getResolvedLayoutDirection() == LAYOUT_DIRECTION_RTL) {
+ mPrivateFlags2 |= LAYOUT_DIRECTION_RESOLVED_RTL;
+ }
+ } else {
+ // Nothing to do, LTR by default
+ }
+ break;
+ case LAYOUT_DIRECTION_RTL:
+ mPrivateFlags2 |= LAYOUT_DIRECTION_RESOLVED_RTL;
+ break;
+ case LAYOUT_DIRECTION_LOCALE:
+ if(isLayoutDirectionRtl(Locale.getDefault())) {
mPrivateFlags2 |= LAYOUT_DIRECTION_RESOLVED_RTL;
}
- } else {
+ break;
+ default:
// Nothing to do, LTR by default
- }
- break;
- case LAYOUT_DIRECTION_RTL:
- mPrivateFlags2 |= LAYOUT_DIRECTION_RESOLVED_RTL;
- break;
- case LAYOUT_DIRECTION_LOCALE:
- if(isLayoutDirectionRtl(Locale.getDefault())) {
- mPrivateFlags2 |= LAYOUT_DIRECTION_RESOLVED_RTL;
- }
- break;
- default:
- // Nothing to do, LTR by default
+ }
}
// Set to resolved
@@ -14827,44 +14836,49 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
// Reset any previous text direction resolution
mPrivateFlags2 &= ~(TEXT_DIRECTION_RESOLVED | TEXT_DIRECTION_RESOLVED_MASK);
- // Set resolved text direction flag depending on text direction flag
- final int textDirection = getTextDirection();
- switch(textDirection) {
- case TEXT_DIRECTION_INHERIT:
- if (canResolveTextDirection()) {
- ViewGroup viewGroup = ((ViewGroup) mParent);
-
- // Set current resolved direction to the same value as the parent's one
- final int parentResolvedDirection = viewGroup.getResolvedTextDirection();
- switch (parentResolvedDirection) {
- case TEXT_DIRECTION_FIRST_STRONG:
- case TEXT_DIRECTION_ANY_RTL:
- case TEXT_DIRECTION_LTR:
- case TEXT_DIRECTION_RTL:
- case TEXT_DIRECTION_LOCALE:
- mPrivateFlags2 |=
- (parentResolvedDirection << TEXT_DIRECTION_RESOLVED_MASK_SHIFT);
- break;
- default:
- // Default resolved direction is "first strong" heuristic
- mPrivateFlags2 |= TEXT_DIRECTION_RESOLVED_DEFAULT;
+ if (hasRtlSupport()) {
+ // Set resolved text direction flag depending on text direction flag
+ final int textDirection = getTextDirection();
+ switch(textDirection) {
+ case TEXT_DIRECTION_INHERIT:
+ if (canResolveTextDirection()) {
+ ViewGroup viewGroup = ((ViewGroup) mParent);
+
+ // Set current resolved direction to the same value as the parent's one
+ final int parentResolvedDirection = viewGroup.getResolvedTextDirection();
+ switch (parentResolvedDirection) {
+ case TEXT_DIRECTION_FIRST_STRONG:
+ case TEXT_DIRECTION_ANY_RTL:
+ case TEXT_DIRECTION_LTR:
+ case TEXT_DIRECTION_RTL:
+ case TEXT_DIRECTION_LOCALE:
+ mPrivateFlags2 |=
+ (parentResolvedDirection << TEXT_DIRECTION_RESOLVED_MASK_SHIFT);
+ break;
+ default:
+ // Default resolved direction is "first strong" heuristic
+ mPrivateFlags2 |= TEXT_DIRECTION_RESOLVED_DEFAULT;
+ }
+ } else {
+ // We cannot do the resolution if there is no parent, so use the default one
+ mPrivateFlags2 |= TEXT_DIRECTION_RESOLVED_DEFAULT;
}
- } else {
- // We cannot do the resolution if there is no parent, so use the default one
+ break;
+ case TEXT_DIRECTION_FIRST_STRONG:
+ case TEXT_DIRECTION_ANY_RTL:
+ case TEXT_DIRECTION_LTR:
+ case TEXT_DIRECTION_RTL:
+ case TEXT_DIRECTION_LOCALE:
+ // Resolved direction is the same as text direction
+ mPrivateFlags2 |= (textDirection << TEXT_DIRECTION_RESOLVED_MASK_SHIFT);
+ break;
+ default:
+ // Default resolved direction is "first strong" heuristic
mPrivateFlags2 |= TEXT_DIRECTION_RESOLVED_DEFAULT;
- }
- break;
- case TEXT_DIRECTION_FIRST_STRONG:
- case TEXT_DIRECTION_ANY_RTL:
- case TEXT_DIRECTION_LTR:
- case TEXT_DIRECTION_RTL:
- case TEXT_DIRECTION_LOCALE:
- // Resolved direction is the same as text direction
- mPrivateFlags2 |= (textDirection << TEXT_DIRECTION_RESOLVED_MASK_SHIFT);
- break;
- default:
- // Default resolved direction is "first strong" heuristic
- mPrivateFlags2 |= TEXT_DIRECTION_RESOLVED_DEFAULT;
+ }
+ } else {
+ // Default resolved direction is "first strong" heuristic
+ mPrivateFlags2 |= TEXT_DIRECTION_RESOLVED_DEFAULT;
}
// Set to resolved
diff --git a/core/java/android/view/ViewConfiguration.java b/core/java/android/view/ViewConfiguration.java
index 20183ee..b9924c7 100644
--- a/core/java/android/view/ViewConfiguration.java
+++ b/core/java/android/view/ViewConfiguration.java
@@ -31,14 +31,14 @@ import android.util.SparseArray;
public class ViewConfiguration {
/**
* Expected bit depth of the display panel.
- *
+ *
* @hide
*/
public static final float PANEL_BIT_DEPTH = 24;
/**
* Minimum alpha required for a view to draw.
- *
+ *
* @hide
*/
public static final float ALPHA_THRESHOLD = 0.5f / PANEL_BIT_DEPTH;
@@ -72,8 +72,8 @@ public class ViewConfiguration {
* Defines the duration in milliseconds of the pressed state in child
* components.
*/
- private static final int PRESSED_STATE_DURATION = 125;
-
+ private static final int PRESSED_STATE_DURATION = 64;
+
/**
* Defines the default duration in milliseconds before a press turns into
* a long press
@@ -91,18 +91,18 @@ public class ViewConfiguration {
* lock screen, etc).
*/
private static final int GLOBAL_ACTIONS_KEY_TIMEOUT = 500;
-
+
/**
- * Defines the duration in milliseconds we will wait to see if a touch event
+ * Defines the duration in milliseconds we will wait to see if a touch event
* is a tap or a scroll. If the user does not move within this interval, it is
- * considered to be a tap.
+ * considered to be a tap.
*/
private static final int TAP_TIMEOUT = 180;
-
+
/**
- * Defines the duration in milliseconds we will wait to see if a touch event
+ * Defines the duration in milliseconds we will wait to see if a touch event
* is a jump tap. If the user does not complete the jump tap within this interval, it is
- * considered to be a tap.
+ * considered to be a tap.
*/
private static final int JUMP_TAP_TIMEOUT = 500;
@@ -128,7 +128,7 @@ public class ViewConfiguration {
private static final int HOVER_TAP_SLOP = 20;
/**
- * Defines the duration in milliseconds we want to display zoom controls in response
+ * Defines the duration in milliseconds we want to display zoom controls in response
* to a user panning within an application.
*/
private static final int ZOOM_CONTROLS_TIMEOUT = 3000;
@@ -137,7 +137,7 @@ public class ViewConfiguration {
* Inset in dips to look for touchable content when the user touches the edge of the screen
*/
private static final int EDGE_SLOP = 12;
-
+
/**
* Distance a touch can wander before we think the user is scrolling in dips.
* Note that this value defined here is only used as a fallback by legacy/misbehaving
@@ -150,7 +150,7 @@ public class ViewConfiguration {
* the characteristics of the touch panel and firmware.
*/
private static final int TOUCH_SLOP = 8;
-
+
/**
* Distance the first touch can wander before we stop considering this event a double tap
* (in dips)
@@ -170,12 +170,12 @@ public class ViewConfiguration {
* config_viewConfigurationTouchSlop * 2 when provided with a Context.
*/
private static final int PAGING_TOUCH_SLOP = TOUCH_SLOP * 2;
-
+
/**
* Distance in dips between the first touch and second touch to still be considered a double tap
*/
private static final int DOUBLE_TAP_SLOP = 100;
-
+
/**
* Distance in dips a touch needs to be outside of a window's bounds for it to
* count as outside for purposes of dismissing the window.
@@ -186,7 +186,7 @@ public class ViewConfiguration {
* Minimum velocity to initiate a fling, as measured in dips per second
*/
private static final int MINIMUM_FLING_VELOCITY = 50;
-
+
/**
* Maximum velocity to initiate a fling, as measured in dips per second
*/
@@ -281,7 +281,7 @@ public class ViewConfiguration {
*
* @param context The application context used to initialize this view configuration.
*
- * @see #get(android.content.Context)
+ * @see #get(android.content.Context)
* @see android.util.DisplayMetrics
*/
private ViewConfiguration(Context context) {
@@ -383,7 +383,7 @@ public class ViewConfiguration {
public static int getScrollDefaultDelay() {
return SCROLL_BAR_DEFAULT_DELAY;
}
-
+
/**
* @return the length of the fading edges in dips
*
@@ -435,7 +435,7 @@ public class ViewConfiguration {
/**
* @return the duration in milliseconds we will wait to see if a touch event
* is a tap or a scroll. If the user does not move within this interval, it is
- * considered to be a tap.
+ * considered to be a tap.
*/
public static int getTapTimeout() {
return TAP_TIMEOUT;
@@ -444,12 +444,12 @@ public class ViewConfiguration {
/**
* @return the duration in milliseconds we will wait to see if a touch event
* is a jump tap. If the user does not move within this interval, it is
- * considered to be a tap.
+ * considered to be a tap.
*/
public static int getJumpTapTimeout() {
return JUMP_TAP_TIMEOUT;
}
-
+
/**
* @return the duration in milliseconds between the first tap's up event and
* the second tap's down event for an interaction to be considered a
@@ -514,7 +514,7 @@ public class ViewConfiguration {
public int getScaledTouchSlop() {
return mTouchSlop;
}
-
+
/**
* @return Distance in pixels the first touch can wander before we do not consider this a
* potential double tap event
@@ -543,7 +543,7 @@ public class ViewConfiguration {
public static int getDoubleTapSlop() {
return DOUBLE_TAP_SLOP;
}
-
+
/**
* @return Distance in pixels between the first touch and second touch to still be
* considered a double tap
@@ -595,7 +595,7 @@ public class ViewConfiguration {
public int getScaledWindowTouchSlop() {
return mWindowTouchSlop;
}
-
+
/**
* @return Minimum velocity to initiate a fling, as measured in dips per second.
*
@@ -629,7 +629,7 @@ public class ViewConfiguration {
public int getScaledMaximumFlingVelocity() {
return mMaximumFlingVelocity;
}
-
+
/**
* The maximum drawing cache size expressed in bytes.
*
@@ -671,7 +671,7 @@ public class ViewConfiguration {
/**
* The amount of time that the zoom controls should be
* displayed on the screen expressed in milliseconds.
- *
+ *
* @return the time the zoom controls should be visible expressed
* in milliseconds.
*/
@@ -692,7 +692,7 @@ public class ViewConfiguration {
/**
* The amount of friction applied to scrolls and flings.
- *
+ *
* @return A scalar dimensionless value representing the coefficient of
* friction.
*/
diff --git a/core/java/android/view/ViewStub.java b/core/java/android/view/ViewStub.java
index d5e9af4..69a26c2 100644
--- a/core/java/android/view/ViewStub.java
+++ b/core/java/android/view/ViewStub.java
@@ -20,6 +20,7 @@ import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.util.AttributeSet;
+import android.widget.RemoteViews.RemoteView;
import com.android.internal.R;
@@ -66,12 +67,14 @@ import java.lang.ref.WeakReference;
* @attr ref android.R.styleable#ViewStub_inflatedId
* @attr ref android.R.styleable#ViewStub_layout
*/
+@RemoteView
public final class ViewStub extends View {
private int mLayoutResource = 0;
private int mInflatedId;
private WeakReference<View> mInflatedViewRef;
+ private LayoutInflater mInflater;
private OnInflateListener mInflateListener;
public ViewStub(Context context) {
@@ -140,6 +143,7 @@ public final class ViewStub extends View {
* @see #getInflatedId()
* @attr ref android.R.styleable#ViewStub_inflatedId
*/
+ @android.view.RemotableViewMethod
public void setInflatedId(int inflatedId) {
mInflatedId = inflatedId;
}
@@ -172,10 +176,26 @@ public final class ViewStub extends View {
* @see #inflate()
* @attr ref android.R.styleable#ViewStub_layout
*/
+ @android.view.RemotableViewMethod
public void setLayoutResource(int layoutResource) {
mLayoutResource = layoutResource;
}
+ /**
+ * Set {@link LayoutInflater} to use in {@link #inflate()}, or {@code null}
+ * to use the default.
+ */
+ public void setLayoutInflater(LayoutInflater inflater) {
+ mInflater = inflater;
+ }
+
+ /**
+ * Get current {@link LayoutInflater} used in {@link #inflate()}.
+ */
+ public LayoutInflater getLayoutInflater() {
+ return mInflater;
+ }
+
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setMeasuredDimension(0, 0);
@@ -199,6 +219,7 @@ public final class ViewStub extends View {
* @see #inflate()
*/
@Override
+ @android.view.RemotableViewMethod
public void setVisibility(int visibility) {
if (mInflatedViewRef != null) {
View view = mInflatedViewRef.get();
@@ -228,7 +249,12 @@ public final class ViewStub extends View {
if (viewParent != null && viewParent instanceof ViewGroup) {
if (mLayoutResource != 0) {
final ViewGroup parent = (ViewGroup) viewParent;
- final LayoutInflater factory = LayoutInflater.from(mContext);
+ final LayoutInflater factory;
+ if (mInflater != null) {
+ factory = mInflater;
+ } else {
+ factory = LayoutInflater.from(mContext);
+ }
final View view = factory.inflate(mLayoutResource, parent,
false);
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 422b48d..9492e38 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -1913,13 +1913,6 @@ public class WebView extends AbsoluteLayout
}
@Override
- protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
- // Not using short-circuit OR: provider does suppress base-class call.
- return mProvider.getViewDelegate().drawChild(canvas, child, drawingTime) |
- super.drawChild(canvas, child, drawingTime);
- }
-
- @Override
protected void onDraw(Canvas canvas) {
mProvider.getViewDelegate().onDraw(canvas);
}
diff --git a/core/java/android/webkit/WebViewClassic.java b/core/java/android/webkit/WebViewClassic.java
index 45c5fa0..4c118ac 100644
--- a/core/java/android/webkit/WebViewClassic.java
+++ b/core/java/android/webkit/WebViewClassic.java
@@ -2011,7 +2011,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
if (mWebView instanceof TitleBarDelegate) {
return ((TitleBarDelegate) mWebView).getTitleHeight();
}
- return mTitleBar != null ? mTitleBar.getHeight() : 0;
+ return 0;
}
/**
@@ -2943,50 +2943,6 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
}
/**
- * A title bar which is embedded in this WebView, and scrolls along with it
- * vertically, but not horizontally.
- */
- private View mTitleBar;
-
- /**
- * the title bar rendering gravity
- */
- private int mTitleGravity;
-
- /**
- * Add or remove a title bar to be embedded into the WebView, and scroll
- * along with it vertically, while remaining in view horizontally. Pass
- * null to remove the title bar from the WebView, and return to drawing
- * the WebView normally without translating to account for the title bar.
- */
- public void setEmbeddedTitleBar(View v) {
- if (mWebView instanceof TitleBarDelegate) {
- ((TitleBarDelegate) mWebView).onSetEmbeddedTitleBar(v);
- }
- if (mTitleBar == v) return;
- if (mTitleBar != null) {
- mWebView.removeView(mTitleBar);
- }
- if (null != v) {
- mWebView.addView(v, new AbsoluteLayout.LayoutParams(
- ViewGroup.LayoutParams.MATCH_PARENT,
- ViewGroup.LayoutParams.WRAP_CONTENT, 0, 0));
- }
- mTitleBar = v;
- }
-
- /**
- * Set where to render the embedded title bar
- * NO_GRAVITY at the top of the page
- * TOP at the top of the screen
- */
- public void setTitleBarGravity(int gravity) {
- mTitleGravity = gravity;
- // force refresh
- invalidate();
- }
-
- /**
* Given a distance in view space, convert it to content space. Note: this
* does not reflect translation, just scaling, so this should not be called
* with coordinates, but should be called for dimensions like width or
@@ -4184,7 +4140,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
// animate the title bar off screen slowly enough that the user can see
// it.
if (cx == 0 && cy == 1 && getScrollX() == 0 && getScrollY() == 0
- && mTitleBar != null) {
+ && getTitleHeight() > 0) {
// FIXME: 100 should be defined somewhere as our max progress.
if (getProgress() < 100) {
// Wait to scroll the title bar off screen until the page has
@@ -4401,24 +4357,6 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
}
}
- @Override
- public boolean drawChild(Canvas canvas, View child, long drawingTime) {
- if (child == mTitleBar) {
- // When drawing the title bar, move it horizontally to always show
- // at the top of the WebView.
- mTitleBar.offsetLeftAndRight(getScrollX() - mTitleBar.getLeft());
- int newTop = 0;
- if (mTitleGravity == Gravity.NO_GRAVITY) {
- newTop = Math.min(0, getScrollY());
- } else if (mTitleGravity == Gravity.TOP) {
- newTop = getScrollY();
- }
- mTitleBar.setBottom(newTop + mTitleBar.getHeight());
- mTitleBar.setTop(newTop);
- }
- return false; // We never call invalidate(), so unconditionally returning false.
- }
-
private void drawContent(Canvas canvas) {
if (mDrawHistory) {
canvas.scale(mZoomManager.getScale(), mZoomManager.getScale());
@@ -4583,9 +4521,8 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
.getUseWebViewBackgroundForOverscrollBackground()) {
drawOverScrollBackground(canvas);
}
- if (mTitleBar != null) {
- canvas.translate(0, getTitleHeight());
- }
+
+ canvas.translate(0, getTitleHeight());
drawContent(canvas);
canvas.restoreToCount(saveCount);
diff --git a/core/java/android/webkit/WebViewProvider.java b/core/java/android/webkit/WebViewProvider.java
index f049198..74a215c 100644
--- a/core/java/android/webkit/WebViewProvider.java
+++ b/core/java/android/webkit/WebViewProvider.java
@@ -287,8 +287,6 @@ public interface WebViewProvider {
public void onWindowVisibilityChanged(int visibility);
- public boolean drawChild(Canvas canvas, View child, long drawingTime);
-
public void onDraw(Canvas canvas);
public void setLayoutParams(LayoutParams layoutParams);
diff --git a/core/java/android/widget/NumberPicker.java b/core/java/android/widget/NumberPicker.java
index 4e56cd6..d897a39 100644
--- a/core/java/android/widget/NumberPicker.java
+++ b/core/java/android/widget/NumberPicker.java
@@ -112,10 +112,10 @@ public class NumberPicker extends LinearLayout {
private static final int SELECTOR_ADJUSTMENT_DURATION_MILLIS = 800;
/**
- * The duration of scrolling to the next/previous value while changing the
- * current value by one, i.e. increment or decrement.
+ * The duration of scrolling to the next/previous value while snapping to
+ * a given position.
*/
- private static final int CHANGE_CURRENT_BY_ONE_SCROLL_DURATION = 300;
+ private static final int SNAP_SCROLL_DURATION = 300;
/**
* The strength of fading in the top and bottom while drawing the selector.
@@ -140,7 +140,7 @@ public class NumberPicker extends LinearLayout {
/**
* Coefficient for adjusting touch scroll distance.
*/
- private static final float TOUCH_SCROLL_DECELERATION_COEFFICIENT = 2.5f;
+ private static final float TOUCH_SCROLL_DECELERATION_COEFFICIENT = 2.0f;
/**
* The resource id for the default layout.
@@ -152,7 +152,7 @@ public class NumberPicker extends LinearLayout {
*/
private static final char[] DIGIT_CHARACTERS = new char[] {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'
- };
+ };
/**
* Constant for unspecified size.
@@ -838,7 +838,13 @@ public class NumberPicker extends LinearLayout {
if (absDeltaMoveY > mMinFlingDistance) {
fling(initialVelocity);
} else {
- changeValueByOne(deltaMove < 0);
+ final int normalizedDeltaMove =
+ (int) (absDeltaMoveY / TOUCH_SCROLL_DECELERATION_COEFFICIENT);
+ if (normalizedDeltaMove < mSelectorElementHeight) {
+ snapToNextValue(deltaMove < 0);
+ } else {
+ snapToClosestValue();
+ }
}
onScrollStateChange(OnScrollListener.SCROLL_STATE_FLING);
} else {
@@ -1509,11 +1515,9 @@ public class NumberPicker extends LinearLayout {
}
mPreviousScrollerY = 0;
if (increment) {
- mFlingScroller.startScroll(0, 0, 0, -mSelectorElementHeight,
- CHANGE_CURRENT_BY_ONE_SCROLL_DURATION);
+ mFlingScroller.startScroll(0, 0, 0, -mSelectorElementHeight, SNAP_SCROLL_DURATION);
} else {
- mFlingScroller.startScroll(0, 0, 0, mSelectorElementHeight,
- CHANGE_CURRENT_BY_ONE_SCROLL_DURATION);
+ mFlingScroller.startScroll(0, 0, 0, mSelectorElementHeight, SNAP_SCROLL_DURATION);
}
invalidate();
} else {
@@ -1902,6 +1906,42 @@ public class NumberPicker extends LinearLayout {
return false;
}
+ private void snapToNextValue(boolean increment) {
+ int deltaY = mCurrentScrollOffset - mInitialScrollOffset;
+ int amountToScroll = 0;
+ if (deltaY != 0) {
+ mPreviousScrollerY = 0;
+ if (deltaY > 0) {
+ if (increment) {
+ amountToScroll = - deltaY;
+ } else {
+ amountToScroll = mSelectorElementHeight - deltaY;
+ }
+ } else {
+ if (increment) {
+ amountToScroll = - mSelectorElementHeight - deltaY;
+ } else {
+ amountToScroll = - deltaY;
+ }
+ }
+ mFlingScroller.startScroll(0, 0, 0, amountToScroll, SNAP_SCROLL_DURATION);
+ invalidate();
+ }
+ }
+
+ private void snapToClosestValue() {
+ // adjust to the closest value
+ int deltaY = mInitialScrollOffset - mCurrentScrollOffset;
+ if (deltaY != 0) {
+ mPreviousScrollerY = 0;
+ if (Math.abs(deltaY) > mSelectorElementHeight / 2) {
+ deltaY += (deltaY > 0) ? -mSelectorElementHeight : mSelectorElementHeight;
+ }
+ mFlingScroller.startScroll(0, 0, 0, deltaY, SNAP_SCROLL_DURATION);
+ invalidate();
+ }
+ }
+
/**
* Command for setting the input text selection.
*/
diff --git a/core/res/res/layout-sw600dp/keyguard_screen_password_portrait.xml b/core/res/res/layout-sw600dp/keyguard_screen_password_portrait.xml
index fb62eb6..36d4a2a 100644
--- a/core/res/res/layout-sw600dp/keyguard_screen_password_portrait.xml
+++ b/core/res/res/layout-sw600dp/keyguard_screen_password_portrait.xml
@@ -98,7 +98,7 @@
android:textAppearance="?android:attr/textAppearanceMedium"
android:background="@null"
android:textColor="#ffffffff"
- android:imeOptions="flagForceAscii"
+ android:imeOptions="flagForceAscii|actionDone"
/>
<!-- This delete button is only visible for numeric PIN entry -->
diff --git a/core/res/res/layout/date_picker_holo.xml b/core/res/res/layout/date_picker_holo.xml
index 57b5614..122a61a 100644
--- a/core/res/res/layout/date_picker_holo.xml
+++ b/core/res/res/layout/date_picker_holo.xml
@@ -41,6 +41,8 @@
android:id="@+id/month"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginTop="10dip"
+ android:layout_marginBottom="10dip"
android:layout_marginLeft="16dip"
android:layout_marginRight="16dip"
android:focusable="true"
@@ -52,6 +54,8 @@
android:id="@+id/day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginTop="10dip"
+ android:layout_marginBottom="10dip"
android:layout_marginLeft="16dip"
android:layout_marginRight="16dip"
android:focusable="true"
@@ -63,6 +67,8 @@
android:id="@+id/year"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginTop="10dip"
+ android:layout_marginBottom="10dip"
android:layout_marginLeft="16dip"
android:layout_marginRight="16dip"
android:focusable="true"
diff --git a/core/res/res/layout/time_picker_holo.xml b/core/res/res/layout/time_picker_holo.xml
index 29c97b7..24b6194 100644
--- a/core/res/res/layout/time_picker_holo.xml
+++ b/core/res/res/layout/time_picker_holo.xml
@@ -30,6 +30,8 @@
android:id="@+id/hour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginTop="10dip"
+ android:layout_marginBottom="10dip"
android:layout_marginLeft="16dip"
android:layout_marginRight="14dip"
android:focusable="true"
@@ -49,6 +51,8 @@
android:id="@+id/minute"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginTop="10dip"
+ android:layout_marginBottom="10dip"
android:layout_marginLeft="14dip"
android:layout_marginRight="16dip"
android:focusable="true"
@@ -60,6 +64,8 @@
android:id="@+id/amPm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginTop="10dip"
+ android:layout_marginBottom="10dip"
android:layout_marginLeft="16dip"
android:layout_marginRight="16dip"
android:focusable="true"
diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index 4aa7dde..1649c48 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -843,6 +843,9 @@
@hide -->
<attr name="cantSaveState" format="boolean" />
<attr name="uiOptions" />
+ <!-- Declare that your application will be able to deal with RTL (right to left) layouts.
+ If set to false (default value), your application will not care about RTL layouts. -->
+ <attr name="supportsRtl" format="boolean" />
</declare-styleable>
<!-- The <code>permission</code> tag declares a security permission that can be
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index b60cda7..e5f049d 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -421,6 +421,7 @@
<java-symbol type="string" name="date_picker_increment_year_button" />
<java-symbol type="string" name="date_time" />
<java-symbol type="string" name="date_time_set" />
+ <java-symbol type="string" name="date_time_done" />
<java-symbol type="string" name="day_of_week_long_friday" />
<java-symbol type="string" name="day_of_week_long_monday" />
<java-symbol type="string" name="day_of_week_long_saturday" />
@@ -3550,6 +3551,8 @@
=============================================================== -->
<public type="attr" name="isolatedProcess" id="0x010103a7" />
+ <public type="attr" name="supportsRtl" id="0x010103a8" />
+
<public type="attr" name="textDirection"/>
<public type="attr" name="layoutDirection" />
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 8919664..718de0a 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -2816,6 +2816,8 @@
<string name="date_picker_dialog_title">Set date</string>
<!-- Name of the button in the date/time picker to accept the date/time change -->
<string name="date_time_set">Set</string>
+ <!-- Name of the button in the date/time picker to accept the date/time change -->
+ <string name="date_time_done">Done</string>
<!-- Security Permissions strings-->
<!-- The default permission group for any permissions that have not explicitly set a group. -->
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index 288b8b2..baeb9cc 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -1643,7 +1643,7 @@ please see styles_device_defaults.xml.
<item name="android:selectionDividerHeight">2dip</item>
<item name="android:selectionDividersDistance">48dip</item>
<item name="android:internalMinWidth">48dip</item>
- <item name="android:internalMaxHeight">200dip</item>
+ <item name="android:internalMaxHeight">180dip</item>
<item name="android:minFlingDistance">150dip</item>
</style>
diff --git a/data/fonts/Android.mk b/data/fonts/Android.mk
index ef38a60..5ba6bf9 100644
--- a/data/fonts/Android.mk
+++ b/data/fonts/Android.mk
@@ -54,7 +54,7 @@ ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
# On space-constrained devices, we include a subset of fonts:
ifeq ($(SMALLER_FONT_FOOTPRINT),true)
droidsans_fallback_src := DroidSansFallback.ttf
-extra_droidsans_fonts := DroidSans.ttf DroidSans-Bold.ttf
+extra_font_files := DroidSans.ttf DroidSans-Bold.ttf
else
include $(CLEAR_VARS)
LOCAL_MODULE := DroidSansEthiopic-Regular.ttf
@@ -64,8 +64,29 @@ LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts
include $(BUILD_PREBUILT)
+include $(CLEAR_VARS)
+LOCAL_MODULE := MTLmr3m.ttf
+LOCAL_SRC_FILES := $(LOCAL_MODULE)
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts
+include $(BUILD_PREBUILT)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := fallback_fonts-ja.xml
+LOCAL_SRC_FILES := $(LOCAL_MODULE)
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)
+include $(BUILD_PREBUILT)
+
droidsans_fallback_src := DroidSansFallbackFull.ttf
-extra_droidsans_fonts := DroidSans.ttf DroidSans-Bold.ttf DroidSansEthiopic-Regular.ttf
+extra_font_files := \
+ DroidSans.ttf \
+ DroidSans-Bold.ttf \
+ DroidSansEthiopic-Regular.ttf \
+ MTLmr3m.ttf \
+ fallback_fonts-ja.xml
endif # SMALLER_FONT_FOOTPRINT
################################
@@ -75,13 +96,13 @@ LOCAL_SRC_FILES := $(droidsans_fallback_src)
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts
-LOCAL_REQUIRED_MODULES := $(extra_droidsans_fonts)
+LOCAL_REQUIRED_MODULES := $(extra_font_files)
include $(BUILD_PREBUILT)
font_symlink_src :=
font_symlink :=
droidsans_fallback_src :=
-extra_droidsans_fonts :=
+extra_font_files :=
################################
# Build the rest font files as prebuilt.
diff --git a/data/fonts/fallback_fonts-ja.xml b/data/fonts/fallback_fonts-ja.xml
new file mode 100644
index 0000000..62491d8
--- /dev/null
+++ b/data/fonts/fallback_fonts-ja.xml
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Fallback Fonts
+
+ This file specifies the fonts, and the priority order, that will be searched for any
+ glyphs not handled by the default fonts specified in /system/etc/system_fonts.xml.
+ Each entry consists of a family tag and a list of files (file names) which support that
+ family. The fonts for each family are listed in the order of the styles that they
+ handle (the order is: regular, bold, italic, and bold-italic). The order in which the
+ families are listed in this file represents the order in which these fallback fonts
+ will be searched for glyphs that are not supported by the default system fonts (which are
+ found in /system/etc/system_fonts.xml).
+
+ Note that there is not nameset for fallback fonts, unlike the fonts specified in
+ system_fonts.xml. The ability to support specific names in fallback fonts may be supported
+ in the future. For now, the lack of files entries here is an indicator to the system that
+ these are fallback fonts, instead of default named system fonts.
+
+ There is another optional file in /vendor/etc/fallback_fonts.xml. That file can be used to
+ provide references to other font families that should be used in addition to the default
+ fallback fonts. That file can also specify the order in which the fallback fonts should be
+ searched, to ensure that a vendor-provided font will be used before another fallback font
+ which happens to handle the same glyph.
+
+ Han languages (Chinese, Japanese, and Korean) share a common range of unicode characters;
+ their ordering in the fallback or vendor files gives priority to the first in the list.
+ Locale-specific ordering can be configured by adding language and region codes to the end
+ of the filename (e.g. /system/etc/fallback_fonts-ja.xml). When no region code is used,
+ as with this example, all regions are matched. Use separate files for each supported locale.
+ The standard fallback file (fallback_fonts.xml) is used when a locale does not have its own
+ file. All fallback files must contain the same complete set of fonts; only their ordering
+ can differ.
+-->
+<familyset>
+ <family>
+ <fileset>
+ <file>DroidSansArabic.ttf</file>
+ </fileset>
+ </family>
+ <family>
+ <fileset>
+ <file>DroidSansEthiopic-Regular.ttf</file>
+ </fileset>
+ </family>
+ <family>
+ <fileset>
+ <file>DroidSansHebrew-Regular.ttf</file>
+ <file>DroidSansHebrew-Bold.ttf</file>
+ </fileset>
+ </family>
+ <family>
+ <fileset>
+ <file>DroidSansThai.ttf</file>
+ </fileset>
+ </family>
+ <family>
+ <fileset>
+ <file>DroidSansArmenian.ttf</file>
+ </fileset>
+ </family>
+ <family>
+ <fileset>
+ <file>DroidSansGeorgian.ttf</file>
+ </fileset>
+ </family>
+ <family>
+ <fileset>
+ <file>Lohit-Devanagari.ttf</file>
+ </fileset>
+ </family>
+ <family>
+ <fileset>
+ <file>Lohit-Bengali.ttf</file>
+ </fileset>
+ </family>
+ <family>
+ <fileset>
+ <file>Lohit-Tamil.ttf</file>
+ </fileset>
+ </family>
+ <family>
+ <fileset>
+ <file>AndroidEmoji.ttf</file>
+ </fileset>
+ </family>
+ <family>
+ <fileset>
+ <file>MTLmr3m.ttf</file>
+ </fileset>
+ </family>
+ <family>
+ <fileset>
+ <file>DroidSansFallback.ttf</file>
+ </fileset>
+ </family>
+</familyset>
diff --git a/data/fonts/fallback_fonts.xml b/data/fonts/fallback_fonts.xml
index 63b3a58..ba01947 100644
--- a/data/fonts/fallback_fonts.xml
+++ b/data/fonts/fallback_fonts.xml
@@ -88,4 +88,9 @@
<file>DroidSansFallback.ttf</file>
</fileset>
</family>
+ <family>
+ <fileset>
+ <file>MTLmr3m.ttf</file>
+ </fileset>
+ </family>
</familyset>
diff --git a/data/fonts/fonts.mk b/data/fonts/fonts.mk
index 458f85b..db26765 100644
--- a/data/fonts/fonts.mk
+++ b/data/fonts/fonts.mk
@@ -15,8 +15,8 @@
# Warning: this is actually a product definition, to be inherited from
PRODUCT_COPY_FILES := \
- frameworks/base/data/fonts/system_fonts.xml:system/etc/system_fonts.xml \
- frameworks/base/data/fonts/fallback_fonts.xml:system/etc/fallback_fonts.xml
+ frameworks/base/data/fonts/system_fonts.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/system_fonts.xml \
+ frameworks/base/data/fonts/fallback_fonts.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/fallback_fonts.xml
PRODUCT_PACKAGES := \
DroidSansFallback.ttf \
diff --git a/docs/html/guide/guide_toc.cs b/docs/html/guide/guide_toc.cs
index ec87de8..ba8dc5e 100644
--- a/docs/html/guide/guide_toc.cs
+++ b/docs/html/guide/guide_toc.cs
@@ -90,21 +90,20 @@
<ul>
<li>
<a href="<?cs var:toroot ?>guide/topics/providers/content-provider-basics.html">
- <span class="en">Content Provider Basics</span>
+ <span class="en">Content Provider Basics<span
+class="new">&nbsp;new!</span></span>
</a>
- <span class="new">new!</span>
</li>
<li>
<a href="<?cs var:toroot ?>guide/topics/providers/content-provider-creating.html">
- <span class="en">Creating a Content Provider</span>
+ <span class="en">Creating a Content Provider<span
+class="new">&nbsp;new!</span></span>
</a>
- <span class="new">new!</span>
</li>
<li>
<a href="<?cs var:toroot ?>guide/topics/providers/calendar-provider.html">
- <span class="en">Calendar Provider</span>
+ <span class="en">Calendar Provider<span class="new">&nbsp;new!</span></span>
</a>
- <span class="new">new!</span>
</li>
</ul>
</li>
@@ -130,8 +129,8 @@
<span class="en">Input Events</span>
</a></li>
<li><a href="<?cs var:toroot ?>guide/topics/ui/menus.html">
- <span class="en">Menus</span>
- </a> <span class="new">updated</span></li>
+ <span class="en">Menus<span class="new">&nbsp;new!</span></span>
+ </a></li>
<li><a href="<?cs var:toroot ?>guide/topics/ui/actionbar.html">
<span class="en">Action Bar</span>
</a></li>
@@ -162,8 +161,7 @@
</a></li>
<li class="toggle-list">
<div><a href="<?cs var:toroot ?>guide/topics/ui/accessibility/index.html">
- <span class="en">Accessibility</span>
- <span class="new">new!</span>
+ <span class="en">Accessibility<span class="new">&nbsp;new!</span></span>
</a></div>
<ul>
<li><a href="<?cs var:toroot ?>guide/topics/ui/accessibility/apps.html">
@@ -514,8 +512,7 @@
<span class="en">Multiple APK Support</span></a>
</li>
<li><a href="<?cs var:toroot ?>guide/market/expansion-files.html">
- <span class="en">APK Expansion Files</span></a>
- <span class="new">new!</span>
+ <span class="en">APK Expansion Files<span class="new">&nbsp;new!</span></span></a>
</li>
</ul>
</li>
diff --git a/docs/html/resources/resources_toc.cs b/docs/html/resources/resources_toc.cs
index f003e75..e4ab16f 100644
--- a/docs/html/resources/resources_toc.cs
+++ b/docs/html/resources/resources_toc.cs
@@ -100,8 +100,9 @@
<li class="toggle-list">
<div><a href="<?cs var:toroot ?>training/efficient-downloads/index.html">
- <span class="en">Transferring Data Without Draining the Battery</span>
- </a> <span class="new">new!</span></div>
+ <span class="en">Transferring Data Without Draining the Battery<span
+class="new">&nbsp;new!</span></span>
+ </a></div>
<ul>
<li><a href="<?cs var:toroot ?>training/efficient-downloads/efficient-network-access.html">
<span class="en">Optimizing Downloads for Efficient Network Access</span>
@@ -124,8 +125,8 @@
<li class="toggle-list">
<div><a href="<?cs var:toroot ?>training/search/index.html">
- <span class="en">Adding Search Functionality</span>
- </a> <span class="new">new!</span>
+ <span class="en">Adding Search Functionality<span class="new">&nbsp;new!</span></span>
+ </a>
</div>
<ul>
<li><a href="<?cs var:toroot ?>training/search/setup.html">
@@ -281,8 +282,8 @@
<li class="toggle-list">
<div><a href="<?cs var:toroot ?>training/accessibility/index.html">
- <span class="en">Implementing Accessibility</span>
- </a> <span class="new">new!</span></div>
+ <span class="en">Implementing Accessibility<span class="new">&nbsp;new!</span></span>
+ </a></div>
<ul>
<li><a href="<?cs var:toroot ?>training/accessibility/accessible-app.html">
<span class="en">Developing Accessible Applications</span>
diff --git a/docs/html/shareables/training/LocationAware.zip b/docs/html/shareables/training/LocationAware.zip
new file mode 100644
index 0000000..e1926fa
--- /dev/null
+++ b/docs/html/shareables/training/LocationAware.zip
Binary files differ
diff --git a/docs/html/training/location/currentlocation.jd b/docs/html/training/location/currentlocation.jd
new file mode 100644
index 0000000..4692530
--- /dev/null
+++ b/docs/html/training/location/currentlocation.jd
@@ -0,0 +1,155 @@
+page.title=Obtaining the Current Location
+parent.title=Making Your App Location Aware
+parent.link=index.html
+
+trainingnavtop=true
+previous.title=Using the Location Manager
+previous.link=locationmanager.html
+next.title=Displaying the Location Address
+next.link=geocoding.html
+
+
+@jd:body
+
+
+<!-- This is the training bar -->
+<div id="tb-wrapper">
+<div id="tb">
+
+<h2>This lesson teaches you to</h2>
+<ol>
+ <li><a href="currentlocation.html#TaskSetupLocationListener">Set Up the Location Listener</a></li>
+ <li><a href="currentlocation.html#TaskHandleLocationUpdates">Handle Multiple Sources of Location Updates</a></li>
+ <li><a href="currentlocation.html#TaskGetLastKnownLocation">Use getLastKnownLocation() Wisely</a></li>
+ <li><a href="currentlocation.html#TaskTerminateUpdates">Terminate Location Updates</a></li>
+</ol>
+
+<h2>You should also read</h2>
+
+<ul>
+ <li><a href="{@docRoot}guide/topics/location/index.html">Location and Maps</a></li>
+</ul>
+
+<h2>Try it out</h2>
+
+<div class="download-box">
+<a href="http://developer.android.com/shareables/training/LocationAware.zip" class="button">Download
+ the sample app</a>
+<p class="filename">LocationAware.zip</p>
+</div>
+
+</div>
+</div>
+
+<p>After setting up your application to work with {@link android.location.LocationManager}, you can begin to obtain location updates.</p>
+
+<h2 id="TaskSetupLocationListener">Set Up the Location Listener</h2>
+
+<p>The {@link android.location.LocationManager} class exposes a number of methods for applications to receive location updates. In its simplest form, you register an event listener, identify the location manager from which you'd like to receive location updates, and specify the minimum time and distance intervals at which to receive location updates. The {@link android.location.LocationListener#onLocationChanged(android.location.Location) onLocationChanged()} callback will be invoked with the frequency that correlates with time and distance intervals.</p>
+
+<p>
+In the sample code snippet below, the location listener is set up to receive notifications at least every 10 seconds and if the device moves by more than 10 meters. The other callback methods notify the application any status change coming from the location provider.
+</p>
+
+<pre>
+private final LocationListener listener = new LocationListener() {
+
+ &#064;Override
+ public void onLocationChanged(Location location) {
+ // A new location update is received. Do something useful with it. In this case,
+ // we're sending the update to a handler which then updates the UI with the new
+ // location.
+ Message.obtain(mHandler,
+ UPDATE_LATLNG,
+ location.getLatitude() + ", " +
+ location.getLongitude()).sendToTarget();
+
+ ...
+ }
+ ...
+};
+
+mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
+ 10000, // 10-second interval.
+ 10, // 10 meters.
+ listener);
+</pre>
+
+<h2 id="TaskHandleLocationUpdates">Handle Multiple Sources of Location Updates</h2>
+
+<p>Generally speaking, a location provider with greater accuracy (GPS) requires a longer fix time than one with lower accuracy (network-based). If you want to display location data as quickly as possible and update it as more accurate data becomes available, a common practice is to register a location listener with both GPS and network providers. In the {@link android.location.LocationListener#onLocationChanged(android.location.Location) onLocationChanged()} callback, you'll receive location updates from multiple location providers that may have different timestamps and varying levels of accuracy. You'll need to incorporate logic to disambiguate the location providers and discard updates that are stale and less accurate. The code snippet below demonstrates a sample implementation of this logic.</p>
+
+<pre>
+private static final int TWO_MINUTES = 1000 * 60 * 2;
+
+/** Determines whether one Location reading is better than the current Location fix
+ * @param location The new Location that you want to evaluate
+ * @param currentBestLocation The current Location fix, to which you want to compare the new one
+ */
+protected boolean isBetterLocation(Location location, Location currentBestLocation) {
+ if (currentBestLocation == null) {
+ // A new location is always better than no location
+ return true;
+ }
+
+ // Check whether the new location fix is newer or older
+ long timeDelta = location.getTime() - currentBestLocation.getTime();
+ boolean isSignificantlyNewer = timeDelta &gt; TWO_MINUTES;
+ boolean isSignificantlyOlder = timeDelta &lt; -TWO_MINUTES;
+ boolean isNewer = timeDelta > 0;
+
+ // If it's been more than two minutes since the current location, use the new location
+ // because the user has likely moved
+ if (isSignificantlyNewer) {
+ return true;
+ // If the new location is more than two minutes older, it must be worse
+ } else if (isSignificantlyOlder) {
+ return false;
+ }
+
+ // Check whether the new location fix is more or less accurate
+ int accuracyDelta = (int) (location.getAccuracy() - currentBestLocation.getAccuracy());
+ boolean isLessAccurate = accuracyDelta &gt; 0;
+ boolean isMoreAccurate = accuracyDelta &lt; 0;
+ boolean isSignificantlyLessAccurate = accuracyDelta &gt; 200;
+
+ // Check if the old and new location are from the same provider
+ boolean isFromSameProvider = isSameProvider(location.getProvider(),
+ currentBestLocation.getProvider());
+
+ // Determine location quality using a combination of timeliness and accuracy
+ if (isMoreAccurate) {
+ return true;
+ } else if (isNewer &amp;&amp; !isLessAccurate) {
+ return true;
+ } else if (isNewer &amp;&amp; !isSignificantlyLessAccurate &amp;&amp; isFromSameProvider) {
+ return true;
+ }
+ return false;
+}
+
+/** Checks whether two providers are the same */
+private boolean isSameProvider(String provider1, String provider2) {
+ if (provider1 == null) {
+ return provider2 == null;
+ }
+ return provider1.equals(provider2);
+}
+</pre>
+
+<h2 id="TaskGetLastKnownLocation">Use getLastKnownLocation() Wisely</h2>
+
+<p>The setup time for getting a reasonable location fix may not be acceptable for certain applications. You should consider calling the {@link android.location.LocationManager#getLastKnownLocation(java.lang.String) getLastKnownLocation()} method which simply queries Android for the last location update previously received by any location providers. Keep in mind that the returned location may be stale. You should check the timestamp and accuracy of the returned location and decide whether it is useful for your application. If you elect to discard the location update returned from {@link android.location.LocationManager#getLastKnownLocation(java.lang.String) getLastKnownLocation()} and wait for fresh updates from the location provider(s), you should consider displaying an appropriate message before location data is received.</p>
+
+<h2 id="TaskTerminateUpdates">Terminate Location Updates</h2>
+
+<p>When you are done with using location data, you should terminate location update to reduce unnecessary consumption of power and network bandwidth. For example, if the user navigates away from an activity where location updates are displayed, you should stop location update by calling {@link android.location.LocationManager#removeUpdates(android.location.LocationListener) removeUpdates()} in {@link android.app.Activity#onStop()}. ({@link android.app.Activity#onStop()} is called when the activity is no longer visible. If you want to learn more about activity lifecycle, read up on the <a href="/training/basic-activity-lifecycle/stopping.html">Starting and Stopping an Activity</a> lesson.</p>
+
+<pre>
+protected void onStop() {
+ super.onStop();
+ mLocationManager.removeUpdates(listener);
+}
+</pre>
+
+<p class="note"><strong>Note:</strong> For applications that need to continuously receive and process location updates like a near-real time mapping application, it is best to incorporate the location update logic in a background service and make use of the system notification bar to make the user aware that location data is being used.</p> \ No newline at end of file
diff --git a/docs/html/training/location/geocoding.jd b/docs/html/training/location/geocoding.jd
new file mode 100644
index 0000000..6364976
--- /dev/null
+++ b/docs/html/training/location/geocoding.jd
@@ -0,0 +1,98 @@
+page.title=Displaying the Location Address
+parent.title=Making Your App Location Aware
+parent.link=index.html
+
+trainingnavtop=true
+previous.title=Obtaining the Current Location
+previous.link=currentlocation.html
+
+@jd:body
+
+
+<!-- This is the training bar -->
+<div id="tb-wrapper">
+<div id="tb">
+
+<h2>This lesson teaches you to</h2>
+<ol>
+ <li><a href="geocoding.html#TaskReverseGeocoding">Perform Reverse Geocoding</a></li>
+</ol>
+
+<h2>You should also read</h2>
+
+<ul>
+ <li><a href="{@docRoot}guide/topics/location/index.html">Location and Maps</a></li>
+</ul>
+
+<h2>Try it out</h2>
+
+<div class="download-box">
+<a href="http://developer.android.com/shareables/training/LocationAware.zip" class="button">Download
+ the sample app</a>
+<p class="filename">LocationAware.zip</p>
+</div>
+
+</div>
+</div>
+
+<p>As shown in previous lessons, location updates are received in the form of latitude and longitude coordinates. While this format is useful for calculating distance or displaying a pushpin on a map, the decimal numbers make no sense to most end users. If you need to display a location to user, it is much more preferable to display the address instead.</p>
+
+<h2 id="TaskReverseGeocoding">Perform Reverse Geocoding</h2>
+
+<p>Reverse-geocoding is the process of translating latitude longitude coordinates to a human-readable address. The {@link android.location.Geocoder} API is available for this purpose. Note that behind the scene, the API is dependent on a web service. If such service is unavailable on the device, the API will throw a "Service not Available exception" or return an empty list of addresses. A helper method called {@link android.location.Geocoder#isPresent()} was added in Android 2.3 (API level 9) to check for the existence of the service.</p>
+
+<p>The following code snippet demonstrates the use of the {@link android.location.Geocoder} API to perform reverse-geocoding. Since the {@link android.location.Geocoder#getFromLocation(double, double, int) getFromLocation()} method is synchronous, you should not invoke it from the UI thread, hence an {@link android.os.AsyncTask} is used in the snippet.</p>
+
+<pre>
+private final LocationListener listener = new LocationListener() {
+
+ public void onLocationChanged(Location location) {
+ // Bypass reverse-geocoding if the Geocoder service is not available on the
+ // device. The isPresent() convenient method is only available on Gingerbread or above.
+ if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.GINGERBREAD &amp;&amp; Geocoder.isPresent()) {
+ // Since the geocoding API is synchronous and may take a while. You don't want to lock
+ // up the UI thread. Invoking reverse geocoding in an AsyncTask.
+ (new ReverseGeocodingTask(this)).execute(new Location[] {location});
+ }
+ }
+ ...
+};
+
+// AsyncTask encapsulating the reverse-geocoding API. Since the geocoder API is blocked,
+// we do not want to invoke it from the UI thread.
+private class ReverseGeocodingTask extends AsyncTask&lt;Location, Void, Void&gt; {
+ Context mContext;
+
+ public ReverseGeocodingTask(Context context) {
+ super();
+ mContext = context;
+ }
+
+ &#064;Override
+ protected Void doInBackground(Location... params) {
+ Geocoder geocoder = new Geocoder(mContext, Locale.getDefault());
+
+ Location loc = params[0];
+ List&lt;Address&gt; addresses = null;
+ try {
+ // Call the synchronous getFromLocation() method by passing in the lat/long values.
+ addresses = geocoder.getFromLocation(loc.getLatitude(), loc.getLongitude(), 1);
+ } catch (IOException e) {
+ e.printStackTrace();
+ // Update UI field with the exception.
+ Message.obtain(mHandler, UPDATE_ADDRESS, e.toString()).sendToTarget();
+ }
+ if (addresses != null &amps;&amps; addresses.size() &gt; 0) {
+ Address address = addresses.get(0);
+ // Format the first line of address (if available), city, and country name.
+ String addressText = String.format("&#037;s, &#037;s, &#037;s",
+ address.getMaxAddressLineIndex() &gt; 0 ? address.getAddressLine(0) : "",
+ address.getLocality(),
+ address.getCountryName());
+ // Update the UI via a message handler.
+ Message.obtain(mHandler, UPDATE_ADDRESS, addressText).sendToTarget();
+ }
+ return null;
+ }
+}
+</pre> \ No newline at end of file
diff --git a/docs/html/training/location/index.jd b/docs/html/training/location/index.jd
new file mode 100644
index 0000000..48cfbc3
--- /dev/null
+++ b/docs/html/training/location/index.jd
@@ -0,0 +1,51 @@
+page.title=Making Your App Location Aware
+
+trainingnavtop=true
+startpage=true
+next.title=Using the Location Manager
+next.link=locationmanager.html
+
+@jd:body
+
+<div id="tb-wrapper">
+<div id="tb">
+
+<h2>Dependencies and prerequisites</h2>
+
+<ul>
+ <li>Android 1.0 or higher (2.3+ for the sample app)</li>
+</ul>
+
+<h2>You should also read</h2>
+
+<ul>
+ <li><a href="{@docRoot}guide/topics/location/index.html">Location and Maps</a></li>
+</ul>
+
+<h2>Try it out</h2>
+
+<div class="download-box">
+<a href="http://developer.android.com/shareables/training/LocationAware.zip" class="button">Download
+ the sample app</a>
+<p class="filename">LocationAware.zip</p>
+</div>
+
+</div>
+</div>
+
+<p>Users bring their mobile devices with them almost everywhere. One of the unique features available to mobile applications is location awareness. Knowing the location and using the information wisely can bring a more contextual experience to your users.</p>
+
+<p>This class teaches you how to incorporate location based services in your Android application. You'll learn a number of methods to receive location updates and related best practices.</p>
+
+<h2>Lessons</h2>
+
+<dl>
+ <dt><b><a href="locationmanager.html">Using the Location Manager</a></b></dt>
+ <dd>Learn how to set up your application before it can receive location updates in Android.</dd>
+
+ <dt><b><a href="currentlocation.html">Obtaining the Current Location</a></b></dt>
+ <dd>Learn how to work with underlying location technologies available on the platform to obtain current location.</dd>
+
+ <dt><b><a href="geocoding.html">Displaying a Location Address</a></b></dt>
+ <dd>Learn how to translate location coordinates into addresses that are readable to users.</dd>
+</dl>
diff --git a/docs/html/training/location/locationmanager.jd b/docs/html/training/location/locationmanager.jd
new file mode 100644
index 0000000..5da1205
--- /dev/null
+++ b/docs/html/training/location/locationmanager.jd
@@ -0,0 +1,90 @@
+page.title=Using the Location Manager
+parent.title=Making Your App Location Aware
+parent.link=index.html
+
+trainingnavtop=true
+next.title=Obtaining the Current Location
+next.link=currentlocation.html
+
+@jd:body
+
+
+<!-- This is the training bar -->
+<div id="tb-wrapper">
+<div id="tb">
+
+<h2>This lesson teaches you to</h2>
+<ol>
+ <li><a href="locationmanager.html#TaskDeclarePermissions">Declare Proper Permissions in Android Manifest</a></li>
+ <li><a href="locationmanager.html#TaskGetLocationManagerRef">Get a Reference to LocationManager</a></li>
+ <li><a href="locationmanager.html#TaskPickLocationProvider">Pick a Location Provider</a></li>
+</ol>
+
+<h2>You should also read</h2>
+
+<ul>
+ <li><a href="{@docRoot}guide/topics/location/index.html">Location and Maps</a></li>
+</ul>
+
+<h2>Try it out</h2>
+
+<div class="download-box">
+<a href="http://developer.android.com/shareables/training/LocationAware.zip" class="button">Download
+ the sample app</a>
+<p class="filename">LocationAware.zip</p>
+</div>
+
+</div>
+</div>
+
+<p>Before your application can begin receiving location updates, it needs to perform some simple steps to set up access. In this lesson, you'll learn what these steps entail.</p>
+
+<h2 id="TaskDeclarePermissions">Declare Proper Permissions in Android Manifest</h2>
+
+<p>The first step of setting up location update access is to declare proper permissions in the manifest. If permissions are missing, the application will get a {@link java.lang.SecurityException} at runtime.</p>
+
+<p>Depending on the {@link android.location.LocationManager} methods used, either {@link android.Manifest.permission#ACCESS_COARSE_LOCATION} or {@link android.Manifest.permission#ACCESS_FINE_LOCATION} permission is needed. For example, you need to declare the {@link android.Manifest.permission#ACCESS_COARSE_LOCATION} permission if your application uses a network-based location provider only. The more accurate GPS requires the {@link android.Manifest.permission#ACCESS_FINE_LOCATION} permission.
+Note that declaring the {@link android.Manifest.permission#ACCESS_FINE_LOCATION} permission implies {@link android.Manifest.permission#ACCESS_COARSE_LOCATION} already.</p>
+
+<p>Also, if a network-based location provider is used in the application, you'll need to declare the internet permission as well.</p>
+
+<pre>
+&lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
+&lt;uses-permission android:name="android.permission.INTERNET" /&gt;
+</pre>
+
+<h2 id="TaskGetLocationManagerRef">Get a Reference to LocationManager</h2>
+
+<p>{@link android.location.LocationManager} is the main class through which your application can access location services on Android. Similar to other system services, a reference can be obtained from calling the {@link android.content.Context#getSystemService(java.lang.String) getSystemService()} method. If your application intends to receive location updates in the foreground (within an {@link android.app.Activity}), you should usually perform this step in the {@link android.app.Activity#onCreate(android.os.Bundle) onCreate()} method.</p>
+
+<pre>
+LocationManager locationManager =
+ (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
+</pre>
+
+<h2 id="TaskPickLocationProvider">Pick a Location Provider</h2>
+
+<p>While not required, most modern Android-powered devices can receive location updates through multiple underlying technologies, which are abstracted to an application as {@link android.location.LocationProvider} objects. Location providers may have different performance characteristics in terms of time-to-fix, accuracy, monetary cost, power consumption, and so on. Generally, a location provider with a greater accuracy, like the GPS, requires a longer fix time than a less accurate one, such as a network-based location provider.</p>
+
+<p>Depending on your application's use case, you have to choose a specific location provider, or multiple providers, based on similar tradeoffs. For example, a points of interest check-in application would require higher location accuracy than say, a retail store locator where a city level location fix would suffice. The snippet below asks for a provider backed by the GPS.</p>
+
+<pre>
+LocationProvider provider =
+ locationManager.getProvider(LocationManager.GPS_PROVIDER);
+</pre>
+
+<p>Alternatively, you can provide some input criteria such as accuracy, power requirement, monetary cost, and so on, and let Android decide a closest match location provider. The snippet below asks for a location provider with fine accuracy and no monetary cost. Note that the criteria may not resolve to any providers, in which case a null will be returned. Your application should be prepared to gracefully handle the situation.</p>
+
+<pre>
+// Retrieve a list of location providers that have fine accuracy, no monetary cost, etc
+Criteria criteria = new Criteria();
+criteria.setAccuracy(Criteria.ACCURACY_FINE);
+criteria.setCostAllowed(false);
+...
+String providerName = locManager.getBestProvider(criteria, true);
+
+// If no suitable provider is found, null is returned.
+if (providerName != null) {
+ ...
+}
+</pre>
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index 5f6a61d..c66a03f 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -92,7 +92,7 @@ public class AudioService extends IAudioService.Stub {
protected static final boolean DEBUG_RC = false;
/** How long to delay before persisting a change in volume/ringer mode. */
- private static final int PERSIST_DELAY = 3000;
+ private static final int PERSIST_DELAY = 500;
private Context mContext;
private ContentResolver mContentResolver;
@@ -861,8 +861,9 @@ public class AudioService extends IAudioService.Stub {
// Post a persist master volume msg
sendMsg(mAudioHandler, MSG_PERSIST_MASTER_VOLUME, SENDMSG_REPLACE,
Math.round(volume * (float)1000.0), 0, null, PERSIST_DELAY);
- sendMasterVolumeUpdate(flags, oldVolume, newVolume);
}
+ // Send the volume update regardless whether there was a change.
+ sendMasterVolumeUpdate(flags, oldVolume, newVolume);
}
}
diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java
index d06e302..7629d60 100644
--- a/media/java/android/media/MediaCodec.java
+++ b/media/java/android/media/MediaCodec.java
@@ -83,7 +83,6 @@ public class MediaCodec
public native final void release();
public static int CONFIGURE_FLAG_ENCODE = 1;
- public static int CONFIGURE_FLAG_SECURE = 2;
/** Configures a component.
* @param format A map of string/value pairs describing the input format
diff --git a/media/jni/android_media_MediaCodec.cpp b/media/jni/android_media_MediaCodec.cpp
index 04d7c22..4b7a811 100644
--- a/media/jni/android_media_MediaCodec.cpp
+++ b/media/jni/android_media_MediaCodec.cpp
@@ -29,6 +29,7 @@
#include <gui/Surface.h>
#include <gui/SurfaceTextureClient.h>
+#include <media/ICrypto.h>
#include <media/stagefright/MediaCodec.h>
#include <media/stagefright/foundation/ABuffer.h>
#include <media/stagefright/foundation/ADebug.h>
@@ -102,7 +103,7 @@ status_t JMediaCodec::configure(
if (surfaceTexture != NULL) {
client = new SurfaceTextureClient(surfaceTexture);
}
- return mCodec->configure(format, client, flags);
+ return mCodec->configure(format, client, NULL /* crypto */, flags);
}
status_t JMediaCodec::start() {
@@ -387,7 +388,7 @@ static jint android_media_MediaCodec_dequeueOutputBuffer(
if (codec == NULL) {
jniThrowException(env, "java/lang/IllegalStateException", NULL);
- return NULL;
+ return 0;
}
size_t index;
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index ab4012f..a6fbdd7 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -904,10 +904,15 @@ public final class ActivityManagerService extends ActivityManagerNative
null, null, 0, null, null, null,
false, false, MY_PID, Process.SYSTEM_UID, 0 /* TODO: Verify */);
- Dialog d = new AppNotRespondingDialog(ActivityManagerService.this,
- mContext, proc, (ActivityRecord)data.get("activity"));
- d.show();
- proc.anrDialog = d;
+ if (mShowDialogs) {
+ Dialog d = new AppNotRespondingDialog(ActivityManagerService.this,
+ mContext, proc, (ActivityRecord)data.get("activity"));
+ d.show();
+ proc.anrDialog = d;
+ } else {
+ // Just kill the app if there is no dialog to be shown.
+ killAppAtUsersRequest(proc, null);
+ }
}
ensureBootCompleted();
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
index dd6c426..16ddd91 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -35,6 +35,7 @@
#include <gui/ISensorServer.h>
#include <gui/ISensorEventConnection.h>
+#include <gui/SensorEventQueue.h>
#include <hardware/sensors.h>
@@ -587,10 +588,9 @@ status_t SensorService::SensorEventConnection::sendEvents(
count = numEvents;
}
- if (count == 0)
- return 0;
-
- ssize_t size = mChannel->write(scratch, count*sizeof(sensors_event_t));
+ // NOTE: ASensorEvent and sensors_event_t are the same type
+ ssize_t size = SensorEventQueue::write(mChannel,
+ reinterpret_cast<ASensorEvent const*>(scratch), count);
if (size == -EAGAIN) {
// the destination doesn't accept events anymore, it's probably
// full. For now, we just drop the events on the floor.
@@ -598,9 +598,6 @@ status_t SensorService::SensorEventConnection::sendEvents(
return size;
}
- //ALOGE_IF(size<0, "dropping %d events on the floor (%s)",
- // count, strerror(-size));
-
return size < 0 ? status_t(size) : status_t(NO_ERROR);
}
diff --git a/tests/BiDiTests/AndroidManifest.xml b/tests/BiDiTests/AndroidManifest.xml
index c60edd8..4aead81 100644
--- a/tests/BiDiTests/AndroidManifest.xml
+++ b/tests/BiDiTests/AndroidManifest.xml
@@ -19,7 +19,9 @@
android:versionCode="1"
android:versionName="1.0">
- <application android:label="BiDiTests" android:hardwareAccelerated="true">
+ <application android:label="BiDiTests"
+ android:hardwareAccelerated="true"
+ android:supportsRtl="true" >
<activity android:name=".BiDiTestActivity"
android:windowSoftInputMode="stateAlwaysHidden">