Merge "Implement remaining infrastructure for user disabling apps."
diff --git a/api/current.txt b/api/current.txt
index 7c656af6..51c9348 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -218,6 +218,7 @@
field public static final int alertDialogIcon = 16843605; // 0x1010355
field public static final int alertDialogStyle = 16842845; // 0x101005d
field public static final int alertDialogTheme = 16843529; // 0x1010309
+ field public static final int alignmentMode = 16843642; // 0x101037a
field public static final int allContactsName = 16843468; // 0x10102cc
field public static final int allowBackup = 16843392; // 0x1010280
field public static final int allowClearUserData = 16842757; // 0x1010005
@@ -627,6 +628,8 @@
field public static final int listDividerAlertDialog = 16843525; // 0x1010305
field public static final int listPopupWindowStyle = 16843519; // 0x10102ff
field public static final int listPreferredItemHeight = 16842829; // 0x101004d
+ field public static final int listPreferredItemHeightLarge = 16843670; // 0x1010396
+ field public static final int listPreferredItemHeightSmall = 16843671; // 0x1010397
field public static final int listSelector = 16843003; // 0x10100fb
field public static final int listSeparatorTextViewStyle = 16843272; // 0x1010208
field public static final int listViewStyle = 16842868; // 0x1010074
@@ -636,7 +639,6 @@
field public static final int loopViews = 16843527; // 0x1010307
field public static final int manageSpaceActivity = 16842756; // 0x1010004
field public static final int mapViewStyle = 16842890; // 0x101008a
- field public static final int marginsIncludedInAlignment = 16843642; // 0x101037a
field public static final int marqueeRepeatLimit = 16843293; // 0x101021d
field public static final int max = 16843062; // 0x1010136
field public static final int maxDate = 16843584; // 0x1010340
@@ -1374,6 +1376,7 @@
field public static final int config_longAnimTime = 17694722; // 0x10e0002
field public static final int config_mediumAnimTime = 17694721; // 0x10e0001
field public static final int config_shortAnimTime = 17694720; // 0x10e0000
+ field public static final int status_bar_notification_info_maxnum = 17694723; // 0x10e0003
}
public static final class R.interpolator {
@@ -1460,6 +1463,7 @@
field public static final int search_go = 17039372; // 0x104000c
field public static final int selectAll = 17039373; // 0x104000d
field public static final int selectTextMode = 17039382; // 0x1040016
+ field public static final int status_bar_notification_info_overflow = 17039383; // 0x1040017
field public static final int unknownName = 17039374; // 0x104000e
field public static final int untitled = 17039375; // 0x104000f
field public static final int yes = 17039379; // 0x1040013
@@ -1632,6 +1636,7 @@
field public static final int Widget_Holo_AutoCompleteTextView = 16973968; // 0x1030090
field public static final int Widget_Holo_Button = 16973963; // 0x103008b
field public static final int Widget_Holo_Button_Borderless = 16974050; // 0x10300e2
+ field public static final int Widget_Holo_Button_Borderless_Small = 16974107; // 0x103011b
field public static final int Widget_Holo_Button_Inset = 16973965; // 0x103008d
field public static final int Widget_Holo_Button_Small = 16973964; // 0x103008c
field public static final int Widget_Holo_Button_Toggle = 16973966; // 0x103008e
@@ -1658,6 +1663,7 @@
field public static final int Widget_Holo_Light_ActionMode = 16974047; // 0x10300df
field public static final int Widget_Holo_Light_AutoCompleteTextView = 16974011; // 0x10300bb
field public static final int Widget_Holo_Light_Button = 16974006; // 0x10300b6
+ field public static final int Widget_Holo_Light_Button_Borderless_Small = 16974108; // 0x103011c
field public static final int Widget_Holo_Light_Button_Inset = 16974008; // 0x10300b8
field public static final int Widget_Holo_Light_Button_Small = 16974007; // 0x10300b7
field public static final int Widget_Holo_Light_Button_Toggle = 16974009; // 0x10300b9
@@ -15264,6 +15270,8 @@
field public static final java.lang.String DIRECTORY_PARAM_KEY = "directory";
field public static final java.lang.String INCLUDE_PROFILE = "include_profile";
field public static final java.lang.String LIMIT_PARAM_KEY = "limit";
+ field public static final java.lang.String PRIMARY_ACCOUNT_NAME = "name_for_primary_account";
+ field public static final java.lang.String PRIMARY_ACCOUNT_TYPE = "type_for_primary_account";
}
public static final class ContactsContract.AggregationExceptions implements android.provider.BaseColumns {
@@ -15606,6 +15614,15 @@
protected static abstract interface ContactsContract.DataColumnsWithJoins implements android.provider.BaseColumns android.provider.ContactsContract.ContactNameColumns android.provider.ContactsContract.ContactOptionsColumns android.provider.ContactsContract.ContactStatusColumns android.provider.ContactsContract.ContactsColumns android.provider.ContactsContract.DataColumns android.provider.ContactsContract.RawContactsColumns android.provider.ContactsContract.StatusColumns {
}
+ public static final class ContactsContract.DataUsageFeedback {
+ ctor public ContactsContract.DataUsageFeedback();
+ field public static final android.net.Uri FEEDBACK_URI;
+ field public static final java.lang.String USAGE_TYPE = "type";
+ field public static final java.lang.String USAGE_TYPE_CALL = "call";
+ field public static final java.lang.String USAGE_TYPE_LONG_TEXT = "long_text";
+ field public static final java.lang.String USAGE_TYPE_SHORT_TEXT = "short_text";
+ }
+
public static final class ContactsContract.Directory implements android.provider.BaseColumns {
method public static void notifyDirectoryChange(android.content.ContentResolver);
field public static final java.lang.String ACCOUNT_NAME = "accountName";
@@ -16674,6 +16691,7 @@
method public static android.renderscript.Element U8_4(android.renderscript.RenderScript);
method public static android.renderscript.Element createPixel(android.renderscript.RenderScript, android.renderscript.Element.DataType, android.renderscript.Element.DataKind);
method public static android.renderscript.Element createVector(android.renderscript.RenderScript, android.renderscript.Element.DataType, int);
+ method public boolean isCompatible(android.renderscript.Element);
method public boolean isComplex();
}
@@ -17372,9 +17390,12 @@
enum_constant public static final android.renderscript.Type.CubemapFace NEGATIVE_X;
enum_constant public static final android.renderscript.Type.CubemapFace NEGATIVE_Y;
enum_constant public static final android.renderscript.Type.CubemapFace NEGATIVE_Z;
- enum_constant public static final android.renderscript.Type.CubemapFace POSITVE_X;
- enum_constant public static final android.renderscript.Type.CubemapFace POSITVE_Y;
- enum_constant public static final android.renderscript.Type.CubemapFace POSITVE_Z;
+ enum_constant public static final android.renderscript.Type.CubemapFace POSITIVE_X;
+ enum_constant public static final android.renderscript.Type.CubemapFace POSITIVE_Y;
+ enum_constant public static final android.renderscript.Type.CubemapFace POSITIVE_Z;
+ enum_constant public static final deprecated android.renderscript.Type.CubemapFace POSITVE_X;
+ enum_constant public static final deprecated android.renderscript.Type.CubemapFace POSITVE_Y;
+ enum_constant public static final deprecated android.renderscript.Type.CubemapFace POSITVE_Z;
}
}
@@ -23716,7 +23737,8 @@
method public boolean getSavePassword();
method public synchronized java.lang.String getSerifFontFamily();
method public synchronized java.lang.String getStandardFontFamily();
- method public synchronized android.webkit.WebSettings.TextSize getTextSize();
+ method public deprecated synchronized android.webkit.WebSettings.TextSize getTextSize();
+ method public synchronized int getTextZoom();
method public deprecated synchronized boolean getUseDoubleTree();
method public deprecated boolean getUseWebViewBackgroundForOverscrollBackground();
method public synchronized boolean getUseWideViewPort();
@@ -23766,7 +23788,8 @@
method public synchronized void setStandardFontFamily(java.lang.String);
method public synchronized void setSupportMultipleWindows(boolean);
method public void setSupportZoom(boolean);
- method public synchronized void setTextSize(android.webkit.WebSettings.TextSize);
+ method public deprecated synchronized void setTextSize(android.webkit.WebSettings.TextSize);
+ method public synchronized void setTextZoom(int);
method public deprecated synchronized void setUseDoubleTree(boolean);
method public deprecated void setUseWebViewBackgroundForOverscrollBackground(boolean);
method public synchronized void setUseWideViewPort(boolean);
@@ -23805,7 +23828,7 @@
enum_constant public static final android.webkit.WebSettings.RenderPriority NORMAL;
}
- public static final class WebSettings.TextSize extends java.lang.Enum {
+ public static final deprecated class WebSettings.TextSize extends java.lang.Enum {
method public static android.webkit.WebSettings.TextSize valueOf(java.lang.String);
method public static final android.webkit.WebSettings.TextSize[] values();
enum_constant public static final android.webkit.WebSettings.TextSize LARGER;
@@ -24776,21 +24799,23 @@
ctor public GridLayout(android.content.Context);
ctor public GridLayout(android.content.Context, android.util.AttributeSet, int);
ctor public GridLayout(android.content.Context, android.util.AttributeSet);
+ method public int getAlignmentMode();
method public int getColumnCount();
- method public boolean getMarginsIncludedInAlignment();
method public int getOrientation();
method public int getRowCount();
method public boolean getUseDefaultMargins();
method public boolean isColumnOrderPreserved();
method public boolean isRowOrderPreserved();
method protected void onLayout(boolean, int, int, int, int);
+ method public void setAlignmentMode(int);
method public void setColumnCount(int);
method public void setColumnOrderPreserved(boolean);
- method public void setMarginsIncludedInAlignment(boolean);
method public void setOrientation(int);
method public void setRowCount(int);
method public void setRowOrderPreserved(boolean);
method public void setUseDefaultMargins(boolean);
+ field public static final int ALIGN_BOUNDS = 0; // 0x0
+ field public static final int ALIGN_MARGINS = 1; // 0x1
field public static final android.widget.GridLayout.Alignment BASELINE;
field public static final android.widget.GridLayout.Alignment BOTTOM;
field public static final android.widget.GridLayout.Alignment CENTER;
diff --git a/core/java/android/app/AlertDialog.java b/core/java/android/app/AlertDialog.java
index e83d104..7a465c1 100644
--- a/core/java/android/app/AlertDialog.java
+++ b/core/java/android/app/AlertDialog.java
@@ -890,7 +890,7 @@
public AlertDialog create() {
final AlertDialog dialog = new AlertDialog(P.mContext, mTheme, false);
P.apply(dialog.mAlert);
- dialog.setCancelable(P.mCancelable);
+ dialog.setCanceledOnTouchOutside(P.mCancelable);
dialog.setOnCancelListener(P.mOnCancelListener);
if (P.mOnKeyListener != null) {
dialog.setOnKeyListener(P.mOnKeyListener);
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index c9351af..170d2b5 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -929,15 +929,15 @@
if (mContentInfo != null) {
contentView.setTextViewText(R.id.info, mContentInfo);
} else if (mNumber > 0) {
- if (mNumber > 999) {
- contentView.setTextViewText(R.id.info, "999+");
+ final int tooBig = mContext.getResources().getInteger(
+ R.integer.status_bar_notification_info_maxnum);
+ if (mNumber > tooBig) {
+ contentView.setTextViewText(R.id.info, mContext.getResources().getString(
+ R.string.status_bar_notification_info_overflow));
} else {
NumberFormat f = NumberFormat.getIntegerInstance();
contentView.setTextViewText(R.id.info, f.format(mNumber));
}
- contentView.setFloat(R.id.info, "setTextSize",
- mContext.getResources().getDimensionPixelSize(
- R.dimen.status_bar_content_number_size));
} else {
contentView.setViewVisibility(R.id.info, View.GONE);
}
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index 1df3108..338e6c8 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -216,7 +216,9 @@
* {@link #getNumberOfCameras()}-1.
* @return a new Camera object, connected, locked and ready for use.
* @throws RuntimeException if connection to the camera service fails (for
- * example, if the camera is in use by another process).
+ * example, if the camera is in use by another process or device policy
+ * manager has disabled the camera).
+ * @see android.app.admin.DevicePolicyManager#getCameraDisabled(android.content.ComponentName)
*/
public static Camera open(int cameraId) {
return new Camera(cameraId);
diff --git a/core/java/android/os/INetworkManagementService.aidl b/core/java/android/os/INetworkManagementService.aidl
index f17a6f2..b97ec19 100644
--- a/core/java/android/os/INetworkManagementService.aidl
+++ b/core/java/android/os/INetworkManagementService.aidl
@@ -59,6 +59,11 @@
void setInterfaceConfig(String iface, in InterfaceConfiguration cfg);
/**
+ * Clear all IP addresses on the specified interface
+ */
+ void clearInterfaceAddresses(String iface);
+
+ /**
* Retrieves the network routes currently configured on the specified
* interface
*/
diff --git a/core/java/android/provider/CalendarContract.java b/core/java/android/provider/CalendarContract.java
index 1a24716..5ccf3ac 100644
--- a/core/java/android/provider/CalendarContract.java
+++ b/core/java/android/provider/CalendarContract.java
@@ -476,7 +476,96 @@
}
/**
- * Fields and helpers for interacting with Calendars.
+ * Constants and helpers for the Calendars table, which contains details for
+ * individual calendars. <h3>Operations</h3> All operations can be done
+ * either as an app or as a sync adapter. To perform an operation as a sync
+ * adapter {@link #CALLER_IS_SYNCADAPTER} should be set to true and
+ * {@link #ACCOUNT_NAME} and {@link #ACCOUNT_TYPE} must be set in the Uri
+ * parameters. See
+ * {@link Uri.Builder#appendQueryParameter(java.lang.String, java.lang.String)}
+ * for details on adding parameters. Sync adapters have write access to more
+ * columns but are restricted to a single account at a time. Calendars are
+ * designed to be primarily managed by a sync adapter and inserting new
+ * calendars should be done as a sync adapter. For the most part, apps
+ * should only update calendars (such as changing the color or display
+ * name). If a local calendar is required an app can do so by inserting as a
+ * sync adapter and using an {@link #ACCOUNT_TYPE} of
+ * {@link #ACCOUNT_TYPE_LOCAL} .
+ * <dl>
+ * <dt><b>Insert</b></dt>
+ * <dd>When inserting a new calendar the following fields must be included:
+ * <ul>
+ * <li>{@link #ACCOUNT_NAME}</li>
+ * <li>{@link #ACCOUNT_TYPE}</li>
+ * <li>{@link #NAME}</li>
+ * <li>{@link #CALENDAR_DISPLAY_NAME}</li>
+ * <li>{@link #CALENDAR_COLOR}</li>
+ * <li>{@link #CALENDAR_ACCESS_LEVEL}</li>
+ * <li>{@link #OWNER_ACCOUNT}</li>
+ * </ul>
+ * The following fields are not required when inserting a Calendar but are
+ * generally a good idea to include:
+ * <ul>
+ * <li>{@link #SYNC_EVENTS} set to 1</li>
+ * <li>{@link #CALENDAR_TIMEZONE}</li>
+ * <li>{@link #ALLOWED_REMINDERS}</li>
+ * </ul>
+ * <dt><b>Update</b></dt>
+ * <dd>To perform an update on a calendar the {@link #_ID} of the calendar
+ * should be provided either as an appended id to the Uri (
+ * {@link ContentUris#withAppendedId}) or as the first selection item--the
+ * selection should start with "_id=?" and the first selectionArg should be
+ * the _id of the calendar. Calendars may also be updated using a selection
+ * without the id. In general, the {@link #ACCOUNT_NAME} and
+ * {@link #ACCOUNT_TYPE} should not be changed after a calendar is created
+ * as this can cause issues for sync adapters.
+ * <dt><b>Delete</b></dt>
+ * <dd>Calendars can be deleted either by the {@link #_ID} as an appended id
+ * on the Uri or using any standard selection. Deleting a calendar should
+ * generally be handled by a sync adapter as it will remove the calendar
+ * from the database and all associated data (aka events).</dd>
+ * <dt><b>Query</b></dt>
+ * <dd>Querying the Calendars table will get you all information about a set
+ * of calendars. There will be one row returned for each calendar that
+ * matches the query selection, or at most a single row if the {@link #_ID}
+ * is appended to the Uri.</dd>
+ * </dl>
+ * <h3>Calendar Columns</h3> The following Calendar columns are writable by
+ * both an app and a sync adapter.
+ * <ul>
+ * <li>{@link #NAME}</li>
+ * <li>{@link #CALENDAR_DISPLAY_NAME}</li>
+ * <li>{@link #CALENDAR_COLOR}</li>
+ * <li>{@link #VISIBLE}</li>
+ * <li>{@link #SYNC_EVENTS}</li>
+ * </ul>
+ * The following Calendars columns are writable only by a sync adapter
+ * <ul>
+ * <li>{@link #ACCOUNT_NAME}</li>
+ * <li>{@link #ACCOUNT_TYPE}</li>
+ * <li>{@link #_SYNC_ID}</li>
+ * <li>{@link #DIRTY}</li>
+ * <li>{@link #OWNER_ACCOUNT}</li>
+ * <li>{@link #MAX_REMINDERS}</li>
+ * <li>{@link #ALLOWED_REMINDERS}</li>
+ * <li>{@link #CAN_MODIFY_TIME_ZONE}</li>
+ * <li>{@link #CAN_ORGANIZER_RESPOND}</li>
+ * <li>{@link #CAN_PARTIALLY_UPDATE}</li>
+ * <li>{@link #CALENDAR_LOCATION}</li>
+ * <li>{@link #CALENDAR_TIME_ZONE}</li>
+ * <li>{@link #CALENDAR_ACCESS_LEVEL}</li>
+ * <li>{@link #DELETED}</li>
+ * <li>{@link #CAL_SYNC1}</li>
+ * <li>{@link #CAL_SYNC2}</li>
+ * <li>{@link #CAL_SYNC3}</li>
+ * <li>{@link #CAL_SYNC4}</li>
+ * <li>{@link #CAL_SYNC5}</li>
+ * <li>{@link #CAL_SYNC6}</li>
+ * <li>{@link #CAL_SYNC7}</li>
+ * <li>{@link #CAL_SYNC8}</li>
+ * <li>{@link #CAL_SYNC9}</li>
+ * <li>{@link #CAL_SYNC10}</li>
+ * </ul>
*/
public static class Calendars implements BaseColumns, SyncColumns, CalendarsColumns {
private static final String WHERE_DELETE_FOR_ACCOUNT = Calendars.ACCOUNT_NAME + "=?"
@@ -569,6 +658,7 @@
DIRTY,
OWNER_ACCOUNT,
MAX_REMINDERS,
+ ALLOWED_REMINDERS,
CAN_MODIFY_TIME_ZONE,
CAN_ORGANIZER_RESPOND,
CAN_PARTIALLY_UPDATE,
@@ -1252,13 +1342,15 @@
}
/**
- * Constants and helpers for the Events table, which contains details of a
- * single event. <h3>Operations</h3> All operations can be done either as an
- * app or as a sync adapter. To perform an operation as a sync adapter
- * {@link #CALLER_IS_SYNCADAPTER} should be set to true in the Uri
- * parameters and {@link #ACCOUNT_NAME} and {@link #ACCOUNT_TYPE} must be
- * set. Sync adapters have write access to more columns but are restricted
- * to a single account at a time.
+ * Constants and helpers for the Events table, which contains details for
+ * individual events. <h3>Operations</h3> All operations can be done either
+ * as an app or as a sync adapter. To perform an operation as a sync adapter
+ * {@link #CALLER_IS_SYNCADAPTER} should be set to true and
+ * {@link #ACCOUNT_NAME} and {@link #ACCOUNT_TYPE} must be set in the Uri
+ * parameters. See
+ * {@link Uri.Builder#appendQueryParameter(java.lang.String, java.lang.String)}
+ * for details on adding parameters. Sync adapters have write access to more
+ * columns but are restricted to a single account at a time.
* <dl>
* <dt><b>Insert</b></dt>
* <dd>When inserting a new event the following fields must be included:
@@ -1270,13 +1362,14 @@
* There are also further requirements when inserting or updating an event.
* See the section on Writing to Events.</dd>
* <dt><b>Update</b></dt>
- * <dd>To perform an update on an Event the {@link Events#_ID} of the event
- * must be provided either as an appended id to the Uri (
+ * <dd>To perform an update of an Event the {@link Events#_ID} of the event
+ * should be provided either as an appended id to the Uri (
* {@link ContentUris#withAppendedId}) or as the first selection item--the
* selection should start with "_id=?" and the first selectionArg should be
- * the _id of the event. Updating an event must respect the same rules as
- * inserting and is further restricted in the fields that can be written.
- * See the section on Writing to Events.</dd>
+ * the _id of the event. Updates may also be done using a selection and no
+ * id. Updating an event must respect the same rules as inserting and is
+ * further restricted in the fields that can be written. See the section on
+ * Writing to Events.</dd>
* <dt><b>Delete</b></dt>
* <dd>Events can be deleted either by the {@link Events#_ID} as an appended
* id on the Uri or using any standard selection. If an appended id is used
@@ -1748,8 +1841,10 @@
/**
* A few Calendar globals are needed in the CalendarProvider for expanding
- * the Instances table and these are all stored in the first (and only)
- * row of the CalendarMetaData table.
+ * the Instances table and these are all stored in the first (and only) row
+ * of the CalendarMetaData table.
+ *
+ * @hide
*/
protected interface CalendarMetaDataColumns {
/**
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index 1816066..b5a11ab 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -163,14 +163,12 @@
* obtaining possible recipients, letting the provider know which account is selected during
* the composition. The provider may use the "primary account" information to optimize
* the search result.
- * @hide
*/
public static final String PRIMARY_ACCOUNT_NAME = "name_for_primary_account";
/**
* A query parameter specifing a primary account. This parameter should be used with
* {@link #PRIMARY_ACCOUNT_NAME}. See the doc in {@link #PRIMARY_ACCOUNT_NAME}.
- * @hide
*/
public static final String PRIMARY_ACCOUNT_TYPE = "type_for_primary_account";
@@ -6317,7 +6315,6 @@
* boolean successful = resolver.update(uri, new ContentValues(), null, null) > 0;
* </pre>
* </p>
- * @hide
*/
public static final class DataUsageFeedback {
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index b0e651a..f2400d8 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -8736,6 +8736,10 @@
}
jumpDrawablesToCurrentState();
resolveLayoutDirection();
+ if (isFocused()) {
+ InputMethodManager imm = InputMethodManager.peekInstance();
+ imm.focusIn(this);
+ }
}
/**
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java
index c361a4a..761007f 100644
--- a/core/java/android/webkit/WebSettings.java
+++ b/core/java/android/webkit/WebSettings.java
@@ -59,6 +59,7 @@
* NORMAL is 100%
* LARGER is 150%
* LARGEST is 200%
+ * @deprecated Use {@link WebSettings#setTextZoom(int)} and {@link WebSettings#getTextZoom()} instead.
*/
public enum TextSize {
SMALLEST(50),
@@ -158,7 +159,7 @@
// know what they are.
private LayoutAlgorithm mLayoutAlgorithm = LayoutAlgorithm.NARROW_COLUMNS;
private Context mContext;
- private TextSize mTextSize = TextSize.NORMAL;
+ private int mTextSize = 100;
private String mStandardFontFamily = "sans-serif";
private String mFixedFontFamily = "monospace";
private String mSansSerifFontFamily = "sans-serif";
@@ -709,26 +710,61 @@
}
/**
- * Set the text size of the page.
- * @param t A TextSize value for increasing or decreasing the text.
- * @see WebSettings.TextSize
+ * Set the text zoom of the page in percent. Default is 100.
+ * @param textZoom A percent value for increasing or decreasing the text.
*/
- public synchronized void setTextSize(TextSize t) {
- if (WebView.mLogEvent && mTextSize != t ) {
- EventLog.writeEvent(EventLogTags.BROWSER_TEXT_SIZE_CHANGE,
- mTextSize.value, t.value);
+ public synchronized void setTextZoom(int textZoom) {
+ if (mTextSize != textZoom) {
+ if (WebView.mLogEvent) {
+ EventLog.writeEvent(EventLogTags.BROWSER_TEXT_SIZE_CHANGE,
+ mTextSize, textZoom);
+ }
+ mTextSize = textZoom;
+ postSync();
}
- mTextSize = t;
- postSync();
}
/**
- * Get the text size of the page.
+ * Get the text zoom of the page in percent.
+ * @return A percent value describing the text zoom.
+ * @see setTextSizeZoom
+ */
+ public synchronized int getTextZoom() {
+ return mTextSize;
+ }
+
+ /**
+ * Set the text size of the page.
+ * @param t A TextSize value for increasing or decreasing the text.
+ * @see WebSettings.TextSize
+ * @deprecated Use {@link #setTextZoom(int)} instead
+ */
+ public synchronized void setTextSize(TextSize t) {
+ setTextZoom(t.value);
+ }
+
+ /**
+ * Get the text size of the page. If the text size was previously specified
+ * in percent using {@link #setTextZoom(int)}, this will return
+ * the closest matching {@link TextSize}.
* @return A TextSize enum value describing the text size.
* @see WebSettings.TextSize
+ * @deprecated Use {@link #getTextZoom()} instead
*/
public synchronized TextSize getTextSize() {
- return mTextSize;
+ TextSize closestSize = null;
+ int smallestDelta = Integer.MAX_VALUE;
+ for (TextSize size : TextSize.values()) {
+ int delta = Math.abs(mTextSize - size.value);
+ if (delta == 0) {
+ return size;
+ }
+ if (delta < smallestDelta) {
+ smallestDelta = delta;
+ closestSize = size;
+ }
+ }
+ return closestSize != null ? closestSize : TextSize.NORMAL;
}
/**
diff --git a/core/java/android/widget/GridLayout.java b/core/java/android/widget/GridLayout.java
index 544bc6b..a15ca0c 100644
--- a/core/java/android/widget/GridLayout.java
+++ b/core/java/android/widget/GridLayout.java
@@ -135,11 +135,44 @@
*/
public static final int UNDEFINED = Integer.MIN_VALUE;
+ /**
+ * This constant is an {@link #setAlignmentMode(int) alignmentMode}.
+ * When the {@code alignmentMode} is set to {@link #ALIGN_BOUNDS}, alignment
+ * is made between the edges of each component's raw
+ * view boundary: i.e. the area delimited by the component's:
+ * {@link android.view.View#getTop() top},
+ * {@link android.view.View#getLeft() left},
+ * {@link android.view.View#getBottom() bottom} and
+ * {@link android.view.View#getRight() right} properties.
+ * <p>
+ * For example, when {@code GridLayout} is in {@link #ALIGN_BOUNDS} mode,
+ * children that belong to a row group that uses {@link #TOP} alignment will
+ * all return the same value when their {@link android.view.View#getTop()}
+ * method is called.
+ *
+ * @see #setAlignmentMode(int)
+ */
+ public static final int ALIGN_BOUNDS = 0;
+
+ /**
+ * This constant is an {@link #setAlignmentMode(int) alignmentMode}.
+ * When the {@code alignmentMode} is set to {@link #ALIGN_MARGINS},
+ * the bounds of each view are extended outwards, according
+ * to their margins, before the edges of the resulting rectangle are aligned.
+ * <p>
+ * For example, when {@code GridLayout} is in {@link #ALIGN_MARGINS} mode,
+ * the quantity {@code top - layoutParams.topMargin} is the same for all children that
+ * belong to a row group that uses {@link #TOP} alignment.
+ *
+ * @see #setAlignmentMode(int)
+ */
+ public static final int ALIGN_MARGINS = 1;
+
// Misc constants
private static final String TAG = GridLayout.class.getName();
private static final boolean DEBUG = false;
- private static final Paint GRID_PAINT = new Paint();
+ private static Paint GRID_PAINT;
private static final double GOLDEN_RATIO = (1 + Math.sqrt(5)) / 2;
private static final int MIN = 0;
private static final int PRF = 1;
@@ -151,7 +184,7 @@
private static final int DEFAULT_COUNT = UNDEFINED;
private static final boolean DEFAULT_USE_DEFAULT_MARGINS = false;
private static final boolean DEFAULT_ORDER_PRESERVED = false;
- private static final boolean DEFAULT_MARGINS_INCLUDED = true;
+ private static final int DEFAULT_ALIGNMENT_MODE = ALIGN_MARGINS;
// todo remove this
private static final int DEFAULT_CONTAINER_MARGIN = 20;
@@ -161,14 +194,17 @@
private static final int ROW_COUNT = styleable.GridLayout_rowCount;
private static final int COLUMN_COUNT = styleable.GridLayout_columnCount;
private static final int USE_DEFAULT_MARGINS = styleable.GridLayout_useDefaultMargins;
- private static final int MARGINS_INCLUDED = styleable.GridLayout_marginsIncludedInAlignment;
+ private static final int ALIGNMENT_MODE = styleable.GridLayout_alignmentMode;
private static final int ROW_ORDER_PRESERVED = styleable.GridLayout_rowOrderPreserved;
private static final int COLUMN_ORDER_PRESERVED = styleable.GridLayout_columnOrderPreserved;
// Static initialization
static {
- GRID_PAINT.setColor(Color.argb(50, 255, 255, 255));
+ if (DEBUG) {
+ GRID_PAINT = new Paint();
+ GRID_PAINT.setColor(Color.argb(50, 255, 255, 255));
+ }
}
// Instance variables
@@ -178,7 +214,7 @@
private boolean mLayoutParamsValid = false;
private int mOrientation = DEFAULT_ORIENTATION;
private boolean mUseDefaultMargins = DEFAULT_USE_DEFAULT_MARGINS;
- private boolean mMarginsIncludedInAlignment = DEFAULT_MARGINS_INCLUDED;
+ private int mAlignmentMode = DEFAULT_ALIGNMENT_MODE;
private int mDefaultGravity = Gravity.NO_GRAVITY;
/* package */ boolean accommodateBothMinAndMax = false;
@@ -189,10 +225,7 @@
* {@inheritDoc}
*/
public GridLayout(Context context) {
- super(context);
- if (DEBUG) {
- setWillNotDraw(false);
- }
+ this(context, null, 0);
}
/**
@@ -200,6 +233,9 @@
*/
public GridLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
+ if (DEBUG) {
+ setWillNotDraw(false);
+ }
processAttributes(context, attrs);
}
@@ -207,18 +243,17 @@
* {@inheritDoc}
*/
public GridLayout(Context context, AttributeSet attrs) {
- super(context, attrs);
- processAttributes(context, attrs);
+ this(context, attrs, 0);
}
private void processAttributes(Context context, AttributeSet attrs) {
TypedArray a = context.obtainStyledAttributes(attrs, styleable.GridLayout);
try {
- setRowCount(a.getInteger(ROW_COUNT, DEFAULT_COUNT));
- setColumnCount(a.getInteger(COLUMN_COUNT, DEFAULT_COUNT));
- mOrientation = a.getInteger(ORIENTATION, DEFAULT_ORIENTATION);
+ setRowCount(a.getInt(ROW_COUNT, DEFAULT_COUNT));
+ setColumnCount(a.getInt(COLUMN_COUNT, DEFAULT_COUNT));
+ mOrientation = a.getInt(ORIENTATION, DEFAULT_ORIENTATION);
mUseDefaultMargins = a.getBoolean(USE_DEFAULT_MARGINS, DEFAULT_USE_DEFAULT_MARGINS);
- mMarginsIncludedInAlignment = a.getBoolean(MARGINS_INCLUDED, DEFAULT_MARGINS_INCLUDED);
+ mAlignmentMode = a.getInt(ALIGNMENT_MODE, DEFAULT_ALIGNMENT_MODE);
setRowOrderPreserved(a.getBoolean(ROW_ORDER_PRESERVED, DEFAULT_ORDER_PRESERVED));
setColumnOrderPreserved(a.getBoolean(COLUMN_ORDER_PRESERVED, DEFAULT_ORDER_PRESERVED));
} finally {
@@ -348,15 +383,15 @@
* When {@code false}, the default value of all margins is zero.
* <p>
* When setting to {@code true}, consider setting the value of the
- * {@link #setMarginsIncludedInAlignment(boolean) marginsIncludedInAlignment}
- * property to {@code false}.
+ * {@link #setAlignmentMode(int) alignmentMode}
+ * property to {@link #ALIGN_BOUNDS}.
* <p>
* The default value of this property is {@code false}.
*
* @param useDefaultMargins use {@code true} to make GridLayout allocate default margins
*
* @see #getUseDefaultMargins()
- * @see #setMarginsIncludedInAlignment(boolean)
+ * @see #setAlignmentMode(int)
*
* @see MarginLayoutParams#leftMargin
* @see MarginLayoutParams#topMargin
@@ -371,36 +406,38 @@
}
/**
- * Returns whether GridLayout aligns the edges of the view or the edges
- * of the larger rectangle created by extending the view by its associated
- * margins.
+ * Returns the alignment mode.
*
- * @see #setMarginsIncludedInAlignment(boolean)
+ * @return the alignment mode; either {@link #ALIGN_BOUNDS} or {@link #ALIGN_MARGINS}
*
- * @return {@code true} if alignment is between edges including margins
+ * @see #ALIGN_BOUNDS
+ * @see #ALIGN_MARGINS
*
- * @attr ref android.R.styleable#GridLayout_marginsIncludedInAlignment
+ * @see #setAlignmentMode(int)
+ *
+ * @attr ref android.R.styleable#GridLayout_alignmentMode
*/
- public boolean getMarginsIncludedInAlignment() {
- return mMarginsIncludedInAlignment;
+ public int getAlignmentMode() {
+ return mAlignmentMode;
}
/**
- * When {@code true}, the bounds of a view are extended outwards according to its
- * margins before the edges of the resulting rectangle are aligned.
- * When {@code false}, alignment occurs between the bounds of the view - i.e.
- * {@link #LEFT} alignment means align the left edges of the view.
+ * Sets the alignment mode to be used for all of the alignments between the
+ * children of this container.
* <p>
- * The default value of this property is {@code true}.
+ * The default value of this property is {@link #ALIGN_MARGINS}.
*
- * @param marginsIncludedInAlignment {@code true} if alignment between edges includes margins
+ * @param alignmentMode either {@link #ALIGN_BOUNDS} or {@link #ALIGN_MARGINS}
*
- * @see #getMarginsIncludedInAlignment()
+ * @see #ALIGN_BOUNDS
+ * @see #ALIGN_MARGINS
*
- * @attr ref android.R.styleable#GridLayout_marginsIncludedInAlignment
+ * @see #getAlignmentMode()
+ *
+ * @attr ref android.R.styleable#GridLayout_alignmentMode
*/
- public void setMarginsIncludedInAlignment(boolean marginsIncludedInAlignment) {
- mMarginsIncludedInAlignment = marginsIncludedInAlignment;
+ public void setAlignmentMode(int alignmentMode) {
+ mAlignmentMode = alignmentMode;
requestLayout();
}
@@ -782,7 +819,7 @@
private int getMeasurementIncludingMargin(View c, boolean horizontal, int measurementType) {
int result = getMeasurement(c, horizontal, measurementType);
- if (mMarginsIncludedInAlignment) {
+ if (mAlignmentMode == ALIGN_MARGINS) {
int leadingMargin = getMargin(c, true, horizontal);
int trailingMargin = getMargin(c, false, horizontal);
return result + leadingMargin + trailingMargin;
@@ -857,7 +894,7 @@
int c2ax = protect(hAlign.getAlignmentValue(null, cellWidth - colBounds.size(), type));
int c2ay = protect(vAlign.getAlignmentValue(null, cellHeight - rowBounds.size(), type));
- if (mMarginsIncludedInAlignment) {
+ if (mAlignmentMode == ALIGN_MARGINS) {
int leftMargin = getMargin(view, true, true);
int topMargin = getMargin(view, true, false);
int rightMargin = getMargin(view, false, true);
@@ -1359,7 +1396,7 @@
private int getLocationIncludingMargin(View view, boolean leading, int index) {
int location = locations[index];
int margin;
- if (!mMarginsIncludedInAlignment) {
+ if (mAlignmentMode != ALIGN_MARGINS) {
margin = (leading ? leadingMargins : trailingMargins)[index];
} else {
margin = 0;
@@ -1371,7 +1408,7 @@
Arrays.fill(a, MIN_VALUE);
a[0] = 0;
solve(getArcs(), a);
- if (!mMarginsIncludedInAlignment) {
+ if (mAlignmentMode != ALIGN_MARGINS) {
addMargins();
}
}
@@ -1752,16 +1789,16 @@
private void init(Context context, AttributeSet attrs, int defaultGravity) {
TypedArray a = context.obtainStyledAttributes(attrs, styleable.GridLayout_Layout);
try {
- int gravity = a.getInteger(GRAVITY, defaultGravity);
+ int gravity = a.getInt(GRAVITY, defaultGravity);
- int column = a.getInteger(COLUMN, DEFAULT_COLUMN);
- int columnSpan = a.getInteger(COLUMN_SPAN, DEFAULT_SPAN_SIZE);
+ int column = a.getInt(COLUMN, DEFAULT_COLUMN);
+ int columnSpan = a.getInt(COLUMN_SPAN, DEFAULT_SPAN_SIZE);
Interval hSpan = new Interval(column, column + columnSpan);
this.columnGroup = new Group(hSpan, getColumnAlignment(gravity, width));
this.columnWeight = a.getFloat(COLUMN_WEIGHT, getDefaultWeight(width));
- int row = a.getInteger(ROW, DEFAULT_ROW);
- int rowSpan = a.getInteger(ROW_SPAN, DEFAULT_SPAN_SIZE);
+ int row = a.getInt(ROW, DEFAULT_ROW);
+ int rowSpan = a.getInt(ROW_SPAN, DEFAULT_SPAN_SIZE);
Interval vSpan = new Interval(row, row + rowSpan);
this.rowGroup = new Group(vSpan, getRowAlignment(gravity, height));
this.rowWeight = a.getFloat(ROW_WEIGHT, getDefaultWeight(height));
@@ -2161,7 +2198,7 @@
* An Alignment implementation must define {@link #getAlignmentValue(View, int, int)},
* to return the appropriate value for the type of alignment being defined.
* The enclosing algorithms position the children
- * so that the locations defined by the alignmnet values
+ * so that the locations defined by the alignment values
* are the same for all of the views in a group.
* <p>
* The GridLayout class defines the most common alignments used in general layout:
@@ -2287,4 +2324,4 @@
return cellSize;
}
};
-}
\ No newline at end of file
+}
diff --git a/core/java/com/android/internal/app/AlertController.java b/core/java/com/android/internal/app/AlertController.java
index 71a7a52..8d6caa1 100644
--- a/core/java/com/android/internal/app/AlertController.java
+++ b/core/java/com/android/internal/app/AlertController.java
@@ -575,9 +575,13 @@
params.weight = 0.5f;
button.setLayoutParams(params);
View leftSpacer = mWindow.findViewById(R.id.leftSpacer);
- leftSpacer.setVisibility(View.VISIBLE);
+ if (leftSpacer != null) {
+ leftSpacer.setVisibility(View.VISIBLE);
+ }
View rightSpacer = mWindow.findViewById(R.id.rightSpacer);
- rightSpacer.setVisibility(View.VISIBLE);
+ if (rightSpacer != null) {
+ rightSpacer.setVisibility(View.VISIBLE);
+ }
}
private void setBackground(LinearLayout topPanel, LinearLayout contentPanel,
diff --git a/core/java/com/android/internal/net/VpnConfig.java b/core/java/com/android/internal/net/VpnConfig.java
index 18d9ec4..773be5b 100644
--- a/core/java/com/android/internal/net/VpnConfig.java
+++ b/core/java/com/android/internal/net/VpnConfig.java
@@ -16,8 +16,12 @@
package com.android.internal.net;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
import android.os.Parcel;
import android.os.Parcelable;
+import android.os.SystemClock;
/**
* A simple container used to carry information in VpnBuilder, VpnDialogs,
@@ -27,6 +31,30 @@
*/
public class VpnConfig implements Parcelable {
+ public static final String ACTION_VPN_REVOKED = "android.net.vpn.action.REVOKED";
+
+ public static void enforceCallingPackage(String packageName) {
+ if (!"com.android.vpndialogs".equals(packageName)) {
+ throw new SecurityException("Unauthorized Caller");
+ }
+ }
+
+ public static Intent getIntentForConfirmation() {
+ Intent intent = new Intent();
+ intent.setClassName("com.android.vpndialogs", "com.android.vpndialogs.ConfirmDialog");
+ return intent;
+ }
+
+ public static PendingIntent getIntentForNotification(Context context, VpnConfig config) {
+ config.startTime = SystemClock.elapsedRealtime();
+ Intent intent = new Intent();
+ intent.setClassName("com.android.vpndialogs", "com.android.vpndialogs.ManageDialog");
+ intent.putExtra("config", config);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_HISTORY |
+ Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+ return PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
+ }
+
public String packageName;
public String sessionName;
public String interfaceName;
diff --git a/core/java/com/android/internal/util/HanziToPinyin.java b/core/java/com/android/internal/util/HanziToPinyin.java
deleted file mode 100644
index 6a4adaa..0000000
--- a/core/java/com/android/internal/util/HanziToPinyin.java
+++ /dev/null
@@ -1,495 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.util;
-
-import android.text.TextUtils;
-import android.util.Log;
-
-import java.text.Collator;
-import java.util.ArrayList;
-import java.util.Locale;
-
-/**
- * An object to convert Chinese character to its corresponding pinyin string.
- * For characters with multiple possible pinyin string, only one is selected
- * according to collator. Polyphone is not supported in this implementation.
- * This class is implemented to achieve the best runtime performance and minimum
- * runtime resources with tolerable sacrifice of accuracy. This implementation
- * highly depends on zh_CN ICU collation data and must be always synchronized with
- * ICU.
- */
-public class HanziToPinyin {
- private static final String TAG = "HanziToPinyin";
-
- private static final char[] UNIHANS = {
- '\u5416', '\u54ce', '\u5b89', '\u80ae', '\u51f9', '\u516b', '\u63b0', '\u6273',
- '\u90a6', '\u52f9', '\u9642', '\u5954', '\u4f3b', '\u7680', '\u782d', '\u706c',
- '\u618b', '\u6c43', '\u51ab', '\u7676', '\u5cec', '\u5693', '\u5072', '\u53c2',
- '\u4ed3', '\u64a1', '\u518a', '\u5d7e', '\u564c', '\u6260', '\u62c6', '\u8fbf',
- '\u4f25', '\u6284', '\u8f66', '\u62bb', '\u9637', '\u5403', '\u5145', '\u62bd',
- '\u51fa', '\u640b', '\u5ddb', '\u5205', '\u5439', '\u65fe', '\u8e14', '\u5472',
- '\u4ece', '\u51d1', '\u7c97', '\u6c46', '\u5d14', '\u90a8', '\u6413', '\u5491',
- '\u5446', '\u4e39', '\u5f53', '\u5200', '\u6074', '\u6265', '\u706f', '\u4efe',
- '\u55f2', '\u6541', '\u5201', '\u7239', '\u4e01', '\u4e1f', '\u4e1c', '\u543a',
- '\u5262', '\u8011', '\u5796', '\u5428', '\u591a', '\u59b8', '\u5940', '\u97a5',
- '\u800c', '\u53d1', '\u5e06', '\u531a', '\u98de', '\u5206', '\u4e30', '\u8985',
- '\u4ecf', '\u57ba', '\u7d11', '\u592b', '\u7324', '\u65ee', '\u4f85', '\u5e72',
- '\u5188', '\u768b', '\u6208', '\u7ed9', '\u6839', '\u63ef', '\u55bc', '\u55f0',
- '\u5de5', '\u52fe', '\u4f30', '\u9e39', '\u4e56', '\u5173', '\u5149', '\u5f52',
- '\u4e28', '\u8b34', '\u5459', '\u598e', '\u548d', '\u4f44', '\u592f', '\u8320',
- '\u8bc3', '\u9ed2', '\u62eb', '\u4ea8', '\u53ff', '\u9f41', '\u4e4e', '\u82b1',
- '\u6000', '\u6b22', '\u5ddf', '\u7070', '\u660f', '\u5419', '\u4e0c', '\u52a0',
- '\u620b', '\u6c5f', '\u827d', '\u9636', '\u5dfe', '\u5755', '\u5182', '\u4e29',
- '\u51e5', '\u59e2', '\u5658', '\u519b', '\u5494', '\u5f00', '\u938e', '\u5ffc',
- '\u5c3b', '\u533c', '\u808e', '\u52a5', '\u7a7a', '\u62a0', '\u625d', '\u5938',
- '\u84af', '\u5bbd', '\u5321', '\u4e8f', '\u5764', '\u6269', '\u62c9', '\u4f86',
- '\u5170', '\u5577', '\u635e', '\u4ec2', '\u96f7', '\u8137', '\u68f1', '\u695e',
- '\u550e', '\u4fe9', '\u5afe', '\u826f', '\u8e7d', '\u57d3', '\u53b8', '\u62ce',
- '\u6e9c', '\u9f99', '\u5a04', '\u565c', '\u5b6a', '\u62a1', '\u9831', '\u5988',
- '\u57cb', '\u989f', '\u7264', '\u732b', '\u5445', '\u95e8', '\u6c13', '\u54aa',
- '\u5b80', '\u55b5', '\u4e5c', '\u6c11', '\u540d', '\u8c2c', '\u6478', '\u725f',
- '\u6bcd', '\u62cf', '\u8149', '\u56e1', '\u56d4', '\u5b6c', '\u8bb7', '\u5a1e',
- '\u5ae9', '\u80fd', '\u92b0', '\u62c8', '\u5a18', '\u9e1f', '\u634f', '\u56dc',
- '\u5b81', '\u599e', '\u519c', '\u7fba', '\u5974', '\u597b', '\u9ec1', '\u90cd',
- '\u5662', '\u8bb4', '\u5991', '\u62cd', '\u7705', '\u6c78', '\u629b', '\u5478',
- '\u55b7', '\u5309', '\u4e76', '\u7247', '\u527d', '\u6c15', '\u59d8', '\u4e52',
- '\u948b', '\u5256', '\u4ec6', '\u4e03', '\u6390', '\u5343', '\u545b', '\u6084',
- '\u5207', '\u4eb2', '\u9751', '\u5b86', '\u74d7', '\u533a', '\u5cd1', '\u7094',
- '\u590b', '\u5465', '\u7a63', '\u835b', '\u60f9', '\u4eba', '\u6254', '\u65e5',
- '\u620e', '\u53b9', '\u909a', '\u5827', '\u6875', '\u95f0', '\u633c', '\u4ee8',
- '\u6be2', '\u4e09', '\u6852', '\u63bb', '\u8272', '\u68ee', '\u50e7', '\u6740',
- '\u7b5b', '\u5c71', '\u4f24', '\u5f30', '\u5962', '\u7533', '\u5347', '\u5c38',
- '\u53ce', '\u4e66', '\u5237', '\u8870', '\u95e9', '\u53cc', '\u8c01', '\u542e',
- '\u8bf4', '\u53b6', '\u5fea', '\u51c1', '\u82cf', '\u72fb', '\u590a', '\u5b59',
- '\u5506', '\u4ed6', '\u5b61', '\u574d', '\u6c64', '\u5932', '\u5fd1', '\u81af',
- '\u5254', '\u5929', '\u65eb', '\u6017', '\u5385', '\u70b5', '\u5077', '\u51f8',
- '\u6e4d', '\u63a8', '\u541e', '\u8bac', '\u52b8', '\u6b6a', '\u5f2f', '\u5c23',
- '\u5371', '\u6637', '\u7fc1', '\u631d', '\u4e4c', '\u5915', '\u5477', '\u4ed9',
- '\u4e61', '\u7071', '\u4e9b', '\u5fc3', '\u5174', '\u51f6', '\u4f11', '\u620c',
- '\u5405', '\u75b6', '\u7025', '\u4e2b', '\u54bd', '\u592e', '\u5e7a', '\u503b',
- '\u4e00', '\u4e5a', '\u5e94', '\u5537', '\u4f63', '\u4f18', '\u7ea1', '\u56e6',
- '\u66f0', '\u8480', '\u5e00', '\u707d', '\u5142', '\u7242', '\u50ae', '\u556b',
- '\u9c61', '\u600e', '\u66fd', '\u5412', '\u635a', '\u6cbe', '\u5f20', '\u4f4b',
- '\u8707', '\u8d1e', '\u9eee', '\u4e4b', '\u4e2d', '\u5dde', '\u6731', '\u6293',
- '\u62fd', '\u4e13', '\u5986', '\u96b9', '\u5b92', '\u5353', '\u4ed4', '\u5b97',
- '\u90b9', '\u79df', '\u5297', '\u55fa', '\u5c0a', '\u6628',
- };
- private final static byte[][] PINYINS = {
- {65, 00, 00, 00, 00, 00, }, {65, 73, 00, 00, 00, 00, },
- {65, 78, 00, 00, 00, 00, }, {65, 78, 71, 00, 00, 00, },
- {65, 79, 00, 00, 00, 00, }, {66, 65, 00, 00, 00, 00, },
- {66, 65, 73, 00, 00, 00, }, {66, 65, 78, 00, 00, 00, },
- {66, 65, 78, 71, 00, 00, }, {66, 65, 79, 00, 00, 00, },
- {66, 69, 73, 00, 00, 00, }, {66, 69, 78, 00, 00, 00, },
- {66, 69, 78, 71, 00, 00, }, {66, 73, 00, 00, 00, 00, },
- {66, 73, 65, 78, 00, 00, }, {66, 73, 65, 79, 00, 00, },
- {66, 73, 69, 00, 00, 00, }, {66, 73, 78, 00, 00, 00, },
- {66, 73, 78, 71, 00, 00, }, {66, 79, 00, 00, 00, 00, },
- {66, 85, 00, 00, 00, 00, }, {67, 65, 00, 00, 00, 00, },
- {67, 65, 73, 00, 00, 00, }, {67, 65, 78, 00, 00, 00, },
- {67, 65, 78, 71, 00, 00, }, {67, 65, 79, 00, 00, 00, },
- {67, 69, 00, 00, 00, 00, }, {67, 69, 78, 00, 00, 00, },
- {67, 69, 78, 71, 00, 00, }, {67, 72, 65, 00, 00, 00, },
- {67, 72, 65, 73, 00, 00, }, {67, 72, 65, 78, 00, 00, },
- {67, 72, 65, 78, 71, 00, }, {67, 72, 65, 79, 00, 00, },
- {67, 72, 69, 00, 00, 00, }, {67, 72, 69, 78, 00, 00, },
- {67, 72, 69, 78, 71, 00, }, {67, 72, 73, 00, 00, 00, },
- {67, 72, 79, 78, 71, 00, }, {67, 72, 79, 85, 00, 00, },
- {67, 72, 85, 00, 00, 00, }, {67, 72, 85, 65, 73, 00, },
- {67, 72, 85, 65, 78, 00, }, {67, 72, 85, 65, 78, 71, },
- {67, 72, 85, 73, 00, 00, }, {67, 72, 85, 78, 00, 00, },
- {67, 72, 85, 79, 00, 00, }, {67, 73, 00, 00, 00, 00, },
- {67, 79, 78, 71, 00, 00, }, {67, 79, 85, 00, 00, 00, },
- {67, 85, 00, 00, 00, 00, }, {67, 85, 65, 78, 00, 00, },
- {67, 85, 73, 00, 00, 00, }, {67, 85, 78, 00, 00, 00, },
- {67, 85, 79, 00, 00, 00, }, {68, 65, 00, 00, 00, 00, },
- {68, 65, 73, 00, 00, 00, }, {68, 65, 78, 00, 00, 00, },
- {68, 65, 78, 71, 00, 00, }, {68, 65, 79, 00, 00, 00, },
- {68, 69, 00, 00, 00, 00, }, {68, 69, 78, 00, 00, 00, },
- {68, 69, 78, 71, 00, 00, }, {68, 73, 00, 00, 00, 00, },
- {68, 73, 65, 00, 00, 00, }, {68, 73, 65, 78, 00, 00, },
- {68, 73, 65, 79, 00, 00, }, {68, 73, 69, 00, 00, 00, },
- {68, 73, 78, 71, 00, 00, }, {68, 73, 85, 00, 00, 00, },
- {68, 79, 78, 71, 00, 00, }, {68, 79, 85, 00, 00, 00, },
- {68, 85, 00, 00, 00, 00, }, {68, 85, 65, 78, 00, 00, },
- {68, 85, 73, 00, 00, 00, }, {68, 85, 78, 00, 00, 00, },
- {68, 85, 79, 00, 00, 00, }, {69, 00, 00, 00, 00, 00, },
- {69, 78, 00, 00, 00, 00, }, {69, 78, 71, 00, 00, 00, },
- {69, 82, 00, 00, 00, 00, }, {70, 65, 00, 00, 00, 00, },
- {70, 65, 78, 00, 00, 00, }, {70, 65, 78, 71, 00, 00, },
- {70, 69, 73, 00, 00, 00, }, {70, 69, 78, 00, 00, 00, },
- {70, 69, 78, 71, 00, 00, }, {70, 73, 65, 79, 00, 00, },
- {70, 79, 00, 00, 00, 00, }, {70, 85, 00, 00, 00, 00, },
- {70, 79, 85, 00, 00, 00, }, {70, 85, 00, 00, 00, 00, },
- {71, 85, 73, 00, 00, 00, }, {71, 65, 00, 00, 00, 00, },
- {71, 65, 73, 00, 00, 00, }, {71, 65, 78, 00, 00, 00, },
- {71, 65, 78, 71, 00, 00, }, {71, 65, 79, 00, 00, 00, },
- {71, 69, 00, 00, 00, 00, }, {71, 69, 73, 00, 00, 00, },
- {71, 69, 78, 00, 00, 00, }, {71, 69, 78, 71, 00, 00, },
- {74, 73, 69, 00, 00, 00, }, {71, 69, 00, 00, 00, 00, },
- {71, 79, 78, 71, 00, 00, }, {71, 79, 85, 00, 00, 00, },
- {71, 85, 00, 00, 00, 00, }, {71, 85, 65, 00, 00, 00, },
- {71, 85, 65, 73, 00, 00, }, {71, 85, 65, 78, 00, 00, },
- {71, 85, 65, 78, 71, 00, }, {71, 85, 73, 00, 00, 00, },
- {71, 85, 78, 00, 00, 00, }, {71, 85, 65, 78, 00, 00, },
- {71, 85, 79, 00, 00, 00, }, {72, 65, 00, 00, 00, 00, },
- {72, 65, 73, 00, 00, 00, }, {72, 65, 78, 00, 00, 00, },
- {72, 65, 78, 71, 00, 00, }, {72, 65, 79, 00, 00, 00, },
- {72, 69, 00, 00, 00, 00, }, {72, 69, 73, 00, 00, 00, },
- {72, 69, 78, 00, 00, 00, }, {72, 69, 78, 71, 00, 00, },
- {72, 79, 78, 71, 00, 00, }, {72, 79, 85, 00, 00, 00, },
- {72, 85, 00, 00, 00, 00, }, {72, 85, 65, 00, 00, 00, },
- {72, 85, 65, 73, 00, 00, }, {72, 85, 65, 78, 00, 00, },
- {72, 85, 65, 78, 71, 00, }, {72, 85, 73, 00, 00, 00, },
- {72, 85, 78, 00, 00, 00, }, {72, 85, 79, 00, 00, 00, },
- {74, 73, 00, 00, 00, 00, }, {74, 73, 65, 00, 00, 00, },
- {74, 73, 65, 78, 00, 00, }, {74, 73, 65, 78, 71, 00, },
- {74, 73, 65, 79, 00, 00, }, {74, 73, 69, 00, 00, 00, },
- {74, 73, 78, 00, 00, 00, }, {74, 73, 78, 71, 00, 00, },
- {74, 73, 79, 78, 71, 00, }, {74, 73, 85, 00, 00, 00, },
- {74, 85, 00, 00, 00, 00, }, {74, 85, 65, 78, 00, 00, },
- {74, 85, 69, 00, 00, 00, }, {74, 85, 78, 00, 00, 00, },
- {75, 65, 00, 00, 00, 00, }, {75, 65, 73, 00, 00, 00, },
- {75, 65, 78, 00, 00, 00, }, {75, 65, 78, 71, 00, 00, },
- {75, 65, 79, 00, 00, 00, }, {75, 69, 00, 00, 00, 00, },
- {75, 69, 78, 00, 00, 00, }, {75, 69, 78, 71, 00, 00, },
- {75, 79, 78, 71, 00, 00, }, {75, 79, 85, 00, 00, 00, },
- {75, 85, 00, 00, 00, 00, }, {75, 85, 65, 00, 00, 00, },
- {75, 85, 65, 73, 00, 00, }, {75, 85, 65, 78, 00, 00, },
- {75, 85, 65, 78, 71, 00, }, {75, 85, 73, 00, 00, 00, },
- {75, 85, 78, 00, 00, 00, }, {75, 85, 79, 00, 00, 00, },
- {76, 65, 00, 00, 00, 00, }, {76, 65, 73, 00, 00, 00, },
- {76, 65, 78, 00, 00, 00, }, {76, 65, 78, 71, 00, 00, },
- {76, 65, 79, 00, 00, 00, }, {76, 69, 00, 00, 00, 00, },
- {76, 69, 73, 00, 00, 00, }, {76, 73, 00, 00, 00, 00, },
- {76, 73, 78, 71, 00, 00, }, {76, 69, 78, 71, 00, 00, },
- {76, 73, 00, 00, 00, 00, }, {76, 73, 65, 00, 00, 00, },
- {76, 73, 65, 78, 00, 00, }, {76, 73, 65, 78, 71, 00, },
- {76, 73, 65, 79, 00, 00, }, {76, 73, 69, 00, 00, 00, },
- {76, 73, 78, 00, 00, 00, }, {76, 73, 78, 71, 00, 00, },
- {76, 73, 85, 00, 00, 00, }, {76, 79, 78, 71, 00, 00, },
- {76, 79, 85, 00, 00, 00, }, {76, 85, 00, 00, 00, 00, },
- {76, 85, 65, 78, 00, 00, }, {76, 85, 78, 00, 00, 00, },
- {76, 85, 79, 00, 00, 00, }, {77, 65, 00, 00, 00, 00, },
- {77, 65, 73, 00, 00, 00, }, {77, 65, 78, 00, 00, 00, },
- {77, 65, 78, 71, 00, 00, }, {77, 65, 79, 00, 00, 00, },
- {77, 69, 73, 00, 00, 00, }, {77, 69, 78, 00, 00, 00, },
- {77, 69, 78, 71, 00, 00, }, {77, 73, 00, 00, 00, 00, },
- {77, 73, 65, 78, 00, 00, }, {77, 73, 65, 79, 00, 00, },
- {77, 73, 69, 00, 00, 00, }, {77, 73, 78, 00, 00, 00, },
- {77, 73, 78, 71, 00, 00, }, {77, 73, 85, 00, 00, 00, },
- {77, 79, 00, 00, 00, 00, }, {77, 79, 85, 00, 00, 00, },
- {77, 85, 00, 00, 00, 00, }, {78, 65, 00, 00, 00, 00, },
- {78, 65, 73, 00, 00, 00, }, {78, 65, 78, 00, 00, 00, },
- {78, 65, 78, 71, 00, 00, }, {78, 65, 79, 00, 00, 00, },
- {78, 69, 00, 00, 00, 00, }, {78, 69, 73, 00, 00, 00, },
- {78, 69, 78, 00, 00, 00, }, {78, 69, 78, 71, 00, 00, },
- {78, 73, 00, 00, 00, 00, }, {78, 73, 65, 78, 00, 00, },
- {78, 73, 65, 78, 71, 00, }, {78, 73, 65, 79, 00, 00, },
- {78, 73, 69, 00, 00, 00, }, {78, 73, 78, 00, 00, 00, },
- {78, 73, 78, 71, 00, 00, }, {78, 73, 85, 00, 00, 00, },
- {78, 79, 78, 71, 00, 00, }, {78, 79, 85, 00, 00, 00, },
- {78, 85, 00, 00, 00, 00, }, {78, 85, 65, 78, 00, 00, },
- {78, 85, 78, 00, 00, 00, }, {78, 85, 79, 00, 00, 00, },
- {79, 00, 00, 00, 00, 00, }, {79, 85, 00, 00, 00, 00, },
- {80, 65, 00, 00, 00, 00, }, {80, 65, 73, 00, 00, 00, },
- {80, 65, 78, 00, 00, 00, }, {80, 65, 78, 71, 00, 00, },
- {80, 65, 79, 00, 00, 00, }, {80, 69, 73, 00, 00, 00, },
- {80, 69, 78, 00, 00, 00, }, {80, 69, 78, 71, 00, 00, },
- {80, 73, 00, 00, 00, 00, }, {80, 73, 65, 78, 00, 00, },
- {80, 73, 65, 79, 00, 00, }, {80, 73, 69, 00, 00, 00, },
- {80, 73, 78, 00, 00, 00, }, {80, 73, 78, 71, 00, 00, },
- {80, 79, 00, 00, 00, 00, }, {80, 79, 85, 00, 00, 00, },
- {80, 85, 00, 00, 00, 00, }, {81, 73, 00, 00, 00, 00, },
- {81, 73, 65, 00, 00, 00, }, {81, 73, 65, 78, 00, 00, },
- {81, 73, 65, 78, 71, 00, }, {81, 73, 65, 79, 00, 00, },
- {81, 73, 69, 00, 00, 00, }, {81, 73, 78, 00, 00, 00, },
- {81, 73, 78, 71, 00, 00, }, {81, 73, 79, 78, 71, 00, },
- {81, 73, 85, 00, 00, 00, }, {81, 85, 00, 00, 00, 00, },
- {81, 85, 65, 78, 00, 00, }, {81, 85, 69, 00, 00, 00, },
- {81, 85, 78, 00, 00, 00, }, {82, 65, 78, 00, 00, 00, },
- {82, 65, 78, 71, 00, 00, }, {82, 65, 79, 00, 00, 00, },
- {82, 69, 00, 00, 00, 00, }, {82, 69, 78, 00, 00, 00, },
- {82, 69, 78, 71, 00, 00, }, {82, 73, 00, 00, 00, 00, },
- {82, 79, 78, 71, 00, 00, }, {82, 79, 85, 00, 00, 00, },
- {82, 85, 00, 00, 00, 00, }, {82, 85, 65, 78, 00, 00, },
- {82, 85, 73, 00, 00, 00, }, {82, 85, 78, 00, 00, 00, },
- {82, 85, 79, 00, 00, 00, }, {83, 65, 00, 00, 00, 00, },
- {83, 65, 73, 00, 00, 00, }, {83, 65, 78, 00, 00, 00, },
- {83, 65, 78, 71, 00, 00, }, {83, 65, 79, 00, 00, 00, },
- {83, 69, 00, 00, 00, 00, }, {83, 69, 78, 00, 00, 00, },
- {83, 69, 78, 71, 00, 00, }, {83, 72, 65, 00, 00, 00, },
- {83, 72, 65, 73, 00, 00, }, {83, 72, 65, 78, 00, 00, },
- {83, 72, 65, 78, 71, 00, }, {83, 72, 65, 79, 00, 00, },
- {83, 72, 69, 00, 00, 00, }, {83, 72, 69, 78, 00, 00, },
- {83, 72, 69, 78, 71, 00, }, {83, 72, 73, 00, 00, 00, },
- {83, 72, 79, 85, 00, 00, }, {83, 72, 85, 00, 00, 00, },
- {83, 72, 85, 65, 00, 00, }, {83, 72, 85, 65, 73, 00, },
- {83, 72, 85, 65, 78, 00, }, {83, 72, 85, 65, 78, 71, },
- {83, 72, 85, 73, 00, 00, }, {83, 72, 85, 78, 00, 00, },
- {83, 72, 85, 79, 00, 00, }, {83, 73, 00, 00, 00, 00, },
- {83, 79, 78, 71, 00, 00, }, {83, 79, 85, 00, 00, 00, },
- {83, 85, 00, 00, 00, 00, }, {83, 85, 65, 78, 00, 00, },
- {83, 85, 73, 00, 00, 00, }, {83, 85, 78, 00, 00, 00, },
- {83, 85, 79, 00, 00, 00, }, {84, 65, 00, 00, 00, 00, },
- {84, 65, 73, 00, 00, 00, }, {84, 65, 78, 00, 00, 00, },
- {84, 65, 78, 71, 00, 00, }, {84, 65, 79, 00, 00, 00, },
- {84, 69, 00, 00, 00, 00, }, {84, 69, 78, 71, 00, 00, },
- {84, 73, 00, 00, 00, 00, }, {84, 73, 65, 78, 00, 00, },
- {84, 73, 65, 79, 00, 00, }, {84, 73, 69, 00, 00, 00, },
- {84, 73, 78, 71, 00, 00, }, {84, 79, 78, 71, 00, 00, },
- {84, 79, 85, 00, 00, 00, }, {84, 85, 00, 00, 00, 00, },
- {84, 85, 65, 78, 00, 00, }, {84, 85, 73, 00, 00, 00, },
- {84, 85, 78, 00, 00, 00, }, {84, 85, 79, 00, 00, 00, },
- {87, 65, 00, 00, 00, 00, }, {87, 65, 73, 00, 00, 00, },
- {87, 65, 78, 00, 00, 00, }, {87, 65, 78, 71, 00, 00, },
- {87, 69, 73, 00, 00, 00, }, {87, 69, 78, 00, 00, 00, },
- {87, 69, 78, 71, 00, 00, }, {87, 79, 00, 00, 00, 00, },
- {87, 85, 00, 00, 00, 00, }, {88, 73, 00, 00, 00, 00, },
- {88, 73, 65, 00, 00, 00, }, {88, 73, 65, 78, 00, 00, },
- {88, 73, 65, 78, 71, 00, }, {88, 73, 65, 79, 00, 00, },
- {88, 73, 69, 00, 00, 00, }, {88, 73, 78, 00, 00, 00, },
- {88, 73, 78, 71, 00, 00, }, {88, 73, 79, 78, 71, 00, },
- {88, 73, 85, 00, 00, 00, }, {88, 85, 00, 00, 00, 00, },
- {88, 85, 65, 78, 00, 00, }, {88, 85, 69, 00, 00, 00, },
- {88, 85, 78, 00, 00, 00, }, {89, 65, 00, 00, 00, 00, },
- {89, 65, 78, 00, 00, 00, }, {89, 65, 78, 71, 00, 00, },
- {89, 65, 79, 00, 00, 00, }, {89, 69, 00, 00, 00, 00, },
- {89, 73, 00, 00, 00, 00, }, {89, 73, 78, 00, 00, 00, },
- {89, 73, 78, 71, 00, 00, }, {89, 79, 00, 00, 00, 00, },
- {89, 79, 78, 71, 00, 00, }, {89, 79, 85, 00, 00, 00, },
- {89, 85, 00, 00, 00, 00, }, {89, 85, 65, 78, 00, 00, },
- {89, 85, 69, 00, 00, 00, }, {89, 85, 78, 00, 00, 00, },
- {90, 65, 00, 00, 00, 00, }, {90, 65, 73, 00, 00, 00, },
- {90, 65, 78, 00, 00, 00, }, {90, 65, 78, 71, 00, 00, },
- {90, 65, 79, 00, 00, 00, }, {90, 69, 00, 00, 00, 00, },
- {90, 69, 73, 00, 00, 00, }, {90, 69, 78, 00, 00, 00, },
- {90, 69, 78, 71, 00, 00, }, {90, 72, 65, 00, 00, 00, },
- {90, 72, 65, 73, 00, 00, }, {90, 72, 65, 78, 00, 00, },
- {90, 72, 65, 78, 71, 00, }, {90, 72, 65, 79, 00, 00, },
- {90, 72, 69, 00, 00, 00, }, {90, 72, 69, 78, 00, 00, },
- {90, 72, 69, 78, 71, 00, }, {90, 72, 73, 00, 00, 00, },
- {90, 72, 79, 78, 71, 00, }, {90, 72, 79, 85, 00, 00, },
- {90, 72, 85, 00, 00, 00, }, {90, 72, 85, 65, 00, 00, },
- {90, 72, 85, 65, 73, 00, }, {90, 72, 85, 65, 78, 00, },
- {90, 72, 85, 65, 78, 71, }, {90, 72, 85, 73, 00, 00, },
- {90, 72, 85, 78, 00, 00, }, {90, 72, 85, 79, 00, 00, },
- {90, 73, 00, 00, 00, 00, }, {90, 79, 78, 71, 00, 00, },
- {90, 79, 85, 00, 00, 00, }, {90, 85, 00, 00, 00, 00, },
- {90, 85, 65, 78, 00, 00, }, {90, 85, 73, 00, 00, 00, },
- {90, 85, 78, 00, 00, 00, }, {90, 85, 79, 00, 00, 00, },
-
- };
-
- /** First and last Chinese character with known Pinyin according to zh collation */
- private static final String FIRST_PINYIN_UNIHAN = "\u5416";
- private static final String LAST_PINYIN_UNIHAN = "\u5497";
- /** The first Chinese character in Unicode block */
- private static final char FIRST_UNIHAN = '\u3400';
- private static final Collator COLLATOR = Collator.getInstance(Locale.CHINA);
-
- private static HanziToPinyin sInstance;
- private final boolean mHasChinaCollator;
-
- public static class Token {
- /**
- * Separator between target string for each source char
- */
- public static final String SEPARATOR = " ";
-
- public static final int LATIN = 1;
- public static final int PINYIN = 2;
- public static final int UNKNOWN = 3;
-
- public Token() {
- }
-
- public Token(int type, String source, String target) {
- this.type = type;
- this.source = source;
- this.target = target;
- }
- /**
- * Type of this token, ASCII, PINYIN or UNKNOWN.
- */
- public int type;
- /**
- * Original string before translation.
- */
- public String source;
- /**
- * Translated string of source. For Han, target is corresponding Pinyin.
- * Otherwise target is original string in source.
- */
- public String target;
- }
-
- protected HanziToPinyin(boolean hasChinaCollator) {
- mHasChinaCollator = hasChinaCollator;
- }
-
- public static HanziToPinyin getInstance() {
- synchronized(HanziToPinyin.class) {
- if (sInstance != null) {
- return sInstance;
- }
- // Check if zh_CN collation data is available
- final Locale locale[] = Collator.getAvailableLocales();
- for (int i = 0; i < locale.length; i++) {
- if (locale[i].equals(Locale.CHINA)) {
- sInstance = new HanziToPinyin(true);
- return sInstance;
- }
- }
- Log.w(TAG, "There is no Chinese collator, HanziToPinyin is disabled");
- sInstance = new HanziToPinyin(false);
- return sInstance;
- }
- }
-
- private Token getToken(char character) {
- Token token = new Token();
- final String letter = Character.toString(character);
- token.source = letter;
- int offset = -1;
- int cmp;
- if (character < 256) {
- token.type = Token.LATIN;
- token.target = letter;
- return token;
- } else if (character < FIRST_UNIHAN) {
- token.type = Token.UNKNOWN;
- token.target = letter;
- return token;
- } else {
- cmp = COLLATOR.compare(letter, FIRST_PINYIN_UNIHAN);
- if (cmp < 0) {
- token.type = Token.UNKNOWN;
- token.target = letter;
- return token;
- } else if (cmp == 0) {
- token.type = Token.PINYIN;
- offset = 0;
- } else {
- cmp = COLLATOR.compare(letter, LAST_PINYIN_UNIHAN);
- if (cmp > 0) {
- token.type = Token.UNKNOWN;
- token.target = letter;
- return token;
- } else if (cmp == 0) {
- token.type = Token.PINYIN;
- offset = UNIHANS.length - 1;
- }
- }
- }
-
- token.type = Token.PINYIN;
- if (offset < 0) {
- int begin = 0;
- int end = UNIHANS.length - 1;
- while (begin <= end) {
- offset = (begin + end) / 2;
- final String unihan = Character.toString(UNIHANS[offset]);
- cmp = COLLATOR.compare(letter, unihan);
- if (cmp == 0) {
- break;
- } else if (cmp > 0) {
- begin = offset + 1;
- } else {
- end = offset - 1;
- }
- }
- }
- if (cmp < 0) {
- offset--;
- }
- StringBuilder pinyin = new StringBuilder();
- for (int j = 0; j < PINYINS[offset].length && PINYINS[offset][j] != 0; j++) {
- pinyin.append((char)PINYINS[offset][j]);
- }
- token.target = pinyin.toString();
- return token;
- }
-
- /**
- * Convert the input to a array of tokens. The sequence of ASCII or Unknown
- * characters without space will be put into a Token, One Hanzi character
- * which has pinyin will be treated as a Token.
- * If these is no China collator, the empty token array is returned.
- */
- public ArrayList<Token> get(final String input) {
- ArrayList<Token> tokens = new ArrayList<Token>();
- if (!mHasChinaCollator || TextUtils.isEmpty(input)) {
- // return empty tokens.
- return tokens;
- }
- final int inputLength = input.length();
- final StringBuilder sb = new StringBuilder();
- int tokenType = Token.LATIN;
- // Go through the input, create a new token when
- // a. Token type changed
- // b. Get the Pinyin of current charater.
- // c. current character is space.
- for (int i = 0; i < inputLength; i++) {
- final char character = input.charAt(i);
- if (character == ' ') {
- if (sb.length() > 0) {
- addToken(sb, tokens, tokenType);
- }
- } else if (character < 256) {
- if (tokenType != Token.LATIN && sb.length() > 0) {
- addToken(sb, tokens, tokenType);
- }
- tokenType = Token.LATIN;
- sb.append(character);
- } else if (character < FIRST_UNIHAN) {
- if (tokenType != Token.UNKNOWN && sb.length() > 0) {
- addToken(sb, tokens, tokenType);
- }
- tokenType = Token.UNKNOWN;
- sb.append(character);
- } else {
- Token t = getToken(character);
- if (t.type == Token.PINYIN) {
- if (sb.length() > 0) {
- addToken(sb, tokens, tokenType);
- }
- tokens.add(t);
- tokenType = Token.PINYIN;
- } else {
- if (tokenType != t.type && sb.length() > 0) {
- addToken(sb, tokens, tokenType);
- }
- tokenType = t.type;
- sb.append(character);
- }
- }
- }
- if (sb.length() > 0) {
- addToken(sb, tokens, tokenType);
- }
- return tokens;
- }
-
- private void addToken(final StringBuilder sb, final ArrayList<Token> tokens,
- final int tokenType) {
- String str = sb.toString();
- tokens.add(new Token(tokenType, str, str));
- sb.setLength(0);
- }
-
-}
diff --git a/core/java/com/android/internal/view/menu/ListMenuPresenter.java b/core/java/com/android/internal/view/menu/ListMenuPresenter.java
index f8d24a3..cc09927 100644
--- a/core/java/com/android/internal/view/menu/ListMenuPresenter.java
+++ b/core/java/com/android/internal/view/menu/ListMenuPresenter.java
@@ -177,7 +177,9 @@
public void restoreHierarchyState(Bundle inState) {
SparseArray<Parcelable> viewStates = inState.getSparseParcelableArray(VIEWS_TAG);
- ((View) mMenuView).restoreHierarchyState(viewStates);
+ if (viewStates != null) {
+ ((View) mMenuView).restoreHierarchyState(viewStates);
+ }
}
private class MenuAdapter extends BaseAdapter {
diff --git a/core/java/com/android/internal/widget/DialogTitle.java b/core/java/com/android/internal/widget/DialogTitle.java
index 125d2c5..cd165dc 100644
--- a/core/java/com/android/internal/widget/DialogTitle.java
+++ b/core/java/com/android/internal/widget/DialogTitle.java
@@ -54,15 +54,19 @@
if (ellipsisCount > 0) {
setSingleLine(false);
- TypedArray a = mContext.obtainStyledAttributes(
- android.R.style.TextAppearance_Medium,
- android.R.styleable.TextAppearance);
+ TypedArray a = mContext.obtainStyledAttributes(null,
+ android.R.styleable.TextAppearance,
+ android.R.attr.textAppearanceMedium,
+ android.R.style.TextAppearance_Medium);
final int textSize = a.getDimensionPixelSize(
android.R.styleable.TextAppearance_textSize,
(int) (20 * getResources().getDisplayMetrics().density));
+ final int textColor = a.getColor(
+ android.R.styleable.TextAppearance_textColor, 0xffffffff);
// textSize is already expressed in pixels
setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
+ setTextColor(textColor);
setMaxLines(2);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
diff --git a/core/res/res/drawable-hdpi/dialog_bottom_holo_dark.9.png b/core/res/res/drawable-hdpi/dialog_bottom_holo_dark.9.png
index 32c2c97..5225a81 100644
--- a/core/res/res/drawable-hdpi/dialog_bottom_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/dialog_bottom_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/dialog_bottom_holo_light.9.png b/core/res/res/drawable-hdpi/dialog_bottom_holo_light.9.png
index f1cba06..2e7e973 100644
--- a/core/res/res/drawable-hdpi/dialog_bottom_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/dialog_bottom_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/dialog_full_holo_dark.9.png b/core/res/res/drawable-hdpi/dialog_full_holo_dark.9.png
index 08b163a..4591627 100644
--- a/core/res/res/drawable-hdpi/dialog_full_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/dialog_full_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/dialog_full_holo_light.9.png b/core/res/res/drawable-hdpi/dialog_full_holo_light.9.png
index 77ec017..9cf1826 100644
--- a/core/res/res/drawable-hdpi/dialog_full_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/dialog_full_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/dialog_middle_holo_dark.9.png b/core/res/res/drawable-hdpi/dialog_middle_holo_dark.9.png
index 029f186..a47ef40 100644
--- a/core/res/res/drawable-hdpi/dialog_middle_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/dialog_middle_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/dialog_middle_holo_light.9.png b/core/res/res/drawable-hdpi/dialog_middle_holo_light.9.png
index ee1054ef..9b50c73 100644
--- a/core/res/res/drawable-hdpi/dialog_middle_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/dialog_middle_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/dialog_top_holo_dark.9.png b/core/res/res/drawable-hdpi/dialog_top_holo_dark.9.png
index acbd7cf..a0d36de 100644
--- a/core/res/res/drawable-hdpi/dialog_top_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/dialog_top_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/dialog_top_holo_light.9.png b/core/res/res/drawable-hdpi/dialog_top_holo_light.9.png
index b7ddbb4..805b9567 100644
--- a/core/res/res/drawable-hdpi/dialog_top_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/dialog_top_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/dialog_bottom_holo_dark.9.png b/core/res/res/drawable-mdpi/dialog_bottom_holo_dark.9.png
index cc66804..a0bd4e3 100644
--- a/core/res/res/drawable-mdpi/dialog_bottom_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/dialog_bottom_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/dialog_bottom_holo_light.9.png b/core/res/res/drawable-mdpi/dialog_bottom_holo_light.9.png
index bc734c8..12abcd2 100644
--- a/core/res/res/drawable-mdpi/dialog_bottom_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/dialog_bottom_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/dialog_full_holo_dark.9.png b/core/res/res/drawable-mdpi/dialog_full_holo_dark.9.png
index 8603e93..adb8104 100644
--- a/core/res/res/drawable-mdpi/dialog_full_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/dialog_full_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/dialog_full_holo_light.9.png b/core/res/res/drawable-mdpi/dialog_full_holo_light.9.png
index 65a318c..d7c6bbf 100644
--- a/core/res/res/drawable-mdpi/dialog_full_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/dialog_full_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/dialog_middle_holo_dark.9.png b/core/res/res/drawable-mdpi/dialog_middle_holo_dark.9.png
index e39a472..42cfc52 100644
--- a/core/res/res/drawable-mdpi/dialog_middle_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/dialog_middle_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/dialog_middle_holo_light.9.png b/core/res/res/drawable-mdpi/dialog_middle_holo_light.9.png
index ec06c17d..9a08e15 100644
--- a/core/res/res/drawable-mdpi/dialog_middle_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/dialog_middle_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/dialog_top_holo_dark.9.png b/core/res/res/drawable-mdpi/dialog_top_holo_dark.9.png
index 32c49f2..5d86b2a 100644
--- a/core/res/res/drawable-mdpi/dialog_top_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/dialog_top_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/dialog_top_holo_light.9.png b/core/res/res/drawable-mdpi/dialog_top_holo_light.9.png
index 7a2bf8d..ad22f5b 100644
--- a/core/res/res/drawable-mdpi/dialog_top_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/dialog_top_holo_light.9.png
Binary files differ
diff --git a/core/res/res/layout/alert_dialog_holo.xml b/core/res/res/layout/alert_dialog_holo.xml
index 8ee91ca..1a3573e 100644
--- a/core/res/res/layout/alert_dialog_holo.xml
+++ b/core/res/res/layout/alert_dialog_holo.xml
@@ -32,12 +32,10 @@
android:orientation="vertical">
<ImageView android:id="@+id/titleDividerTop"
android:layout_width="match_parent"
- android:layout_height="4dip"
+ android:layout_height="1dip"
android:visibility="gone"
android:scaleType="fitXY"
android:gravity="fill_horizontal"
- android:paddingLeft="16dip"
- android:paddingRight="16dip"
android:src="@android:drawable/divider_strong_holo" />
<LinearLayout android:id="@+id/title_template"
android:layout_width="match_parent"
@@ -45,15 +43,16 @@
android:orientation="horizontal"
android:gravity="center_vertical|left"
android:minHeight="@dimen/alert_dialog_title_height"
- android:layout_marginLeft="32dip"
- android:layout_marginRight="32dip">
+ android:layout_marginLeft="16dip"
+ android:layout_marginRight="16dip">
<ImageView android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:paddingRight="16dip"
+ android:paddingRight="8dip"
android:src="@null" />
<com.android.internal.widget.DialogTitle android:id="@+id/alertTitle"
- style="?android:attr/textAppearanceMedium"
+ style="?android:attr/textAppearanceLarge"
+ android:textColor="@android:color/holo_blue"
android:singleLine="true"
android:ellipsize="end"
android:layout_width="match_parent"
@@ -61,12 +60,10 @@
</LinearLayout>
<ImageView android:id="@+id/titleDivider"
android:layout_width="match_parent"
- android:layout_height="4dip"
+ android:layout_height="1dip"
android:visibility="gone"
android:scaleType="fitXY"
android:gravity="fill_horizontal"
- android:paddingLeft="16dip"
- android:paddingRight="16dip"
android:src="@android:drawable/divider_strong_holo" />
<!-- If the client uses a customTitle, it will be added here. -->
</LinearLayout>
@@ -79,10 +76,6 @@
<ScrollView android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginLeft="16dip"
- android:layout_marginRight="16dip"
- android:paddingTop="32dip"
- android:paddingBottom="32dip"
android:clipToPadding="false">
<TextView android:id="@+id/message"
style="?android:attr/textAppearanceMedium"
@@ -99,11 +92,7 @@
android:layout_weight="1">
<FrameLayout android:id="@+android:id/custom"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingTop="8dip"
- android:paddingBottom="8dip"
- android:paddingLeft="32dip"
- android:paddingRight="32dip" />
+ android:layout_height="wrap_content" />
</FrameLayout>
<LinearLayout android:id="@+id/buttonPanel"
@@ -113,27 +102,21 @@
android:orientation="vertical"
android:divider="?android:attr/dividerHorizontal"
android:showDividers="beginning"
- android:dividerPadding="16dip">
+ android:dividerPadding="0dip">
<LinearLayout
style="?android:attr/buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
- android:paddingLeft="2dip"
- android:paddingRight="2dip"
+ android:layoutDirection="locale"
android:measureWithLargestChild="true">
- <LinearLayout android:id="@+id/leftSpacer"
- android:layout_weight="0.25"
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:visibility="gone" />
- <Button android:id="@+id/button1"
+ <Button android:id="@+id/button2"
android:layout_width="0dip"
android:layout_gravity="left"
android:layout_weight="1"
android:maxLines="2"
style="?android:attr/buttonBarButtonStyle"
+ android:textSize="14sp"
android:minHeight="@dimen/alert_dialog_button_bar_height"
android:layout_height="wrap_content" />
<Button android:id="@+id/button3"
@@ -142,22 +125,18 @@
android:layout_weight="1"
android:maxLines="2"
style="?android:attr/buttonBarButtonStyle"
+ android:textSize="14sp"
android:minHeight="@dimen/alert_dialog_button_bar_height"
android:layout_height="wrap_content" />
- <Button android:id="@+id/button2"
+ <Button android:id="@+id/button1"
android:layout_width="0dip"
android:layout_gravity="right"
android:layout_weight="1"
android:maxLines="2"
android:minHeight="@dimen/alert_dialog_button_bar_height"
style="?android:attr/buttonBarButtonStyle"
+ android:textSize="14sp"
android:layout_height="wrap_content" />
- <LinearLayout android:id="@+id/rightSpacer"
- android:layout_width="0dip"
- android:layout_weight="0.25"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:visibility="gone" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
diff --git a/core/res/res/layout/dialog_custom_title_holo.xml b/core/res/res/layout/dialog_custom_title_holo.xml
index 74b6070..5261553 100644
--- a/core/res/res/layout/dialog_custom_title_holo.xml
+++ b/core/res/res/layout/dialog_custom_title_holo.xml
@@ -23,18 +23,16 @@
android:fitsSystemWindows="true">
<FrameLayout android:id="@android:id/title_container"
android:layout_width="match_parent"
- android:layout_height="60dip"
+ android:layout_height="@dimen/alert_dialog_title_height"
android:layout_weight="0"
android:gravity="center_vertical|left"
style="?android:attr/windowTitleBackgroundStyle">
</FrameLayout>
<ImageView android:id="@+id/titleDivider"
android:layout_width="match_parent"
- android:layout_height="4dip"
+ android:layout_height="1dip"
android:scaleType="fitXY"
android:gravity="fill_horizontal"
- android:paddingLeft="16dip"
- android:paddingRight="16dip"
android:src="@android:drawable/divider_strong_holo" />
<FrameLayout
android:layout_width="match_parent" android:layout_height="wrap_content"
diff --git a/core/res/res/layout/dialog_title_holo.xml b/core/res/res/layout/dialog_title_holo.xml
index 534dd8d..400ef60 100644
--- a/core/res/res/layout/dialog_title_holo.xml
+++ b/core/res/res/layout/dialog_title_holo.xml
@@ -26,17 +26,15 @@
<TextView android:id="@android:id/title" style="?android:attr/windowTitleStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:minHeight="60dip"
- android:paddingLeft="32dip"
- android:paddingRight="32dip"
+ android:minHeight="@android:dimen/alert_dialog_title_height"
+ android:paddingLeft="16dip"
+ android:paddingRight="16dip"
android:gravity="center_vertical|left" />
<ImageView android:id="@+id/titleDivider"
android:layout_width="match_parent"
- android:layout_height="4dip"
+ android:layout_height="1dip"
android:scaleType="fitXY"
android:gravity="fill_horizontal"
- android:paddingLeft="16dip"
- android:paddingRight="16dip"
android:src="@android:drawable/divider_strong_holo" />
<FrameLayout
android:layout_width="match_parent" android:layout_height="wrap_content"
diff --git a/core/res/res/layout/dialog_title_icons_holo.xml b/core/res/res/layout/dialog_title_icons_holo.xml
index a3cd3af..f780ab0 100644
--- a/core/res/res/layout/dialog_title_icons_holo.xml
+++ b/core/res/res/layout/dialog_title_icons_holo.xml
@@ -28,16 +28,16 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
- android:minHeight="60dip"
- android:paddingLeft="32dip"
- android:paddingRight="32dip">
+ android:minHeight="@android:dimen/alert_dialog_title_height"
+ android:paddingLeft="16dip"
+ android:paddingRight="16dip">
<ImageView android:id="@+id/left_icon"
android:layout_width="32dip"
android:layout_height="32dip"
android:scaleType="fitCenter"
android:layout_marginRight="8dip" />
<TextView android:id="@android:id/title"
- style="?android:attr/windowTitleStyle"
+ style="?android:attr/windowTitleStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0" />
@@ -50,11 +50,9 @@
<ImageView android:id="@+id/titleDivider"
android:layout_width="match_parent"
- android:layout_height="4dip"
+ android:layout_height="1dip"
android:scaleType="fitXY"
android:gravity="fill_horizontal"
- android:paddingLeft="16dip"
- android:paddingRight="16dip"
android:src="@android:drawable/divider_strong_holo" />
<FrameLayout
diff --git a/core/res/res/layout/select_dialog_holo.xml b/core/res/res/layout/select_dialog_holo.xml
index 7c95693..06a5d96 100644
--- a/core/res/res/layout/select_dialog_holo.xml
+++ b/core/res/res/layout/select_dialog_holo.xml
@@ -27,9 +27,6 @@
android:id="@+android:id/select_dialog_listview"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_marginTop="5dip"
- android:paddingLeft="16dip"
- android:paddingRight="16dip"
android:cacheColorHint="@null"
android:divider="?android:attr/listDividerAlertDialog"
android:scrollbars="vertical"
diff --git a/core/res/res/layout/select_dialog_item_holo.xml b/core/res/res/layout/select_dialog_item_holo.xml
index 396092e..0c700cf 100644
--- a/core/res/res/layout/select_dialog_item_holo.xml
+++ b/core/res/res/layout/select_dialog_item_holo.xml
@@ -26,7 +26,7 @@
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:minHeight="?android:attr/listPreferredItemHeight"
+ android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorAlertDialogListItem"
android:gravity="center_vertical"
diff --git a/core/res/res/layout/select_dialog_multichoice_holo.xml b/core/res/res/layout/select_dialog_multichoice_holo.xml
index 8027035..683151c 100644
--- a/core/res/res/layout/select_dialog_multichoice_holo.xml
+++ b/core/res/res/layout/select_dialog_multichoice_holo.xml
@@ -18,7 +18,7 @@
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:minHeight="?android:attr/listPreferredItemHeight"
+ android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorAlertDialogListItem"
android:gravity="center_vertical"
diff --git a/core/res/res/layout/select_dialog_singlechoice_holo.xml b/core/res/res/layout/select_dialog_singlechoice_holo.xml
index cab519f..52782d0 100644
--- a/core/res/res/layout/select_dialog_singlechoice_holo.xml
+++ b/core/res/res/layout/select_dialog_singlechoice_holo.xml
@@ -18,7 +18,7 @@
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:minHeight="?android:attr/listPreferredItemHeight"
+ android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorAlertDialogListItem"
android:gravity="center_vertical"
diff --git a/core/res/res/layout/status_bar_latest_event_content.xml b/core/res/res/layout/status_bar_latest_event_content.xml
index 676c38b..0dc6741 100644
--- a/core/res/res/layout/status_bar_latest_event_content.xml
+++ b/core/res/res/layout/status_bar_latest_event_content.xml
@@ -1,4 +1,5 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/status_bar_latest_event_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
@@ -8,41 +9,9 @@
android:background="@drawable/notify_panel_notification_icon_bg"
android:scaleType="center"
/>
- <LinearLayout
- android:layout_width="0dp"
+ <include layout="@layout/status_bar_latest_event_content_large_icon"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:layout_weight="1"
- android:orientation="vertical"
- android:paddingLeft="16dp"
- >
- <TextView android:id="@+id/title"
- android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Title"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:fadingEdge="horizontal"
- android:layout_marginBottom="-3dp"
- />
- <TextView android:id="@+id/text"
- android:textAppearance="@style/TextAppearance.StatusBar.EventContent"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:layout_marginTop="-2dp"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:fadingEdge="horizontal"
- />
- </LinearLayout>
- <TextView android:id="@+id/info"
- android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Info"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:singleLine="true"
- android:gravity="center_vertical"
- android:paddingLeft="8dp"
+ android:layout_gravity="center"
/>
</LinearLayout>
-
diff --git a/core/res/res/layout/status_bar_latest_event_content_large_icon.xml b/core/res/res/layout/status_bar_latest_event_content_large_icon.xml
index ebdaaa3..d937392 100644
--- a/core/res/res/layout/status_bar_latest_event_content_large_icon.xml
+++ b/core/res/res/layout/status_bar_latest_event_content_large_icon.xml
@@ -1,50 +1,65 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/status_bar_latest_event_content_large_icon"
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:orientation="vertical"
+ android:paddingLeft="8dp"
+ android:paddingRight="8dp"
>
- <LinearLayout
- android:layout_width="0dp"
+ <TextView android:id="@+id/title"
+ android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Title"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:layout_weight="1"
- android:orientation="vertical"
- android:paddingLeft="16dp"
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ android:fadingEdge="horizontal"
+ />
+ <TextView android:id="@+id/text2"
+ android:textAppearance="@style/TextAppearance.StatusBar.EventContent"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="-2dp"
+ android:layout_marginBottom="-2dp"
+ android:singleLine="true"
+ android:fadingEdge="horizontal"
+ android:ellipsize="marquee"
+ android:visibility="gone"
+ android:alpha="0.7"
+ />
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:alpha="0.7"
>
- <TextView android:id="@+id/title"
- android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Title"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:fadingEdge="horizontal"
- android:layout_marginBottom="-3dp"
- />
<TextView android:id="@+id/text"
android:textAppearance="@style/TextAppearance.StatusBar.EventContent"
- android:layout_width="match_parent"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
- android:layout_marginTop="-2dp"
+ android:layout_gravity="center"
android:singleLine="true"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
/>
+ <TextView android:id="@+id/info"
+ android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Info"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:layout_weight="0"
+ android:singleLine="true"
+ android:gravity="center"
+ android:paddingLeft="8dp"
+ />
+ <ImageView android:id="@+id/icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:layout_weight="0"
+ android:scaleType="center"
+ android:paddingLeft="8dp"
+ />
</LinearLayout>
- <TextView android:id="@+id/info"
- android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Info"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:singleLine="true"
- android:gravity="center_vertical"
- android:paddingLeft="4dp"
- android:paddingRight="4dp"
- />
- <ImageView android:id="@+id/icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom"
- android:layout_marginBottom="13dip"
- android:scaleType="center"
- />
</LinearLayout>
-
diff --git a/core/res/res/values-h720dp/dimens.xml b/core/res/res/values-h720dp/dimens.xml
index c09cb5b..37dee8e 100644
--- a/core/res/res/values-h720dp/dimens.xml
+++ b/core/res/res/values-h720dp/dimens.xml
@@ -17,8 +17,6 @@
*/
-->
<resources>
- <!-- Dialog title height -->
- <dimen name="alert_dialog_title_height">54dip</dimen>
<!-- Dialog button bar height -->
<dimen name="alert_dialog_button_bar_height">54dip</dimen>
<!-- Preference fragment padding, bottom -->
diff --git a/core/res/res/values-sw600dp/styles.xml b/core/res/res/values-sw600dp/styles.xml
index 7515c98..645db13 100644
--- a/core/res/res/values-sw600dp/styles.xml
+++ b/core/res/res/values-sw600dp/styles.xml
@@ -15,27 +15,6 @@
-->
<resources>
- <!-- Status Bar Styles -->
-
- <style name="TextAppearance.StatusBar">
- <item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
- </style>
- <style name="TextAppearance.StatusBar.Ticker">
- </style>
- <style name="TextAppearance.StatusBar.Title">
- <item name="android:textStyle">bold</item>
- </style>
-
- <style name="TextAppearance.StatusBar.Icon">
- </style>
- <style name="TextAppearance.StatusBar.EventContent">
- <item name="android:textColor">#ff999999</item>
- <item name="android:textSize">14sp</item>
- </style>
- <style name="TextAppearance.StatusBar.EventContent.Title">
- <item name="android:textColor">?android:attr/textColorPrimary</item>
- </style>
-
<style name="TextAppearance.Holo.Widget.TabWidget">
<item name="android:textSize">18sp</item>
<item name="android:textStyle">normal</item>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 9c25ace..a59af1a 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -202,9 +202,14 @@
<!-- The preferred list item height. -->
<attr name="listPreferredItemHeight" format="dimension" />
- <!-- The drawable for the list divider. -->
+ <!-- A smaller, sleeker list item height. -->
+ <attr name="listPreferredItemHeightSmall" format="dimension" />
+ <!-- A larger, more robust list item height. -->
+ <attr name="listPreferredItemHeightLarge" format="dimension" />
<!-- The list item height for search results. @hide -->
<attr name="searchResultListItemHeight" format="dimension" />
+
+ <!-- The drawable for the list divider. -->
<attr name="listDivider" format="reference" />
<!-- The list divider used in alert dialogs. -->
<attr name="listDividerAlertDialog" format="reference" />
@@ -1206,6 +1211,16 @@
<enum name="vertical" value="1" />
</attr>
+ <!-- Alignment constants. -->
+ <attr name="alignmentMode">
+ <!-- Align the bounds of the children.
+ See {@link android.widget.GridLayout#ALIGN_BOUNDS}. -->
+ <enum name="alignBounds" value="0" />
+ <!-- Align the margins of the children.
+ See {@link android.widget.GridLayout#ALIGN_MARGINS}. -->
+ <enum name="alignMargins" value="1" />
+ </attr>
+
<!-- ========================== -->
<!-- Key Codes -->
<!-- ========================== -->
@@ -2541,12 +2556,12 @@
The default value is false.
See {@link android.widget.GridLayout#setUseDefaultMargins(boolean)}.-->
<attr name="useDefaultMargins" format="boolean" />
- <!-- When set to true, causes alignment to take place between the outer
- boundary of a view, as defined by its margins. When set to false,
+ <!-- When set to alignMargins, causes alignment to take place between the outer
+ boundary of a view, as defined by its margins. When set to alignBounds,
causes alignment to take place between the edges of the view.
- The default is true.
- See {@link android.widget.GridLayout#setMarginsIncludedInAlignment(boolean)}.-->
- <attr name="marginsIncludedInAlignment" format="boolean" />
+ The default is alignMargins.
+ See {@link android.widget.GridLayout#setAlignmentMode(int)}.-->
+ <attr name="alignmentMode" />
<!-- When set to true, forces row boundaries to appear in the same order
as row indices.
The default is false.
diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml
index 6529fe1..e76c0e5 100644
--- a/core/res/res/values/colors.xml
+++ b/core/res/res/values/colors.xml
@@ -148,5 +148,14 @@
<color name="group_button_dialog_pressed_holo_light">#ffffffff</color>
<color name="group_button_dialog_focused_holo_light">#4699cc00</color>
+
+ <!-- General purpose colors for Holo-themed elements -->
+ <eat-comment />
+
+ <!-- A Holo shade of blue -->
+ <color name="holo_blue">#ff6699ff</color>
+ <!-- A Holo shade of green -->
+ <color name="holo_green">#ff99cc00</color>
+
</resources>
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index e6dfc03..4deb8ca 100755
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -82,7 +82,7 @@
<!-- The maximum width we would prefer dialogs to be. 0 if there is no
maximum (let them grow as large as the screen). Actual values are
specified for -large and -xlarge configurations. -->
- <dimen name="config_prefDialogWidth">0px</dimen>
+ <dimen name="config_prefDialogWidth">320dp</dimen>
<!-- Whether dialogs should close automatically when the user touches outside
of them. This should not normally be modified. -->
@@ -642,4 +642,10 @@
-SourcePortDestPort-SourcePortDestPort-OMADM PDU
If false, not supported. -->
<bool name="config_duplicate_port_omadm_wappush">false</bool>
+
+ <!-- Maximum numerical value that will be shown in a status bar
+ notification icon or in the notification itself. Will be replaced
+ with @string/status_bar_notification_info_overflow when shown in the
+ UI. -->
+ <integer name="status_bar_notification_info_maxnum">999</integer>
</resources>
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index df22f15..0725c2f 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -111,7 +111,7 @@
<dimen name="search_view_text_min_width">160dip</dimen>
<!-- Dialog title height -->
- <dimen name="alert_dialog_title_height">48dip</dimen>
+ <dimen name="alert_dialog_title_height">64dip</dimen>
<!-- Dialog button bar height -->
<dimen name="alert_dialog_button_bar_height">48dip</dimen>
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 17b23da..e02496c 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1733,7 +1733,7 @@
<public type="attr" name="columnCount" />
<public type="attr" name="columnOrderPreserved" />
<public type="attr" name="useDefaultMargins" />
- <public type="attr" name="marginsIncludedInAlignment" />
+ <public type="attr" name="alignmentMode" />
<public type="attr" name="layout_row" />
<public type="attr" name="layout_rowSpan" />
@@ -1766,5 +1766,13 @@
<public type="attr" name="feedbackCount" />
<public type="attr" name="verticalOffset" />
<public type="attr" name="horizontalOffset" />
+ <public type="attr" name="listPreferredItemHeightLarge" />
+ <public type="attr" name="listPreferredItemHeightSmall" />
+
+ <public type="style" name="Widget.Holo.Button.Borderless.Small" />
+ <public type="style" name="Widget.Holo.Light.Button.Borderless.Small" />
+
+ <public type="integer" name="status_bar_notification_info_maxnum" />
+ <public type="string" name="status_bar_notification_info_overflow" />
</resources>
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index d7b7dd0..d9e7dac 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -339,10 +339,12 @@
<!-- status message in phone options dialog for when airplane mode is off -->
<string name="global_actions_airplane_mode_off_status">Airplane mode is OFF</string>
- <!-- Text to use when the number in a notification info is too large (> 100). Most likely does not need
- to be translated. We do this so, for example, if the user has tens of thousands of unread
- emails, the whole notification isn't taken over by the number. [CHAR LIMIT=5] -->
- <string name="status_bar_notification_info_overflow">100+</string>
+ <!-- Text to use when the number in a notification info is too large
+ (greater than status_bar_notification_info_maxnum, defined in
+ values/config.xml) and must be truncated. May need to be localized
+ for most appropriate textual indicator of "more than X".
+ [CHAR LIMIT=4] -->
+ <string name="status_bar_notification_info_overflow">999+</string>
<!-- Displayed to the user to tell them that they have started up the phone in "safe mode" -->
<string name="safeMode">Safe mode</string>
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index 19b05c9..72a5797 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -227,15 +227,15 @@
<style name="TextAppearance.StatusBar.Icon">
</style>
<style name="TextAppearance.StatusBar.EventContent">
- <item name="android:textColor">#ff999999</item>
- <item name="android:textSize">14sp</item>
+ <item name="android:textColor">?android:attr/textColorPrimary</item>
+ <item name="android:textSize">13sp</item>
</style>
<style name="TextAppearance.StatusBar.EventContent.Title">
- <item name="android:textColor">?android:attr/textColorPrimary</item>
+ <item name="android:textSize">16sp</item>
+ <item name="android:textStyle">bold</item>
</style>
<style name="TextAppearance.StatusBar.EventContent.Info">
- <item name="android:textAppearance">?android:attr/textAppearanceLarge</item>
- <item name="android:textColor">#ff272727</item>
+ <item name="android:textSize">13sp</item>
</style>
<style name="TextAppearance.Small.CalendarViewWeekDayView">
@@ -1321,7 +1321,8 @@
</style>
<style name="TextAppearance.Holo.DialogWindowTitle">
- <item name="android:textSize">18sp</item>
+ <item name="android:textSize">22sp</item>
+ <item name="android:textColor">@android:color/holo_blue</item>
</style>
<style name="TextAppearance.Holo.CalendarViewWeekDayView" parent="TextAppearance.Small.CalendarViewWeekDayView">
@@ -1419,7 +1420,8 @@
</style>
<style name="TextAppearance.Holo.Light.DialogWindowTitle">
- <item name="android:textSize">18sp</item>
+ <item name="android:textSize">22sp</item>
+ <item name="android:textColor">@android:color/holo_blue</item>
</style>
<style name="TextAppearance.Holo.Light.CalendarViewWeekDayView" parent="TextAppearance.Small.CalendarViewWeekDayView">
@@ -1448,6 +1450,12 @@
<style name="Widget.Holo.Button.Borderless">
<item name="android:background">?android:attr/selectableItemBackground</item>
+ <item name="android:paddingLeft">4dip</item>
+ <item name="android:paddingRight">4dip</item>
+ </style>
+
+ <style name="Widget.Holo.Button.Borderless.Small">
+ <item name="android:textSize">14sp</item>
</style>
<style name="Widget.Holo.Button.Small">
@@ -1488,6 +1496,7 @@
<style name="Holo.ButtonBar.AlertDialog">
<item name="android:background">@null</item>
+ <item name="android:dividerPadding">0dp</item>
</style>
<style name="Widget.Holo.TextView" parent="Widget.TextView">
@@ -1864,6 +1873,12 @@
<style name="Widget.Holo.Light.Button.Borderless">
<item name="android:background">?android:attr/selectableItemBackground</item>
+ <item name="android:paddingLeft">4dip</item>
+ <item name="android:paddingRight">4dip</item>
+ </style>
+
+ <style name="Widget.Holo.Light.Button.Borderless.Small">
+ <item name="android:textSize">14sp</item>
</style>
<style name="Widget.Holo.Light.Button.Small">
@@ -1891,6 +1906,7 @@
<style name="Holo.Light.ButtonBar.AlertDialog">
<item name="android:background">@null</item>
+ <item name="android:dividerPadding">0dp</item>
</style>
<style name="Holo.Light.SegmentedButton" parent="SegmentedButton">
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index 5f77dc5..2ab2c04 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -95,7 +95,9 @@
<!-- List attributes -->
<item name="listPreferredItemHeight">64dip</item>
- <item name="dropdownListPreferredItemHeight">64dip</item>
+ <item name="listPreferredItemHeightSmall">?android:attr/listPreferredItemHeight</item>
+ <item name="listPreferredItemHeightLarge">?android:attr/listPreferredItemHeight</item>
+ <item name="dropdownListPreferredItemHeight">?android:attr/listPreferredItemHeight</item>
<!-- @hide -->
<item name="searchResultListItemHeight">58dip</item>
@@ -861,7 +863,9 @@
<!-- List attributes -->
<item name="listPreferredItemHeight">64dip</item>
- <item name="dropdownListPreferredItemHeight">48dip</item>
+ <item name="listPreferredItemHeightSmall">48dip</item>
+ <item name="listPreferredItemHeightLarge">80dip</item>
+ <item name="dropdownListPreferredItemHeight">?android:attr/listPreferredItemHeightSmall</item>
<!-- @hide -->
<item name="searchResultListItemHeight">58dip</item>
@@ -1150,7 +1154,9 @@
<!-- List attributes -->
<item name="listPreferredItemHeight">64dip</item>
- <item name="dropdownListPreferredItemHeight">48dip</item>
+ <item name="listPreferredItemHeightSmall">48dip</item>
+ <item name="listPreferredItemHeightLarge">80dip</item>
+ <item name="dropdownListPreferredItemHeight">?android:attr/listPreferredItemHeightSmall</item>
<!-- @hide -->
<item name="searchResultListItemHeight">58dip</item>
@@ -1411,6 +1417,7 @@
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:buttonBarStyle">@android:style/Holo.ButtonBar.AlertDialog</item>
+ <item name="borderlessButtonStyle">@android:style/Widget.Holo.Button.Borderless.Small</item>
<item name="textAppearance">@android:style/TextAppearance.Holo</item>
<item name="textAppearanceInverse">@android:style/TextAppearance.Holo.Inverse</item>
@@ -1420,7 +1427,7 @@
a regular dialog. -->
<style name="Theme.Holo.Dialog.MinWidth">
<item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item>
- <item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_major</item>
+ <item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_minor</item>
</style>
<!-- Variation of Theme.Holo.Dialog that does not include a title bar. -->
@@ -1433,7 +1440,7 @@
a regular dialog. -->
<style name="Theme.Holo.Dialog.NoActionBar.MinWidth">
<item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item>
- <item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_major</item>
+ <item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_minor</item>
</style>
<!-- Variation of Theme.Holo.Dialog that does not include a frame (or background).
@@ -1460,7 +1467,7 @@
<item name="windowTitleStyle">@android:style/DialogWindowTitle.Holo</item>
<item name="windowContentOverlay">@null</item>
<item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item>
- <item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_major</item>
+ <item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_minor</item>
</style>
<!-- Theme for a window that will be displayed either full-screen on
@@ -1499,6 +1506,7 @@
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:buttonBarStyle">@android:style/Holo.Light.ButtonBar.AlertDialog</item>
+ <item name="borderlessButtonStyle">@android:style/Widget.Holo.Light.Button.Borderless.Small</item>
<item name="textAppearance">@android:style/TextAppearance.Holo.Light</item>
<item name="textAppearanceInverse">@android:style/TextAppearance.Holo.Light.Inverse</item>
@@ -1508,7 +1516,7 @@
a regular dialog. -->
<style name="Theme.Holo.Light.Dialog.MinWidth">
<item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item>
- <item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_major</item>
+ <item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_minor</item>
</style>
<!-- Variation of Theme.Holo.Light.Dialog that does not include a title bar. -->
@@ -1521,7 +1529,7 @@
a regular dialog. -->
<style name="Theme.Holo.Light.Dialog.NoActionBar.MinWidth">
<item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item>
- <item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_major</item>
+ <item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_minor</item>
</style>
<!-- Theme for a window that will be displayed either full-screen on
@@ -1547,7 +1555,7 @@
<item name="windowTitleStyle">@android:style/DialogWindowTitle.Holo.Light</item>
<item name="windowContentOverlay">@null</item>
<item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item>
- <item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_major</item>
+ <item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_minor</item>
</style>
<!-- Default holographic (dark) for windows that want to have the user's selected
diff --git a/core/tests/coretests/src/com/android/internal/util/HanziToPinyinTest.java b/core/tests/coretests/src/com/android/internal/util/HanziToPinyinTest.java
deleted file mode 100644
index 36dee70..0000000
--- a/core/tests/coretests/src/com/android/internal/util/HanziToPinyinTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.util;
-
-import java.text.Collator;
-import java.util.Arrays;
-import java.util.ArrayList;
-import java.util.Locale;
-
-import android.test.suitebuilder.annotation.SmallTest;
-import android.util.Log;
-
-import com.android.internal.util.HanziToPinyin;
-import com.android.internal.util.HanziToPinyin.Token;
-
-import junit.framework.TestCase;
-
-public class HanziToPinyinTest extends TestCase {
- private final static String ONE_HANZI = "\u675C";
- private final static String TWO_HANZI = "\u675C\u9D51";
- private final static String ASSIC = "test";
- private final static String ONE_UNKNOWN = "\uFF71";
- private final static String MISC = "test\u675C Test with space\uFF71\uFF71\u675C";
-
- @SmallTest
- public void testGetToken() throws Exception {
- if (!Arrays.asList(Collator.getAvailableLocales()).contains(Locale.CHINA)) {
- return;
- }
- ArrayList<Token> tokens = HanziToPinyin.getInstance().get(ONE_HANZI);
- assertEquals(tokens.size(), 1);
- assertEquals(tokens.get(0).type, Token.PINYIN);
- assertTrue(tokens.get(0).target.equalsIgnoreCase("DU"));
-
- tokens = HanziToPinyin.getInstance().get(TWO_HANZI);
- assertEquals(tokens.size(), 2);
- assertEquals(tokens.get(0).type, Token.PINYIN);
- assertEquals(tokens.get(1).type, Token.PINYIN);
- assertTrue(tokens.get(0).target.equalsIgnoreCase("DU"));
- assertTrue(tokens.get(1).target.equalsIgnoreCase("JUAN"));
-
- tokens = HanziToPinyin.getInstance().get(ASSIC);
- assertEquals(tokens.size(), 1);
- assertEquals(tokens.get(0).type, Token.LATIN);
-
- tokens = HanziToPinyin.getInstance().get(ONE_UNKNOWN);
- assertEquals(tokens.size(), 1);
- assertEquals(tokens.get(0).type, Token.UNKNOWN);
-
- tokens = HanziToPinyin.getInstance().get(MISC);
- assertEquals(tokens.size(), 7);
- assertEquals(tokens.get(0).type, Token.LATIN);
- assertEquals(tokens.get(1).type, Token.PINYIN);
- assertEquals(tokens.get(2).type, Token.LATIN);
- assertEquals(tokens.get(3).type, Token.LATIN);
- assertEquals(tokens.get(4).type, Token.LATIN);
- assertEquals(tokens.get(5).type, Token.UNKNOWN);
- assertEquals(tokens.get(6).type, Token.PINYIN);
- }
-}
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index a63abb9..eeab9b4 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -606,9 +606,9 @@
*/
public void copy1DRangeFrom(int off, int count, Allocation data, int dataOff) {
mRS.nAllocationData2D(getID(), off, 0,
- 0, Type.CubemapFace.POSITVE_X.mID,
+ 0, Type.CubemapFace.POSITIVE_X.mID,
count, 1, data.getID(), dataOff, 0,
- 0, Type.CubemapFace.POSITVE_X.mID);
+ 0, Type.CubemapFace.POSITIVE_X.mID);
}
private void validate2DRange(int xoff, int yoff, int w, int h) {
@@ -675,9 +675,9 @@
mRS.validate();
validate2DRange(xoff, yoff, w, h);
mRS.nAllocationData2D(getID(), xoff, yoff,
- 0, Type.CubemapFace.POSITVE_X.mID,
+ 0, Type.CubemapFace.POSITIVE_X.mID,
w, h, data.getID(), dataXoff, dataYoff,
- 0, Type.CubemapFace.POSITVE_X.mID);
+ 0, Type.CubemapFace.POSITIVE_X.mID);
}
/**
@@ -1048,15 +1048,15 @@
Allocation cubemap = Allocation.createTyped(rs, t, mips, usage);
AllocationAdapter adapter = AllocationAdapter.create2D(rs, cubemap);
- adapter.setFace(Type.CubemapFace.POSITVE_X);
+ adapter.setFace(Type.CubemapFace.POSITIVE_X);
adapter.copyFrom(xpos);
adapter.setFace(Type.CubemapFace.NEGATIVE_X);
adapter.copyFrom(xneg);
- adapter.setFace(Type.CubemapFace.POSITVE_Y);
+ adapter.setFace(Type.CubemapFace.POSITIVE_Y);
adapter.copyFrom(ypos);
adapter.setFace(Type.CubemapFace.NEGATIVE_Y);
adapter.copyFrom(yneg);
- adapter.setFace(Type.CubemapFace.POSITVE_Z);
+ adapter.setFace(Type.CubemapFace.POSITIVE_Z);
adapter.copyFrom(zpos);
adapter.setFace(Type.CubemapFace.NEGATIVE_Z);
adapter.copyFrom(zneg);
diff --git a/graphics/java/android/renderscript/AllocationAdapter.java b/graphics/java/android/renderscript/AllocationAdapter.java
index 07a1f5d..61f2e1f 100644
--- a/graphics/java/android/renderscript/AllocationAdapter.java
+++ b/graphics/java/android/renderscript/AllocationAdapter.java
@@ -33,7 +33,7 @@
private Allocation mAlloc;
private int mSelectedLOD = 0;
- private Type.CubemapFace mSelectedFace = Type.CubemapFace.POSITVE_X;
+ private Type.CubemapFace mSelectedFace = Type.CubemapFace.POSITIVE_X;
AllocationAdapter(int id, RenderScript rs, Allocation alloc) {
super(id, rs, null, alloc.mUsage);
diff --git a/graphics/java/android/renderscript/Element.java b/graphics/java/android/renderscript/Element.java
index 0c1ad2a..5a72dbe 100644
--- a/graphics/java/android/renderscript/Element.java
+++ b/graphics/java/android/renderscript/Element.java
@@ -32,8 +32,8 @@
* <p>Complex elements contain a list of sub-elements and names that
* represents a structure of data. The fields can be accessed by name
* from a script or shader. The memory layout is defined and ordered. Data
- * alignment is determinied by the most basic primitive type. i.e. a float4
- * vector will be alligned to sizeof(float) and not sizeof(float4). The
+ * alignment is determined by the most basic primitive type. i.e. a float4
+ * vector will be aligned to sizeof(float) and not sizeof(float4). The
* ordering of elements in memory will be the order in which they were added
* with each component aligned as necessary. No re-ordering will be done.</p>
*
@@ -584,6 +584,33 @@
}
/**
+ * Check if the current Element is compatible with another Element.
+ * Primitive Elements are compatible if they share the same underlying
+ * size and type (i.e. U8 is compatible with A_8). User-defined Elements
+ * must be equal in order to be compatible. This requires strict name
+ * equivalence for all sub-Elements (in addition to structural equivalence).
+ *
+ * @param e The Element to check compatibility with.
+ *
+ * @return boolean true if the Elements are compatible, otherwise false.
+ */
+ public boolean isCompatible(Element e) {
+ // Try strict BaseObj equality to start with.
+ if (this.equals(e)) {
+ return true;
+ }
+
+ // Ignore mKind because it is allowed to be different (user vs. pixel).
+ // We also ignore mNormalized because it can be different. The mType
+ // field must be non-null since we require name equivalence for
+ // user-created Elements.
+ return ((mSize == e.mSize) &&
+ (mType != null) &&
+ (mType == e.mType) &&
+ (mVectorSize == e.mVectorSize));
+ }
+
+ /**
* Builder class for producing complex elements with matching field and name
* pairs. The builder starts empty. The order in which elements are added
* is retained for the layout in memory.
diff --git a/graphics/java/android/renderscript/Type.java b/graphics/java/android/renderscript/Type.java
index b39d2e4..f88af8b 100644
--- a/graphics/java/android/renderscript/Type.java
+++ b/graphics/java/android/renderscript/Type.java
@@ -46,12 +46,18 @@
Element mElement;
public enum CubemapFace {
- POSITVE_X (0),
+ POSITIVE_X (0),
NEGATIVE_X (1),
- POSITVE_Y (2),
+ POSITIVE_Y (2),
NEGATIVE_Y (3),
- POSITVE_Z (4),
- NEGATIVE_Z (5);
+ POSITIVE_Z (4),
+ NEGATIVE_Z (5),
+ @Deprecated
+ POSITVE_X (0),
+ @Deprecated
+ POSITVE_Y (2),
+ @Deprecated
+ POSITVE_Z (4);
int mID;
CubemapFace(int id) {
diff --git a/libs/gui/tests/SurfaceTextureClient_test.cpp b/libs/gui/tests/SurfaceTextureClient_test.cpp
index a4c5b36..519b40e 100644
--- a/libs/gui/tests/SurfaceTextureClient_test.cpp
+++ b/libs/gui/tests/SurfaceTextureClient_test.cpp
@@ -590,7 +590,7 @@
// This test verifies that the buffer format can be queried immediately after
// it is set.
-TEST_F(SurfaceTextureClientTest, DISABLED_QueryFormatAfterSettingWorks) {
+TEST_F(SurfaceTextureClientTest, QueryFormatAfterSettingWorks) {
sp<ANativeWindow> anw(mSTC);
int fmts[] = {
// RGBA_8888 should not come first, as it's the default
diff --git a/libs/gui/tests/SurfaceTexture_test.cpp b/libs/gui/tests/SurfaceTexture_test.cpp
index 50af3bb..f6cefa6 100644
--- a/libs/gui/tests/SurfaceTexture_test.cpp
+++ b/libs/gui/tests/SurfaceTexture_test.cpp
@@ -542,11 +542,7 @@
EXPECT_TRUE(checkPixel(36, 22, 155, 29, 0, 255));
}
-// XXX: This test is disabled because it it currently broken on all devices to
-// which I have access. Some of the checkPixel calls are not correct because
-// I just copied them from the npot test above and haven't bothered to figure
-// out the correct values.
-TEST_F(SurfaceTextureGLTest, DISABLED_TexturingFromCpuFilledYV12BufferPow2) {
+TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledYV12BufferPow2) {
const int texWidth = 64;
const int texHeight = 64;
@@ -576,18 +572,18 @@
drawTexture();
- EXPECT_TRUE(checkPixel( 0, 0, 255, 127, 255, 255));
- EXPECT_TRUE(checkPixel(63, 0, 0, 133, 0, 255));
+ EXPECT_TRUE(checkPixel( 0, 0, 0, 133, 0, 255));
+ EXPECT_TRUE(checkPixel(63, 0, 255, 127, 255, 255));
EXPECT_TRUE(checkPixel(63, 63, 0, 133, 0, 255));
EXPECT_TRUE(checkPixel( 0, 63, 255, 127, 255, 255));
- EXPECT_TRUE(checkPixel(22, 19, 247, 70, 255, 255));
- EXPECT_TRUE(checkPixel(45, 11, 209, 32, 235, 255));
- EXPECT_TRUE(checkPixel(52, 12, 100, 255, 73, 255));
- EXPECT_TRUE(checkPixel( 7, 32, 155, 0, 118, 255));
- EXPECT_TRUE(checkPixel(31, 54, 148, 71, 110, 255));
- EXPECT_TRUE(checkPixel(29, 28, 255, 127, 255, 255));
- EXPECT_TRUE(checkPixel(36, 41, 155, 29, 0, 255));
+ EXPECT_TRUE(checkPixel(22, 19, 100, 255, 74, 255));
+ EXPECT_TRUE(checkPixel(45, 11, 100, 255, 74, 255));
+ EXPECT_TRUE(checkPixel(52, 12, 155, 0, 181, 255));
+ EXPECT_TRUE(checkPixel( 7, 32, 150, 237, 170, 255));
+ EXPECT_TRUE(checkPixel(31, 54, 0, 71, 117, 255));
+ EXPECT_TRUE(checkPixel(29, 28, 0, 133, 0, 255));
+ EXPECT_TRUE(checkPixel(36, 41, 100, 232, 255, 255));
}
TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledYV12BufferWithCrop) {
diff --git a/media/libeffects/factory/EffectsFactory.c b/media/libeffects/factory/EffectsFactory.c
index b0e8585..a3e76d9 100644
--- a/media/libeffects/factory/EffectsFactory.c
+++ b/media/libeffects/factory/EffectsFactory.c
@@ -257,7 +257,7 @@
}
// create effect in library
- l->desc->create_effect(uuid, sessionId, ioId, &itfe);
+ ret = l->desc->create_effect(uuid, sessionId, ioId, &itfe);
if (ret != 0) {
LOGW("EffectCreate() library %s: could not create fx %s, error %d", l->name, d->name, ret);
goto exit;
diff --git a/packages/SystemUI/res/layout-sw600dp/status_bar_notification_row.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_notification_row.xml
deleted file mode 100644
index 93085d7..0000000
--- a/packages/SystemUI/res/layout-sw600dp/status_bar_notification_row.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="@dimen/notification_height"
- >
-
- <ImageButton
- android:id="@+id/veto"
- android:layout_width="48dp"
- android:layout_height="match_parent"
- android:layout_centerVertical="true"
- android:layout_alignParentRight="true"
- android:src="@drawable/status_bar_veto"
- android:scaleType="center"
- android:background="@null"
- android:paddingRight="8dp"
- android:paddingLeft="8dp"
- />
-
- <ImageView
- android:id="@+id/large_icon"
- android:layout_width="@android:dimen/notification_large_icon_width"
- android:layout_height="@android:dimen/notification_large_icon_height"
- android:layout_alignParentTop="true"
- android:layout_alignParentLeft="true"
- android:scaleType="center"
- />
-
- <com.android.systemui.statusbar.LatestItemView android:id="@+id/content"
- android:layout_width="match_parent"
- android:layout_height="64dp"
- android:layout_alignParentTop="true"
- android:layout_toRightOf="@id/large_icon"
- android:layout_toLeftOf="@id/veto"
- android:focusable="true"
- android:clickable="true"
- />
-
- <View
- android:layout_width="match_parent"
- android:layout_height="1dp"
- android:layout_alignParentBottom="true"
- android:background="@android:drawable/divider_horizontal_dark"
- />
-
-</RelativeLayout>
diff --git a/packages/SystemUI/res/layout/status_bar_notification_row.xml b/packages/SystemUI/res/layout/status_bar_notification_row.xml
index 93085d7..aff6a6e 100644
--- a/packages/SystemUI/res/layout/status_bar_notification_row.xml
+++ b/packages/SystemUI/res/layout/status_bar_notification_row.xml
@@ -9,6 +9,7 @@
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
+ android:layout_marginRight="-80dp"
android:src="@drawable/status_bar_veto"
android:scaleType="center"
android:background="@null"
@@ -30,7 +31,7 @@
android:layout_height="64dp"
android:layout_alignParentTop="true"
android:layout_toRightOf="@id/large_icon"
- android:layout_toLeftOf="@id/veto"
+ android:layout_alignParentRight="true"
android:focusable="true"
android:clickable="true"
/>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
index dbfbe11..d9d9c06 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
@@ -29,6 +29,8 @@
import android.view.ViewDebug;
import android.widget.FrameLayout;
+import java.text.NumberFormat;
+
import com.android.internal.statusbar.StatusBarIcon;
import com.android.systemui.R;
@@ -180,7 +182,18 @@
}
void placeNumber() {
- final String str = mNumberText = Integer.toString(mIcon.number);
+ final String str;
+ final int tooBig = mContext.getResources().getInteger(
+ android.R.integer.status_bar_notification_info_maxnum);
+ if (mIcon.number > tooBig) {
+ str = mContext.getResources().getString(
+ android.R.string.status_bar_notification_info_overflow);
+ } else {
+ NumberFormat f = NumberFormat.getIntegerInstance();
+ str = f.format(mIcon.number);
+ }
+ mNumberText = str;
+
final int w = getWidth();
final int h = getHeight();
final Rect r = new Rect();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java
index b5ea7b2..981fb24 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java
@@ -52,11 +52,16 @@
private static final boolean ANIMATE_LAYOUT = true;
+ private static final boolean CLEAR_IF_SWIPED_FAR_ENOUGH = true;
+
+ private static final boolean CONSTRAIN_SWIPE_ON_PERMANENT = true;
+
private static final int APPEAR_ANIM_LEN = SLOW_ANIMATIONS ? 5000 : 250;
private static final int DISAPPEAR_ANIM_LEN = APPEAR_ANIM_LEN;
private static final int SNAP_ANIM_LEN = SLOW_ANIMATIONS ? 1000 : 250;
private static final float SWIPE_ESCAPE_VELOCITY = 1500f;
+ private static final float SWIPE_ANIM_VELOCITY_MIN = 1000f;
Rect mTmpRect = new Rect();
int mNumRows = 0;
@@ -149,6 +154,21 @@
}
return mSlidingChild != null;
}
+
+ protected boolean canBeCleared(View v) {
+ final View veto = v.findViewById(R.id.veto);
+ return (veto != null && veto.getVisibility() != View.GONE);
+ }
+
+ protected boolean clear(View v) {
+ final View veto = v.findViewById(R.id.veto);
+ if (veto != null && veto.getVisibility() != View.GONE) {
+ veto.performClick();
+ return true;
+ }
+ return false;
+ }
+
@Override
public boolean onTouchEvent(MotionEvent ev) {
final int action = ev.getAction();
@@ -159,7 +179,13 @@
case MotionEvent.ACTION_MOVE:
mVT.addMovement(ev);
- mSlidingChild.setTranslationX(ev.getX() - mInitialTouchX);
+ float delta = (ev.getX() - mInitialTouchX);
+ if (CONSTRAIN_SWIPE_ON_PERMANENT && !canBeCleared(mSlidingChild)) {
+ delta = Math.copySign(
+ Math.min(Math.abs(delta),
+ mSlidingChild.getMeasuredWidth() * 0.2f), delta);
+ }
+ mSlidingChild.setTranslationX(delta);
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
@@ -168,14 +194,13 @@
if (DEBUG) Slog.d(TAG, "exit velocity: " + mVT.getXVelocity());
boolean restore = true;
mLiftoffVelocity = mVT.getXVelocity();
- if (Math.abs(mLiftoffVelocity) > SWIPE_ESCAPE_VELOCITY) {
- // flingadingy
+ if (Math.abs(mLiftoffVelocity) > SWIPE_ESCAPE_VELOCITY
+ || (CLEAR_IF_SWIPED_FAR_ENOUGH &&
+ (mSlidingChild.getTranslationX() * 2) > mSlidingChild.getMeasuredWidth()))
+ {
- View veto = mSlidingChild.findViewById(R.id.veto);
- if (veto != null && veto.getVisibility() == View.VISIBLE) {
- veto.performClick();
- restore = false;
- }
+ // flingadingy
+ restore = ! clear(mSlidingChild);
}
if (restore) {
// snappity
@@ -230,7 +255,8 @@
child.setPivotY(0);
final float velocity = (mSlidingChild == child)
- ? mLiftoffVelocity : SWIPE_ESCAPE_VELOCITY;
+ ? Math.min(mLiftoffVelocity, SWIPE_ANIM_VELOCITY_MIN)
+ : SWIPE_ESCAPE_VELOCITY;
final TimeAnimator zoom = new TimeAnimator();
zoom.setTimeListener(new TimeAnimator.TimeListener() {
@Override
diff --git a/services/java/com/android/server/NetworkManagementService.java b/services/java/com/android/server/NetworkManagementService.java
index 2190b30..bb0c671 100644
--- a/services/java/com/android/server/NetworkManagementService.java
+++ b/services/java/com/android/server/NetworkManagementService.java
@@ -311,6 +311,18 @@
}
}
+ /* TODO: This is right now a IPv4 only function. Works for wifi which loses its
+ IPv6 addresses on interface down, but we need to do full clean up here */
+ public void clearInterfaceAddresses(String iface) throws IllegalStateException {
+ String cmd = String.format("interface clearaddrs %s", iface);
+ try {
+ mConnector.doCommand(cmd);
+ } catch (NativeDaemonConnectorException e) {
+ throw new IllegalStateException(
+ "Unable to communicate with native daemon to interface clearallips - " + e);
+ }
+ }
+
public void addRoute(String interfaceName, RouteInfo route) {
modifyRoute(interfaceName, ADD, route);
}
diff --git a/services/java/com/android/server/connectivity/Vpn.java b/services/java/com/android/server/connectivity/Vpn.java
index 372ba85..035a6679 100644
--- a/services/java/com/android/server/connectivity/Vpn.java
+++ b/services/java/com/android/server/connectivity/Vpn.java
@@ -18,7 +18,6 @@
import android.app.Notification;
import android.app.NotificationManager;
-import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
@@ -64,29 +63,40 @@
* @return The name of the current prepared package.
*/
public synchronized String prepare(String packageName) {
-
- // TODO: Check if the caller is VpnDialogs.
-
+ // Return the current prepared package if the new one is null.
if (packageName == null) {
return mPackageName;
}
- // Check the permission of the given application.
+ // Check the permission of the caller.
PackageManager pm = mContext.getPackageManager();
- if (pm.checkPermission(VPN, packageName) != PackageManager.PERMISSION_GRANTED) {
+ VpnConfig.enforceCallingPackage(pm.getNameForUid(Binder.getCallingUid()));
+
+ // Check the permission of the given package.
+ if (packageName.isEmpty()) {
+ packageName = null;
+ } else if (pm.checkPermission(VPN, packageName) != PackageManager.PERMISSION_GRANTED) {
throw new SecurityException(packageName + " does not have " + VPN);
}
// Reset the interface and hide the notification.
if (mInterfaceName != null) {
nativeReset(mInterfaceName);
- mInterfaceName = null;
+ mCallback.restore();
hideNotification();
- // TODO: Send out a broadcast.
+ mInterfaceName = null;
}
+ // Notify the package being revoked.
+ if (mPackageName != null) {
+ Intent intent = new Intent(VpnConfig.ACTION_VPN_REVOKED);
+ intent.setPackage(mPackageName);
+ intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
+ mContext.sendBroadcast(intent);
+ }
+
+ Log.i(TAG, "Switched from " + mPackageName + " to " + packageName);
mPackageName = packageName;
- Log.i(TAG, "Prepared for " + packageName);
return mPackageName;
}
@@ -118,10 +128,10 @@
try {
app = pm.getApplicationInfo(mPackageName, 0);
} catch (Exception e) {
- throw new SecurityException("Not prepared");
+ return null;
}
if (Binder.getCallingUid() != app.uid) {
- throw new SecurityException("Not prepared");
+ return null;
}
// Create and configure the interface.
@@ -148,7 +158,9 @@
String dnsServers = (config.dnsServers == null) ? "" : config.dnsServers.trim();
mCallback.override(dnsServers.isEmpty() ? null : dnsServers.split(" "));
- showNotification(pm, app, config.sessionName);
+ config.packageName = mPackageName;
+ config.interfaceName = mInterfaceName;
+ showNotification(pm, app, config);
return descriptor;
}
@@ -169,7 +181,7 @@
}
}
- private void showNotification(PackageManager pm, ApplicationInfo app, String sessionName) {
+ private void showNotification(PackageManager pm, ApplicationInfo app, VpnConfig config) {
NotificationManager nm = (NotificationManager)
mContext.getSystemService(Context.NOTIFICATION_SERVICE);
@@ -190,20 +202,9 @@
// Load the label.
String label = app.loadLabel(pm).toString();
- // Build the intent.
- // TODO: move these into VpnBuilder.
- Intent intent = new Intent();
- intent.setClassName("com.android.vpndialogs",
- "com.android.vpndialogs.ManageDialog");
- intent.putExtra("packageName", mPackageName);
- intent.putExtra("interfaceName", mInterfaceName);
- intent.putExtra("session", sessionName);
- intent.putExtra("startTime", android.os.SystemClock.elapsedRealtime());
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
-
// Build the notification.
- String text = (sessionName == null) ? mContext.getString(R.string.vpn_text) :
- mContext.getString(R.string.vpn_text_long, sessionName);
+ String text = (config.sessionName == null) ? mContext.getString(R.string.vpn_text) :
+ mContext.getString(R.string.vpn_text_long, config.sessionName);
long identity = Binder.clearCallingIdentity();
Notification notification = new Notification.Builder(mContext)
.setSmallIcon(R.drawable.vpn_connected)
@@ -211,7 +212,7 @@
.setTicker(mContext.getString(R.string.vpn_ticker, label))
.setContentTitle(mContext.getString(R.string.vpn_title, label))
.setContentText(text)
- .setContentIntent(PendingIntent.getActivity(mContext, 0, intent, 0))
+ .setContentIntent(VpnConfig.getIntentForNotification(mContext, config))
.setDefaults(Notification.DEFAULT_ALL)
.setOngoing(true)
.getNotification();
diff --git a/services/java/com/android/server/net/NetworkStatsService.java b/services/java/com/android/server/net/NetworkStatsService.java
index f762123..0a84bc7 100644
--- a/services/java/com/android/server/net/NetworkStatsService.java
+++ b/services/java/com/android/server/net/NetworkStatsService.java
@@ -225,7 +225,9 @@
mContext.unregisterReceiver(mShutdownReceiver);
writeNetworkStatsLocked();
- writeUidStatsLocked();
+ if (mUidStatsLoaded) {
+ writeUidStatsLocked();
+ }
mNetworkStats.clear();
mUidStats.clear();
mUidStatsLoaded = false;
@@ -442,7 +444,9 @@
if (persistDelta.rx[index] > persistThreshold
|| persistDelta.tx[index] > persistThreshold) {
writeNetworkStatsLocked();
- writeUidStatsLocked();
+ if (mUidStatsLoaded) {
+ writeUidStatsLocked();
+ }
mLastNetworkPersist = networkStats;
break;
}
diff --git a/services/jni/com_android_server_connectivity_Vpn.cpp b/services/jni/com_android_server_connectivity_Vpn.cpp
index 206df25..ae7fbfe 100644
--- a/services/jni/com_android_server_connectivity_Vpn.cpp
+++ b/services/jni/com_android_server_connectivity_Vpn.cpp
@@ -55,6 +55,7 @@
{
int tun = open("/dev/tun", O_RDWR);
int inet4 = socket(AF_INET, SOCK_DGRAM, 0);
+ int flags;
ifreq ifr4;
memset(&ifr4, 0, sizeof(ifr4));
@@ -86,6 +87,13 @@
goto error;
}
+ // Make it non-blocking.
+ flags = fcntl(tun, F_GETFL, 0);
+ if (flags == -1 || fcntl(tun, F_SETFL, flags | O_NONBLOCK)) {
+ LOGE("Cannot set non-blocking on %s: %s", ifr4.ifr_name, strerror(errno));
+ goto error;
+ }
+
strcpy(name, ifr4.ifr_name);
*index = ifr4.ifr_ifindex;
close(inet4);
diff --git a/telephony/java/com/android/internal/telephony/IccSmsInterfaceManager.java b/telephony/java/com/android/internal/telephony/IccSmsInterfaceManager.java
index 5fef6de..9763265 100644
--- a/telephony/java/com/android/internal/telephony/IccSmsInterfaceManager.java
+++ b/telephony/java/com/android/internal/telephony/IccSmsInterfaceManager.java
@@ -112,7 +112,7 @@
*/
public void sendText(String destAddr, String scAddr,
String text, PendingIntent sentIntent, PendingIntent deliveryIntent) {
- mPhone.getContext().enforceCallingPermission(
+ mPhone.getContext().enforceCallingOrSelfPermission(
"android.permission.SEND_SMS",
"Sending SMS message");
if (Log.isLoggable("SMS", Log.VERBOSE)) {
diff --git a/tests/GridLayoutTest/res/layout/grid3.xml b/tests/GridLayoutTest/res/layout/grid3.xml
index 5cdacf7..ba911c2 100644
--- a/tests/GridLayoutTest/res/layout/grid3.xml
+++ b/tests/GridLayoutTest/res/layout/grid3.xml
@@ -21,7 +21,7 @@
android:layout_height="match_parent"
android:useDefaultMargins="true"
- android:marginsIncludedInAlignment="false"
+ android:alignmentMode="alignBounds"
android:columnCount="4"
>
diff --git a/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java b/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java
index 32365d7..e010a00 100644
--- a/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java
+++ b/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java
@@ -36,7 +36,7 @@
public static View create(Context context) {
GridLayout vg = new GridLayout(context);
vg.setUseDefaultMargins(true);
- vg.setMarginsIncludedInAlignment(false);
+ vg.setAlignmentMode(ALIGN_BOUNDS);
Group row1 = new Group(1, CENTER);
Group row2 = new Group(2, CENTER);
diff --git a/tests/StatusBar/res/drawable-hdpi/emo_im_kissing.png b/tests/StatusBar/res/drawable-hdpi/emo_im_kissing.png
new file mode 100644
index 0000000..0a8f0d7
--- /dev/null
+++ b/tests/StatusBar/res/drawable-hdpi/emo_im_kissing.png
Binary files differ
diff --git a/tests/StatusBar/res/drawable-hdpi/notification0.png b/tests/StatusBar/res/drawable-hdpi/notification0.png
new file mode 100644
index 0000000..6d2612e
--- /dev/null
+++ b/tests/StatusBar/res/drawable-hdpi/notification0.png
Binary files differ
diff --git a/tests/StatusBar/res/drawable-hdpi/notification1.png b/tests/StatusBar/res/drawable-hdpi/notification1.png
new file mode 100644
index 0000000..ce9009c
--- /dev/null
+++ b/tests/StatusBar/res/drawable-hdpi/notification1.png
Binary files differ
diff --git a/tests/StatusBar/res/drawable-hdpi/notification2.png b/tests/StatusBar/res/drawable-hdpi/notification2.png
new file mode 100644
index 0000000..772d70a
--- /dev/null
+++ b/tests/StatusBar/res/drawable-hdpi/notification2.png
Binary files differ
diff --git a/tests/StatusBar/res/drawable-hdpi/notification3.png b/tests/StatusBar/res/drawable-hdpi/notification3.png
new file mode 100644
index 0000000..61127ee
--- /dev/null
+++ b/tests/StatusBar/res/drawable-hdpi/notification3.png
Binary files differ
diff --git a/tests/StatusBar/res/drawable-hdpi/notification4.png b/tests/StatusBar/res/drawable-hdpi/notification4.png
new file mode 100644
index 0000000..40b7d55
--- /dev/null
+++ b/tests/StatusBar/res/drawable-hdpi/notification4.png
Binary files differ
diff --git a/tests/StatusBar/res/drawable-hdpi/notification5.png b/tests/StatusBar/res/drawable-hdpi/notification5.png
new file mode 100644
index 0000000..e89903a
--- /dev/null
+++ b/tests/StatusBar/res/drawable-hdpi/notification5.png
Binary files differ
diff --git a/tests/StatusBar/res/drawable-hdpi/notification6.png b/tests/StatusBar/res/drawable-hdpi/notification6.png
new file mode 100644
index 0000000..e0878f5
--- /dev/null
+++ b/tests/StatusBar/res/drawable-hdpi/notification6.png
Binary files differ
diff --git a/tests/StatusBar/res/drawable-hdpi/notification7.png b/tests/StatusBar/res/drawable-hdpi/notification7.png
new file mode 100644
index 0000000..49397ca
--- /dev/null
+++ b/tests/StatusBar/res/drawable-hdpi/notification7.png
Binary files differ
diff --git a/tests/StatusBar/res/drawable-hdpi/notification8.png b/tests/StatusBar/res/drawable-hdpi/notification8.png
new file mode 100644
index 0000000..763b048
--- /dev/null
+++ b/tests/StatusBar/res/drawable-hdpi/notification8.png
Binary files differ
diff --git a/tests/StatusBar/res/drawable-hdpi/notification9.png b/tests/StatusBar/res/drawable-hdpi/notification9.png
new file mode 100644
index 0000000..c3c3771
--- /dev/null
+++ b/tests/StatusBar/res/drawable-hdpi/notification9.png
Binary files differ
diff --git a/tests/StatusBar/res/drawable-hdpi/notificationx.png b/tests/StatusBar/res/drawable-hdpi/notificationx.png
new file mode 100644
index 0000000..7267286
--- /dev/null
+++ b/tests/StatusBar/res/drawable-hdpi/notificationx.png
Binary files differ
diff --git a/tests/StatusBar/res/drawable-hdpi/pineapple.png b/tests/StatusBar/res/drawable-hdpi/pineapple.png
new file mode 100644
index 0000000..e62d3c8
--- /dev/null
+++ b/tests/StatusBar/res/drawable-hdpi/pineapple.png
Binary files differ
diff --git a/tests/StatusBar/res/drawable-hdpi/pineapple2.png b/tests/StatusBar/res/drawable-hdpi/pineapple2.png
new file mode 100644
index 0000000..54146a8
--- /dev/null
+++ b/tests/StatusBar/res/drawable-hdpi/pineapple2.png
Binary files differ
diff --git a/tests/StatusBar/res/layout/notification_builder_test.xml b/tests/StatusBar/res/layout/notification_builder_test.xml
index 3c37a73..e1199c7 100644
--- a/tests/StatusBar/res/layout/notification_builder_test.xml
+++ b/tests/StatusBar/res/layout/notification_builder_test.xml
@@ -1,224 +1,220 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
+<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:orientation="horizontal"
- android:paddingLeft="40dp"
- android:paddingTop="12dp"
- android:paddingRight="24dp"
- android:paddingBottom="12dp"
+ xmlns:android="http://schemas.android.com/apk/res/android"
>
-
<LinearLayout
- android:layout_width="220sp"
+ android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_marginRight="24dp"
- android:orientation="vertical"
+ android:orientation="horizontal"
>
+
<LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
+ android:layout_width="120dp"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <Button
+ style="@style/IdButton.Minus"
+ android:id="@+id/clear_1"
+ />
+ <TextView
+ style="@style/IdTitle"
+ android:text="1"
+ />
+ <Button
+ style="@style/IdButton.Plus"
+ android:id="@+id/notify_1"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <Button
+ style="@style/IdButton.Minus"
+ android:id="@+id/clear_2"
+ />
+ <TextView
+ style="@style/IdTitle"
+ android:text="2"
+ />
+ <Button
+ style="@style/IdButton.Plus"
+ android:id="@+id/notify_2"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <Button
+ style="@style/IdButton.Minus"
+ android:id="@+id/clear_3"
+ />
+ <TextView
+ style="@style/IdTitle"
+ android:text="3"
+ />
+ <Button
+ style="@style/IdButton.Plus"
+ android:id="@+id/notify_3"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <Button
+ style="@style/IdButton.Minus"
+ android:id="@+id/clear_4"
+ />
+ <TextView
+ style="@style/IdTitle"
+ android:text="4"
+ />
+ <Button
+ style="@style/IdButton.Plus"
+ android:id="@+id/notify_4"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <Button
+ style="@style/IdButton.Minus"
+ android:id="@+id/clear_5"
+ />
+ <TextView
+ style="@style/IdTitle"
+ android:text="5"
+ />
+ <Button
+ style="@style/IdButton.Plus"
+ android:id="@+id/notify_5"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <Button
+ style="@style/IdButton.Minus"
+ android:id="@+id/clear_6"
+ />
+ <TextView
+ style="@style/IdTitle"
+ android:text="6"
+ />
+ <Button
+ style="@style/IdButton.Plus"
+ android:id="@+id/notify_6"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <Button
+ style="@style/IdButton.Minus"
+ android:id="@+id/clear_7"
+ />
+ <TextView
+ style="@style/IdTitle"
+ android:text="7"
+ />
+ <Button
+ style="@style/IdButton.Plus"
+ android:id="@+id/notify_7"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <Button
+ style="@style/IdButton.Minus"
+ android:id="@+id/clear_8"
+ />
+ <TextView
+ style="@style/IdTitle"
+ android:text="8"
+ />
+ <Button
+ style="@style/IdButton.Plus"
+ android:id="@+id/notify_8"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <Button
+ style="@style/IdButton.Minus"
+ android:id="@+id/clear_9"
+ />
+ <TextView
+ style="@style/IdTitle"
+ android:text="9"
+ />
+ <Button
+ style="@style/IdButton.Plus"
+ android:id="@+id/notify_9"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <Button
+ style="@style/IdButton.Minus"
+ android:id="@+id/clear_10"
+ />
+ <TextView
+ style="@style/IdTitle"
+ android:text="10"
+ />
+ <Button
+ style="@style/IdButton.Plus"
+ android:id="@+id/notify_10"
+ />
+ </LinearLayout>
+
<Button
- style="@style/IdButton.Minus"
- android:id="@+id/clear_1"
- />
- <TextView
- style="@style/IdTitle"
- android:text="1"
+ android:id="@+id/clear_all"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="12dp"
+ android:layout_marginBottom="12dp"
+ android:text="Clear All"
/>
<Button
- style="@style/IdButton.Plus"
- android:id="@+id/notify_1"
+ android:id="@+id/ten"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="Ten notifications"
/>
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
- <Button
- style="@style/IdButton.Minus"
- android:id="@+id/clear_2"
- />
- <TextView
- style="@style/IdTitle"
- android:text="2"
- />
- <Button
- style="@style/IdButton.Plus"
- android:id="@+id/notify_2"
- />
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
- <Button
- style="@style/IdButton.Minus"
- android:id="@+id/clear_3"
- />
- <TextView
- style="@style/IdTitle"
- android:text="3"
- />
- <Button
- style="@style/IdButton.Plus"
- android:id="@+id/notify_3"
- />
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
- <Button
- style="@style/IdButton.Minus"
- android:id="@+id/clear_4"
- />
- <TextView
- style="@style/IdTitle"
- android:text="4"
- />
- <Button
- style="@style/IdButton.Plus"
- android:id="@+id/notify_4"
- />
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
- <Button
- style="@style/IdButton.Minus"
- android:id="@+id/clear_5"
- />
- <TextView
- style="@style/IdTitle"
- android:text="5"
- />
- <Button
- style="@style/IdButton.Plus"
- android:id="@+id/notify_5"
- />
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
- <Button
- style="@style/IdButton.Minus"
- android:id="@+id/clear_6"
- />
- <TextView
- style="@style/IdTitle"
- android:text="6"
- />
- <Button
- style="@style/IdButton.Plus"
- android:id="@+id/notify_6"
- />
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
- <Button
- style="@style/IdButton.Minus"
- android:id="@+id/clear_7"
- />
- <TextView
- style="@style/IdTitle"
- android:text="7"
- />
- <Button
- style="@style/IdButton.Plus"
- android:id="@+id/notify_7"
- />
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
- <Button
- style="@style/IdButton.Minus"
- android:id="@+id/clear_8"
- />
- <TextView
- style="@style/IdTitle"
- android:text="8"
- />
- <Button
- style="@style/IdButton.Plus"
- android:id="@+id/notify_8"
- />
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
- <Button
- style="@style/IdButton.Minus"
- android:id="@+id/clear_9"
- />
- <TextView
- style="@style/IdTitle"
- android:text="9"
- />
- <Button
- style="@style/IdButton.Plus"
- android:id="@+id/notify_9"
- />
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
- <Button
- style="@style/IdButton.Minus"
- android:id="@+id/clear_10"
- />
- <TextView
- style="@style/IdTitle"
- android:text="10"
- />
- <Button
- style="@style/IdButton.Plus"
- android:id="@+id/notify_10"
- />
+
</LinearLayout>
- <Button
- android:id="@+id/clear_all"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="12dp"
- android:layout_marginBottom="12dp"
- android:text="Clear All"
- />
- <Button
- android:id="@+id/ten"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="Ten notifications"
- />
-
- </LinearLayout>
-
- <ScrollView
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_weight="1"
- >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -818,7 +814,6 @@
</LinearLayout>
- </ScrollView>
+ </LinearLayout>
-
-</LinearLayout>
+</ScrollView>
diff --git a/tests/StatusBar/res/values-sw600dp/styles.xml b/tests/StatusBar/res/values-sw600dp/styles.xml
new file mode 100644
index 0000000..f29847c
--- /dev/null
+++ b/tests/StatusBar/res/values-sw600dp/styles.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <style name="IdTitle">
+ <item name="android:textAppearance">?android:attr/textAppearanceLarge</item>
+ <item name="android:layout_width">30sp</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:gravity">center</item>
+ <item name="android:textStyle">bold</item>
+ </style>
+
+ <style name="IdButton">
+ <item name="android:textAppearance">?android:attr/textAppearanceLarge</item>
+ <item name="android:layout_width">0dp</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:layout_weight">1</item>
+ <item name="android:layout_marginRight">8dp</item>
+ <item name="android:layout_marginLeft">8dp</item>
+ <item name="android:textStyle">bold</item>
+ </style>
+
+ <style name="IdButton.Minus">
+ <item name="android:text">-</item>
+ </style>
+
+ <style name="IdButton.Plus">
+ <item name="android:text">+</item>
+ </style>
+
+ <style name="FieldTitle">
+ <item name="android:textAppearance">?android:attr/textAppearanceLarge</item>
+ <item name="android:layout_width">208sp</item>
+ <item name="android:layout_height">wrap_content</item>
+ </style>
+
+ <style name="FieldContents">
+ <item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
+ <item name="android:layout_width">wrap_content</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:layout_marginRight">20dp</item>
+ </style>
+
+ <style name="FieldContents.Disabled">
+ <item name="android:clickable">false</item>
+ <item name="android:visibility">gone</item>
+ </style>
+
+</resources>
+
+
diff --git a/tests/StatusBar/res/values/styles.xml b/tests/StatusBar/res/values/styles.xml
index e051efd..103a25a 100644
--- a/tests/StatusBar/res/values/styles.xml
+++ b/tests/StatusBar/res/values/styles.xml
@@ -16,21 +16,23 @@
<resources>
<style name="IdTitle">
- <item name="android:textAppearance">?android:attr/textAppearanceLarge</item>
- <item name="android:layout_width">30sp</item>
+ <item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
+ <item name="android:layout_width">20sp</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:gravity">center</item>
<item name="android:textStyle">bold</item>
</style>
<style name="IdButton">
- <item name="android:textAppearance">?android:attr/textAppearanceLarge</item>
- <item name="android:layout_width">0dp</item>
+ <item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
+ <item name="android:layout_width">10dp</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_weight">1</item>
- <item name="android:layout_marginRight">8dp</item>
- <item name="android:layout_marginLeft">8dp</item>
<item name="android:textStyle">bold</item>
+ <item name="android:layout_marginLeft">1dp</item>
+ <item name="android:layout_marginRight">1dp</item>
+ <item name="android:paddingLeft">6dp</item>
+ <item name="android:paddingRight">6dp</item>
</style>
<style name="IdButton.Minus">
@@ -42,16 +44,16 @@
</style>
<style name="FieldTitle">
- <item name="android:textAppearance">?android:attr/textAppearanceLarge</item>
- <item name="android:layout_width">208sp</item>
+ <item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
+ <item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="FieldContents">
- <item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
+ <item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
- <item name="android:layout_marginRight">20dp</item>
+ <item name="android:layout_marginRight">4dp</item>
</style>
<style name="FieldContents.Disabled">
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index 4f5349a..2a033d1 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -1028,9 +1028,6 @@
boolean wifiTethered = false;
boolean wifiAvailable = false;
- IBinder b = ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE);
- INetworkManagementService service = INetworkManagementService.Stub.asInterface(b);
-
if (mCm == null) {
mCm = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
}
@@ -1043,14 +1040,14 @@
InterfaceConfiguration ifcg = null;
try {
- ifcg = service.getInterfaceConfig(intf);
+ ifcg = nwService.getInterfaceConfig(intf);
if (ifcg != null) {
/* IP/netmask: 192.168.43.1/255.255.255.0 */
ifcg.addr = new LinkAddress(NetworkUtils.numericToInetAddress(
"192.168.43.1"), 24);
ifcg.interfaceFlags = "[up]";
- service.setInterfaceConfig(intf, ifcg);
+ nwService.setInterfaceConfig(intf, ifcg);
}
} catch (Exception e) {
Log.e(TAG, "Error configuring interface " + intf + ", :" + e);
@@ -1438,7 +1435,6 @@
/* BSSID is valid only in ASSOCIATING state */
mWifiInfo.setBSSID(stateChangeResult.BSSID);
}
- setNetworkDetailedState(WifiInfo.getDetailedStateOf(state));
mSupplicantStateTracker.sendMessage(Message.obtain(message));
mWpsStateMachine.sendMessage(Message.obtain(message));
@@ -1451,7 +1447,7 @@
* using the interface, stopping DHCP & disabling interface
*/
private void handleNetworkDisconnect() {
- Log.d(TAG, "Reset connections and stopping DHCP");
+ Log.d(TAG, "Stopping DHCP and clearing IP");
/*
* stop DHCP
@@ -1462,6 +1458,12 @@
mDhcpStateMachine = null;
}
+ try {
+ nwService.clearInterfaceAddresses(mInterfaceName);
+ } catch (Exception e) {
+ Log.e(TAG, "Failed to clear IP addresses on disconnect" + e);
+ }
+
/* Reset data structures */
mWifiInfo.setInetAddress(null);
mWifiInfo.setBSSID(null);
@@ -2657,13 +2659,11 @@
} else {
DhcpInfoInternal dhcpInfoInternal = WifiConfigStore.getIpConfiguration(
mLastNetworkId);
- IBinder b = ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE);
- INetworkManagementService netd = INetworkManagementService.Stub.asInterface(b);
InterfaceConfiguration ifcg = new InterfaceConfiguration();
ifcg.addr = dhcpInfoInternal.makeLinkAddress();
ifcg.interfaceFlags = "[up]";
try {
- netd.setInterfaceConfig(mInterfaceName, ifcg);
+ nwService.setInterfaceConfig(mInterfaceName, ifcg);
Log.v(TAG, "Static IP configuration succeeded");
sendMessage(CMD_STATIC_IP_SUCCESS, dhcpInfoInternal);
} catch (RemoteException re) {
@@ -2975,7 +2975,12 @@
/* Ignore network disconnect */
case NETWORK_DISCONNECTION_EVENT:
break;
- case CMD_START_SCAN:
+ case SUPPLICANT_STATE_CHANGE_EVENT:
+ StateChangeResult stateChangeResult = (StateChangeResult) message.obj;
+ setNetworkDetailedState(WifiInfo.getDetailedStateOf(stateChangeResult.state));
+ /* ConnectModeState does the rest of the handling */
+ return NOT_HANDLED;
+ case CMD_START_SCAN:
/* Disable background scan temporarily during a regular scan */
if (mEnableBackgroundScan) {
WifiNative.enableBackgroundScanCommand(false);