diff options
Diffstat (limited to 'core')
31 files changed, 264 insertions, 105 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index ef9f6d4..5f65f08 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -4530,6 +4530,14 @@ public final class ActivityThread { IContentProvider provider = pr.mProvider; IBinder jBinder = provider.asBinder(); + if (!jBinder.isBinderAlive()) { + // The hosting process of the provider has died; we can't + // use this one. + Log.i(TAG, "Acquiring provider " + auth + " for user " + userId + + ": existing object's process dead"); + handleUnstableProviderDiedLocked(jBinder, true); + return null; + } // Only increment the ref count if we have one. If we don't then the // provider is not reference counted and never needs to be released. @@ -4670,33 +4678,37 @@ public final class ActivityThread { } final void handleUnstableProviderDied(IBinder provider, boolean fromClient) { - synchronized(mProviderMap) { - ProviderRefCount prc = mProviderRefCountMap.get(provider); - if (prc != null) { - if (DEBUG_PROVIDER) Slog.v(TAG, "Cleaning up dead provider " - + provider + " " + prc.holder.info.name); - mProviderRefCountMap.remove(provider); - if (prc.client != null && prc.client.mNames != null) { - for (String name : prc.client.mNames) { - ProviderClientRecord pr = mProviderMap.get(name); - if (pr != null && pr.mProvider.asBinder() == provider) { - Slog.i(TAG, "Removing dead content provider: " + name); - mProviderMap.remove(name); - } + synchronized (mProviderMap) { + handleUnstableProviderDiedLocked(provider, fromClient); + } + } + + final void handleUnstableProviderDiedLocked(IBinder provider, boolean fromClient) { + ProviderRefCount prc = mProviderRefCountMap.get(provider); + if (prc != null) { + if (DEBUG_PROVIDER) Slog.v(TAG, "Cleaning up dead provider " + + provider + " " + prc.holder.info.name); + mProviderRefCountMap.remove(provider); + if (prc.client != null && prc.client.mNames != null) { + for (String name : prc.client.mNames) { + ProviderClientRecord pr = mProviderMap.get(name); + if (pr != null && pr.mProvider.asBinder() == provider) { + Slog.i(TAG, "Removing dead content provider: " + name); + mProviderMap.remove(name); } } - if (fromClient) { - // We found out about this due to execution in our client - // code. Tell the activity manager about it now, to ensure - // that the next time we go to do anything with the provider - // it knows it is dead (so we don't race with its death - // notification). - try { - ActivityManagerNative.getDefault().unstableProviderDied( - prc.holder.connection); - } catch (RemoteException e) { - //do nothing content provider object is dead any way - } + } + if (fromClient) { + // We found out about this due to execution in our client + // code. Tell the activity manager about it now, to ensure + // that the next time we go to do anything with the provider + // it knows it is dead (so we don't race with its death + // notification). + try { + ActivityManagerNative.getDefault().unstableProviderDied( + prc.holder.connection); + } catch (RemoteException e) { + //do nothing content provider object is dead any way } } } diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java index 4ab8272..9e406d4 100644 --- a/core/java/android/content/ContentResolver.java +++ b/core/java/android/content/ContentResolver.java @@ -1219,7 +1219,7 @@ public abstract class ContentResolver { public final void registerContentObserver(Uri uri, boolean notifyForDescendents, ContentObserver observer) { - registerContentObserver(uri, notifyForDescendents, observer, UserHandle.getCallingUserId()); + registerContentObserver(uri, notifyForDescendents, observer, UserHandle.myUserId()); } /** @hide - designated user version */ diff --git a/core/java/android/database/AbstractCursor.java b/core/java/android/database/AbstractCursor.java index e7ff92d..300b4d1 100644 --- a/core/java/android/database/AbstractCursor.java +++ b/core/java/android/database/AbstractCursor.java @@ -19,6 +19,7 @@ package android.database; import android.content.ContentResolver; import android.net.Uri; import android.os.Bundle; +import android.os.UserHandle; import android.util.Log; import java.lang.ref.WeakReference; @@ -350,6 +351,11 @@ public abstract class AbstractCursor implements CrossProcessCursor { * specific row URI, or a base URI for a whole class of content. */ public void setNotificationUri(ContentResolver cr, Uri notifyUri) { + setNotificationUri(cr, notifyUri, UserHandle.myUserId()); + } + + /** @hide - set the notification uri but with an observer for a particular user's view */ + public void setNotificationUri(ContentResolver cr, Uri notifyUri, int userHandle) { synchronized (mSelfObserverLock) { mNotifyUri = notifyUri; mContentResolver = cr; @@ -357,7 +363,7 @@ public abstract class AbstractCursor implements CrossProcessCursor { mContentResolver.unregisterContentObserver(mSelfObserver); } mSelfObserver = new SelfContentObserver(this); - mContentResolver.registerContentObserver(mNotifyUri, true, mSelfObserver); + mContentResolver.registerContentObserver(mNotifyUri, true, mSelfObserver, userHandle); mSelfObserverRegistered = true; } } diff --git a/core/java/android/nfc/INfcAdapterExtras.aidl b/core/java/android/nfc/INfcAdapterExtras.aidl index 2b9d4f0..41ebf63 100644 --- a/core/java/android/nfc/INfcAdapterExtras.aidl +++ b/core/java/android/nfc/INfcAdapterExtras.aidl @@ -29,4 +29,5 @@ interface INfcAdapterExtras { int getCardEmulationRoute(in String pkg); void setCardEmulationRoute(in String pkg, int route); void authenticate(in String pkg, in byte[] token); + String getDriverName(in String pkg); } diff --git a/core/java/android/os/BatteryManager.java b/core/java/android/os/BatteryManager.java index 7b16f4d..2e38960 100644 --- a/core/java/android/os/BatteryManager.java +++ b/core/java/android/os/BatteryManager.java @@ -117,4 +117,8 @@ public class BatteryManager { public static final int BATTERY_PLUGGED_USB = 2; /** Power source is wireless. */ public static final int BATTERY_PLUGGED_WIRELESS = 4; + + /** @hide */ + public static final int BATTERY_PLUGGED_ANY = + BATTERY_PLUGGED_AC | BATTERY_PLUGGED_USB | BATTERY_PLUGGED_WIRELESS; } diff --git a/core/java/android/os/IPowerManager.aidl b/core/java/android/os/IPowerManager.aidl index 557d3f3..6d6d147 100644 --- a/core/java/android/os/IPowerManager.aidl +++ b/core/java/android/os/IPowerManager.aidl @@ -37,7 +37,8 @@ interface IPowerManager void nap(long time); boolean isScreenOn(); - void reboot(String reason); + void reboot(boolean confirm, String reason, boolean wait); + void shutdown(boolean confirm, boolean wait); void crash(String message); void setStayOnSetting(int val); diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java index ae50ddb..fb02c0a 100644 --- a/core/java/android/os/PowerManager.java +++ b/core/java/android/os/PowerManager.java @@ -596,7 +596,7 @@ public final class PowerManager { */ public void reboot(String reason) { try { - mService.reboot(reason); + mService.reboot(false, reason, true); } catch (RemoteException e) { } } diff --git a/core/java/android/preference/PreferenceActivity.java b/core/java/android/preference/PreferenceActivity.java index 9bfa8c0..09ff7be 100644 --- a/core/java/android/preference/PreferenceActivity.java +++ b/core/java/android/preference/PreferenceActivity.java @@ -1083,6 +1083,12 @@ public abstract class PreferenceActivity extends ListActivity implements } return; } + if (mSinglePane) { + mFragmentBreadCrumbs.setVisibility(View.GONE); + // Hide the breadcrumb section completely for single-pane + View bcSection = findViewById(com.android.internal.R.id.breadcrumb_section); + if (bcSection != null) bcSection.setVisibility(View.GONE); + } mFragmentBreadCrumbs.setMaxVisible(2); mFragmentBreadCrumbs.setActivity(this); } diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 2a8cf21..3bbdf36 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -911,17 +911,20 @@ public final class Settings { } private static final HashSet<String> MOVED_TO_GLOBAL; + private static final HashSet<String> MOVED_TO_SECURE_THEN_GLOBAL; static { MOVED_TO_GLOBAL = new HashSet<String>(); + MOVED_TO_SECURE_THEN_GLOBAL = new HashSet<String>(); + // these were originally in system but migrated to secure in the past, // so are duplicated in the Secure.* namespace - MOVED_TO_GLOBAL.add(Global.ADB_ENABLED); - MOVED_TO_GLOBAL.add(Global.BLUETOOTH_ON); - MOVED_TO_GLOBAL.add(Global.DATA_ROAMING); - MOVED_TO_GLOBAL.add(Global.DEVICE_PROVISIONED); - MOVED_TO_GLOBAL.add(Global.INSTALL_NON_MARKET_APPS); - MOVED_TO_GLOBAL.add(Global.USB_MASS_STORAGE_ENABLED); - MOVED_TO_GLOBAL.add(Global.HTTP_PROXY); + MOVED_TO_SECURE_THEN_GLOBAL.add(Global.ADB_ENABLED); + MOVED_TO_SECURE_THEN_GLOBAL.add(Global.BLUETOOTH_ON); + MOVED_TO_SECURE_THEN_GLOBAL.add(Global.DATA_ROAMING); + MOVED_TO_SECURE_THEN_GLOBAL.add(Global.DEVICE_PROVISIONED); + MOVED_TO_SECURE_THEN_GLOBAL.add(Global.INSTALL_NON_MARKET_APPS); + MOVED_TO_SECURE_THEN_GLOBAL.add(Global.USB_MASS_STORAGE_ENABLED); + MOVED_TO_SECURE_THEN_GLOBAL.add(Global.HTTP_PROXY); // these are moving directly from system to global MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_ON); @@ -954,6 +957,17 @@ public final class Settings { MOVED_TO_GLOBAL.add(Settings.Global.ALWAYS_FINISH_ACTIVITIES); } + /** @hide */ + public static void getMovedKeys(HashSet<String> outKeySet) { + outKeySet.addAll(MOVED_TO_GLOBAL); + outKeySet.addAll(MOVED_TO_SECURE_THEN_GLOBAL); + } + + /** @hide */ + public static void getNonLegacyMovedKeys(HashSet<String> outKeySet) { + outKeySet.addAll(MOVED_TO_GLOBAL); + } + /** * Look up a name in the database. * @param resolver to access the database with @@ -972,7 +986,7 @@ public final class Settings { + " to android.provider.Settings.Secure, returning read-only value."); return Secure.getStringForUser(resolver, name, userHandle); } - if (MOVED_TO_GLOBAL.contains(name)) { + if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) { Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" + " to android.provider.Settings.Global, returning read-only value."); return Global.getStringForUser(resolver, name, userHandle); @@ -999,7 +1013,7 @@ public final class Settings { + " to android.provider.Settings.Secure, value is unchanged."); return false; } - if (MOVED_TO_GLOBAL.contains(name)) { + if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) { Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" + " to android.provider.Settings.Global, value is unchanged."); return false; @@ -1019,7 +1033,7 @@ public final class Settings { + " to android.provider.Settings.Secure, returning Secure URI."); return Secure.getUriFor(Secure.CONTENT_URI, name); } - if (MOVED_TO_GLOBAL.contains(name)) { + if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) { Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System" + " to android.provider.Settings.Global, returning read-only global URI."); return Global.getUriFor(Global.CONTENT_URI, name); @@ -2257,7 +2271,7 @@ public final class Settings { * @hide */ public static final String[] SETTINGS_TO_BACKUP = { - STAY_ON_WHILE_PLUGGED_IN, + STAY_ON_WHILE_PLUGGED_IN, // moved to global WIFI_USE_STATIC_IP, WIFI_STATIC_IP, WIFI_STATIC_GATEWAY, @@ -2272,7 +2286,7 @@ public final class Settings { SCREEN_BRIGHTNESS_MODE, SCREEN_AUTO_BRIGHTNESS_ADJ, VIBRATE_INPUT_DEVICES, - MODE_RINGER, + MODE_RINGER, // moved to global MODE_RINGER_STREAMS_AFFECTED, MUTE_STREAMS_AFFECTED, VOLUME_VOICE, @@ -2293,20 +2307,18 @@ public final class Settings { TEXT_AUTO_CAPS, TEXT_AUTO_PUNCTUATE, TEXT_SHOW_PASSWORD, - AUTO_TIME, - AUTO_TIME_ZONE, + AUTO_TIME, // moved to global + AUTO_TIME_ZONE, // moved to global TIME_12_24, DATE_FORMAT, DTMF_TONE_WHEN_DIALING, DTMF_TONE_TYPE_WHEN_DIALING, - Global.EMERGENCY_TONE, - Global.CALL_AUTO_RETRY, HEARING_AID, TTY_MODE, SOUND_EFFECTS_ENABLED, HAPTIC_FEEDBACK_ENABLED, - POWER_SOUNDS_ENABLED, - DOCK_SOUNDS_ENABLED, + POWER_SOUNDS_ENABLED, // moved to global + DOCK_SOUNDS_ENABLED, // moved to global LOCKSCREEN_SOUNDS_ENABLED, SHOW_WEB_SUGGESTIONS, NOTIFICATION_LIGHT_PULSE, @@ -2702,6 +2714,11 @@ public final class Settings { MOVED_TO_GLOBAL.add(Settings.Global.PREFERRED_CDMA_SUBSCRIPTION); } + /** @hide */ + public static void getMovedKeys(HashSet<String> outKeySet) { + outKeySet.addAll(MOVED_TO_GLOBAL); + } + /** * Look up a name in the database. * @param resolver to access the database with @@ -3993,12 +4010,11 @@ public final class Settings { * @hide */ public static final String[] SETTINGS_TO_BACKUP = { - ADB_ENABLED, BUGREPORT_IN_POWER_MENU, ALLOW_MOCK_LOCATION, PARENTAL_CONTROL_ENABLED, PARENTAL_CONTROL_REDIRECT_URL, - USB_MASS_STORAGE_ENABLED, + USB_MASS_STORAGE_ENABLED, // moved to global ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE, ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE, @@ -4017,9 +4033,9 @@ public final class Settings { TTS_DEFAULT_COUNTRY, TTS_ENABLED_PLUGINS, TTS_DEFAULT_LOCALE, - WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, - WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, - WIFI_NUM_OPEN_NETWORKS_KEPT, + WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, // moved to global + WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, // moved to global + WIFI_NUM_OPEN_NETWORKS_KEPT, // moved to global MOUNT_PLAY_NOTIFICATION_SND, MOUNT_UMS_AUTOSTART, MOUNT_UMS_PROMPT, @@ -5251,6 +5267,38 @@ public final class Settings { public static final String ALWAYS_FINISH_ACTIVITIES = "always_finish_activities"; + /** + * Settings to backup. This is here so that it's in the same place as the settings + * keys and easy to update. + * + * These keys may be mentioned in the SETTINGS_TO_BACKUP arrays in System + * and Secure as well. This is because those tables drive both backup and + * restore, and restore needs to properly whitelist keys that used to live + * in those namespaces. The keys will only actually be backed up / restored + * if they are also mentioned in this table (Global.SETTINGS_TO_BACKUP). + * + * NOTE: Settings are backed up and restored in the order they appear + * in this array. If you have one setting depending on another, + * make sure that they are ordered appropriately. + * + * @hide + */ + public static final String[] SETTINGS_TO_BACKUP = { + STAY_ON_WHILE_PLUGGED_IN, + MODE_RINGER, + AUTO_TIME, + AUTO_TIME_ZONE, + POWER_SOUNDS_ENABLED, + DOCK_SOUNDS_ENABLED, + USB_MASS_STORAGE_ENABLED, + ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED, + WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, + WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, + WIFI_NUM_OPEN_NETWORKS_KEPT, + EMERGENCY_TONE, + CALL_AUTO_RETRY, + }; + // Populated lazily, guarded by class object: private static NameValueCache sNameValueCache = new NameValueCache( SYS_PROP_SETTING_VERSION, diff --git a/core/java/android/text/Layout.java b/core/java/android/text/Layout.java index d2bed48..123acca 100644 --- a/core/java/android/text/Layout.java +++ b/core/java/android/text/Layout.java @@ -475,10 +475,14 @@ public abstract class Layout { Alignment align = getParagraphAlignment(line); int dir = getParagraphDirection(line); - int x; if (align == Alignment.ALIGN_LEFT) { - x = left; - } else if (align == Alignment.ALIGN_NORMAL) { + align = (dir == DIR_LEFT_TO_RIGHT) ? Alignment.ALIGN_NORMAL : Alignment.ALIGN_OPPOSITE; + } else if (align == Alignment.ALIGN_RIGHT) { + align = (dir == DIR_LEFT_TO_RIGHT) ? Alignment.ALIGN_OPPOSITE : Alignment.ALIGN_NORMAL; + } + + int x; + if (align == Alignment.ALIGN_NORMAL) { if (dir == DIR_LEFT_TO_RIGHT) { x = left; } else { @@ -498,12 +502,11 @@ public abstract class Layout { } } int max = (int)getLineExtent(line, tabStops, false); - if (align == Alignment.ALIGN_RIGHT) { - x = right - max; - } else if (align == Alignment.ALIGN_OPPOSITE) { + if (align == Alignment.ALIGN_OPPOSITE) { if (dir == DIR_LEFT_TO_RIGHT) { x = right - max; } else { + // max is negative here x = left - max; } } else { // Alignment.ALIGN_CENTER diff --git a/core/java/android/view/GLES20RecordingCanvas.java b/core/java/android/view/GLES20RecordingCanvas.java index ba8be6c..d2df45a 100644 --- a/core/java/android/view/GLES20RecordingCanvas.java +++ b/core/java/android/view/GLES20RecordingCanvas.java @@ -236,18 +236,6 @@ class GLES20RecordingCanvas extends GLES20Canvas implements Poolable<GLES20Recor } @Override - public void drawRect(Rect r, Paint paint) { - super.drawRect(r, paint); - recordShaderBitmap(paint); - } - - @Override - public void drawRect(RectF r, Paint paint) { - super.drawRect(r, paint); - recordShaderBitmap(paint); - } - - @Override public void drawRoundRect(RectF rect, float rx, float ry, Paint paint) { super.drawRoundRect(rect, rx, ry, paint); recordShaderBitmap(paint); diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java index 99987bf..37e0a36 100644 --- a/core/java/android/view/HardwareRenderer.java +++ b/core/java/android/view/HardwareRenderer.java @@ -507,17 +507,22 @@ public abstract class HardwareRenderer { * @param width The width of the drawing surface. * @param height The height of the drawing surface. * @param surface The surface to hardware accelerate + * + * @return true if the surface was initialized, false otherwise. Returning + * false might mean that the surface was already initialized. */ - void initializeIfNeeded(int width, int height, Surface surface) + boolean initializeIfNeeded(int width, int height, Surface surface) throws Surface.OutOfResourcesException { if (isRequested()) { // We lost the gl context, so recreate it. if (!isEnabled()) { if (initialize(surface)) { setup(width, height); + return true; } } - } + } + return false; } /** diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 2d083b6..ae51c1d 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -2904,6 +2904,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ int mOldHeightMeasureSpec = Integer.MIN_VALUE; + @ViewDebug.ExportedProperty(deepExport = true, prefix = "bg_") private Drawable mBackground; private int mBackgroundResource; diff --git a/core/java/android/view/ViewDebug.java b/core/java/android/view/ViewDebug.java index c013d85..023e58f 100644 --- a/core/java/android/view/ViewDebug.java +++ b/core/java/android/view/ViewDebug.java @@ -923,8 +923,12 @@ public class ViewDebug { private static void dumpViewProperties(Context context, Object view, BufferedWriter out, String prefix) throws IOException { - Class<?> klass = view.getClass(); + if (view == null) { + out.write(prefix + "=4,null "); + return; + } + Class<?> klass = view.getClass(); do { exportFields(context, view, out, klass, prefix); exportMethods(context, view, out, klass, prefix); @@ -1064,8 +1068,8 @@ public class ViewDebug { return; } else if (!type.isPrimitive()) { if (property.deepExport()) { - dumpViewProperties(context, field.get(view), out, prefix - + property.prefix()); + dumpViewProperties(context, field.get(view), out, prefix + + property.prefix()); continue; } } diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 438f792..be2d5b3 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -52,7 +52,6 @@ import android.os.RemoteException; import android.os.SystemClock; import android.os.SystemProperties; import android.os.Trace; -import android.os.UserHandle; import android.util.AndroidRuntimeException; import android.util.DisplayMetrics; import android.util.Log; @@ -2817,10 +2816,10 @@ public final class ViewRootImpl implements ViewParent, case MSG_RESIZED: { // Recycled in the fall through... SomeArgs args = (SomeArgs) msg.obj; - if (mWinFrame.equals((Rect) args.arg1) - && mPendingContentInsets.equals((Rect) args.arg2) - && mPendingVisibleInsets.equals((Rect) args.arg3) - && ((Configuration) args.arg4 == null)) { + if (mWinFrame.equals(args.arg1) + && mPendingContentInsets.equals(args.arg2) + && mPendingVisibleInsets.equals(args.arg3) + && args.arg4 == null) { break; } } // fall through... @@ -2882,8 +2881,10 @@ public final class ViewRootImpl implements ViewParent, mSurface != null && mSurface.isValid()) { mFullRedrawNeeded = true; try { - mAttachInfo.mHardwareRenderer.initializeIfNeeded(mWidth, mHeight, - mHolder.getSurface()); + if (mAttachInfo.mHardwareRenderer.initializeIfNeeded( + mWidth, mHeight, mHolder.getSurface())) { + mFullRedrawNeeded = true; + } } catch (Surface.OutOfResourcesException e) { Log.e(TAG, "OutOfResourcesException locking surface", e); try { diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java index c67cae6..19b825c 100644 --- a/core/java/android/widget/Editor.java +++ b/core/java/android/widget/Editor.java @@ -122,6 +122,7 @@ public class Editor { InputMethodState mInputMethodState; DisplayList[] mTextDisplayLists; + int mLastLayoutHeight; boolean mFrozenWithFocus; boolean mSelectionMoved; @@ -1258,6 +1259,16 @@ public class Editor { mTextDisplayLists = new DisplayList[ArrayUtils.idealObjectArraySize(0)]; } + // If the height of the layout changes (usually when inserting or deleting a line, + // but could be changes within a span), invalidate everything. We could optimize + // more aggressively (for example, adding offsets to blocks) but it would be more + // complex and we would only get the benefit in some cases. + int layoutHeight = layout.getHeight(); + if (mLastLayoutHeight != layoutHeight) { + invalidateTextDisplayList(); + mLastLayoutHeight = layoutHeight; + } + DynamicLayout dynamicLayout = (DynamicLayout) layout; int[] blockEndLines = dynamicLayout.getBlockEndLines(); int[] blockIndices = dynamicLayout.getBlockIndices(); diff --git a/core/java/android/widget/Spinner.java b/core/java/android/widget/Spinner.java index 317baf1..925864c 100644 --- a/core/java/android/widget/Spinner.java +++ b/core/java/android/widget/Spinner.java @@ -30,8 +30,11 @@ import android.util.Log; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; +import android.view.ViewTreeObserver; +import android.view.ViewTreeObserver.OnGlobalLayoutListener; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; +import android.widget.PopupWindow.OnDismissListener; /** @@ -978,6 +981,30 @@ public class Spinner extends AbsSpinner implements OnClickListener { super.show(); getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE); setSelection(Spinner.this.getSelectedItemPosition()); + + // Make sure we hide if our anchor goes away. + // TODO: This might be appropriate to push all the way down to PopupWindow, + // but it may have other side effects to investigate first. (Text editing handles, etc.) + final ViewTreeObserver vto = getViewTreeObserver(); + if (vto != null) { + final OnGlobalLayoutListener layoutListener = new OnGlobalLayoutListener() { + @Override + public void onGlobalLayout() { + if (!Spinner.this.isVisibleToUser()) { + dismiss(); + } + } + }; + vto.addOnGlobalLayoutListener(layoutListener); + setOnDismissListener(new OnDismissListener() { + @Override public void onDismiss() { + final ViewTreeObserver vto = getViewTreeObserver(); + if (vto != null) { + vto.removeOnGlobalLayoutListener(layoutListener); + } + } + }); + } } } } diff --git a/core/java/com/android/internal/widget/LockPatternView.java b/core/java/com/android/internal/widget/LockPatternView.java index 0d9cf9a..6c5ed7e 100644 --- a/core/java/com/android/internal/widget/LockPatternView.java +++ b/core/java/com/android/internal/widget/LockPatternView.java @@ -375,31 +375,31 @@ public class LockPatternView extends View { } private void notifyCellAdded() { + sendAccessEvent(R.string.lockscreen_access_pattern_cell_added); if (mOnPatternListener != null) { mOnPatternListener.onPatternCellAdded(mPattern); } - sendAccessEvent(R.string.lockscreen_access_pattern_cell_added); } private void notifyPatternStarted() { + sendAccessEvent(R.string.lockscreen_access_pattern_start); if (mOnPatternListener != null) { mOnPatternListener.onPatternStart(); } - sendAccessEvent(R.string.lockscreen_access_pattern_start); } private void notifyPatternDetected() { + sendAccessEvent(R.string.lockscreen_access_pattern_detected); if (mOnPatternListener != null) { mOnPatternListener.onPatternDetected(mPattern); } - sendAccessEvent(R.string.lockscreen_access_pattern_detected); } private void notifyPatternCleared() { + sendAccessEvent(R.string.lockscreen_access_pattern_cleared); if (mOnPatternListener != null) { mOnPatternListener.onPatternCleared(); } - sendAccessEvent(R.string.lockscreen_access_pattern_cleared); } /** @@ -799,9 +799,7 @@ public class LockPatternView extends View { } private void sendAccessEvent(int resId) { - setContentDescription(mContext.getString(resId)); - sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED); - setContentDescription(null); + announceForAccessibility(mContext.getString(resId)); } private void handleActionUp(MotionEvent event) { diff --git a/core/jni/android/graphics/Canvas.cpp b/core/jni/android/graphics/Canvas.cpp index 2a02f7c..5d6f738 100644 --- a/core/jni/android/graphics/Canvas.cpp +++ b/core/jni/android/graphics/Canvas.cpp @@ -20,6 +20,7 @@ #include "SkCanvas.h" #include "SkDevice.h" +#include "SkDrawFilter.h" #include "SkGraphics.h" #include "SkImageRef_GlobalPool.h" #include "SkPorterDuff.h" @@ -784,7 +785,15 @@ public: #define kStdUnderline_Thickness (1.0f / 18.0f) static void doDrawTextDecorations(SkCanvas* canvas, jfloat x, jfloat y, jfloat length, SkPaint* paint) { - uint32_t flags = paint->getFlags(); + uint32_t flags; + SkDrawFilter* drawFilter = canvas->getDrawFilter(); + if (drawFilter) { + SkPaint paintCopy(*paint); + drawFilter->filter(&paintCopy, SkDrawFilter::kText_Type); + flags = paintCopy.getFlags(); + } else { + flags = paint->getFlags(); + } if (flags & (SkPaint::kUnderlineText_Flag | SkPaint::kStrikeThruText_Flag)) { SkScalar left = SkFloatToScalar(x); SkScalar right = SkFloatToScalar(x + length); diff --git a/core/res/res/drawable-nodpi/kg_widget_overscroll_layer_left.9.png b/core/res/res/drawable-nodpi/kg_widget_overscroll_layer_left.9.png Binary files differdeleted file mode 100644 index c30eb1c..0000000 --- a/core/res/res/drawable-nodpi/kg_widget_overscroll_layer_left.9.png +++ /dev/null diff --git a/core/res/res/drawable-nodpi/kg_widget_overscroll_layer_right.9.png b/core/res/res/drawable-nodpi/kg_widget_overscroll_layer_right.9.png Binary files differdeleted file mode 100644 index e5d5771..0000000 --- a/core/res/res/drawable-nodpi/kg_widget_overscroll_layer_right.9.png +++ /dev/null diff --git a/core/res/res/layout-land/keyguard_host_view.xml b/core/res/res/layout-land/keyguard_host_view.xml index ac943cb..10034de 100644 --- a/core/res/res/layout-land/keyguard_host_view.xml +++ b/core/res/res/layout-land/keyguard_host_view.xml @@ -29,6 +29,7 @@ <include layout="@layout/keyguard_widget_region" android:layout_width="0dp" + android:layout_height="match_parent" android:layout_weight=".45" /> <com.android.internal.policy.impl.keyguard.KeyguardSecurityViewFlipper diff --git a/core/res/res/layout-xlarge/breadcrumbs_in_fragment.xml b/core/res/res/layout-xlarge/breadcrumbs_in_fragment.xml index 0fb3443..8e86427 100644 --- a/core/res/res/layout-xlarge/breadcrumbs_in_fragment.xml +++ b/core/res/res/layout-xlarge/breadcrumbs_in_fragment.xml @@ -15,6 +15,7 @@ --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+android:id/breadcrumb_section" android:orientation="vertical" android:layout_height="wrap_content" android:layout_width="match_parent" diff --git a/core/res/res/layout/action_bar_title_item.xml b/core/res/res/layout/action_bar_title_item.xml index 3ac0e21..df773eb 100644 --- a/core/res/res/layout/action_bar_title_item.xml +++ b/core/res/res/layout/action_bar_title_item.xml @@ -42,7 +42,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/action_bar_subtitle_top_margin" - android:layout_marginBottom="@dimen/action_bar_subtitle_bottom_margin" android:singleLine="true" android:ellipsize="end" android:visibility="gone" /> diff --git a/core/res/res/layout/keyguard_multi_user_avatar.xml b/core/res/res/layout/keyguard_multi_user_avatar.xml index df3ee00..d6a858f 100644 --- a/core/res/res/layout/keyguard_multi_user_avatar.xml +++ b/core/res/res/layout/keyguard_multi_user_avatar.xml @@ -22,6 +22,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="125dp" android:layout_height="125dp" + android:background="#000000" android:gravity="center_horizontal"> <ImageView android:id="@+id/keyguard_user_avatar" @@ -29,12 +30,23 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center"/> - <TextView - android:id="@+id/keyguard_user_name" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="bottom|right" - android:textSize="12sp" - android:background="#99FFFFFF" - android:textColor="#ff000000"/> -</com.android.internal.policy.impl.keyguard.KeyguardMultiUserAvatar> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + <Space + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="0.78" /> + <TextView + android:id="@+id/keyguard_user_name" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="0.22" + android:paddingLeft="6dp" + android:layout_gravity="center_vertical|left" + android:textSize="16sp" + android:textColor="#ffffff" + android:background="#808080" /> + </LinearLayout> +</com.android.internal.policy.impl.keyguard.KeyguardMultiUserAvatar>
\ No newline at end of file diff --git a/core/res/res/layout/keyguard_multi_user_selector_widget.xml b/core/res/res/layout/keyguard_multi_user_selector_widget.xml index c00089c..ad9fdfe 100644 --- a/core/res/res/layout/keyguard_multi_user_selector_widget.xml +++ b/core/res/res/layout/keyguard_multi_user_selector_widget.xml @@ -20,6 +20,7 @@ <!-- This is a view that shows general status information in Keyguard. --> <com.android.internal.policy.impl.keyguard.KeyguardWidgetFrame xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/keyguard_multi_user_selector" android:layout_width="match_parent" android:layout_height="match_parent"> diff --git a/core/res/res/layout/keyguard_widget_region.xml b/core/res/res/layout/keyguard_widget_region.xml index 7bf06ed..01b5551 100644 --- a/core/res/res/layout/keyguard_widget_region.xml +++ b/core/res/res/layout/keyguard_widget_region.xml @@ -38,7 +38,8 @@ android:layout_height="10dp" android:orientation="horizontal" android:paddingLeft="@dimen/kg_widget_pager_horizontal_padding" - android:paddingRight="@dimen/kg_widget_pager_horizontal_padding"> + android:paddingRight="@dimen/kg_widget_pager_horizontal_padding" + android:layout_marginTop="@dimen/kg_runway_lights_top_margin"> <com.android.internal.policy.impl.keyguard.KeyguardGlowStripView android:id="@+id/left_strip" android:paddingTop="@dimen/kg_runway_lights_vertical_padding" diff --git a/core/res/res/values-sw600dp/dimens.xml b/core/res/res/values-sw600dp/dimens.xml index 4e202ac..0c36d4a 100644 --- a/core/res/res/values-sw600dp/dimens.xml +++ b/core/res/res/values-sw600dp/dimens.xml @@ -77,5 +77,13 @@ <!-- Preference fragment padding, sides --> <dimen name="preference_fragment_padding_side">24dp</dimen> <dimen name="preference_screen_header_padding_side">24dip</dimen> + + <!-- Keyguard dimensions --> + <!-- Bottom padding for the widget pager --> + <dimen name="kg_widget_pager_bottom_padding">16dp</dimen> + + <!-- Top margin for the runway lights. We add a negative margin in large + devices to account for the widget pager padding --> + <dimen name="kg_runway_lights_top_margin">-10dp</dimen> </resources> diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml index 07d0d74..6a93f30 100644 --- a/core/res/res/values/colors.xml +++ b/core/res/res/values/colors.xml @@ -115,6 +115,11 @@ <color name="lockscreen_clock_am_pm">#ffffffff</color> <color name="lockscreen_owner_info">#ff9a9a9a</color> + <!-- keyguard overscroll widget pager --> + <color name="kg_multi_user_text_active">#ffffffff</color> + <color name="kg_multi_user_text_inactive">#ff808080</color> + <color name="kg_widget_pager_gradient">#ff33B5E5</color> + <!-- FaceLock --> <color name="facelock_spotlight_mask">#CC000000</color> diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index 289adf4..10f0d39 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -286,7 +286,7 @@ <dimen name="kg_runway_lights_height">7dp</dimen> <!-- The height of the runway lights strip --> - <dimen name="kg_runway_lights_vertical_padding">3dp</dimen> + <dimen name="kg_runway_lights_vertical_padding">2dp</dimen> <!-- Horizontal padding for the widget pager --> <dimen name="kg_widget_pager_horizontal_padding">16dp</dimen> @@ -297,6 +297,10 @@ <!-- Bottom padding for the widget pager --> <dimen name="kg_widget_pager_bottom_padding">6dp</dimen> + <!-- Top margin for the runway lights. We add a negative margin in large + devices to account for the widget pager padding --> + <dimen name="kg_runway_lights_top_margin">0dp</dimen> + <!-- Touch slop for the global toggle accessibility gesture --> <dimen name="accessibility_touch_slop">80dip</dimen> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 8ac0ad5..281d92a 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -217,6 +217,7 @@ <java-symbol type="id" name="sms_short_code_detail_message" /> <java-symbol type="id" name="sms_short_code_remember_choice_checkbox" /> <java-symbol type="id" name="sms_short_code_remember_undo_instruction" /> + <java-symbol type="id" name="breadcrumb_section" /> <java-symbol type="attr" name="actionModeShareDrawable" /> <java-symbol type="attr" name="alertDialogCenterButtons" /> @@ -1188,6 +1189,9 @@ <java-symbol type="bool" name="config_reverseDefaultRotation" /> <java-symbol type="bool" name="config_showNavigationBar" /> <java-symbol type="bool" name="target_honeycomb_needs_options_menu" /> + <java-symbol type="color" name="kg_multi_user_text_active" /> + <java-symbol type="color" name="kg_multi_user_text_inactive" /> + <java-symbol type="color" name="kg_widget_pager_gradient" /> <java-symbol type="dimen" name="navigation_bar_height" /> <java-symbol type="dimen" name="navigation_bar_height_landscape" /> <java-symbol type="dimen" name="navigation_bar_width" /> @@ -1213,8 +1217,6 @@ <java-symbol type="drawable" name="magnified_region_frame" /> <java-symbol type="drawable" name="menu_background" /> <java-symbol type="drawable" name="stat_sys_secure" /> - <java-symbol type="drawable" name="kg_widget_overscroll_layer_left" /> - <java-symbol type="drawable" name="kg_widget_overscroll_layer_right" /> <java-symbol type="id" name="action_mode_bar_stub" /> <java-symbol type="id" name="alarm_status" /> <java-symbol type="id" name="backspace" /> @@ -1298,6 +1300,7 @@ <java-symbol type="id" name="kg_widget_region" /> <java-symbol type="id" name="left_strip" /> <java-symbol type="id" name="right_strip" /> + <java-symbol type="id" name="keyguard_multi_user_selector" /> <java-symbol type="integer" name="config_carDockRotation" /> <java-symbol type="integer" name="config_defaultUiModeType" /> @@ -1408,7 +1411,6 @@ <java-symbol type="string" name="kg_password_wrong_pin_code" /> <java-symbol type="string" name="kg_invalid_sim_pin_hint" /> <java-symbol type="string" name="kg_invalid_sim_puk_hint" /> - <java-symbol type="string" name="kg_sim_puk_recovery_hint" /> <java-symbol type="string" name="kg_invalid_puk" /> <java-symbol type="string" name="kg_login_too_many_attempts" /> <java-symbol type="string" name="kg_login_instructions" /> |
