diff options
137 files changed, 1861 insertions, 1265 deletions
diff --git a/api/current.txt b/api/current.txt index 54061570b6d3..5205856fbc13 100644 --- a/api/current.txt +++ b/api/current.txt @@ -331,6 +331,7 @@ package android { field public static final int checkboxStyle = 16842860; // 0x101006c field public static final int checked = 16843014; // 0x1010106 field public static final int checkedButton = 16843080; // 0x1010148 + field public static final int checkedTextViewStyle = 16843720; // 0x10103c8 field public static final int childDivider = 16843025; // 0x1010111 field public static final int childIndicator = 16843020; // 0x101010c field public static final int childIndicatorLeft = 16843023; // 0x101010f @@ -1789,6 +1790,7 @@ package android { field public static final int Widget_DeviceDefault_Button_Small = 16974146; // 0x1030142 field public static final int Widget_DeviceDefault_Button_Toggle = 16974148; // 0x1030144 field public static final int Widget_DeviceDefault_CalendarView = 16974190; // 0x103016e + field public static final int Widget_DeviceDefault_CheckedTextView = 16974299; // 0x10301db field public static final int Widget_DeviceDefault_CompoundButton_CheckBox = 16974152; // 0x1030148 field public static final int Widget_DeviceDefault_CompoundButton_RadioButton = 16974169; // 0x1030159 field public static final int Widget_DeviceDefault_CompoundButton_Star = 16974173; // 0x103015d @@ -1822,6 +1824,7 @@ package android { field public static final int Widget_DeviceDefault_Light_Button_Small = 16974198; // 0x1030176 field public static final int Widget_DeviceDefault_Light_Button_Toggle = 16974200; // 0x1030178 field public static final int Widget_DeviceDefault_Light_CalendarView = 16974238; // 0x103019e + field public static final int Widget_DeviceDefault_Light_CheckedTextView = 16974300; // 0x10301dc field public static final int Widget_DeviceDefault_Light_CompoundButton_CheckBox = 16974204; // 0x103017c field public static final int Widget_DeviceDefault_Light_CompoundButton_RadioButton = 16974224; // 0x1030190 field public static final int Widget_DeviceDefault_Light_CompoundButton_Star = 16974228; // 0x1030194 @@ -1907,6 +1910,7 @@ package android { field public static final int Widget_Holo_Button_Small = 16973964; // 0x103008c field public static final int Widget_Holo_Button_Toggle = 16973966; // 0x103008e field public static final int Widget_Holo_CalendarView = 16974060; // 0x10300ec + field public static final int Widget_Holo_CheckedTextView = 16974297; // 0x10301d9 field public static final int Widget_Holo_CompoundButton_CheckBox = 16973969; // 0x1030091 field public static final int Widget_Holo_CompoundButton_RadioButton = 16973986; // 0x10300a2 field public static final int Widget_Holo_CompoundButton_Star = 16973990; // 0x10300a6 @@ -1940,6 +1944,7 @@ package android { field public static final int Widget_Holo_Light_Button_Small = 16974007; // 0x10300b7 field public static final int Widget_Holo_Light_Button_Toggle = 16974009; // 0x10300b9 field public static final int Widget_Holo_Light_CalendarView = 16974061; // 0x10300ed + field public static final int Widget_Holo_Light_CheckedTextView = 16974298; // 0x10301da field public static final int Widget_Holo_Light_CompoundButton_CheckBox = 16974012; // 0x10300bc field public static final int Widget_Holo_Light_CompoundButton_RadioButton = 16974032; // 0x10300d0 field public static final int Widget_Holo_Light_CompoundButton_Star = 16974036; // 0x10300d4 diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c index 396771fd6027..a27622580f0c 100644 --- a/cmds/installd/commands.c +++ b/cmds/installd/commands.c @@ -271,11 +271,11 @@ int clone_persona_data(uid_t src_persona, uid_t target_persona, int copy) return 0; } -int delete_cache(const char *pkgname) +int delete_cache(const char *pkgname, uid_t persona) { char cachedir[PKG_PATH_MAX]; - if (create_pkg_path(cachedir, pkgname, CACHE_DIR_POSTFIX, 0)) + if (create_pkg_path(cachedir, pkgname, CACHE_DIR_POSTFIX, persona)) return -1; /* delete contents, not the directory, no exceptions */ diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c index a099537da030..19298a34d408 100644 --- a/cmds/installd/installd.c +++ b/cmds/installd/installd.c @@ -72,7 +72,7 @@ static int do_free_cache(char **arg, char reply[REPLY_MAX]) /* TODO int:free_siz static int do_rm_cache(char **arg, char reply[REPLY_MAX]) { - return delete_cache(arg[0]); /* pkgname */ + return delete_cache(arg[0], atoi(arg[1])); /* pkgname, userid */ } static int do_get_size(char **arg, char reply[REPLY_MAX]) @@ -142,7 +142,7 @@ struct cmdinfo cmds[] = { { "rename", 2, do_rename }, { "fixuid", 3, do_fixuid }, { "freecache", 1, do_free_cache }, - { "rmcache", 1, do_rm_cache }, + { "rmcache", 2, do_rm_cache }, { "getsize", 5, do_get_size }, { "rmuserdata", 2, do_rm_user_data }, { "movefiles", 0, do_movefiles }, diff --git a/cmds/installd/installd.h b/cmds/installd/installd.h index a229b9703c35..2540dbe18c2f 100644 --- a/cmds/installd/installd.h +++ b/cmds/installd/installd.h @@ -199,7 +199,7 @@ int delete_user_data(const char *pkgname, uid_t persona); int make_user_data(const char *pkgname, uid_t uid, uid_t persona); int delete_persona(uid_t persona); int clone_persona_data(uid_t src_persona, uid_t target_persona, int copy); -int delete_cache(const char *pkgname); +int delete_cache(const char *pkgname, uid_t persona); int move_dex(const char *src, const char *dst); int rm_dex(const char *path); int protect(char *pkgname, gid_t gid); diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 02942b73b1aa..ef9f6d4289a6 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -3873,14 +3873,20 @@ public final class ActivityThread { final void applyNonDefaultDisplayMetricsToConfigurationLocked( DisplayMetrics dm, Configuration config) { - config.screenLayout = Configuration.SCREENLAYOUT_SIZE_XLARGE - | Configuration.SCREENLAYOUT_LONG_NO; config.touchscreen = Configuration.TOUCHSCREEN_NOTOUCH; - config.orientation = (dm.widthPixels >= dm.heightPixels) ? - Configuration.ORIENTATION_LANDSCAPE : Configuration.ORIENTATION_PORTRAIT; config.densityDpi = dm.densityDpi; config.screenWidthDp = (int)(dm.widthPixels / dm.density); config.screenHeightDp = (int)(dm.heightPixels / dm.density); + int sl = Configuration.resetScreenLayout(config.screenLayout); + if (dm.widthPixels > dm.heightPixels) { + config.orientation = Configuration.ORIENTATION_LANDSCAPE; + config.screenLayout = Configuration.reduceScreenLayout(sl, + config.screenWidthDp, config.screenHeightDp); + } else { + config.orientation = Configuration.ORIENTATION_PORTRAIT; + config.screenLayout = Configuration.reduceScreenLayout(sl, + config.screenHeightDp, config.screenWidthDp); + } config.smallestScreenWidthDp = config.screenWidthDp; // assume screen does not rotate config.compatScreenWidthDp = config.screenWidthDp; config.compatScreenHeightDp = config.screenHeightDp; diff --git a/core/java/android/app/MediaRouteButton.java b/core/java/android/app/MediaRouteButton.java index a9ccef002863..3ecafc3bc9b9 100644 --- a/core/java/android/app/MediaRouteButton.java +++ b/core/java/android/app/MediaRouteButton.java @@ -50,6 +50,7 @@ public class MediaRouteButton extends View { private boolean mRemoteActive; private boolean mToggleMode; private boolean mCheatSheetEnabled; + private boolean mIsConnecting; private int mMinWidth; private int mMinHeight; @@ -57,6 +58,10 @@ public class MediaRouteButton extends View { private OnClickListener mExtendedSettingsClickListener; private MediaRouteChooserDialogFragment mDialogFragment; + private static final int[] CHECKED_STATE_SET = { + R.attr.state_checked + }; + private static final int[] ACTIVATED_STATE_SET = { R.attr.state_activated }; @@ -210,10 +215,21 @@ public class MediaRouteButton extends View { } void updateRemoteIndicator() { - final boolean isRemote = - mRouter.getSelectedRoute(mRouteTypes) != mRouter.getSystemAudioRoute(); + final RouteInfo selected = mRouter.getSelectedRoute(mRouteTypes); + final boolean isRemote = selected != mRouter.getSystemAudioRoute(); + final boolean isConnecting = selected.getStatusCode() == RouteInfo.STATUS_CONNECTING; + + boolean needsRefresh = false; if (mRemoteActive != isRemote) { mRemoteActive = isRemote; + needsRefresh = true; + } + if (mIsConnecting != isConnecting) { + mIsConnecting = isConnecting; + needsRefresh = true; + } + + if (needsRefresh) { refreshDrawableState(); } } @@ -248,7 +264,14 @@ public class MediaRouteButton extends View { @Override protected int[] onCreateDrawableState(int extraSpace) { final int[] drawableState = super.onCreateDrawableState(extraSpace + 1); - if (mRemoteActive) { + + // Technically we should be handling this more completely, but these + // are implementation details here. Checked is used to express the connecting + // drawable state and it's mutually exclusive with activated for the purposes + // of state selection here. + if (mIsConnecting) { + mergeDrawableStates(drawableState, CHECKED_STATE_SET); + } else if (mRemoteActive) { mergeDrawableStates(drawableState, ACTIVATED_STATE_SET); } return drawableState; @@ -426,6 +449,11 @@ public class MediaRouteButton extends View { } @Override + public void onRouteChanged(MediaRouter router, RouteInfo info) { + updateRemoteIndicator(); + } + + @Override public void onRouteAdded(MediaRouter router, RouteInfo info) { updateRouteCount(); } diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java index 9d5746734b85..d36d99deeb44 100644 --- a/core/java/android/app/PendingIntent.java +++ b/core/java/android/app/PendingIntent.java @@ -395,6 +395,31 @@ public final class PendingIntent implements Parcelable { } /** + * @hide + * Note that UserHandle.CURRENT will be interpreted at the time the + * activity is started, not when the pending intent is created. + */ + public static PendingIntent getActivitiesAsUser(Context context, int requestCode, + Intent[] intents, int flags, Bundle options, UserHandle user) { + String packageName = context.getPackageName(); + String[] resolvedTypes = new String[intents.length]; + for (int i=0; i<intents.length; i++) { + intents[i].setAllowFds(false); + resolvedTypes[i] = intents[i].resolveTypeIfNeeded(context.getContentResolver()); + } + try { + IIntentSender target = + ActivityManagerNative.getDefault().getIntentSender( + ActivityManager.INTENT_SENDER_ACTIVITY, packageName, + null, null, requestCode, intents, resolvedTypes, + flags, options, user.getIdentifier()); + return target != null ? new PendingIntent(target) : null; + } catch (RemoteException e) { + } + return null; + } + + /** * Retrieve a PendingIntent that will perform a broadcast, like calling * {@link Context#sendBroadcast(Intent) Context.sendBroadcast()}. * diff --git a/core/java/android/app/TaskStackBuilder.java b/core/java/android/app/TaskStackBuilder.java index 9d5bcc6b7ac7..3e0ac7ec4767 100644 --- a/core/java/android/app/TaskStackBuilder.java +++ b/core/java/android/app/TaskStackBuilder.java @@ -274,6 +274,20 @@ public class TaskStackBuilder { } /** + * @hide + */ + public PendingIntent getPendingIntent(int requestCode, int flags, Bundle options, + UserHandle user) { + if (mIntents.isEmpty()) { + throw new IllegalStateException( + "No intents added to TaskStackBuilder; cannot getPendingIntent"); + } + + return PendingIntent.getActivitiesAsUser(mSourceContext, requestCode, getIntents(), flags, + options, user); + } + + /** * Return an array containing the intents added to this builder. The intent at the * root of the task stack will appear as the first item in the array and the * intent at the top of the stack will appear as the last item. diff --git a/core/java/android/content/res/Configuration.java b/core/java/android/content/res/Configuration.java index 51b8d259b41e..86d6ee77ae7e 100644 --- a/core/java/android/content/res/Configuration.java +++ b/core/java/android/content/res/Configuration.java @@ -172,7 +172,77 @@ public final class Configuration implements Parcelable, Comparable<Configuration * Multiple Screens</a> for more information. */ public int screenLayout; - + + /** @hide */ + static public int resetScreenLayout(int curLayout) { + return (curLayout&~(SCREENLAYOUT_LONG_MASK | SCREENLAYOUT_SIZE_MASK + | SCREENLAYOUT_COMPAT_NEEDED)) + | (SCREENLAYOUT_LONG_YES | SCREENLAYOUT_SIZE_XLARGE); + } + + /** @hide */ + static public int reduceScreenLayout(int curLayout, int longSizeDp, int shortSizeDp) { + int screenLayoutSize; + boolean screenLayoutLong; + boolean screenLayoutCompatNeeded; + + // These semi-magic numbers define our compatibility modes for + // applications with different screens. These are guarantees to + // app developers about the space they can expect for a particular + // configuration. DO NOT CHANGE! + if (longSizeDp < 470) { + // This is shorter than an HVGA normal density screen (which + // is 480 pixels on its long side). + screenLayoutSize = SCREENLAYOUT_SIZE_SMALL; + screenLayoutLong = false; + screenLayoutCompatNeeded = false; + } else { + // What size is this screen screen? + if (longSizeDp >= 960 && shortSizeDp >= 720) { + // 1.5xVGA or larger screens at medium density are the point + // at which we consider it to be an extra large screen. + screenLayoutSize = SCREENLAYOUT_SIZE_XLARGE; + } else if (longSizeDp >= 640 && shortSizeDp >= 480) { + // VGA or larger screens at medium density are the point + // at which we consider it to be a large screen. + screenLayoutSize = SCREENLAYOUT_SIZE_LARGE; + } else { + screenLayoutSize = SCREENLAYOUT_SIZE_NORMAL; + } + + // If this screen is wider than normal HVGA, or taller + // than FWVGA, then for old apps we want to run in size + // compatibility mode. + if (shortSizeDp > 321 || longSizeDp > 570) { + screenLayoutCompatNeeded = true; + } else { + screenLayoutCompatNeeded = false; + } + + // Is this a long screen? + if (((longSizeDp*3)/5) >= (shortSizeDp-1)) { + // Anything wider than WVGA (5:3) is considering to be long. + screenLayoutLong = true; + } else { + screenLayoutLong = false; + } + } + + // Now reduce the last screenLayout to not be better than what we + // have found. + if (!screenLayoutLong) { + curLayout = (curLayout&~SCREENLAYOUT_LONG_MASK) | SCREENLAYOUT_LONG_NO; + } + if (screenLayoutCompatNeeded) { + curLayout |= Configuration.SCREENLAYOUT_COMPAT_NEEDED; + } + int curSize = curLayout&SCREENLAYOUT_SIZE_MASK; + if (screenLayoutSize < curSize) { + curLayout = (curLayout&~SCREENLAYOUT_SIZE_MASK) | screenLayoutSize; + } + return curLayout; + } + /** * Check if the Configuration's current {@link #screenLayout} is at * least the given size. diff --git a/core/java/android/os/IPowerManager.aidl b/core/java/android/os/IPowerManager.aidl index 8bfefd40f6c9..557d3f306967 100644 --- a/core/java/android/os/IPowerManager.aidl +++ b/core/java/android/os/IPowerManager.aidl @@ -40,8 +40,6 @@ interface IPowerManager void reboot(String reason); void crash(String message); - void clearUserActivityTimeout(long now, long timeout); - void setPokeLock(int pokey, IBinder lock, String tag); void setStayOnSetting(int val); void setMaximumScreenOffTimeoutFromDeviceAdmin(int timeMs); diff --git a/core/java/android/os/LocalPowerManager.java b/core/java/android/os/LocalPowerManager.java deleted file mode 100644 index 519315cdb598..000000000000 --- a/core/java/android/os/LocalPowerManager.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007 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 android.os; - -/** @hide */ -public interface LocalPowerManager { - // FIXME: Replace poke locks with something else. - - public static final int POKE_LOCK_IGNORE_TOUCH_EVENTS = 0x1; - - public static final int POKE_LOCK_SHORT_TIMEOUT = 0x2; - public static final int POKE_LOCK_MEDIUM_TIMEOUT = 0x4; - public static final int POKE_LOCK_TIMEOUT_MASK = 0x6; -} diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java index 58372f4ebe70..ae50ddbc1447 100644 --- a/core/java/android/os/PowerManager.java +++ b/core/java/android/os/PowerManager.java @@ -340,6 +340,15 @@ public final class PowerManager { } /** + * Returns true if the twilight service should be used to adjust screen brightness + * policy. This setting is experimental and disabled by default. + * @hide + */ + public static boolean useTwilightAdjustmentFeature() { + return SystemProperties.getBoolean("persist.power.usetwilightadj", false); + } + + /** * Creates a new wake lock with the specified level and flags. * <p> * The {@code levelAndFlags} parameter specifies a wake lock level and optional flags diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 8825f58dab2e..8f1210b1d8c2 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -3078,30 +3078,6 @@ public final class Settings { public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON; /** - * Get the key that retrieves a bluetooth headset's priority. - * @hide - */ - public static final String getBluetoothHeadsetPriorityKey(String address) { - return ("bluetooth_headset_priority_" + address.toUpperCase()); - } - - /** - * Get the key that retrieves a bluetooth a2dp sink's priority. - * @hide - */ - public static final String getBluetoothA2dpSinkPriorityKey(String address) { - return ("bluetooth_a2dp_sink_priority_" + address.toUpperCase()); - } - - /** - * Get the key that retrieves a bluetooth Input Device's priority. - * @hide - */ - public static final String getBluetoothInputDevicePriorityKey(String address) { - return ("bluetooth_input_device_priority_" + address.toUpperCase()); - } - - /** * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead */ @Deprecated @@ -5160,6 +5136,40 @@ public final class Settings { */ public static final String DEFAULT_DNS_SERVER = "default_dns_server"; + /** {@hide} */ + public static final String + BLUETOOTH_HEADSET_PRIORITY_PREFIX = "bluetooth_headset_priority_"; + /** {@hide} */ + public static final String + BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX = "bluetooth_a2dp_sink_priority_"; + /** {@hide} */ + public static final String + BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX = "bluetooth_input_device_priority_"; + + /** + * Get the key that retrieves a bluetooth headset's priority. + * @hide + */ + public static final String getBluetoothHeadsetPriorityKey(String address) { + return BLUETOOTH_HEADSET_PRIORITY_PREFIX + address.toUpperCase(); + } + + /** + * Get the key that retrieves a bluetooth a2dp sink's priority. + * @hide + */ + public static final String getBluetoothA2dpSinkPriorityKey(String address) { + return BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX + address.toUpperCase(); + } + + /** + * Get the key that retrieves a bluetooth Input Device's priority. + * @hide + */ + public static final String getBluetoothInputDevicePriorityKey(String address) { + return BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX + address.toUpperCase(); + } + // Populated lazily, guarded by class object: private static NameValueCache sNameValueCache = new NameValueCache( SYS_PROP_SETTING_VERSION, diff --git a/core/java/android/service/dreams/DreamService.java b/core/java/android/service/dreams/DreamService.java index f97354fb81b0..03b685b595e2 100644 --- a/core/java/android/service/dreams/DreamService.java +++ b/core/java/android/service/dreams/DreamService.java @@ -47,24 +47,30 @@ import com.android.internal.policy.PolicyManager; * * <p>Dreams should be declared in the manifest as follows:</p> * <pre> - * {@code - * <service + * <service * android:name=".MyDream" * android:exported="true" * android:icon="@drawable/my_icon" * android:label="@string/my_dream_label" > * - * <intent-filter> - * <action android:name="android.intent.action.MAIN" /> - * <category android:name="android.intent.category.DREAM" /> - * </intent-filter> + * <intent-filter> + * <action android:name="android.service.dreams.DreamService" /> + * <category android:name="android.intent.category.DEFAULT" /> + * </intent-filter> * - * <!-- Point to additional information for this dream (optional) --> - * <meta-data + * <!-- Point to additional information for this dream (optional) --> + * <meta-data * android:name="android.service.dream" * android:resource="@xml/my_dream" /> - * </service> - * } + * </service> + * </pre> + * <p>If specified, additional information for the dream is defined using the + * <code><{@link android.R.styleable#Dream dream}></code> element. For example:</p> + * <pre> + * (in res/xml/my_dream.xml) + * + * <dream xmlns:android="http://schemas.android.com/apk/res/android" + * android:settingsActivity="com.example.app/.MyDreamSettingsActivity" /> * </pre> */ public class DreamService extends Service implements Window.Callback { diff --git a/core/java/android/view/DisplayList.java b/core/java/android/view/DisplayList.java index a42e15677c39..5e34a36bb52d 100644 --- a/core/java/android/view/DisplayList.java +++ b/core/java/android/view/DisplayList.java @@ -332,4 +332,11 @@ public abstract class DisplayList { * @see View#offsetTopAndBottom(int) */ public abstract void offsetTopBottom(int offset); + + /** + * Reset native resources. This is called when cleaning up the state of DisplayLists + * during destruction of hardware resources, to ensure that we do not hold onto + * obsolete resources after related resources are gone. + */ + public abstract void reset(); } diff --git a/core/java/android/view/GLES20DisplayList.java b/core/java/android/view/GLES20DisplayList.java index 3bdd5c054c3c..e9bd0c43976d 100644 --- a/core/java/android/view/GLES20DisplayList.java +++ b/core/java/android/view/GLES20DisplayList.java @@ -87,6 +87,13 @@ class GLES20DisplayList extends DisplayList { } @Override + public void reset() { + if (hasNativeDisplayList()) { + nReset(mFinalizer.mNativeDisplayList); + } + } + + @Override public boolean isValid() { return mValid; } @@ -294,6 +301,7 @@ class GLES20DisplayList extends DisplayList { } } + private static native void nReset(int displayList); private static native void nOffsetTopBottom(int displayList, int offset); private static native void nOffsetLeftRight(int displayList, int offset); private static native void nSetLeftTopRightBottom(int displayList, int left, int top, diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java index 28763b3c949d..99987bfd2793 100644 --- a/core/java/android/view/HardwareRenderer.java +++ b/core/java/android/view/HardwareRenderer.java @@ -1508,6 +1508,9 @@ public abstract class HardwareRenderer { @Override void destroyLayers(View view) { if (view != null && isEnabled() && checkCurrent() != SURFACE_STATE_ERROR) { + if (mCanvas != null) { + mCanvas.clearLayerUpdates(); + } destroyHardwareLayer(view); GLES20Canvas.flushCaches(GLES20Canvas.FLUSH_CACHES_LAYERS); } @@ -1556,6 +1559,9 @@ public abstract class HardwareRenderer { safelyRun(new Runnable() { @Override public void run() { + if (mCanvas != null) { + mCanvas.clearLayerUpdates(); + } destroyResources(view); GLES20Canvas.flushCaches(GLES20Canvas.FLUSH_CACHES_LAYERS); } diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 6eca8fd93ca7..63ec577120d0 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -2881,14 +2881,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * * @hide */ - int mUserPaddingLeftInitial = UNDEFINED_PADDING; + int mUserPaddingLeftInitial = 0; /** * Cache initial right padding. * * @hide */ - int mUserPaddingRightInitial = UNDEFINED_PADDING; + int mUserPaddingRightInitial = 0; /** * Default undefined padding @@ -3643,26 +3643,41 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mUserPaddingRightInitial = padding; } - // RTL compatibility mode: pre Jelly Bean MR1 case OR no RTL support case. - // left / right padding are used if defined (meaning here nothing to do). If they are not - // defined and start / end padding are defined (e.g. in Frameworks resources), then we use - // start / end and resolve them as left / right (layout direction is not taken into account). if (isRtlCompatibilityMode()) { + // RTL compatibility mode: pre Jelly Bean MR1 case OR no RTL support case. + // left / right padding are used if defined (meaning here nothing to do). If they are not + // defined and start / end padding are defined (e.g. in Frameworks resources), then we use + // start / end and resolve them as left / right (layout direction is not taken into account). + // Padding from the background drawable is stored at this point in mUserPaddingLeftInitial + // and mUserPaddingRightInitial) so drawable padding will be used as ultimate default if + // defined. if (!leftPaddingDefined && startPaddingDefined) { leftPadding = startPadding; } + mUserPaddingLeftInitial = (leftPadding >= 0) ? leftPadding : mUserPaddingLeftInitial; if (!rightPaddingDefined && endPaddingDefined) { rightPadding = endPadding; } + mUserPaddingRightInitial = (rightPadding >= 0) ? rightPadding : mUserPaddingRightInitial; + } else { + // Jelly Bean MR1 and after case: if start/end defined, they will override any left/right + // values defined. Otherwise, left /right values are used. + // Padding from the background drawable is stored at this point in mUserPaddingLeftInitial + // and mUserPaddingRightInitial) so drawable padding will be used as ultimate default if + // defined. + if (startPaddingDefined) { + mUserPaddingLeftInitial = startPadding; + } else if (leftPaddingDefined) { + mUserPaddingLeftInitial = leftPadding; + } + if (endPaddingDefined) { + mUserPaddingRightInitial = endPadding; + } + else if (rightPaddingDefined) { + mUserPaddingRightInitial = rightPadding; + } } - // If the user specified the padding (either with android:padding or - // android:paddingLeft/Top/Right/Bottom), use this padding, otherwise - // use the default padding or the padding from the background drawable - // (stored at this point in mPadding*). Padding resolution will happen later if - // RTL is supported. - mUserPaddingLeftInitial = leftPadding >= 0 ? leftPadding : mPaddingLeft; - mUserPaddingRightInitial = rightPadding >= 0 ? rightPadding : mPaddingRight; internalSetPadding( mUserPaddingLeftInitial, topPadding >= 0 ? topPadding : mPaddingTop, @@ -11745,10 +11760,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, // If start / end padding are not defined, use the left / right ones. int resolvedLayoutDirection = getLayoutDirection(); // Set user padding to initial values ... - mUserPaddingLeft = (mUserPaddingLeftInitial == UNDEFINED_PADDING) ? - 0 : mUserPaddingLeftInitial; - mUserPaddingRight = (mUserPaddingRightInitial == UNDEFINED_PADDING) ? - 0 : mUserPaddingRightInitial; + mUserPaddingLeft = mUserPaddingLeftInitial; + mUserPaddingRight = mUserPaddingRightInitial; // ... then resolve it. switch (resolvedLayoutDirection) { case LAYOUT_DIRECTION_RTL: @@ -12394,6 +12407,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mHardwareLayer.destroy(); mHardwareLayer = null; + if (mDisplayList != null) { + mDisplayList.reset(); + } invalidate(true); invalidateParentCaches(); } @@ -14779,8 +14795,18 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @hide */ public void resetPaddingToInitialValues() { - mPaddingLeft = mUserPaddingLeftInitial; - mPaddingRight = mUserPaddingRightInitial; + if (isRtlCompatibilityMode()) { + mPaddingLeft = mUserPaddingLeftInitial; + mPaddingRight = mUserPaddingRightInitial; + } else { + if (isLayoutRtl()) { + mPaddingLeft = mUserPaddingRightInitial; + mPaddingRight = mUserPaddingLeftInitial; + } else { + mPaddingLeft = mUserPaddingLeftInitial; + mPaddingRight = mUserPaddingRightInitial; + } + } } /** @@ -17208,7 +17234,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @return the measure specification based on size and mode */ public static int makeMeasureSpec(int size, int mode) { - return (size & ~MODE_MASK) | (mode & MODE_MASK); + return size + mode; } /** diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index fa2d4e8ee7bf..6e5127043337 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -1176,14 +1176,42 @@ public interface WindowManager extends ViewManager { public static final int INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002; /** + * When this window has focus, does not call user activity for all input events so + * the application will have to do it itself. Should only be used by + * the keyguard and phone app. + * <p> + * Should only be used by the keyguard and phone app. + * </p> + * + * @hide + */ + public static final int INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004; + + /** * Control special features of the input subsystem. * * @see #INPUT_FEATURE_DISABLE_TOUCH_PAD_GESTURES * @see #INPUT_FEATURE_NO_INPUT_CHANNEL + * @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY * @hide */ public int inputFeatures; + /** + * Sets the number of milliseconds before the user activity timeout occurs + * when this window has focus. A value of -1 uses the standard timeout. + * A value of 0 uses the minimum support display timeout. + * <p> + * This property can only be used to reduce the user specified display timeout; + * it can never make the timeout longer than it normally would be. + * </p><p> + * Should only be used by the keyguard and phone app. + * </p> + * + * @hide + */ + public long userActivityTimeout = -1; + public LayoutParams() { super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); type = TYPE_APPLICATION; @@ -1268,6 +1296,7 @@ public interface WindowManager extends ViewManager { out.writeInt(subtreeSystemUiVisibility); out.writeInt(hasSystemUiListeners ? 1 : 0); out.writeInt(inputFeatures); + out.writeLong(userActivityTimeout); } public static final Parcelable.Creator<LayoutParams> CREATOR @@ -1308,6 +1337,7 @@ public interface WindowManager extends ViewManager { subtreeSystemUiVisibility = in.readInt(); hasSystemUiListeners = in.readInt() != 0; inputFeatures = in.readInt(); + userActivityTimeout = in.readLong(); } @SuppressWarnings({"PointlessBitwiseExpression"}) @@ -1334,6 +1364,8 @@ public interface WindowManager extends ViewManager { /** {@hide} */ public static final int PRIVATE_FLAGS_CHANGED = 1<<16; /** {@hide} */ + public static final int USER_ACTIVITY_TIMEOUT_CHANGED = 1<<17; + /** {@hide} */ public static final int EVERYTHING_CHANGED = 0xffffffff; // internal buffer to backup/restore parameters under compatibility mode. @@ -1455,6 +1487,11 @@ public interface WindowManager extends ViewManager { changes |= INPUT_FEATURES_CHANGED; } + if (userActivityTimeout != o.userActivityTimeout) { + userActivityTimeout = o.userActivityTimeout; + changes |= USER_ACTIVITY_TIMEOUT_CHANGED; + } + return changes; } @@ -1547,6 +1584,9 @@ public interface WindowManager extends ViewManager { if (inputFeatures != 0) { sb.append(" if=0x").append(Integer.toHexString(inputFeatures)); } + if (userActivityTimeout >= 0) { + sb.append(" userActivityTimeout=").append(userActivityTimeout); + } sb.append('}'); return sb.toString(); } diff --git a/core/java/android/widget/CheckedTextView.java b/core/java/android/widget/CheckedTextView.java index d6fd4ff26190..e74e37c280b2 100644 --- a/core/java/android/widget/CheckedTextView.java +++ b/core/java/android/widget/CheckedTextView.java @@ -55,7 +55,7 @@ public class CheckedTextView extends TextView implements Checkable { } public CheckedTextView(Context context, AttributeSet attrs) { - this(context, attrs, 0); + this(context, attrs, R.attr.checkedTextViewStyle); } public CheckedTextView(Context context, AttributeSet attrs, int defStyle) { diff --git a/core/java/android/widget/ImageView.java b/core/java/android/widget/ImageView.java index 1d465cef320b..87396fbc13d0 100644 --- a/core/java/android/widget/ImageView.java +++ b/core/java/android/widget/ImageView.java @@ -789,12 +789,6 @@ public class ImageView extends View { if (resizeWidth) { int newWidth = (int)(desiredAspect * (heightSize - ptop - pbottom)) + pleft + pright; - - // Allow the width to outgrow its original estimate if height is fixed. - if (!resizeHeight) { - widthSize = resolveAdjustedSize(newWidth, mMaxWidth, widthMeasureSpec); - } - if (newWidth <= widthSize) { widthSize = newWidth; done = true; @@ -805,13 +799,6 @@ public class ImageView extends View { if (!done && resizeHeight) { int newHeight = (int)((widthSize - pleft - pright) / desiredAspect) + ptop + pbottom; - - // Allow the height to outgrow its original estimate if width is fixed. - if (!resizeWidth) { - heightSize = resolveAdjustedSize(newHeight, mMaxHeight, - heightMeasureSpec); - } - if (newHeight <= heightSize) { heightSize = newHeight; } diff --git a/core/java/com/android/internal/statusbar/IStatusBarService.aidl b/core/java/com/android/internal/statusbar/IStatusBarService.aidl index 600c27aa390e..04e5bc97d39c 100644 --- a/core/java/com/android/internal/statusbar/IStatusBarService.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBarService.aidl @@ -33,6 +33,7 @@ interface IStatusBarService void topAppWindowChanged(boolean menuVisible); void setImeWindowStatus(in IBinder token, int vis, int backDisposition); void expandSettingsPanel(); + void setCurrentUser(int newUserId); // ---- Methods below are for use by the status bar policy services ---- // You need the STATUS_BAR_SERVICE permission diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java index 471575085e9a..991c69922eb8 100644 --- a/core/java/com/android/internal/widget/ActionBarView.java +++ b/core/java/com/android/internal/widget/ActionBarView.java @@ -556,12 +556,16 @@ public class ActionBarView extends AbsActionBarView { // Make sure the home button has an accurate content description for accessibility. if (!enable) { mHomeLayout.setContentDescription(null); - } else if ((mDisplayOptions & ActionBar.DISPLAY_HOME_AS_UP) != 0) { - mHomeLayout.setContentDescription(mContext.getResources().getText( - R.string.action_bar_up_description)); + mHomeLayout.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO); } else { - mHomeLayout.setContentDescription(mContext.getResources().getText( - R.string.action_bar_home_description)); + mHomeLayout.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_AUTO); + if ((mDisplayOptions & ActionBar.DISPLAY_HOME_AS_UP) != 0) { + mHomeLayout.setContentDescription(mContext.getResources().getText( + R.string.action_bar_up_description)); + } else { + mHomeLayout.setContentDescription(mContext.getResources().getText( + R.string.action_bar_home_description)); + } } } @@ -624,12 +628,16 @@ public class ActionBarView extends AbsActionBarView { // Make sure the home button has an accurate content description for accessibility. if (!mHomeLayout.isEnabled()) { mHomeLayout.setContentDescription(null); - } else if ((options & ActionBar.DISPLAY_HOME_AS_UP) != 0) { - mHomeLayout.setContentDescription(mContext.getResources().getText( - R.string.action_bar_up_description)); + mHomeLayout.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO); } else { - mHomeLayout.setContentDescription(mContext.getResources().getText( - R.string.action_bar_home_description)); + mHomeLayout.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_AUTO); + if ((options & ActionBar.DISPLAY_HOME_AS_UP) != 0) { + mHomeLayout.setContentDescription(mContext.getResources().getText( + R.string.action_bar_up_description)); + } else { + mHomeLayout.setContentDescription(mContext.getResources().getText( + R.string.action_bar_home_description)); + } } } diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index 48fe7fa40136..9820e60545d1 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -574,7 +574,7 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) strcpy(heaptargetutilizationOptsBuf, "-XX:HeapTargetUtilization="); property_get("dalvik.vm.heaptargetutilization", heaptargetutilizationOptsBuf+26, ""); - if (heapmaxfreeOptsBuf[26] != '\0') { + if (heaptargetutilizationOptsBuf[26] != '\0') { opt.optionString = heaptargetutilizationOptsBuf; mOptions.add(opt); } diff --git a/core/jni/android/graphics/Canvas.cpp b/core/jni/android/graphics/Canvas.cpp index 5c276024fcf2..2a02f7c82eba 100644 --- a/core/jni/android/graphics/Canvas.cpp +++ b/core/jni/android/graphics/Canvas.cpp @@ -931,6 +931,9 @@ static void doDrawTextDecorations(SkCanvas* canvas, jfloat x, jfloat y, jfloat l SkIRect ir; bool result = canvas->getClipBounds(&r, SkCanvas::kBW_EdgeType); + if (!result) { + r.setEmpty(); + } r.round(&ir); (void)GraphicsJNI::irect_to_jrect(ir, env, bounds); return result; diff --git a/core/jni/android_view_GLES20DisplayList.cpp b/core/jni/android_view_GLES20DisplayList.cpp index b307a2f9d8f9..c5f52df5ad4e 100644 --- a/core/jni/android_view_GLES20DisplayList.cpp +++ b/core/jni/android_view_GLES20DisplayList.cpp @@ -36,6 +36,11 @@ using namespace uirenderer; */ #ifdef USE_OPENGL_RENDERER +static void android_view_GLES20DisplayList_reset(JNIEnv* env, + jobject clazz, DisplayList* displayList) { + displayList->reset(); +} + // ---------------------------------------------------------------------------- // DisplayList view properties // ---------------------------------------------------------------------------- @@ -185,6 +190,7 @@ const char* const kClassPathName = "android/view/GLES20DisplayList"; static JNINativeMethod gMethods[] = { #ifdef USE_OPENGL_RENDERER + { "nReset", "(I)V", (void*) android_view_GLES20DisplayList_reset }, { "nSetCaching", "(IZ)V", (void*) android_view_GLES20DisplayList_setCaching }, { "nSetStaticMatrix", "(II)V", (void*) android_view_GLES20DisplayList_setStaticMatrix }, { "nSetAnimationMatrix", "(II)V", (void*) android_view_GLES20DisplayList_setAnimationMatrix }, diff --git a/core/res/res/drawable-hdpi/ic_media_route_on_0_holo_dark.png b/core/res/res/drawable-hdpi/ic_media_route_on_0_holo_dark.png Binary files differnew file mode 100644 index 000000000000..10fc8dac3b65 --- /dev/null +++ b/core/res/res/drawable-hdpi/ic_media_route_on_0_holo_dark.png diff --git a/core/res/res/drawable-hdpi/ic_media_route_on_0_holo_light.png b/core/res/res/drawable-hdpi/ic_media_route_on_0_holo_light.png Binary files differnew file mode 100644 index 000000000000..a0e5060727c4 --- /dev/null +++ b/core/res/res/drawable-hdpi/ic_media_route_on_0_holo_light.png diff --git a/core/res/res/drawable-hdpi/ic_media_route_on_1_holo_dark.png b/core/res/res/drawable-hdpi/ic_media_route_on_1_holo_dark.png Binary files differnew file mode 100644 index 000000000000..8364a3672b16 --- /dev/null +++ b/core/res/res/drawable-hdpi/ic_media_route_on_1_holo_dark.png diff --git a/core/res/res/drawable-hdpi/ic_media_route_on_1_holo_light.png b/core/res/res/drawable-hdpi/ic_media_route_on_1_holo_light.png Binary files differnew file mode 100644 index 000000000000..44b89e1ae8c7 --- /dev/null +++ b/core/res/res/drawable-hdpi/ic_media_route_on_1_holo_light.png diff --git a/core/res/res/drawable-hdpi/ic_media_route_on_2_holo_dark.png b/core/res/res/drawable-hdpi/ic_media_route_on_2_holo_dark.png Binary files differnew file mode 100644 index 000000000000..770bf78d1367 --- /dev/null +++ b/core/res/res/drawable-hdpi/ic_media_route_on_2_holo_dark.png diff --git a/core/res/res/drawable-hdpi/ic_media_route_on_2_holo_light.png b/core/res/res/drawable-hdpi/ic_media_route_on_2_holo_light.png Binary files differnew file mode 100644 index 000000000000..2a2467b8c3ce --- /dev/null +++ b/core/res/res/drawable-hdpi/ic_media_route_on_2_holo_light.png diff --git a/core/res/res/drawable-ldrtl-hdpi/ic_ab_back_holo_dark.png b/core/res/res/drawable-ldrtl-hdpi/ic_ab_back_holo_dark.png Binary files differnew file mode 100644 index 000000000000..9beeb0fd5bd8 --- /dev/null +++ b/core/res/res/drawable-ldrtl-hdpi/ic_ab_back_holo_dark.png diff --git a/core/res/res/drawable-ldrtl-hdpi/ic_ab_back_holo_light.png b/core/res/res/drawable-ldrtl-hdpi/ic_ab_back_holo_light.png Binary files differnew file mode 100644 index 000000000000..844e38be65a5 --- /dev/null +++ b/core/res/res/drawable-ldrtl-hdpi/ic_ab_back_holo_light.png diff --git a/core/res/res/drawable-ldrtl-mdpi/ic_ab_back_holo_dark.png b/core/res/res/drawable-ldrtl-mdpi/ic_ab_back_holo_dark.png Binary files differnew file mode 100644 index 000000000000..c22dc9035e5d --- /dev/null +++ b/core/res/res/drawable-ldrtl-mdpi/ic_ab_back_holo_dark.png diff --git a/core/res/res/drawable-ldrtl-mdpi/ic_ab_back_holo_light.png b/core/res/res/drawable-ldrtl-mdpi/ic_ab_back_holo_light.png Binary files differnew file mode 100644 index 000000000000..f49b715f3418 --- /dev/null +++ b/core/res/res/drawable-ldrtl-mdpi/ic_ab_back_holo_light.png diff --git a/core/res/res/drawable-ldrtl-xhdpi/ic_ab_back_holo_dark.png b/core/res/res/drawable-ldrtl-xhdpi/ic_ab_back_holo_dark.png Binary files differnew file mode 100644 index 000000000000..8dfb7d828141 --- /dev/null +++ b/core/res/res/drawable-ldrtl-xhdpi/ic_ab_back_holo_dark.png diff --git a/core/res/res/drawable-ldrtl-xhdpi/ic_ab_back_holo_light.png b/core/res/res/drawable-ldrtl-xhdpi/ic_ab_back_holo_light.png Binary files differnew file mode 100644 index 000000000000..29852ad5dacd --- /dev/null +++ b/core/res/res/drawable-ldrtl-xhdpi/ic_ab_back_holo_light.png diff --git a/core/res/res/drawable-mdpi/ic_media_route_on_0_holo_dark.png b/core/res/res/drawable-mdpi/ic_media_route_on_0_holo_dark.png Binary files differnew file mode 100644 index 000000000000..fb2ac25a5edc --- /dev/null +++ b/core/res/res/drawable-mdpi/ic_media_route_on_0_holo_dark.png diff --git a/core/res/res/drawable-mdpi/ic_media_route_on_0_holo_light.png b/core/res/res/drawable-mdpi/ic_media_route_on_0_holo_light.png Binary files differnew file mode 100644 index 000000000000..0c200910a0a3 --- /dev/null +++ b/core/res/res/drawable-mdpi/ic_media_route_on_0_holo_light.png diff --git a/core/res/res/drawable-mdpi/ic_media_route_on_1_holo_dark.png b/core/res/res/drawable-mdpi/ic_media_route_on_1_holo_dark.png Binary files differnew file mode 100644 index 000000000000..2f70ceef3b7e --- /dev/null +++ b/core/res/res/drawable-mdpi/ic_media_route_on_1_holo_dark.png diff --git a/core/res/res/drawable-mdpi/ic_media_route_on_1_holo_light.png b/core/res/res/drawable-mdpi/ic_media_route_on_1_holo_light.png Binary files differnew file mode 100644 index 000000000000..0b76d8e08fe7 --- /dev/null +++ b/core/res/res/drawable-mdpi/ic_media_route_on_1_holo_light.png diff --git a/core/res/res/drawable-mdpi/ic_media_route_on_2_holo_dark.png b/core/res/res/drawable-mdpi/ic_media_route_on_2_holo_dark.png Binary files differnew file mode 100644 index 000000000000..ae7b10534ef0 --- /dev/null +++ b/core/res/res/drawable-mdpi/ic_media_route_on_2_holo_dark.png diff --git a/core/res/res/drawable-mdpi/ic_media_route_on_2_holo_light.png b/core/res/res/drawable-mdpi/ic_media_route_on_2_holo_light.png Binary files differnew file mode 100644 index 000000000000..8d37b9940a18 --- /dev/null +++ b/core/res/res/drawable-mdpi/ic_media_route_on_2_holo_light.png diff --git a/core/res/res/drawable-xhdpi/ic_media_route_on_0_holo_dark.png b/core/res/res/drawable-xhdpi/ic_media_route_on_0_holo_dark.png Binary files differnew file mode 100644 index 000000000000..483b61270a0e --- /dev/null +++ b/core/res/res/drawable-xhdpi/ic_media_route_on_0_holo_dark.png diff --git a/core/res/res/drawable-xhdpi/ic_media_route_on_0_holo_light.png b/core/res/res/drawable-xhdpi/ic_media_route_on_0_holo_light.png Binary files differnew file mode 100644 index 000000000000..c3507dc30cea --- /dev/null +++ b/core/res/res/drawable-xhdpi/ic_media_route_on_0_holo_light.png diff --git a/core/res/res/drawable-xhdpi/ic_media_route_on_1_holo_dark.png b/core/res/res/drawable-xhdpi/ic_media_route_on_1_holo_dark.png Binary files differnew file mode 100644 index 000000000000..24c65198f21a --- /dev/null +++ b/core/res/res/drawable-xhdpi/ic_media_route_on_1_holo_dark.png diff --git a/core/res/res/drawable-xhdpi/ic_media_route_on_1_holo_light.png b/core/res/res/drawable-xhdpi/ic_media_route_on_1_holo_light.png Binary files differnew file mode 100644 index 000000000000..2be0380fdbfc --- /dev/null +++ b/core/res/res/drawable-xhdpi/ic_media_route_on_1_holo_light.png diff --git a/core/res/res/drawable-xhdpi/ic_media_route_on_2_holo_dark.png b/core/res/res/drawable-xhdpi/ic_media_route_on_2_holo_dark.png Binary files differnew file mode 100644 index 000000000000..4fd69bd765cb --- /dev/null +++ b/core/res/res/drawable-xhdpi/ic_media_route_on_2_holo_dark.png diff --git a/core/res/res/drawable-xhdpi/ic_media_route_on_2_holo_light.png b/core/res/res/drawable-xhdpi/ic_media_route_on_2_holo_light.png Binary files differnew file mode 100644 index 000000000000..51588564da42 --- /dev/null +++ b/core/res/res/drawable-xhdpi/ic_media_route_on_2_holo_light.png diff --git a/core/res/res/drawable/ic_media_route_connecting_holo_dark.xml b/core/res/res/drawable/ic_media_route_connecting_holo_dark.xml new file mode 100644 index 000000000000..36e01f6ef7d3 --- /dev/null +++ b/core/res/res/drawable/ic_media_route_connecting_holo_dark.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* + * Copyright 2012, 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. + */ +--> +<animation-list + xmlns:android="http://schemas.android.com/apk/res/android" + android:oneshot="false"> + <item android:drawable="@drawable/ic_media_route_on_0_holo_dark" android:duration="500" /> + <item android:drawable="@drawable/ic_media_route_on_1_holo_dark" android:duration="500" /> + <item android:drawable="@drawable/ic_media_route_on_2_holo_dark" android:duration="500" /> + <item android:drawable="@drawable/ic_media_route_on_holo_dark" android:duration="500" /> + <item android:drawable="@drawable/ic_media_route_on_2_holo_dark" android:duration="500" /> + <item android:drawable="@drawable/ic_media_route_on_1_holo_dark" android:duration="500" /> +</animation-list> diff --git a/core/res/res/drawable/ic_media_route_connecting_holo_light.xml b/core/res/res/drawable/ic_media_route_connecting_holo_light.xml new file mode 100644 index 000000000000..6683db84bd0d --- /dev/null +++ b/core/res/res/drawable/ic_media_route_connecting_holo_light.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* + * Copyright 2012, 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. + */ +--> +<animation-list + xmlns:android="http://schemas.android.com/apk/res/android" + android:oneshot="false"> + <item android:drawable="@drawable/ic_media_route_on_0_holo_light" android:duration="500" /> + <item android:drawable="@drawable/ic_media_route_on_1_holo_light" android:duration="500" /> + <item android:drawable="@drawable/ic_media_route_on_2_holo_light" android:duration="500" /> + <item android:drawable="@drawable/ic_media_route_on_holo_light" android:duration="500" /> + <item android:drawable="@drawable/ic_media_route_on_2_holo_light" android:duration="500" /> + <item android:drawable="@drawable/ic_media_route_on_1_holo_light" android:duration="500" /> +</animation-list> diff --git a/core/res/res/drawable/ic_media_route_holo_dark.xml b/core/res/res/drawable/ic_media_route_holo_dark.xml index 0b267d7cff95..b4c1fac9cca9 100644 --- a/core/res/res/drawable/ic_media_route_holo_dark.xml +++ b/core/res/res/drawable/ic_media_route_holo_dark.xml @@ -15,6 +15,7 @@ --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_checked="true" android:state_enabled="true" android:drawable="@android:drawable/ic_media_route_connecting_holo_dark" /> <item android:state_activated="true" android:state_enabled="true" android:drawable="@android:drawable/ic_media_route_on_holo_dark" /> <item android:state_enabled="true" android:drawable="@android:drawable/ic_media_route_off_holo_dark" /> <item android:drawable="@android:drawable/ic_media_route_disabled_holo_dark" /> diff --git a/core/res/res/drawable/ic_media_route_holo_light.xml b/core/res/res/drawable/ic_media_route_holo_light.xml index 377253a2e077..553721d6678c 100644 --- a/core/res/res/drawable/ic_media_route_holo_light.xml +++ b/core/res/res/drawable/ic_media_route_holo_light.xml @@ -15,6 +15,7 @@ --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_checked="true" android:state_enabled="true" android:drawable="@android:drawable/ic_media_route_connecting_holo_light" /> <item android:state_activated="true" android:state_enabled="true" android:drawable="@android:drawable/ic_media_route_on_holo_light" /> <item android:state_enabled="true" android:drawable="@android:drawable/ic_media_route_off_holo_light" /> <item android:drawable="@android:drawable/ic_media_route_disabled_holo_light" /> diff --git a/core/res/res/layout-xlarge/select_dialog_holo.xml b/core/res/res/layout-xlarge/select_dialog_holo.xml deleted file mode 100644 index f931cf23b997..000000000000 --- a/core/res/res/layout-xlarge/select_dialog_holo.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 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. -*/ ---> - -<!-- - This layout file is used by the AlertDialog when displaying a list of items. - This layout file is inflated and used as the ListView to display the items. - Assign an ID so its state will be saved/restored. ---> -<view class="com.android.internal.app.AlertController$RecycleListView" - xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+android:id/select_dialog_listview" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_marginTop="5dip" - android:paddingStart="16dip" - android:paddingEnd="16dip" - android:cacheColorHint="@null" - android:divider="?android:attr/listDividerAlertDialog" - android:scrollbars="vertical" - android:overScrollMode="ifContentScrolls" /> diff --git a/core/res/res/layout/keyguard_widget_region.xml b/core/res/res/layout/keyguard_widget_region.xml index f75936646323..123d105538b7 100644 --- a/core/res/res/layout/keyguard_widget_region.xml +++ b/core/res/res/layout/keyguard_widget_region.xml @@ -54,7 +54,7 @@ <Space android:layout_width="0dip" android:layout_height="match_parent" - android:layout_weight="1"/> + android:layout_weight="1.6"/> <com.android.internal.policy.impl.keyguard.KeyguardGlowStripView android:id="@+id/right_strip" android:layout_width="0dip" diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index ea89633bf864..9ce7f8a9cef7 100755 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -483,6 +483,8 @@ <attr name="autoCompleteTextViewStyle" format="reference" /> <!-- Default Checkbox style. --> <attr name="checkboxStyle" format="reference" /> + <!-- Default CheckedTextView style. --> + <attr name="checkedTextViewStyle" format="reference" /> <!-- Default ListView style for drop downs. --> <attr name="dropDownListViewStyle" format="reference" /> <!-- Default EditText style. --> diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index ab183a30c854..f143d504aa2b 100755 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -960,4 +960,8 @@ --> <bool name="config_enableWifiDisplay">false</bool> + <!-- When true use the linux /dev/input/event subsystem to detect the switch changes + on the headphone/microphone jack. When false use the older uevent framework. --> + <bool name="config_useDevInputEventForAudioJack">false</bool> + </resources> diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 76fa2b07b45b..ffc09de6284e 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -2018,10 +2018,10 @@ <public type="attr" name="permissionGroupFlags" id="0x010103c5" /> <public type="attr" name="labelFor" id="0x010103c6" /> <public type="attr" name="permissionFlags" id="0x010103c7" /> - - -<!-- =============================================================== - Resources added in next version of platform - =============================================================== --> + <public type="attr" name="checkedTextViewStyle" /> + <public type="style" name="Widget.Holo.CheckedTextView" /> + <public type="style" name="Widget.Holo.Light.CheckedTextView" /> + <public type="style" name="Widget.DeviceDefault.CheckedTextView" /> + <public type="style" name="Widget.DeviceDefault.Light.CheckedTextView" /> </resources> diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 51dc0d210e83..2f9ce0c53b01 100755 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -3926,14 +3926,13 @@ "Raise volume above safe level?\nListening at high volume for long periods may damage your hearing." </string> - <!-- Text spoken when the user is performing a gesture that will enable accessibility. [CHAR LIMIT=none] --> - <string name="continue_to_enable_accessibility">Continue touching the screen to enable accessibility.</string> + <string name="continue_to_enable_accessibility">Keep holding down your two fingers to enable accessibility.</string> <!-- Text spoken when the user enabled accessibility. [CHAR LIMIT=none] --> <string name="accessibility_enabled">Accessibility enabled.</string> <!-- Text spoken when the user stops preforming a gesture that would enable accessibility. [CHAR LIMIT=none] --> - <string name="enable_accessibility_canceled">Enable accessibility canceled.</string> + <string name="enable_accessibility_canceled">Accessibility canceled.</string> <!-- Text spoken when the current user is switched if accessibility is enabled. [CHAR LIMIT=none] --> - <string name="user_switched">Switched to user <xliff:g id="name" example="Bob">%1$s</xliff:g>.</string> + <string name="user_switched">Current user <xliff:g id="name" example="Bob">%1$s</xliff:g>.</string> </resources> diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml index 74e242511f9e..4371aec76228 100644 --- a/core/res/res/values/styles.xml +++ b/core/res/res/values/styles.xml @@ -464,7 +464,11 @@ please see styles_device_defaults.xml. <item name="android:textEditSuggestionItemLayout">?android:attr/textEditSuggestionItemLayout</item> <item name="android:textCursorDrawable">?android:attr/textCursorDrawable</item> </style> - + + <style name="Widget.CheckedTextView"> + <item name="android:textAlignment">viewStart</item> + </style> + <style name="Widget.TextView.ListSeparator"> <item name="android:background">@android:drawable/dark_header_dither</item> <item name="android:layout_width">match_parent</item> @@ -1589,6 +1593,9 @@ please see styles_device_defaults.xml. <style name="Widget.Holo.TextView" parent="Widget.TextView"> </style> + <style name="Widget.Holo.CheckedTextView" parent="Widget.CheckedTextView"> + </style> + <style name="Widget.Holo.TextView.ListSeparator" parent="Widget.TextView.ListSeparator"> <item name="android:background">@android:drawable/list_section_divider_holo_dark</item> <item name="android:textAllCaps">true</item> @@ -2017,6 +2024,9 @@ please see styles_device_defaults.xml. <style name="Widget.Holo.Light.TextView" parent="Widget.TextView"> </style> + <style name="Widget.Holo.Light.CheckedTextView" parent="Widget.CheckedTextView"> + </style> + <style name="Widget.Holo.Light.TextView.ListSeparator" parent="Widget.TextView.ListSeparator"> <item name="android:background">@android:drawable/list_section_divider_holo_light</item> <item name="android:textAllCaps">true</item> diff --git a/core/res/res/values/styles_device_defaults.xml b/core/res/res/values/styles_device_defaults.xml index d46535636596..edeba022926d 100644 --- a/core/res/res/values/styles_device_defaults.xml +++ b/core/res/res/values/styles_device_defaults.xml @@ -50,6 +50,9 @@ easier. <style name="Widget.DeviceDefault.TextView" parent="Widget.Holo.TextView" > </style> + <style name="Widget.DeviceDefault.CheckedTextView" parent="Widget.Holo.CheckedTextView" > + + </style> <style name="Widget.DeviceDefault.AutoCompleteTextView" parent="Widget.Holo.AutoCompleteTextView" > </style> @@ -288,6 +291,9 @@ easier. <style name="Widget.DeviceDefault.Light.TextView" parent="Widget.Holo.Light.TextView" > </style> + <style name="Widget.DeviceDefault.Light.CheckedTextView" parent="Widget.Holo.Light.CheckedTextView" > + + </style> <style name="Widget.DeviceDefault.Light.AutoCompleteTextView" parent="Widget.Holo.Light.AutoCompleteTextView" > </style> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 224a05903839..0b30324d4582 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -271,7 +271,8 @@ <java-symbol type="bool" name="config_enableScreenshotChord" /> <java-symbol type="bool" name="config_bluetooth_default_profiles" /> <java-symbol type="bool" name="config_enableWifiDisplay" /> - + <java-symbol type="bool" name="config_useDevInputEventForAudioJack" /> + <java-symbol type="integer" name="config_cursorWindowSize" /> <java-symbol type="integer" name="config_longPressOnPowerBehavior" /> <java-symbol type="integer" name="config_max_pan_devices" /> diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml index 215551b375e7..75850dd0c190 100644 --- a/core/res/res/values/themes.xml +++ b/core/res/res/values/themes.xml @@ -241,6 +241,7 @@ please see themes_device_defaults.xml. <item name="absListViewStyle">@android:style/Widget.AbsListView</item> <item name="autoCompleteTextViewStyle">@android:style/Widget.AutoCompleteTextView</item> <item name="checkboxStyle">@android:style/Widget.CompoundButton.CheckBox</item> + <item name="checkedTextViewStyle">@android:style/Widget.CheckedTextView</item> <item name="dropDownListViewStyle">@android:style/Widget.ListView.DropDown</item> <item name="editTextStyle">@android:style/Widget.EditText</item> <item name="expandableListViewStyle">@android:style/Widget.ExpandableListView</item> @@ -648,6 +649,8 @@ please see themes_device_defaults.xml. <item name="listPreferredItemPaddingRight">10dip</item> <item name="listPreferredItemPaddingStart">10dip</item> <item name="listPreferredItemPaddingEnd">10dip</item> + + <item name="preferencePanelStyle">@style/PreferencePanel.Dialog</item> </style> <!-- Variant of {@link Theme_Dialog} that does not include a frame (or background). @@ -874,12 +877,12 @@ please see themes_device_defaults.xml. <p>This is the default system theme for apps that target API level 11 - 13. Starting with API level 14, the default system theme is supplied by {@link #Theme_DeviceDefault}, which might apply a different style on different devices. If you want to ensure that your - app consistenly uses the Holo theme at all times, you must explicitly declare it in your + app consistently uses the Holo theme at all times, you must explicitly declare it in your manifest. For example, {@code <application android:theme="@android:style/Theme.Holo">}. For more information, read <a href="http://android-developers.blogspot.com/2012/01/holo-everywhere.html">Holo Everywhere</a>.</p> - <p>The widgets in the holographic theme are translucent on their brackground, so + <p>The widgets in the holographic theme are translucent on their background, so applications must ensure that any background they use with this theme is itself dark; otherwise, it will be difficult to see the widgets. This UI style also includes a full action bar by default.</p> @@ -1069,6 +1072,7 @@ please see themes_device_defaults.xml. <item name="absListViewStyle">@android:style/Widget.Holo.AbsListView</item> <item name="autoCompleteTextViewStyle">@android:style/Widget.Holo.AutoCompleteTextView</item> <item name="checkboxStyle">@android:style/Widget.Holo.CompoundButton.CheckBox</item> + <item name="checkedTextViewStyle">@android:style/Widget.Holo.CheckedTextView</item> <item name="dropDownListViewStyle">@android:style/Widget.Holo.ListView.DropDown</item> <item name="editTextStyle">@android:style/Widget.Holo.EditText</item> <item name="expandableListViewStyle">@android:style/Widget.Holo.ExpandableListView</item> @@ -1382,6 +1386,7 @@ please see themes_device_defaults.xml. <item name="absListViewStyle">@android:style/Widget.Holo.Light.AbsListView</item> <item name="autoCompleteTextViewStyle">@android:style/Widget.Holo.Light.AutoCompleteTextView</item> <item name="checkboxStyle">@android:style/Widget.Holo.Light.CompoundButton.CheckBox</item> + <item name="checkedTextViewStyle">@android:style/Widget.Holo.Light.CheckedTextView</item> <item name="dropDownListViewStyle">@android:style/Widget.Holo.ListView.DropDown</item> <item name="editTextStyle">@android:style/Widget.Holo.Light.EditText</item> <item name="expandableListViewStyle">@android:style/Widget.Holo.Light.ExpandableListView</item> @@ -1605,6 +1610,8 @@ please see themes_device_defaults.xml. <item name="listPreferredItemPaddingRight">16dip</item> <item name="listPreferredItemPaddingStart">16dip</item> <item name="listPreferredItemPaddingEnd">16dip</item> + + <item name="preferencePanelStyle">@style/PreferencePanel.Dialog</item> </style> <!-- Variant of Theme.Holo.Dialog that has a nice minimum width for @@ -1719,6 +1726,8 @@ please see themes_device_defaults.xml. <item name="listPreferredItemPaddingRight">16dip</item> <item name="listPreferredItemPaddingStart">16dip</item> <item name="listPreferredItemPaddingEnd">16dip</item> + + <item name="preferencePanelStyle">@style/PreferencePanel.Dialog</item> </style> <!-- Variant of Theme.Holo.Light.Dialog that has a nice minimum width for diff --git a/core/res/res/values/themes_device_defaults.xml b/core/res/res/values/themes_device_defaults.xml index 2a2b9e0e47e4..4178cc48419c 100644 --- a/core/res/res/values/themes_device_defaults.xml +++ b/core/res/res/values/themes_device_defaults.xml @@ -104,6 +104,7 @@ easier. <item name="absListViewStyle">@android:style/Widget.DeviceDefault.AbsListView</item> <item name="autoCompleteTextViewStyle">@android:style/Widget.DeviceDefault.AutoCompleteTextView</item> <item name="checkboxStyle">@android:style/Widget.DeviceDefault.CompoundButton.CheckBox</item> + <item name="checkedTextViewStyle">@android:style/Widget.DeviceDefault.CheckedTextView</item> <item name="dropDownListViewStyle">@android:style/Widget.DeviceDefault.ListView.DropDown</item> <item name="editTextStyle">@android:style/Widget.DeviceDefault.EditText</item> <item name="expandableListViewStyle">@android:style/Widget.DeviceDefault.ExpandableListView</item> @@ -261,7 +262,8 @@ easier. <item name="absListViewStyle">@android:style/Widget.DeviceDefault.Light.AbsListView</item> <item name="autoCompleteTextViewStyle">@android:style/Widget.DeviceDefault.Light.AutoCompleteTextView</item> <item name="checkboxStyle">@android:style/Widget.DeviceDefault.Light.CompoundButton.CheckBox</item> - <item name="dropDownListViewStyle">@android:style/Widget.DeviceDefault.ListView.DropDown</item> + <item name="checkedTextViewStyle">@android:style/Widget.DeviceDefault.Light.CheckedTextView</item> + <item name="dropDownListViewStyle">@android:style/Widget.DeviceDefault.Light.ListView.DropDown</item> <item name="editTextStyle">@android:style/Widget.DeviceDefault.Light.EditText</item> <item name="expandableListViewStyle">@android:style/Widget.DeviceDefault.Light.ExpandableListView</item> <item name="expandableListViewWhiteStyle">@android:style/Widget.DeviceDefault.Light.ExpandableListView.White</item> @@ -296,7 +298,7 @@ easier. <item name="webViewStyle">@android:style/Widget.DeviceDefault.Light.WebView</item> <item name="dropDownItemStyle">@android:style/Widget.DeviceDefault.Light.DropDownItem</item> <item name="spinnerDropDownItemStyle">@android:style/Widget.DeviceDefault.Light.DropDownItem.Spinner</item> - <item name="spinnerItemStyle">@android:style/Widget.DeviceDefault.TextView.SpinnerItem</item> + <item name="spinnerItemStyle">@android:style/Widget.DeviceDefault.Light.TextView.SpinnerItem</item> <item name="dropDownHintAppearance">@android:style/TextAppearance.DeviceDefault.Widget.DropDownHint</item> <item name="keyboardViewStyle">@android:style/Widget.DeviceDefault.KeyboardView</item> <item name="quickContactBadgeStyleWindowSmall">@android:style/Widget.DeviceDefault.QuickContactBadge.WindowSmall</item> diff --git a/docs/html/about/dashboards/index.jd b/docs/html/about/dashboards/index.jd index c3da3bf4f7e1..655573391b75 100644 --- a/docs/html/about/dashboards/index.jd +++ b/docs/html/about/dashboards/index.jd @@ -30,33 +30,31 @@ Google Play within a 14-day period ending on the data collection date noted belo <th>API</th> <th>Distribution</th> </tr> -<tr><td><a href="/about/versions/android-1.5.html">1.5</a></td><td>Cupcake</td> <td>3</td><td>0.2%</td></tr> +<tr><td><a href="/about/versions/android-1.5.html">1.5</a></td><td>Cupcake</td> <td>3</td><td>0.1%</td></tr> <tr><td><a href="/about/versions/android-1.6.html">1.6</a></td><td>Donut</td> <td>4</td><td>0.4%</td></tr> -<tr><td><a href="/about/versions/android-2.1.html">2.1</a></td><td>Eclair</td> <td>7</td><td>3.7%</td></tr> -<tr><td><a href="/about/versions/android-2.2.html">2.2</a></td><td>Froyo</td> <td>8</td><td>14%</td></tr> +<tr><td><a href="/about/versions/android-2.1.html">2.1</a></td><td>Eclair</td> <td>7</td><td>3.4%</td></tr> +<tr><td><a href="/about/versions/android-2.2.html">2.2</a></td><td>Froyo</td> <td>8</td><td>12.9%</td></tr> <tr><td><a href="/about/versions/android-2.3.html">2.3 - 2.3.2</a> </td><td rowspan="2">Gingerbread</td> <td>9</td><td>0.3%</td></tr> <tr><td><a href="/about/versions/android-2.3.3.html">2.3.3 - 2.3.7 - </a></td><!-- Gingerbread --> <td>10</td><td>57.2%</td></tr> + </a></td><!-- Gingerbread --> <td>10</td><td>55.5%</td></tr> <tr><td><a href="/about/versions/android-3.1.html">3.1</a></td> - <td rowspan="2">Honeycomb</td> <td>12</td><td>0.5%</td></tr> -<tr><td><a href="/about/versions/android-3.2.html">3.2</a></td> <!-- Honeycomb --><td>13</td><td>1.6%</td></tr> -<tr><td><a href="/about/versions/android-4.0.html">4.0 - 4.0.2</a></td> - <td rowspan="2">Ice Cream Sandwich</td><td>14</td><td>0.1%</td></tr> + <td rowspan="2">Honeycomb</td> <td>12</td><td>0.4%</td></tr> +<tr><td><a href="/about/versions/android-3.2.html">3.2</a></td> <!-- Honeycomb --><td>13</td><td>1.5%</td></tr> <tr><td><a href="/about/versions/android-4.0.3.html">4.0.3 - 4.0.4</a></td> - <!-- ICS --> <td>15</td><td>20.8%</td></tr> -<tr><td><a href="/about/versions/android-4.1.html">4.1</a></td> <td>Jelly Bean</td><td>16</td><td>1.2%</td></tr> + <td>Ice Cream Sandwich</td><td>15</td><td>23.7%</td></tr> +<tr><td><a href="/about/versions/android-4.1.html">4.1</a></td> <td>Jelly Bean</td><td>16</td><td>1.8%</td></tr> </table> </div> <div class="col-8" style="margin-right:0"> <img alt="" -src="http://chart.apis.google.com/chart?&cht=p&chs=460x245&chd=t:4.3,14,57.5,2.1,20.9,1.2&chl=Eclair%20%26%20older|Froyo|Gingerbread|Honeycomb|Ice%20Cream%20Sandwich|Jelly%20Bean&chco=c4df9b,6fad0c&chf=bg,s,00000000" /> +src="http://chart.apis.google.com/chart?&cht=p&chs=460x245&chd=t:3.9,12.9,55.8,1.9,23.7,1.8&chl=Eclair%20%26%20older|Froyo|Gingerbread|Honeycomb|Ice%20Cream%20Sandwich|Jelly%20Bean&chco=c4df9b,6fad0c&chf=bg,s,00000000" /> </div><!-- end dashboard-panel --> -<p style="clear:both"><em>Data collected during a 14-day period ending on September 4, 2012</em></p> +<p style="clear:both"><em>Data collected during a 14-day period ending on October 1, 2012</em></p> <!-- <p style="font-size:.9em">* <em>Other: 0.1% of devices running obsolete versions</em></p> --> @@ -81,9 +79,9 @@ line for that version meets the y-axis on the right.</p> Google Play within a 14-day period ending on the date indicated on the x-axis.</p> <img alt="" height="250" width="660" -src="http://chart.apis.google.com/chart?&cht=lc&chs=660x250&chxt=x,x,y,r&chf=bg,s,00000000&chxr=0,0,12|1,0,12|2,0,100|3,0,100&chxl=0%3A%7C03/01%7C03/15%7C04/01%7C04/15%7C05/01%7C05/15%7C06/01%7C06/15%7C07/01%7C07/15%7C08/01%7C08/15%7C09/01%7C1%3A%7C2012%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C2012%7C2%3A%7C0%25%7C25%25%7C50%25%7C75%25%7C100%25%7C3%3A%7C0%25%7C25%25%7C50%25%7C75%25%7C100%25&chxp=0,0,1,2,3,4,5,6,7,8,9,10,11,12&chxtc=0,5&chd=t:97.6,97.8,97.8,97.9,98.1,98.1,98.3,98.5,98.6,98.7,98.9,98.9,99.0|90.8,91.4,91.8,92.1,92.5,92.7,93.1,93.5,93.9,94.2,94.7,94.9,95.3|65.2,66.8,68.6,69.9,71.5,72.6,74.0,75.2,76.5,77.8,79.2,80.1,81.1|4.3,4.6,5.5,6.5,7.6,8.2,9.4,11.0,12.8,15.6,18.9,21.2,23.7|3.2,3.5,4.5,5.5,6.6,7.4,8.7,10.4,12.3,15.1,18.4,20.7,23.2|1.1,1.3,2.3,3.3,4.4,5.3,6.7,8.4,10.4,13.2,16.6,19.0,21.5|0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.8,0.9,1.1&chm=b,c3df9b,0,1,0|tAndroid%202.2,6c9729,1,0,15,,t::-5|b,b6dc7d,1,2,0|tAndroid%202.3.3,5b831d,2,0,15,,t::-5|b,aadb5e,2,3,0|b,9ddb3d,3,4,0|b,91da1e,4,5,0|tAndroid%204.0.3,253a06,5,8,15,,t::-5|b,80c414,5,6,0|B,6fad0c,6,7,0&chg=7,25&chdl=Android%202.1|Android%202.2|Android%202.3.3|Android%203.1|Android%203.2|Android%204.0.3|Android%204.1&chco=add274,a0d155,94d134,84c323,73ad18,62960f,507d08" /> +src="http://chart.apis.google.com/chart?&cht=lc&chs=660x250&chxt=x,x,y,r&chf=bg,s,00000000&chxr=0,0,12|1,0,12|2,0,100|3,0,100&chxl=0%3A%7C04/01%7C04/15%7C05/01%7C05/15%7C06/01%7C06/15%7C07/01%7C07/15%7C08/01%7C08/15%7C09/01%7C09/15%7C10/01%7C1%3A%7C2012%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C2012%7C2%3A%7C0%25%7C25%25%7C50%25%7C75%25%7C100%25%7C3%3A%7C0%25%7C25%25%7C50%25%7C75%25%7C100%25&chxp=0,0,1,2,3,4,5,6,7,8,9,10,11,12&chxtc=0,5&chd=t:97.8,97.9,98.1,98.1,98.3,98.5,98.6,98.7,98.9,98.9,99.0,99.1,99.2|91.8,92.1,92.5,92.7,93.1,93.5,93.9,94.2,94.7,94.9,95.3,95.5,95.8|68.6,69.9,71.5,72.6,74.0,75.2,76.5,77.8,79.2,80.1,81.1,82.0,82.9|5.5,6.5,7.6,8.2,9.4,11.0,12.8,15.6,18.9,21.2,23.7,25.5,27.4|4.5,5.5,6.6,7.4,8.7,10.4,12.3,15.1,18.4,20.7,23.2,25.1,27.0|2.3,3.3,4.4,5.3,6.7,8.4,10.4,13.2,16.6,19.0,21.5,23.5,25.5|0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.8,0.9,1.1,1.4,1.8&chm=b,c3df9b,0,1,0|tAndroid%202.2,6c9729,1,0,15,,t::-5|b,b6dc7d,1,2,0|tAndroid%202.3.3,5b831d,2,0,15,,t::-5|b,aadb5e,2,3,0|b,9ddb3d,3,4,0|b,91da1e,4,5,0|tAndroid%204.0.3,253a06,5,6,15,,t::-5|b,80c414,5,6,0|B,6fad0c,6,7,0&chg=7,25&chdl=Android%202.1|Android%202.2|Android%202.3.3|Android%203.1|Android%203.2|Android%204.0.3|Android%204.1&chco=add274,a0d155,94d134,84c323,73ad18,62960f,507d08" /> -<p><em>Last historical dataset collected during a 14-day period ending on September 1, 2012</em></p> +<p><em>Last historical dataset collected during a 14-day period ending on October 1, 2012</em></p> @@ -112,11 +110,11 @@ src="http://chart.apis.google.com/chart?&cht=lc&chs=660x250&chxt=x,x,y,r&chf=bg, <img alt="" style="float:right;" -src="http://chart.googleapis.com/chart?cht=p&chs=400x250&chf=bg,s,00000000&chco=c4df9b,6fad0c&chl=Xlarge%7CLarge%7CNormal%7CSmall&chd=t%3A4.7,6.5,86,2.8" /> +src="http://chart.googleapis.com/chart?cht=p&chs=400x250&chf=bg,s,00000000&chco=c4df9b,6fad0c&chl=Xlarge%7CLarge%7CNormal%7CSmall&chd=t%3A4.6,6.1,86.6,2.7" /> <img alt="" style="float:right;clear:right" -src="http://chart.googleapis.com/chart?cht=p&chs=400x250&chf=bg,s,00000000&chco=c4df9b,6fad0c&chl=ldpi%7Cmdpi%7Chdpi%7Cxhdpi&chd=t%3A1.6,18.6,53.6,26.2" /> +src="http://chart.googleapis.com/chart?cht=p&chs=400x250&chf=bg,s,00000000&chco=c4df9b,6fad0c&chl=ldpi%7Cmdpi%7Chdpi%7Cxhdpi&chd=t%3A2.2,18,51.1,28.7" /> <p>This section provides data about the relative number of active devices that have a particular screen configuration, defined by a combination of screen size and density. To simplify the way that @@ -148,32 +146,32 @@ ending on the data collection date noted below.</p> <th scope="col">xhdpi</th> </tr> <tr><th scope="row">small</th> -<td>1.1%</td> <!-- small/ldpi --> +<td>1.7%</td> <!-- small/ldpi --> <td></td> <!-- small/mdpi --> -<td>1.7%</td> <!-- small/hdpi --> +<td>1.0%</td> <!-- small/hdpi --> <td></td> <!-- small/xhdpi --> </tr> <tr><th scope="row">normal</th> <td>0.4%</td> <!-- normal/ldpi --> -<td>11.4%</td> <!-- normal/mdpi --> -<td>51.9%</td> <!-- normal/hdpi --> -<td>22.3%</td> <!-- normal/xhdpi --> +<td>11%</td> <!-- normal/mdpi --> +<td>50.1%</td> <!-- normal/hdpi --> +<td>25.1%</td> <!-- normal/xhdpi --> </tr> <tr><th scope="row">large</th> <td>0.1%</td> <!-- large/ldpi --> -<td>2.5%</td> <!-- large/mdpi --> +<td>2.4%</td> <!-- large/mdpi --> <td></td> <!-- large/hdpi --> -<td>3.9%</td> <!-- large/xhdpi --> +<td>3.6%</td> <!-- large/xhdpi --> </tr> <tr><th scope="row">xlarge</th> <td></td> <!-- xlarge/ldpi --> -<td>4.7%</td> <!-- xlarge/mdpi --> +<td>4.6%</td> <!-- xlarge/mdpi --> <td></td> <!-- xlarge/hdpi --> <td></td> <!-- xlarge/xhdpi --> </tr> </table> -<p style="clear:both"><em>Data collected during a 7-day period ending on September 4, 2012</em></p> +<p style="clear:both"><em>Data collected during a 7-day period ending on October 1, 2012</em></p> @@ -225,4 +223,4 @@ ending on the data collection date noted below.</p> -<p style="clear:both"><em>Data collected during a 7-day period ending on September 4, 2012</em></p> +<p style="clear:both"><em>Data collected during a 7-day period ending on October 1, 2012</em></p> diff --git a/docs/html/distribute/googleplay/promote/brand.jd b/docs/html/distribute/googleplay/promote/brand.jd index 875794a2db48..cb6bf48c0fd6 100644 --- a/docs/html/distribute/googleplay/promote/brand.jd +++ b/docs/html/distribute/googleplay/promote/brand.jd @@ -95,7 +95,7 @@ in text.</p> <p>When referring to the mobile experience, use "Google Play" unless the text is clearly instructional for the user. For example, a marketing headline might read "Download our -games on Google Play™," but instructional text woud read "Download our games using the Google +games on Google Play™," but instructional text would read "Download our games using the Google Play™ Store app." <p>Any use of the Google Play name or icon needs to include this @@ -117,8 +117,9 @@ Play™ Store app." <p>You may use the Google Play Store icon, but you may not modify it.</p> -<p>When labeling or referring to the icon, the name can be either the full app -name, Google Play Store, or the app display name, Play Store.</p> +<p>As mentioned above, when referring to the Google Play Store app in copy, use the full name: +"Google Play Store." However, when labelling the Google Play Store icon directly, it's OK to use +"Play Store" without "Google" (which is how the icon is labelled on a device).</p> <h4>Google Play badge</h4> diff --git a/libs/hwui/Caches.cpp b/libs/hwui/Caches.cpp index e44329404190..7853ae4168b9 100644 --- a/libs/hwui/Caches.cpp +++ b/libs/hwui/Caches.cpp @@ -268,8 +268,6 @@ void Caches::deleteDisplayListDeferred(DisplayList* displayList) { void Caches::flush(FlushMode mode) { FLUSH_LOGD("Flushing caches (mode %d)", mode); - clearGarbage(); - switch (mode) { case kFlushMode_Full: textureCache.clear(); @@ -293,6 +291,8 @@ void Caches::flush(FlushMode mode) { layerCache.clear(); break; } + + clearGarbage(); } /////////////////////////////////////////////////////////////////////////////// diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp index f84c84735daf..589d5c2eb985 100644 --- a/libs/hwui/DisplayListRenderer.cpp +++ b/libs/hwui/DisplayListRenderer.cpp @@ -105,35 +105,6 @@ DisplayList::~DisplayList() { clearResources(); } -void DisplayList::initProperties() { - mLeft = 0; - mTop = 0; - mRight = 0; - mBottom = 0; - mClipChildren = true; - mAlpha = 1; - mMultipliedAlpha = 255; - mHasOverlappingRendering = true; - mTranslationX = 0; - mTranslationY = 0; - mRotation = 0; - mRotationX = 0; - mRotationY= 0; - mScaleX = 1; - mScaleY = 1; - mPivotX = 0; - mPivotY = 0; - mCameraDistance = 0; - mMatrixDirty = false; - mMatrixFlags = 0; - mPrevWidth = -1; - mPrevHeight = -1; - mWidth = 0; - mHeight = 0; - mPivotExplicitlySet = false; - mCaching = false; -} - void DisplayList::destroyDisplayListDeferred(DisplayList* displayList) { if (displayList) { DISPLAY_LIST_LOGD("Deferring display list destruction"); @@ -215,8 +186,12 @@ void DisplayList::clearResources() { mLayers.clear(); } +void DisplayList::reset() { + clearResources(); + init(); +} + void DisplayList::initFromDisplayListRenderer(const DisplayListRenderer& recorder, bool reusing) { - const SkWriter32& writer = recorder.writeStream(); if (reusing) { // re-using display list - clear out previous allocations @@ -224,8 +199,8 @@ void DisplayList::initFromDisplayListRenderer(const DisplayListRenderer& recorde } init(); - initProperties(); + const SkWriter32& writer = recorder.writeStream(); if (writer.size() == 0) { return; } @@ -303,6 +278,32 @@ void DisplayList::init() { mSize = 0; mIsRenderable = true; mFunctorCount = 0; + mLeft = 0; + mTop = 0; + mRight = 0; + mBottom = 0; + mClipChildren = true; + mAlpha = 1; + mMultipliedAlpha = 255; + mHasOverlappingRendering = true; + mTranslationX = 0; + mTranslationY = 0; + mRotation = 0; + mRotationX = 0; + mRotationY= 0; + mScaleX = 1; + mScaleY = 1; + mPivotX = 0; + mPivotY = 0; + mCameraDistance = 0; + mMatrixDirty = false; + mMatrixFlags = 0; + mPrevWidth = -1; + mPrevHeight = -1; + mWidth = 0; + mHeight = 0; + mPivotExplicitlySet = false; + mCaching = false; } size_t DisplayList::getSize() { diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h index 39061f4c6c71..2610055ecd06 100644 --- a/libs/hwui/DisplayListRenderer.h +++ b/libs/hwui/DisplayListRenderer.h @@ -137,6 +137,8 @@ public: void output(OpenGLRenderer& renderer, uint32_t level = 0); + ANDROID_API void reset(); + void setRenderable(bool renderable) { mIsRenderable = renderable; } @@ -399,7 +401,6 @@ public: private: void init(); - void initProperties(); void clearResources(); diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index c0150776b76c..c2e6ee39a9c9 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -1265,7 +1265,7 @@ bool OpenGLRenderer::quickRejectPreStroke(float left, float top, float right, fl } bool OpenGLRenderer::quickReject(float left, float top, float right, float bottom) { - if (mSnapshot->isIgnored()) { + if (mSnapshot->isIgnored() || bottom <= top || right <= left) { return true; } @@ -1951,6 +1951,11 @@ void OpenGLRenderer::drawConvexPath(const SkPath& path, SkPaint* paint) { // TODO: try clipping large paths to viewport PathRenderer::convexPathVertices(path, paint, mSnapshot->transform, vertexBuffer); + if (!vertexBuffer.getSize()) { + // no vertices to draw + return; + } + setupDraw(); setupDrawNoTexture(); if (isAA) setupDrawAA(); diff --git a/libs/hwui/PathRenderer.cpp b/libs/hwui/PathRenderer.cpp index 4a66c62d92d8..5b55c2b94589 100644 --- a/libs/hwui/PathRenderer.cpp +++ b/libs/hwui/PathRenderer.cpp @@ -323,6 +323,11 @@ void PathRenderer::convexPathVertices(const SkPath &path, const SkPaint* paint, convexPathPerimeterVertices(path, threshInvScaleX * threshInvScaleX, threshInvScaleY * threshInvScaleY, tempVertices); + if (!tempVertices.size()) { + // path was empty, return without allocating vertex buffer + return; + } + #if VERTEX_DEBUG for (unsigned int i = 0; i < tempVertices.size(); i++) { ALOGD("orig path: point at %f %f", tempVertices[i].position[0], tempVertices[i].position[1]); diff --git a/location/java/com/android/internal/location/GpsNetInitiatedHandler.java b/location/java/com/android/internal/location/GpsNetInitiatedHandler.java index 0adba06fe36b..57e2786213bb 100755 --- a/location/java/com/android/internal/location/GpsNetInitiatedHandler.java +++ b/location/java/com/android/internal/location/GpsNetInitiatedHandler.java @@ -26,6 +26,7 @@ import android.content.Intent; import android.location.LocationManager; import android.os.Bundle; import android.os.RemoteException; +import android.os.UserHandle; import android.util.Log; import com.android.internal.R; @@ -89,7 +90,6 @@ public class GpsNetInitiatedHandler { // configuration of notificaiton behavior private boolean mPlaySounds = false; - private boolean visible = true; private boolean mPopupImmediately = true; // Set to true if string from HAL is encoded as Hex, e.g., "3F0039" @@ -213,11 +213,8 @@ public class GpsNetInitiatedHandler { PendingIntent pi = PendingIntent.getBroadcast(mContext, 0, intent, 0); mNiNotification.setLatestEventInfo(mContext, title, message, pi); - if (visible) { - notificationManager.notify(notif.notificationId, mNiNotification); - } else { - notificationManager.cancel(notif.notificationId); - } + notificationManager.notifyAsUser(null, notif.notificationId, mNiNotification, + UserHandle.ALL); } // Opens the notification dialog and waits for user input diff --git a/media/java/android/media/MediaRouter.java b/media/java/android/media/MediaRouter.java index 36c9c705e322..e5b9637a44b4 100644 --- a/media/java/android/media/MediaRouter.java +++ b/media/java/android/media/MediaRouter.java @@ -105,8 +105,13 @@ public class MediaRouter { mDefaultAudioVideo = new RouteInfo(mSystemCategory); mDefaultAudioVideo.mNameResId = com.android.internal.R.string.default_audio_route_name; mDefaultAudioVideo.mSupportedTypes = ROUTE_TYPE_LIVE_AUDIO | ROUTE_TYPE_LIVE_VIDEO; - addRoute(mDefaultAudioVideo); + addRouteStatic(mDefaultAudioVideo); + // This will select the active wifi display route if there is one. + updateWifiDisplayStatus(mDisplayService.getWifiDisplayStatus()); + + appContext.registerReceiver(new WifiDisplayStatusChangedReceiver(), + new IntentFilter(DisplayManager.ACTION_WIFI_DISPLAY_STATUS_CHANGED)); appContext.registerReceiver(new VolumeChangeReceiver(), new IntentFilter(AudioManager.VOLUME_CHANGED_ACTION)); @@ -116,13 +121,17 @@ public class MediaRouter { } catch (RemoteException e) { } if (newAudioRoutes != null) { + // This will select the active BT route if there is one and the current + // selected route is the default system route, or if there is no selected + // route yet. updateAudioRoutes(newAudioRoutes); } - updateWifiDisplayStatus(mDisplayService.getWifiDisplayStatus()); - - appContext.registerReceiver(new WifiDisplayStatusChangedReceiver(), - new IntentFilter(DisplayManager.ACTION_WIFI_DISPLAY_STATUS_CHANGED)); + // Select the default route if the above didn't sync us up + // appropriately with relevant system state. + if (mSelectedRoute == null) { + selectRouteStatic(mDefaultAudioVideo.getSupportedTypes(), mDefaultAudioVideo); + } } void updateAudioRoutes(AudioRoutesInfo newRoutes) { @@ -159,7 +168,7 @@ public class MediaRouter { info.mName = mCurAudioRoutesInfo.mBluetoothName; info.mSupportedTypes = ROUTE_TYPE_LIVE_AUDIO; sStatic.mBluetoothA2dpRoute = info; - addRoute(sStatic.mBluetoothA2dpRoute); + addRouteStatic(sStatic.mBluetoothA2dpRoute); } else { sStatic.mBluetoothA2dpRoute.mName = mCurAudioRoutesInfo.mBluetoothName; dispatchRouteChanged(sStatic.mBluetoothA2dpRoute); @@ -175,7 +184,8 @@ public class MediaRouter { mSelectedRoute == mBluetoothA2dpRoute) { selectRouteStatic(ROUTE_TYPE_LIVE_AUDIO, mDefaultAudioVideo); } else if (mCurAudioRoutesInfo.mMainType == AudioRoutesInfo.MAIN_SPEAKER && - mSelectedRoute == mDefaultAudioVideo && a2dpEnabled) { + (mSelectedRoute == mDefaultAudioVideo || mSelectedRoute == null) && + a2dpEnabled) { selectRouteStatic(ROUTE_TYPE_LIVE_AUDIO, mBluetoothA2dpRoute); } } @@ -393,22 +403,21 @@ public class MediaRouter { * @see #removeUserRoute(UserRouteInfo) */ public void addUserRoute(UserRouteInfo info) { - addRoute(info); + addRouteStatic(info); } /** * @hide Framework use only */ public void addRouteInt(RouteInfo info) { - addRoute(info); + addRouteStatic(info); } - static void addRoute(RouteInfo info) { + static void addRouteStatic(RouteInfo info) { final RouteCategory cat = info.getCategory(); if (!sStatic.mCategories.contains(cat)) { sStatic.mCategories.add(cat); } - final boolean onlyRoute = sStatic.mRoutes.isEmpty(); if (cat.isGroupable() && !(info instanceof RouteGroup)) { // Enforce that any added route in a groupable category must be in a group. final RouteGroup group = new RouteGroup(info.getCategory()); @@ -422,10 +431,6 @@ public class MediaRouter { sStatic.mRoutes.add(info); dispatchRouteAdded(info); } - - if (onlyRoute) { - selectRouteStatic(info.getSupportedTypes(), info); - } } /** @@ -693,18 +698,25 @@ public class MediaRouter { oldStatus.getRememberedDisplays() : new WifiDisplay[0]; WifiDisplay[] newDisplays = newStatus.getRememberedDisplays(); WifiDisplay[] availableDisplays = newStatus.getAvailableDisplays(); + WifiDisplay activeDisplay = newStatus.getActiveDisplay(); for (int i = 0; i < newDisplays.length; i++) { final WifiDisplay d = newDisplays[i]; final WifiDisplay oldRemembered = findMatchingDisplay(d, oldDisplays); if (oldRemembered == null) { - addRoute(makeWifiDisplayRoute(d)); + addRouteStatic(makeWifiDisplayRoute(d)); needScan = true; } else { final boolean available = findMatchingDisplay(d, availableDisplays) != null; final RouteInfo route = findWifiDisplayRoute(d); updateWifiDisplayRoute(route, d, available, newStatus); } + if (d.equals(activeDisplay)) { + final RouteInfo activeRoute = findWifiDisplayRoute(d); + if (activeRoute != null) { + selectRouteStatic(activeRoute.getSupportedTypes(), activeRoute); + } + } } for (int i = 0; i < oldDisplays.length; i++) { final WifiDisplay d = oldDisplays[i]; @@ -840,11 +852,11 @@ public class MediaRouter { // A predetermined connection status that can override mStatus private int mStatusCode; - static final int STATUS_NONE = 0; - static final int STATUS_SCANNING = 1; - static final int STATUS_CONNECTING = 2; - static final int STATUS_AVAILABLE = 3; - static final int STATUS_NOT_AVAILABLE = 4; + /** @hide */ public static final int STATUS_NONE = 0; + /** @hide */ public static final int STATUS_SCANNING = 1; + /** @hide */ public static final int STATUS_CONNECTING = 2; + /** @hide */ public static final int STATUS_AVAILABLE = 3; + /** @hide */ public static final int STATUS_NOT_AVAILABLE = 4; private Object mTag; @@ -941,6 +953,13 @@ public class MediaRouter { } /** + * @hide + */ + public int getStatusCode() { + return mStatusCode; + } + + /** * @return A media type flag set describing which types this route supports. */ public int getSupportedTypes() { diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index c8ce3cd13a34..f69c0af6db59 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -68,7 +68,7 @@ public class DatabaseHelper extends SQLiteOpenHelper { // database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion' // is properly propagated through your change. Not doing so will result in a loss of user // settings. - private static final int DATABASE_VERSION = 89; + private static final int DATABASE_VERSION = 90; private Context mContext; private int mUserHandle; @@ -1380,6 +1380,26 @@ public class DatabaseHelper extends SQLiteOpenHelper { upgradeVersion = 89; } + if (upgradeVersion == 89) { + if (mUserHandle == UserHandle.USER_OWNER) { + db.beginTransaction(); + try { + String[] prefixesToMove = { + Settings.Global.BLUETOOTH_HEADSET_PRIORITY_PREFIX, + Settings.Global.BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX, + Settings.Global.BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX, + }; + + movePrefixedSettingsToNewTable(db, TABLE_SECURE, TABLE_GLOBAL, prefixesToMove); + + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + } + } + upgradeVersion = 90; + } + // *** Remember to update DATABASE_VERSION above! if (upgradeVersion != currentVersion) { @@ -1446,6 +1466,44 @@ public class DatabaseHelper extends SQLiteOpenHelper { } } + /** + * Move any settings with the given prefixes from the source table to the + * destination table. + */ + private void movePrefixedSettingsToNewTable( + SQLiteDatabase db, String sourceTable, String destTable, String[] prefixesToMove) { + SQLiteStatement insertStmt = null; + SQLiteStatement deleteStmt = null; + + db.beginTransaction(); + try { + insertStmt = db.compileStatement("INSERT INTO " + destTable + + " (name,value) SELECT name,value FROM " + sourceTable + + " WHERE substr(name,0,?)=?"); + deleteStmt = db.compileStatement( + "DELETE FROM " + sourceTable + " WHERE substr(name,0,?)=?"); + + for (String prefix : prefixesToMove) { + insertStmt.bindLong(1, prefix.length() + 1); + insertStmt.bindString(2, prefix); + insertStmt.execute(); + + deleteStmt.bindLong(1, prefix.length() + 1); + deleteStmt.bindString(2, prefix); + deleteStmt.execute(); + } + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + if (insertStmt != null) { + insertStmt.close(); + } + if (deleteStmt != null) { + deleteStmt.close(); + } + } + } + private void upgradeLockPatternLocation(SQLiteDatabase db) { Cursor c = db.query(TABLE_SYSTEM, new String[] {"_id", "value"}, "name='lock_pattern'", null, null, null, null); @@ -1826,10 +1884,6 @@ public class DatabaseHelper extends SQLiteOpenHelper { loadIntegerSetting(stmt, Settings.System.LOCKSCREEN_SOUNDS_ENABLED, R.integer.def_lockscreen_sounds_enabled); - loadStringSetting(stmt, Settings.System.LOCK_SOUND, - R.string.def_lock_sound); - loadStringSetting(stmt, Settings.System.UNLOCK_SOUND, - R.string.def_unlock_sound); } private void loadDefaultAnimationSettings(SQLiteStatement stmt) { @@ -2045,6 +2099,12 @@ public class DatabaseHelper extends SQLiteOpenHelper { loadBooleanSetting(stmt, Settings.Global.WIFI_DISPLAY_ON, R.bool.def_wifi_display_on); + loadStringSetting(stmt, Settings.Global.LOCK_SOUND, + R.string.def_lock_sound); + + loadStringSetting(stmt, Settings.Global.UNLOCK_SOUND, + R.string.def_unlock_sound); + // --- New global settings start here } finally { if (stmt != null) stmt.close(); diff --git a/packages/SystemUI/res/drawable-hdpi/ic_qs_clock_hour.png b/packages/SystemUI/res/drawable-hdpi/ic_qs_clock_hour.png Binary files differindex 979ca0846aca..045a3d15884f 100644 --- a/packages/SystemUI/res/drawable-hdpi/ic_qs_clock_hour.png +++ b/packages/SystemUI/res/drawable-hdpi/ic_qs_clock_hour.png diff --git a/packages/SystemUI/res/drawable-mdpi/ic_qs_clock_hour.png b/packages/SystemUI/res/drawable-mdpi/ic_qs_clock_hour.png Binary files differindex 4dca96a5a3da..ee887e9db6f7 100644 --- a/packages/SystemUI/res/drawable-mdpi/ic_qs_clock_hour.png +++ b/packages/SystemUI/res/drawable-mdpi/ic_qs_clock_hour.png diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_qs_clock_hour.png b/packages/SystemUI/res/drawable-xhdpi/ic_qs_clock_hour.png Binary files differindex a293c0bacf93..d1d29dc0aa75 100644 --- a/packages/SystemUI/res/drawable-xhdpi/ic_qs_clock_hour.png +++ b/packages/SystemUI/res/drawable-xhdpi/ic_qs_clock_hour.png diff --git a/packages/SystemUI/res/layout-land/status_bar_recent_item.xml b/packages/SystemUI/res/layout-land/status_bar_recent_item.xml index 715ccba2b9b9..c293fe6706c3 100644 --- a/packages/SystemUI/res/layout-land/status_bar_recent_item.xml +++ b/packages/SystemUI/res/layout-land/status_bar_recent_item.xml @@ -23,7 +23,8 @@ android:layout_height="match_parent" android:layout_width="wrap_content" android:paddingLeft="@dimen/status_bar_recents_item_padding" - android:paddingRight="@dimen/status_bar_recents_item_padding"> + android:paddingRight="@dimen/status_bar_recents_item_padding" + android:importantForAccessibility="no"> <RelativeLayout android:id="@+id/recent_item" android:layout_gravity="center_vertical" @@ -75,6 +76,7 @@ android:singleLine="true" android:ellipsize="marquee" android:textColor="@color/status_bar_recents_app_label_color" + android:importantForAccessibility="no" /> <TextView android:id="@+id/app_description" diff --git a/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml b/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml index 8fdde92bde09..e940c859065d 100644 --- a/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml +++ b/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml @@ -41,7 +41,8 @@ android:fadingEdge="horizontal" android:scrollbars="none" android:layout_gravity="right" - android:fadingEdgeLength="@dimen/status_bar_recents_scroll_fading_edge_length"> + android:fadingEdgeLength="@dimen/status_bar_recents_scroll_fading_edge_length" + android:importantForAccessibility="no"> <LinearLayout android:id="@+id/recents_linear_layout" android:layout_width="wrap_content" diff --git a/packages/SystemUI/res/layout/status_bar_recent_item.xml b/packages/SystemUI/res/layout/status_bar_recent_item.xml index 50643abf61b1..fc247d64ed94 100644 --- a/packages/SystemUI/res/layout/status_bar_recent_item.xml +++ b/packages/SystemUI/res/layout/status_bar_recent_item.xml @@ -23,7 +23,8 @@ android:layout_height="wrap_content" android:layout_width="match_parent" android:paddingTop="@dimen/status_bar_recents_item_padding" - android:paddingBottom="@dimen/status_bar_recents_item_padding"> + android:paddingBottom="@dimen/status_bar_recents_item_padding" + android:importantForAccessibility="no"> <RelativeLayout android:id="@+id/recent_item" android:layout_gravity="center_horizontal" @@ -44,6 +45,7 @@ android:singleLine="true" android:ellipsize="marquee" android:textColor="@color/status_bar_recents_app_label_color" + android:importantForAccessibility="no" /> <FrameLayout android:id="@+id/app_thumbnail" android:layout_width="wrap_content" diff --git a/packages/SystemUI/res/layout/status_bar_recent_panel.xml b/packages/SystemUI/res/layout/status_bar_recent_panel.xml index 7335f8602ea5..12599f859d93 100644 --- a/packages/SystemUI/res/layout/status_bar_recent_panel.xml +++ b/packages/SystemUI/res/layout/status_bar_recent_panel.xml @@ -45,7 +45,8 @@ android:fadingEdgeLength="@dimen/status_bar_recents_scroll_fading_edge_length" android:layout_gravity="bottom|left" android:clipToPadding="false" - android:clipChildren="false"> + android:clipChildren="false" + android:importantForAccessibility="no"> <LinearLayout android:id="@+id/recents_linear_layout" android:layout_width="match_parent" diff --git a/packages/SystemUI/res/layout/system_bar_recent_item.xml b/packages/SystemUI/res/layout/system_bar_recent_item.xml index 7d639eccfd1e..b5f7da7bda8c 100644 --- a/packages/SystemUI/res/layout/system_bar_recent_item.xml +++ b/packages/SystemUI/res/layout/system_bar_recent_item.xml @@ -37,6 +37,7 @@ android:singleLine="true" android:ellipsize="marquee" android:textColor="@color/status_bar_recents_app_label_color" + android:importantForAccessibility="no" /> <FrameLayout android:id="@+id/app_thumbnail" diff --git a/packages/SystemUI/res/layout/system_bar_recent_panel.xml b/packages/SystemUI/res/layout/system_bar_recent_panel.xml index 3951bba7acd6..8afed2267548 100644 --- a/packages/SystemUI/res/layout/system_bar_recent_panel.xml +++ b/packages/SystemUI/res/layout/system_bar_recent_panel.xml @@ -49,7 +49,8 @@ android:fadingEdgeLength="20dip" android:layout_gravity="bottom|left" android:clipToPadding="false" - android:clipChildren="false"> + android:clipChildren="false" + android:importantForAccessibility="no"> <LinearLayout android:id="@+id/recents_linear_layout" android:layout_width="wrap_content" diff --git a/packages/SystemUI/res/values-af/strings.xml b/packages/SystemUI/res/values-af/strings.xml index e17505c41703..fe81191b4240 100644 --- a/packages/SystemUI/res/values-af/strings.xml +++ b/packages/SystemUI/res/values-af/strings.xml @@ -153,7 +153,7 @@ <string name="ethernet_label" msgid="7967563676324087464">"Ethernet"</string> <string name="quick_settings_airplane_mode_label" msgid="5510520633448831350">"Vliegtuigmodus"</string> <string name="quick_settings_battery_charging_label" msgid="490074774465309209">"Laai, <xliff:g id="NUMBER">%d</xliff:g><xliff:g id="PERCENT">%%</xliff:g>"</string> - <string name="quick_settings_battery_charged_label" msgid="8865413079414246081">"Gehef"</string> + <string name="quick_settings_battery_charged_label" msgid="8865413079414246081">"Gelaai"</string> <string name="quick_settings_bluetooth_label" msgid="6304190285170721401">"Bluetooth"</string> <string name="quick_settings_bluetooth_multiple_devices_label" msgid="3912245565613684735">"Bluetooth (<xliff:g id="NUMBER">%d</xliff:g> toestelle)"</string> <string name="quick_settings_bluetooth_off_label" msgid="8159652146149219937">"Bluetooth af"</string> diff --git a/packages/SystemUI/res/values-ca/strings.xml b/packages/SystemUI/res/values-ca/strings.xml index 16a412d3e5e7..7dcbabf100a6 100644 --- a/packages/SystemUI/res/values-ca/strings.xml +++ b/packages/SystemUI/res/values-ca/strings.xml @@ -173,7 +173,7 @@ <string name="quick_settings_wifi_label" msgid="9135344704899546041">"Wi-Fi"</string> <string name="quick_settings_wifi_not_connected" msgid="7171904845345573431">"Desconnectat"</string> <string name="quick_settings_wifi_no_network" msgid="2221993077220856376">"No hi ha cap xarxa"</string> - <string name="quick_settings_wifi_off_label" msgid="7558778100843885864">"Wi-Fi desconnectat"</string> + <string name="quick_settings_wifi_off_label" msgid="7558778100843885864">"Wi-Fi desconnectada"</string> <string name="quick_settings_wifi_display_label" msgid="6893592964463624333">"Pantalla Wi-Fi"</string> <string name="quick_settings_wifi_display_no_connection_label" msgid="7834964244709912066">"No hi ha cap connexió amb una pantalla Wi-Fi"</string> <string name="quick_settings_brightness_dialog_title" msgid="8599674057673605368">"Brillantor"</string> diff --git a/packages/SystemUI/res/values-da/strings.xml b/packages/SystemUI/res/values-da/strings.xml index fde9916be4cd..e2f0d446ff67 100644 --- a/packages/SystemUI/res/values-da/strings.xml +++ b/packages/SystemUI/res/values-da/strings.xml @@ -168,17 +168,12 @@ <string name="quick_settings_settings_label" msgid="5326556592578065401">"Indstillinger"</string> <string name="quick_settings_time_label" msgid="4635969182239736408">"Tid"</string> <string name="quick_settings_user_label" msgid="5238995632130897840">"Mig"</string> - <!-- no translation found for quick_settings_wifi_label (9135344704899546041) --> - <skip /> - <!-- no translation found for quick_settings_wifi_not_connected (7171904845345573431) --> - <skip /> + <string name="quick_settings_wifi_label" msgid="9135344704899546041">"Wi-Fi"</string> + <string name="quick_settings_wifi_not_connected" msgid="7171904845345573431">"Ikke forbundet"</string> <string name="quick_settings_wifi_no_network" msgid="2221993077220856376">"Intet netværk"</string> - <!-- no translation found for quick_settings_wifi_off_label (7558778100843885864) --> - <skip /> - <!-- no translation found for quick_settings_wifi_display_label (6893592964463624333) --> - <skip /> - <!-- no translation found for quick_settings_wifi_display_no_connection_label (7834964244709912066) --> - <skip /> + <string name="quick_settings_wifi_off_label" msgid="7558778100843885864">"Wi-Fi slået fra"</string> + <string name="quick_settings_wifi_display_label" msgid="6893592964463624333">"Wi-Fi Display"</string> + <string name="quick_settings_wifi_display_no_connection_label" msgid="7834964244709912066">"Ingen forbindelse til Wi-Fi Display"</string> <string name="quick_settings_brightness_dialog_title" msgid="8599674057673605368">"Lysstyrke"</string> <string name="quick_settings_brightness_dialog_auto_brightness_label" msgid="5064982743784071218">"AUTO"</string> </resources> diff --git a/packages/SystemUI/res/values-es-rUS/strings.xml b/packages/SystemUI/res/values-es-rUS/strings.xml index 756f5e39c1d1..1bccbbc60815 100644 --- a/packages/SystemUI/res/values-es-rUS/strings.xml +++ b/packages/SystemUI/res/values-es-rUS/strings.xml @@ -154,8 +154,8 @@ <string name="start_dreams" msgid="870400522982252717">"Iniciar Dreams"</string> <string name="ethernet_label" msgid="7967563676324087464">"Ethernet"</string> <string name="quick_settings_airplane_mode_label" msgid="5510520633448831350">"Modo de avión"</string> - <string name="quick_settings_battery_charging_label" msgid="490074774465309209">"Cargando <xliff:g id="NUMBER">%d</xliff:g><xliff:g id="PERCENT">%%</xliff:g>"</string> - <string name="quick_settings_battery_charged_label" msgid="8865413079414246081">"Cobrado"</string> + <string name="quick_settings_battery_charging_label" msgid="490074774465309209">"Cargando (<xliff:g id="NUMBER">%d</xliff:g><xliff:g id="PERCENT">%%</xliff:g>)"</string> + <string name="quick_settings_battery_charged_label" msgid="8865413079414246081">"Cargada"</string> <string name="quick_settings_bluetooth_label" msgid="6304190285170721401">"Bluetooth"</string> <string name="quick_settings_bluetooth_multiple_devices_label" msgid="3912245565613684735">"Bluetooth (<xliff:g id="NUMBER">%d</xliff:g> dispositivos)"</string> <string name="quick_settings_bluetooth_off_label" msgid="8159652146149219937">"Bluetooth desactivado"</string> diff --git a/packages/SystemUI/res/values-et/strings.xml b/packages/SystemUI/res/values-et/strings.xml index 8113e8dc7504..ce1c578c5944 100644 --- a/packages/SystemUI/res/values-et/strings.xml +++ b/packages/SystemUI/res/values-et/strings.xml @@ -172,8 +172,8 @@ <string name="quick_settings_wifi_not_connected" msgid="7171904845345573431">"Ühendus puudub"</string> <string name="quick_settings_wifi_no_network" msgid="2221993077220856376">"Võrku pole"</string> <string name="quick_settings_wifi_off_label" msgid="7558778100843885864">"WiFi-ühendus on väljas"</string> - <string name="quick_settings_wifi_display_label" msgid="6893592964463624333">"WiFi kuva"</string> - <string name="quick_settings_wifi_display_no_connection_label" msgid="7834964244709912066">"WiFi-ühenduse puudumise kuva"</string> + <string name="quick_settings_wifi_display_label" msgid="6893592964463624333">"WiFi-ekraan"</string> + <string name="quick_settings_wifi_display_no_connection_label" msgid="7834964244709912066">"WiFi-ekraani ühendus puudub"</string> <string name="quick_settings_brightness_dialog_title" msgid="8599674057673605368">"Heledus"</string> <string name="quick_settings_brightness_dialog_auto_brightness_label" msgid="5064982743784071218">"AUTOMAATNE"</string> </resources> diff --git a/packages/SystemUI/res/values-nb/strings.xml b/packages/SystemUI/res/values-nb/strings.xml index bbf3aed319dc..f74383e72c33 100644 --- a/packages/SystemUI/res/values-nb/strings.xml +++ b/packages/SystemUI/res/values-nb/strings.xml @@ -168,17 +168,12 @@ <string name="quick_settings_settings_label" msgid="5326556592578065401">"Innstillinger"</string> <string name="quick_settings_time_label" msgid="4635969182239736408">"Tidspunkt"</string> <string name="quick_settings_user_label" msgid="5238995632130897840">"Meg"</string> - <!-- no translation found for quick_settings_wifi_label (9135344704899546041) --> - <skip /> - <!-- no translation found for quick_settings_wifi_not_connected (7171904845345573431) --> - <skip /> + <string name="quick_settings_wifi_label" msgid="9135344704899546041">"Wi-Fi"</string> + <string name="quick_settings_wifi_not_connected" msgid="7171904845345573431">"Ikke tilkoblet"</string> <string name="quick_settings_wifi_no_network" msgid="2221993077220856376">"Ingen nettverk"</string> - <!-- no translation found for quick_settings_wifi_off_label (7558778100843885864) --> - <skip /> - <!-- no translation found for quick_settings_wifi_display_label (6893592964463624333) --> - <skip /> - <!-- no translation found for quick_settings_wifi_display_no_connection_label (7834964244709912066) --> - <skip /> + <string name="quick_settings_wifi_off_label" msgid="7558778100843885864">"Wi-Fi er av"</string> + <string name="quick_settings_wifi_display_label" msgid="6893592964463624333">"Wi-Fi-skjerm"</string> + <string name="quick_settings_wifi_display_no_connection_label" msgid="7834964244709912066">"Ingen tilkobling til Wi-Fi-skjermen"</string> <string name="quick_settings_brightness_dialog_title" msgid="8599674057673605368">"Lysstyrke"</string> <string name="quick_settings_brightness_dialog_auto_brightness_label" msgid="5064982743784071218">"AUTO"</string> </resources> diff --git a/packages/SystemUI/res/values-pt/strings.xml b/packages/SystemUI/res/values-pt/strings.xml index 377a6170d12d..8730f80cda57 100644 --- a/packages/SystemUI/res/values-pt/strings.xml +++ b/packages/SystemUI/res/values-pt/strings.xml @@ -170,17 +170,12 @@ <string name="quick_settings_settings_label" msgid="5326556592578065401">"Configurações"</string> <string name="quick_settings_time_label" msgid="4635969182239736408">"Hora"</string> <string name="quick_settings_user_label" msgid="5238995632130897840">"Eu"</string> - <!-- no translation found for quick_settings_wifi_label (9135344704899546041) --> - <skip /> - <!-- no translation found for quick_settings_wifi_not_connected (7171904845345573431) --> - <skip /> + <string name="quick_settings_wifi_label" msgid="9135344704899546041">"Wi-Fi"</string> + <string name="quick_settings_wifi_not_connected" msgid="7171904845345573431">"Não conectado"</string> <string name="quick_settings_wifi_no_network" msgid="2221993077220856376">"Sem rede"</string> - <!-- no translation found for quick_settings_wifi_off_label (7558778100843885864) --> - <skip /> - <!-- no translation found for quick_settings_wifi_display_label (6893592964463624333) --> - <skip /> - <!-- no translation found for quick_settings_wifi_display_no_connection_label (7834964244709912066) --> - <skip /> + <string name="quick_settings_wifi_off_label" msgid="7558778100843885864">"Wi-Fi desligado"</string> + <string name="quick_settings_wifi_display_label" msgid="6893592964463624333">"Wi-Fi Display"</string> + <string name="quick_settings_wifi_display_no_connection_label" msgid="7834964244709912066">"Sem conexão Wi-Fi Display"</string> <string name="quick_settings_brightness_dialog_title" msgid="8599674057673605368">"Brilho"</string> <string name="quick_settings_brightness_dialog_auto_brightness_label" msgid="5064982743784071218">"AUTO"</string> </resources> diff --git a/packages/SystemUI/res/values-ru/strings.xml b/packages/SystemUI/res/values-ru/strings.xml index 69ac9bcfd96a..8da1e80c9470 100644 --- a/packages/SystemUI/res/values-ru/strings.xml +++ b/packages/SystemUI/res/values-ru/strings.xml @@ -170,17 +170,12 @@ <string name="quick_settings_settings_label" msgid="5326556592578065401">"Настройки"</string> <string name="quick_settings_time_label" msgid="4635969182239736408">"Время"</string> <string name="quick_settings_user_label" msgid="5238995632130897840">"Пользователь"</string> - <!-- no translation found for quick_settings_wifi_label (9135344704899546041) --> - <skip /> - <!-- no translation found for quick_settings_wifi_not_connected (7171904845345573431) --> - <skip /> + <string name="quick_settings_wifi_label" msgid="9135344704899546041">"Wi-Fi"</string> + <string name="quick_settings_wifi_not_connected" msgid="7171904845345573431">"Нет соединения"</string> <string name="quick_settings_wifi_no_network" msgid="2221993077220856376">"Нет сети"</string> - <!-- no translation found for quick_settings_wifi_off_label (7558778100843885864) --> - <skip /> - <!-- no translation found for quick_settings_wifi_display_label (6893592964463624333) --> - <skip /> - <!-- no translation found for quick_settings_wifi_display_no_connection_label (7834964244709912066) --> - <skip /> + <string name="quick_settings_wifi_off_label" msgid="7558778100843885864">"Wi-Fi выкл."</string> + <string name="quick_settings_wifi_display_label" msgid="6893592964463624333">"Проектор вкл."</string> + <string name="quick_settings_wifi_display_no_connection_label" msgid="7834964244709912066">"Проектор выкл."</string> <string name="quick_settings_brightness_dialog_title" msgid="8599674057673605368">"Яркость"</string> <string name="quick_settings_brightness_dialog_auto_brightness_label" msgid="5064982743784071218">"АВТОНАСТРОЙКА"</string> </resources> diff --git a/packages/SystemUI/res/values-sv/strings.xml b/packages/SystemUI/res/values-sv/strings.xml index 8d7e8c4997e8..728d61f0f484 100644 --- a/packages/SystemUI/res/values-sv/strings.xml +++ b/packages/SystemUI/res/values-sv/strings.xml @@ -168,17 +168,12 @@ <string name="quick_settings_settings_label" msgid="5326556592578065401">"Inställningar"</string> <string name="quick_settings_time_label" msgid="4635969182239736408">"Tid"</string> <string name="quick_settings_user_label" msgid="5238995632130897840">"Jag"</string> - <!-- no translation found for quick_settings_wifi_label (9135344704899546041) --> - <skip /> - <!-- no translation found for quick_settings_wifi_not_connected (7171904845345573431) --> - <skip /> + <string name="quick_settings_wifi_label" msgid="9135344704899546041">"Wi-Fi"</string> + <string name="quick_settings_wifi_not_connected" msgid="7171904845345573431">"Ej ansluten"</string> <string name="quick_settings_wifi_no_network" msgid="2221993077220856376">"Inget nätverk"</string> - <!-- no translation found for quick_settings_wifi_off_label (7558778100843885864) --> - <skip /> - <!-- no translation found for quick_settings_wifi_display_label (6893592964463624333) --> - <skip /> - <!-- no translation found for quick_settings_wifi_display_no_connection_label (7834964244709912066) --> - <skip /> + <string name="quick_settings_wifi_off_label" msgid="7558778100843885864">"Wi-Fi är inaktiverat"</string> + <string name="quick_settings_wifi_display_label" msgid="6893592964463624333">"Wi-Fi visas"</string> + <string name="quick_settings_wifi_display_no_connection_label" msgid="7834964244709912066">"Ingen Wi-Fi-anslutning visas"</string> <string name="quick_settings_brightness_dialog_title" msgid="8599674057673605368">"Ljusstyrka"</string> <string name="quick_settings_brightness_dialog_auto_brightness_label" msgid="5064982743784071218">"AUTO"</string> </resources> diff --git a/packages/SystemUI/res/values-zh-rCN/strings.xml b/packages/SystemUI/res/values-zh-rCN/strings.xml index a743c9e41146..faa7ab720af6 100644 --- a/packages/SystemUI/res/values-zh-rCN/strings.xml +++ b/packages/SystemUI/res/values-zh-rCN/strings.xml @@ -173,7 +173,7 @@ <string name="quick_settings_wifi_label" msgid="9135344704899546041">"Wi-Fi"</string> <string name="quick_settings_wifi_not_connected" msgid="7171904845345573431">"未连接"</string> <string name="quick_settings_wifi_no_network" msgid="2221993077220856376">"无网络"</string> - <string name="quick_settings_wifi_off_label" msgid="7558778100843885864">"已关闭 Wi-Fi"</string> + <string name="quick_settings_wifi_off_label" msgid="7558778100843885864">"Wi-Fi 已关闭"</string> <string name="quick_settings_wifi_display_label" msgid="6893592964463624333">"Wi-Fi 显示设备"</string> <string name="quick_settings_wifi_display_no_connection_label" msgid="7834964244709912066">"无 Wi-Fi 显示设备连接"</string> <string name="quick_settings_brightness_dialog_title" msgid="8599674057673605368">"亮度"</string> diff --git a/packages/SystemUI/res/values-zu/strings.xml b/packages/SystemUI/res/values-zu/strings.xml index 64a36999b82a..6dbdcc758f00 100644 --- a/packages/SystemUI/res/values-zu/strings.xml +++ b/packages/SystemUI/res/values-zu/strings.xml @@ -172,7 +172,7 @@ <string name="quick_settings_wifi_not_connected" msgid="7171904845345573431">"Akuxhunyiwe"</string> <string name="quick_settings_wifi_no_network" msgid="2221993077220856376">"Ayikho inethiwekhi"</string> <string name="quick_settings_wifi_off_label" msgid="7558778100843885864">"I-Wi-Fi icimile"</string> - <string name="quick_settings_wifi_display_label" msgid="6893592964463624333">"Ukusboniswa kwe-Wi-"</string> + <string name="quick_settings_wifi_display_label" msgid="6893592964463624333">"Ukuboniswa kwe-Wi-"</string> <string name="quick_settings_wifi_display_no_connection_label" msgid="7834964244709912066">"Alukho uxhumo lokubonisa le-Wi-Fi"</string> <string name="quick_settings_brightness_dialog_title" msgid="8599674057673605368">"Ukugqama"</string> <string name="quick_settings_brightness_dialog_auto_brightness_label" msgid="5064982743784071218">"OKUZENZAKALELAYO"</string> diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 58f749a4ade0..2b74f5642bd0 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -399,7 +399,7 @@ <string name="jelly_bean_dream_name">BeanFlinger</string> <!-- Name of the launcher shortcut icon that allows dreams to be started immediately [CHAR LIMIT=20] --> - <string name="start_dreams">Start dreams</string> + <string name="start_dreams">Sleep Now</string> <!-- Textual description of Ethernet connections --> <string name="ethernet_label">Ethernet</string> diff --git a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java index 0671e44b75b6..a98c4dcefbc7 100644 --- a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java +++ b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java @@ -261,6 +261,19 @@ public class ImageWallpaper extends WallpaperService { } } + @Override + public void onSurfaceRedrawNeeded(SurfaceHolder holder) { + if (DEBUG) { + Log.d(TAG, "onSurfaceRedrawNeeded:"); + } + super.onSurfaceRedrawNeeded(holder); + + synchronized (mLock) { + mRedrawNeeded = true; + drawFrameLocked(); + } + } + void drawFrameLocked() { if (!mVisible) { if (DEBUG) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 3fea0a01469f..12e749dc5ba0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -1376,12 +1376,34 @@ public class PhoneStatusBar extends BaseStatusBar { private void setStatusBarLowProfile(boolean lightsOut) { if (mLightsOutAnimation == null) { - mLightsOutAnimation = ObjectAnimator.ofFloat(mStatusBarContents, View.ALPHA, 0); - mLightsOutAnimation.setDuration(750); - - mLightsOnAnimation = new AnimatorSet(); - mLightsOnAnimation = ObjectAnimator.ofFloat(mStatusBarContents, View.ALPHA, 1); - mLightsOnAnimation.setDuration(250); + final View notifications = mStatusBarView.findViewById(R.id.notification_icon_area); + final View systemIcons = mStatusBarView.findViewById(R.id.statusIcons); + final View signal = mStatusBarView.findViewById(R.id.signal_cluster); + final View battery = mStatusBarView.findViewById(R.id.battery); + final View clock = mStatusBarView.findViewById(R.id.clock); + + final AnimatorSet lightsOutAnim = new AnimatorSet(); + lightsOutAnim.playTogether( + ObjectAnimator.ofFloat(notifications, View.ALPHA, 0), + ObjectAnimator.ofFloat(systemIcons, View.ALPHA, 0), + ObjectAnimator.ofFloat(signal, View.ALPHA, 0), + ObjectAnimator.ofFloat(battery, View.ALPHA, 0.5f), + ObjectAnimator.ofFloat(clock, View.ALPHA, 0.5f) + ); + lightsOutAnim.setDuration(750); + + final AnimatorSet lightsOnAnim = new AnimatorSet(); + lightsOnAnim.playTogether( + ObjectAnimator.ofFloat(notifications, View.ALPHA, 1), + ObjectAnimator.ofFloat(systemIcons, View.ALPHA, 1), + ObjectAnimator.ofFloat(signal, View.ALPHA, 1), + ObjectAnimator.ofFloat(battery, View.ALPHA, 1), + ObjectAnimator.ofFloat(clock, View.ALPHA, 1) + ); + lightsOnAnim.setDuration(250); + + mLightsOutAnimation = lightsOutAnim; + mLightsOnAnimation = lightsOnAnim; } mLightsOutAnimation.cancel(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java index f3c2df16c77b..d63d5177434e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java @@ -71,6 +71,7 @@ import java.util.ArrayList; * */ class QuickSettings { + public static final boolean SHOW_IME_TILE = false; private Context mContext; private PanelBar mBar; @@ -274,12 +275,7 @@ class QuickSettings { timeTile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - // TODO: Jump into the clock application - Intent intent = new Intent(); - intent.setComponent(new ComponentName( - "com.google.android.deskclock", - "com.android.deskclock.DeskClock")); - startSettingsActivity(intent); + startSettingsActivity(android.provider.Settings.ACTION_DATE_SETTINGS); } }); mModel.addTimeTile(timeTile, new QuickSettingsModel.RefreshCallback() { @@ -566,32 +562,34 @@ class QuickSettings { }); parent.addView(wifiDisplayTile); - // IME - QuickSettingsTileView imeTile = (QuickSettingsTileView) - inflater.inflate(R.layout.quick_settings_tile, parent, false); - imeTile.setContent(R.layout.quick_settings_tile_ime, inflater); - imeTile.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - try { - mBar.collapseAllPanels(true); - Intent intent = new Intent(Settings.ACTION_SHOW_INPUT_METHOD_PICKER); - PendingIntent pendingIntent = PendingIntent.getBroadcast(mContext, 0, intent, 0); - pendingIntent.send(); - } catch (Exception e) {} - } - }); - mModel.addImeTile(imeTile, new QuickSettingsModel.RefreshCallback() { - @Override - public void refreshView(QuickSettingsTileView view, State state) { - TextView tv = (TextView) view.findViewById(R.id.ime_textview); - if (state.label != null) { - tv.setText(state.label); + if (SHOW_IME_TILE) { + // IME + QuickSettingsTileView imeTile = (QuickSettingsTileView) + inflater.inflate(R.layout.quick_settings_tile, parent, false); + imeTile.setContent(R.layout.quick_settings_tile_ime, inflater); + imeTile.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + try { + mBar.collapseAllPanels(true); + Intent intent = new Intent(Settings.ACTION_SHOW_INPUT_METHOD_PICKER); + PendingIntent pendingIntent = PendingIntent.getBroadcast(mContext, 0, intent, 0); + pendingIntent.send(); + } catch (Exception e) {} } - view.setVisibility(state.enabled ? View.VISIBLE : View.GONE); - } - }); - parent.addView(imeTile); + }); + mModel.addImeTile(imeTile, new QuickSettingsModel.RefreshCallback() { + @Override + public void refreshView(QuickSettingsTileView view, State state) { + TextView tv = (TextView) view.findViewById(R.id.ime_textview); + if (state.label != null) { + tv.setText(state.label); + } + view.setVisibility(state.enabled ? View.VISIBLE : View.GONE); + } + }); + parent.addView(imeTile); + } // Bug reports QuickSettingsTileView bugreportTile = (QuickSettingsTileView) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java index 5adfeb1b6a77..6b9a32108186 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java @@ -184,7 +184,7 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, private State mLocationState = new State(); private QuickSettingsTileView mImeTile; - private RefreshCallback mImeCallback; + private RefreshCallback mImeCallback = null; private State mImeState = new State(); private QuickSettingsTileView mRotationLockTile; @@ -551,7 +551,9 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, mImeState.enabled = (visible && needsToShowImeSwitchOngoingNotification(imm)); mImeState.label = getCurrentInputMethodName(mContext, mContext.getContentResolver(), imm, imis, mContext.getPackageManager()); - mImeCallback.refreshView(mImeTile, mImeState); + if (mImeCallback != null) { + mImeCallback.refreshView(mImeTile, mImeState); + } } private static String getCurrentInputMethodName(Context context, ContentResolver resolver, InputMethodManager imm, List<InputMethodInfo> imis, PackageManager pm) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationController.java index f864d041c24b..776cf368d6d9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationController.java @@ -97,7 +97,6 @@ public class LocationController extends BroadcastReceiver { } try { - // XXX WHAT TO DO ABOUT MULTI-USER? if (visible) { Intent gpsIntent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); gpsIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); @@ -126,7 +125,7 @@ public class LocationController extends BroadcastReceiver { GPS_NOTIFICATION_ID, n, idOut, - UserHandle.USER_CURRENT); + UserHandle.USER_ALL); for (LocationGpsStateChangeCallback cb : mChangeCallbacks) { cb.onLocationGpsStateChanged(true, text); @@ -134,7 +133,7 @@ public class LocationController extends BroadcastReceiver { } else { mNotificationService.cancelNotificationWithTag( mContext.getPackageName(), null, - GPS_NOTIFICATION_ID, UserHandle.USER_CURRENT); + GPS_NOTIFICATION_ID, UserHandle.USER_ALL); for (LocationGpsStateChangeCallback cb : mChangeCallbacks) { cb.onLocationGpsStateChanged(false, null); diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index c3bd9881c692..93f2aa55a481 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -730,14 +730,15 @@ public class PhoneWindowManager implements WindowManagerPolicy { public void run() { // The context isn't read if (mLongPressOnPowerBehavior < 0) { - if (FactoryTest.isLongPressOnPowerOffEnabled()) { - mLongPressOnPowerBehavior = LONG_PRESS_POWER_SHUT_OFF_NO_CONFIRM; - } else { - mLongPressOnPowerBehavior = mContext.getResources().getInteger( - com.android.internal.R.integer.config_longPressOnPowerBehavior); - } + mLongPressOnPowerBehavior = mContext.getResources().getInteger( + com.android.internal.R.integer.config_longPressOnPowerBehavior); + } + int resolvedBehavior = mLongPressOnPowerBehavior; + if (FactoryTest.isLongPressOnPowerOffEnabled()) { + resolvedBehavior = LONG_PRESS_POWER_SHUT_OFF_NO_CONFIRM; } - switch (mLongPressOnPowerBehavior) { + + switch (resolvedBehavior) { case LONG_PRESS_POWER_NOTHING: break; case LONG_PRESS_POWER_GLOBAL_ACTIONS: @@ -753,8 +754,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { mPowerKeyHandled = true; performHapticFeedbackLw(null, HapticFeedbackConstants.LONG_PRESS, false); sendCloseSystemWindows(SYSTEM_DIALOG_REASON_GLOBAL_ACTIONS); - mWindowManagerFuncs.shutdown( - mLongPressOnPowerBehavior == LONG_PRESS_POWER_SHUT_OFF); + mWindowManagerFuncs.shutdown(resolvedBehavior == LONG_PRESS_POWER_SHUT_OFF); break; } } @@ -775,7 +775,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (keyguardShowing) { // since it took two seconds of long press to bring this up, // poke the wake lock so they have some time to see the dialog. - mKeyguardMediator.pokeWakelock(); + mKeyguardMediator.userActivity(); } } @@ -1140,6 +1140,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN; + if (ActivityManager.isHighEndGfx()) { + lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; + lp.privateFlags |= + WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED; + } lp.format = PixelFormat.TRANSLUCENT; lp.setTitle("PointerLocation"); WindowManager wm = (WindowManager) @@ -4298,6 +4303,13 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (mKeyguardMediator != null) { mKeyguardMediator.setCurrentUser(newUserId); } + if (mStatusBarService != null) { + try { + mStatusBarService.setCurrentUser(newUserId); + } catch (RemoteException e) { + // oh well + } + } } @Override diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java index 14633c43c4c6..a7fc1a165490 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java @@ -166,6 +166,7 @@ public class KeyguardHostView extends KeyguardViewBase { // from AudioManager KeyguardHostView.this.addView(mTransportControl); mTransportControl.setVisibility(View.GONE); + showAppropriateWidgetPage(); } } @@ -178,6 +179,7 @@ public class KeyguardHostView extends KeyguardViewBase { mTransportControl.setVisibility(View.VISIBLE); // Once shown, leave it showing mSticky = true; + showAppropriateWidgetPage(); } } }); @@ -234,7 +236,7 @@ public class KeyguardHostView extends KeyguardViewBase { public void userActivity(long timeout) { if (mViewMediatorCallback != null) { - mViewMediatorCallback.pokeWakelock(timeout); + mViewMediatorCallback.userActivity(timeout); } } @@ -638,7 +640,7 @@ public class KeyguardHostView extends KeyguardViewBase { if (DEBUG) Log.d(TAG, "poking wake lock immediately"); } if (mViewMediatorCallback != null) { - mViewMediatorCallback.pokeWakelock(); + mViewMediatorCallback.wakeUp(); } } @@ -736,6 +738,15 @@ public class KeyguardHostView extends KeyguardViewBase { addWidget(widgets[i]); } } + showAppropriateWidgetPage(); + } + + private void showAppropriateWidgetPage() { + int page = mAppWidgetContainer.indexOfChild(findViewById(R.id.keyguard_status_view)); + if (mAppWidgetContainer.indexOfChild(mTransportControl) != -1) { + page = mAppWidgetContainer.indexOfChild(mTransportControl); + } + mAppWidgetContainer.setCurrentPage(page); } private void inflateAndAddUserSelectorWidgetIfNecessary() { diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSelectorView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSelectorView.java index 8714276b5541..1977b52921c6 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSelectorView.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSelectorView.java @@ -76,6 +76,7 @@ public class KeyguardSelectorView extends LinearLayout implements KeyguardSecuri case com.android.internal.R.drawable.ic_lockscreen_unlock_phantom: case com.android.internal.R.drawable.ic_lockscreen_unlock: + mCallback.userActivity(0); mCallback.dismiss(false); break; } @@ -86,6 +87,7 @@ public class KeyguardSelectorView extends LinearLayout implements KeyguardSecuri } public void onGrabbed(View v, int handle) { + mCallback.userActivity(0); doTransition(mFadeView, 0.0f); } diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java index 1abcc106ae73..a3a9c5f56819 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java @@ -155,6 +155,8 @@ public class KeyguardViewManager { WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED; } lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SET_NEEDS_MENU_KEY; + lp.inputFeatures |= WindowManager.LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY; + lp.userActivityTimeout = KeyguardViewMediator.AWAKE_INTERVAL_DEFAULT_MS; lp.setTitle(isActivity ? "KeyguardMock" : "Keyguard"); mWindowLayoutParams = lp; mViewManager.addView(mKeyguardHost, lp); diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java index 212a6bb72f27..514ada63b7f8 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java @@ -104,7 +104,6 @@ public class KeyguardViewMediator { "com.android.internal.policy.impl.PhoneWindowManager.DELAYED_KEYGUARD"; // used for handler messages - private static final int TIMEOUT = 1; private static final int SHOW = 2; private static final int HIDE = 3; private static final int RESET = 4; @@ -167,12 +166,6 @@ public class KeyguardViewMediator { private UserManager mUserManager; /** - * Used to keep the device awake while the keyguard is showing, i.e for - * calls to {@link #pokeWakelock()} - */ - private PowerManager.WakeLock mWakeLock; - - /** * Used to keep the device awake while to ensure the keyguard finishes opening before * we sleep. */ @@ -215,8 +208,6 @@ public class KeyguardViewMediator { */ private int mDelayedShowingSequence; - private int mWakelockSequence; - /** * If the user has disabled the keyguard, then requests to exit, this is * how we'll ultimately let them know whether it was successful. We use this @@ -262,15 +253,16 @@ public class KeyguardViewMediator { public interface ViewMediatorCallback { /** - * Request the wakelock to be poked for the default amount of time. + * Wake the device immediately. */ - void pokeWakelock(); + void wakeUp(); /** - * Request the wakelock to be poked for a specific amount of time. + * Reports user activity and requests that the screen stay on for the specified + * amount of time. * @param millis The amount of time in millis. */ - void pokeWakelock(long millis); + void userActivity(long millis); /** * Report that the keyguard is done. @@ -402,12 +394,12 @@ public class KeyguardViewMediator { }; ViewMediatorCallback mViewMediatorCallback = new ViewMediatorCallback() { - public void pokeWakelock() { - KeyguardViewMediator.this.pokeWakelock(); + public void wakeUp() { + KeyguardViewMediator.this.wakeUp(); } - public void pokeWakelock(long holdMs) { - KeyguardViewMediator.this.pokeWakelock(holdMs); + public void userActivity(long holdMs) { + KeyguardViewMediator.this.userActivity(holdMs); } public void keyguardDone(boolean authenticated) { @@ -424,19 +416,18 @@ public class KeyguardViewMediator { } }; - public void pokeWakelock() { - pokeWakelock(AWAKE_INTERVAL_DEFAULT_MS); + public void wakeUp() { + mPM.wakeUp(SystemClock.uptimeMillis()); } - public void pokeWakelock(long holdMs) { - synchronized (this) { - if (DBG_WAKE) Log.d(TAG, "pokeWakelock(" + holdMs + ")"); - mWakeLock.acquire(); - mHandler.removeMessages(TIMEOUT); - mWakelockSequence++; - Message msg = mHandler.obtainMessage(TIMEOUT, mWakelockSequence, 0); - mHandler.sendMessageDelayed(msg, holdMs); - } + public void userActivity() { + userActivity(AWAKE_INTERVAL_DEFAULT_MS); + } + + public void userActivity(long holdMs) { + // We ignore the hold time. Eventually we should remove it. + // Instead, the keyguard window has an explicit user activity timeout set on it. + mPM.userActivity(SystemClock.uptimeMillis(), false); } /** @@ -448,9 +439,6 @@ public class KeyguardViewMediator { mContext = context; mPM = (PowerManager) context.getSystemService(Context.POWER_SERVICE); mUserManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE); - mWakeLock = mPM.newWakeLock( - PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "keyguard"); - mWakeLock.setReferenceCounted(false); mShowKeyguardWakeLock = mPM.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "show keyguard"); mShowKeyguardWakeLock.setReferenceCounted(false); @@ -482,19 +470,19 @@ public class KeyguardViewMediator { mScreenOn = mPM.isScreenOn(); mLockSounds = new SoundPool(1, AudioManager.STREAM_SYSTEM, 0); - String soundPath = Settings.System.getString(cr, Settings.System.LOCK_SOUND); + String soundPath = Settings.Global.getString(cr, Settings.Global.LOCK_SOUND); if (soundPath != null) { mLockSoundId = mLockSounds.load(soundPath, 1); } if (soundPath == null || mLockSoundId == 0) { - if (DEBUG) Log.d(TAG, "failed to load sound from " + soundPath); + Log.w(TAG, "failed to load lock sound from " + soundPath); } - soundPath = Settings.System.getString(cr, Settings.System.UNLOCK_SOUND); + soundPath = Settings.Global.getString(cr, Settings.Global.UNLOCK_SOUND); if (soundPath != null) { mUnlockSoundId = mLockSounds.load(soundPath, 1); } if (soundPath == null || mUnlockSoundId == 0) { - if (DEBUG) Log.d(TAG, "failed to load sound from " + soundPath); + Log.w(TAG, "failed to load unlock sound from " + soundPath); } int lockSoundDefaultAttenuation = context.getResources().getInteger( com.android.internal.R.integer.config_lockSoundVolumeDb); @@ -737,7 +725,6 @@ public class KeyguardViewMediator { if (mHidden != isHidden) { mHidden = isHidden; updateActivityLockScreenState(); - adjustUserActivityLocked(); adjustStatusBarLocked(); } } @@ -1050,9 +1037,6 @@ public class KeyguardViewMediator { @Override public void handleMessage(Message msg) { switch (msg.what) { - case TIMEOUT: - handleTimeout(msg.arg1); - return ; case SHOW: handleShow(); return ; @@ -1103,9 +1087,8 @@ public class KeyguardViewMediator { if (DEBUG) Log.d(TAG, "handleKeyguardDone"); handleHide(); if (wakeup) { - mPM.wakeUp(SystemClock.uptimeMillis()); + wakeUp(); } - mWakeLock.release(); sendUserPresentBroadcast(); } @@ -1137,21 +1120,6 @@ public class KeyguardViewMediator { } } - /** - * Handles the message sent by {@link #pokeWakelock} - * @param seq used to determine if anything has changed since the message - * was sent. - * @see #TIMEOUT - */ - private void handleTimeout(int seq) { - synchronized (KeyguardViewMediator.this) { - if (DEBUG) Log.d(TAG, "handleTimeout"); - if (seq == mWakelockSequence) { - mWakeLock.release(); - } - } - } - private void playSounds(boolean locked) { // User feedback for keyguard. @@ -1200,8 +1168,8 @@ public class KeyguardViewMediator { mKeyguardViewManager.show(); mShowing = true; updateActivityLockScreenState(); - adjustUserActivityLocked(); adjustStatusBarLocked(); + userActivity(); try { ActivityManagerNative.getDefault().closeSystemDialogs("lock"); } catch (RemoteException e) { @@ -1235,23 +1203,10 @@ public class KeyguardViewMediator { mKeyguardViewManager.hide(); mShowing = false; updateActivityLockScreenState(); - adjustUserActivityLocked(); adjustStatusBarLocked(); } } - private void adjustUserActivityLocked() { - // disable user activity if we are shown and not hidden - if (DEBUG) Log.d(TAG, "adjustUserActivityLocked mShowing: " + mShowing + " mHidden: " + mHidden); - boolean enabled = !mShowing || mHidden; - // FIXME: Replace this with a new timeout control mechanism. - //mRealPowerManager.enableUserActivity(enabled); - if (!enabled && mScreenOn) { - // reinstate our short screen timeout policy - pokeWakelock(); - } - } - private void adjustStatusBarLocked() { if (mStatusBarManager == null) { mStatusBarManager = (StatusBarManager) @@ -1320,7 +1275,7 @@ public class KeyguardViewMediator { if (!mKeyguardViewManager.wakeWhenReadyTq(keyCode)) { // poke wakelock ourselves if keyguard is no longer active Log.w(TAG, "mKeyguardViewManager.wakeWhenReadyTq did not poke wake lock, so poke it ourselves"); - pokeWakelock(); + userActivity(); } /** @@ -1328,10 +1283,6 @@ public class KeyguardViewMediator { * release the handoff wakelock */ mWakeAndHandOff.release(); - - if (!mWakeLock.isHeld()) { - Log.w(TAG, "mWakeLock not held in mKeyguardViewManager.wakeWhenReadyTq"); - } } } diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetRegion.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetRegion.java index 34754e0c612e..f7f23c714528 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetRegion.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetRegion.java @@ -18,15 +18,17 @@ package com.android.internal.policy.impl.keyguard; import android.content.Context; import android.util.AttributeSet; import android.view.View; -import android.view.View.OnClickListener; +import android.view.ViewGroup; import android.widget.LinearLayout; import com.android.internal.R; +import com.android.internal.policy.impl.keyguard.PagedView.PageSwitchListener; -public class KeyguardWidgetRegion extends LinearLayout { +public class KeyguardWidgetRegion extends LinearLayout implements PageSwitchListener { KeyguardGlowStripView mLeftStrip; KeyguardGlowStripView mRightStrip; KeyguardWidgetPager mPager; + private int mPage = 0; public KeyguardWidgetRegion(Context context) { this(context, null, 0); @@ -46,6 +48,7 @@ public class KeyguardWidgetRegion extends LinearLayout { mLeftStrip = (KeyguardGlowStripView) findViewById(R.id.left_strip); mRightStrip = (KeyguardGlowStripView) findViewById(R.id.right_strip); mPager = (KeyguardWidgetPager) findViewById(R.id.app_widget_container); + mPager.setPageSwitchListener(this); setSoundEffectsEnabled(false); setOnClickListener(new OnClickListener() { @@ -57,7 +60,31 @@ public class KeyguardWidgetRegion extends LinearLayout { } public void showPagingFeedback() { - mLeftStrip.makeEmGo(); - mRightStrip.makeEmGo(); + if (mPage < mPager.getPageCount() - 1) { + mLeftStrip.makeEmGo(); + } + if (mPage > 0) { + mRightStrip.makeEmGo(); + } + } + + @Override + public void onPageSwitch(View newPage, int newPageIndex) { + mPage = newPageIndex; + + // If we're showing the default system status widget, then we want to hide the clock + boolean hideClock = false; + if ((newPage instanceof ViewGroup)) { + ViewGroup vg = (ViewGroup) newPage; + if (vg.getChildAt(0) instanceof KeyguardStatusView) { + hideClock = true; + } + } + + if (hideClock) { + setSystemUiVisibility(getSystemUiVisibility() | View.STATUS_BAR_DISABLE_CLOCK); + } else { + setSystemUiVisibility(getSystemUiVisibility() & ~View.STATUS_BAR_DISABLE_CLOCK); + } } } diff --git a/services/input/InputDispatcher.cpp b/services/input/InputDispatcher.cpp index be0cec9c397a..7862e172ea90 100644 --- a/services/input/InputDispatcher.cpp +++ b/services/input/InputDispatcher.cpp @@ -1716,6 +1716,16 @@ String8 InputDispatcher::getApplicationWindowLabelLocked( } void InputDispatcher::pokeUserActivityLocked(const EventEntry* eventEntry) { + if (mFocusedWindowHandle != NULL) { + const InputWindowInfo* info = mFocusedWindowHandle->getInfo(); + if (info->inputFeatures & InputWindowInfo::INPUT_FEATURE_DISABLE_USER_ACTIVITY) { +#if DEBUG_DISPATCH_CYCLE + ALOGD("Not poking user activity: disabled by window '%s'.", info->name.string()); +#endif + return; + } + } + int32_t eventType = USER_ACTIVITY_EVENT_OTHER; switch (eventEntry->type) { case EventEntry::TYPE_MOTION: { diff --git a/services/input/InputWindow.h b/services/input/InputWindow.h index 3118099a4311..7bd3af796e4f 100644 --- a/services/input/InputWindow.h +++ b/services/input/InputWindow.h @@ -110,6 +110,8 @@ struct InputWindowInfo { enum { INPUT_FEATURE_DISABLE_TOUCH_PAD_GESTURES = 0x00000001, + INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002, + INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004, }; sp<InputChannel> inputChannel; diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java index ec58e4378692..f06bf8e28e9e 100644 --- a/services/java/com/android/server/InputMethodManagerService.java +++ b/services/java/com/android/server/InputMethodManagerService.java @@ -900,14 +900,28 @@ public class InputMethodManagerService extends IInputMethodManager.Stub Slog.d(TAG, "--- calledFromForegroundUserOrSystemProcess ? " + "calling uid = " + uid + " system uid = " + Process.SYSTEM_UID + " calling userId = " + userId + ", foreground user id = " - + mSettings.getCurrentUserId()); + + mSettings.getCurrentUserId() + ", calling uid = " + Binder.getCallingPid()); } if (uid == Process.SYSTEM_UID || userId == mSettings.getCurrentUserId()) { return true; - } else { - Slog.w(TAG, "--- IPC called from background users. Ignore. \n" + getStackTrace()); - return false; } + + // Caveat: A process which has INTERACT_ACROSS_USERS_FULL gets results for the + // foreground user, not for the user of that process. Accordingly InputMethodManagerService + // must not manage background users' states in any functions. + // Note that privacy-sensitive IPCs, such as setInputMethod, are still securely guarded + // by a token. + if (mContext.checkCallingOrSelfPermission( + android.Manifest.permission.INTERACT_ACROSS_USERS_FULL) + == PackageManager.PERMISSION_GRANTED) { + if (DEBUG) { + Slog.d(TAG, "--- Access granted because the calling process has " + + "the INTERACT_ACROSS_USERS_FULL permission"); + } + return true; + } + Slog.w(TAG, "--- IPC called from background users. Ignore. \n" + getStackTrace()); + return false; } private boolean bindCurrentInputMethodService( @@ -1475,9 +1489,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub final CharSequence title = mRes.getText( com.android.internal.R.string.select_input_method); final CharSequence imiLabel = imi.loadLabel(pm); - if (DEBUG) { - Slog.d(TAG, "--- imiLabel = " + imiLabel); - } final CharSequence summary = mCurrentSubtype != null ? TextUtils.concat(mCurrentSubtype.getDisplayName(mContext, imi.getPackageName(), imi.getServiceInfo().applicationInfo), @@ -1488,15 +1499,22 @@ public class InputMethodManagerService extends IInputMethodManager.Stub mImeSwitcherNotification.setLatestEventInfo( mContext, title, summary, mImeSwitchPendingIntent); if (mNotificationManager != null) { - mNotificationManager.notify( + if (DEBUG) { + Slog.d(TAG, "--- show notification: label = " + imiLabel + + ", summary = " + summary); + } + mNotificationManager.notifyAsUser(null, com.android.internal.R.string.select_input_method, - mImeSwitcherNotification); + mImeSwitcherNotification, UserHandle.ALL); mNotificationShown = true; } } else { if (mNotificationShown && mNotificationManager != null) { - mNotificationManager.cancel( - com.android.internal.R.string.select_input_method); + if (DEBUG) { + Slog.d(TAG, "--- hide notification"); + } + mNotificationManager.cancelAsUser(null, + com.android.internal.R.string.select_input_method, UserHandle.ALL); mNotificationShown = false; } } diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java index a0c1552b4222..2197e3122269 100644 --- a/services/java/com/android/server/LocationManagerService.java +++ b/services/java/com/android/server/LocationManagerService.java @@ -17,9 +17,11 @@ package com.android.server; import android.app.PendingIntent; +import android.content.BroadcastReceiver; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; +import android.content.IntentFilter; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; @@ -171,6 +173,9 @@ public class LocationManagerService extends ILocationManager.Stub implements Run private final ArrayList<LocationProviderProxy> mProxyProviders = new ArrayList<LocationProviderProxy>(); + // current active user on the device - other users are denied location data + private int mCurrentUserId = UserHandle.USER_OWNER; + public LocationManagerService(Context context) { super(); mContext = context; @@ -224,10 +229,30 @@ public class LocationManagerService extends ILocationManager.Stub implements Run }); mPackageMonitor.register(mContext, Looper.myLooper(), true); + // listen for user change + IntentFilter intentFilter = new IntentFilter(); + intentFilter.addAction(Intent.ACTION_USER_SWITCHED); + + mContext.registerReceiverAsUser(new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + String action = intent.getAction(); + if (Intent.ACTION_USER_SWITCHED.equals(action)) { + switchUser(intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0)); + } + } + }, UserHandle.ALL, intentFilter, null, null); + updateProvidersLocked(); } private void loadProvidersLocked() { + // create a passive location provider, which is always enabled + PassiveProvider passiveProvider = new PassiveProvider(this); + addProviderLocked(passiveProvider); + mEnabledProviders.add(passiveProvider.getName()); + mPassiveProvider = passiveProvider; + if (GpsLocationProvider.isSupported()) { // Create a gps location provider GpsLocationProvider gpsProvider = new GpsLocationProvider(mContext, this); @@ -237,12 +262,6 @@ public class LocationManagerService extends ILocationManager.Stub implements Run mRealProviders.put(LocationManager.GPS_PROVIDER, gpsProvider); } - // create a passive location provider, which is always enabled - PassiveProvider passiveProvider = new PassiveProvider(this); - addProviderLocked(passiveProvider); - mEnabledProviders.add(passiveProvider.getName()); - mPassiveProvider = passiveProvider; - /* Load package name(s) containing location provider support. These packages can contain services implementing location providers: @@ -302,6 +321,19 @@ public class LocationManagerService extends ILocationManager.Stub implements Run } /** + * Called when the device's active user changes. + * @param userId the new active user's UserId + */ + private void switchUser(int userId) { + //Log.d("LocationManagerService", "switchUser(" + mCurrentUserId + " -> " + userId + ")"); // TODO: remove this + synchronized (mLock) { + // TODO: inform previous user's Receivers that they will no longer receive updates + mCurrentUserId = userId; + // TODO: inform new user's Receivers that they are back on the update train + } + } + + /** * A wrapper class holding either an ILocationListener or a PendingIntent to receive * location updates. */ diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java index 0312705f109d..c512bc184503 100644 --- a/services/java/com/android/server/MountService.java +++ b/services/java/com/android/server/MountService.java @@ -1577,9 +1577,16 @@ class MountService extends IMountService.Stub private void warnOnNotMounted() { final StorageVolume primary = getPrimaryPhysicalVolume(); - if (primary != null - && Environment.MEDIA_MOUNTED.equals(getVolumeState(primary.getPath()))) { - Slog.w(TAG, "getSecureContainerList() called when storage not mounted"); + if (primary != null) { + boolean mounted = false; + try { + mounted = Environment.MEDIA_MOUNTED.equals(getVolumeState(primary.getPath())); + } catch (IllegalStateException e) { + } + + if (!mounted) { + Slog.w(TAG, "getSecureContainerList() called when storage not mounted"); + } } } diff --git a/services/java/com/android/server/StatusBarManagerService.java b/services/java/com/android/server/StatusBarManagerService.java index 87b0eb313a7c..5d9441b842ef 100644 --- a/services/java/com/android/server/StatusBarManagerService.java +++ b/services/java/com/android/server/StatusBarManagerService.java @@ -64,7 +64,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub = new HashMap<IBinder,StatusBarNotification>(); // for disabling the status bar - ArrayList<DisableRecord> mDisableRecords = new ArrayList<DisableRecord>(); + final ArrayList<DisableRecord> mDisableRecords = new ArrayList<DisableRecord>(); IBinder mSysUiVisToken = new Binder(); int mDisabled = 0; @@ -75,15 +75,17 @@ public class StatusBarManagerService extends IStatusBarService.Stub int mImeWindowVis = 0; int mImeBackDisposition; IBinder mImeToken = null; + int mCurrentUserId; private class DisableRecord implements IBinder.DeathRecipient { + int userId; String pkg; int what; IBinder token; public void binderDied() { Slog.i(TAG, "binder died for pkg=" + pkg); - disable(0, token, pkg); + disableInternal(userId, 0, token, pkg); token.unlinkToDeath(this, 0); } } @@ -151,20 +153,24 @@ public class StatusBarManagerService extends IStatusBarService.Stub } public void disable(int what, IBinder token, String pkg) { + disableInternal(mCurrentUserId, what, token, pkg); + } + + private void disableInternal(int userId, int what, IBinder token, String pkg) { enforceStatusBar(); synchronized (mLock) { - disableLocked(what, token, pkg); + disableLocked(userId, what, token, pkg); } } - private void disableLocked(int what, IBinder token, String pkg) { + private void disableLocked(int userId, int what, IBinder token, String pkg) { // It's important that the the callback and the call to mBar get done // in the same order when multiple threads are calling this function // so they are paired correctly. The messages on the handler will be // handled in the order they were enqueued, but will be outside the lock. - manageDisableListLocked(what, token, pkg); - final int net = gatherDisableActionsLocked(); + manageDisableListLocked(userId, what, token, pkg); + final int net = gatherDisableActionsLocked(userId); if (net != mDisabled) { mDisabled = net; mHandler.post(new Runnable() { @@ -312,7 +318,10 @@ public class StatusBarManagerService extends IStatusBarService.Stub synchronized (mLock) { updateUiVisibilityLocked(vis, mask); - disableLocked(vis & StatusBarManager.DISABLE_MASK, mSysUiVisToken, + disableLocked( + mCurrentUserId, + vis & StatusBarManager.DISABLE_MASK, + mSysUiVisToken, "WindowManager.LayoutParams"); } } @@ -382,6 +391,12 @@ public class StatusBarManagerService extends IStatusBarService.Stub } } + @Override + public void setCurrentUser(int newUserId) { + if (SPEW) Slog.d(TAG, "Setting current user to user " + newUserId); + mCurrentUserId = newUserId; + } + private void enforceStatusBar() { mContext.enforceCallingOrSelfPermission(android.Manifest.permission.STATUS_BAR, "StatusBarManagerService"); @@ -417,7 +432,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub } } synchronized (mLock) { - switches[0] = gatherDisableActionsLocked(); + switches[0] = gatherDisableActionsLocked(mCurrentUserId); switches[1] = mSystemUiVisibility; switches[2] = mMenuVisible ? 1 : 0; switches[3] = mImeWindowVis; @@ -518,9 +533,10 @@ public class StatusBarManagerService extends IStatusBarService.Stub // ================================================================================ // lock on mDisableRecords - void manageDisableListLocked(int what, IBinder token, String pkg) { + void manageDisableListLocked(int userId, int what, IBinder token, String pkg) { if (SPEW) { - Slog.d(TAG, "manageDisableList what=0x" + Integer.toHexString(what) + " pkg=" + pkg); + Slog.d(TAG, "manageDisableList userId=" + userId + + " what=0x" + Integer.toHexString(what) + " pkg=" + pkg); } // update the list final int N = mDisableRecords.size(); @@ -541,6 +557,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub } else { if (tok == null) { tok = new DisableRecord(); + tok.userId = userId; try { token.linkToDeath(tok, 0); } @@ -556,12 +573,15 @@ public class StatusBarManagerService extends IStatusBarService.Stub } // lock on mDisableRecords - int gatherDisableActionsLocked() { + int gatherDisableActionsLocked(int userId) { final int N = mDisableRecords.size(); // gather the new net flags int net = 0; for (int i=0; i<N; i++) { - net |= mDisableRecords.get(i).what; + final DisableRecord rec = mDisableRecords.get(i); + if (rec.userId == userId) { + net |= rec.what; + } } return net; } @@ -593,13 +613,15 @@ public class StatusBarManagerService extends IStatusBarService.Stub } synchronized (mLock) { + pw.println(" mDisabled=0x" + Integer.toHexString(mDisabled)); final int N = mDisableRecords.size(); - pw.println(" mDisableRecords.size=" + N - + " mDisabled=0x" + Integer.toHexString(mDisabled)); + pw.println(" mDisableRecords.size=" + N); for (int i=0; i<N; i++) { DisableRecord tok = mDisableRecords.get(i); - pw.println(" [" + i + "] what=0x" + Integer.toHexString(tok.what) - + " pkg=" + tok.pkg + " token=" + tok.token); + pw.println(" [" + i + "] userId=" + tok.userId + + " what=0x" + Integer.toHexString(tok.what) + + " pkg=" + tok.pkg + + " token=" + tok.token); } } } diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index b684c90d05da..eaaf33f61a29 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -631,11 +631,12 @@ class ServerThread extends Thread { } try { - Slog.i(TAG, "Wired Accessory Observer"); + Slog.i(TAG, "Wired Accessory Manager"); // Listen for wired headset changes - new WiredAccessoryObserver(context); + inputManager.setWiredAccessoryCallbacks( + new WiredAccessoryManager(context, inputManager)); } catch (Throwable e) { - reportWtf("starting WiredAccessoryObserver", e); + reportWtf("starting WiredAccessoryManager", e); } try { diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java index adb63f9b8dcf..98794c923f7c 100644 --- a/services/java/com/android/server/WifiService.java +++ b/services/java/com/android/server/WifiService.java @@ -21,6 +21,7 @@ import android.app.AlarmManager; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; +import android.app.TaskStackBuilder; import android.bluetooth.BluetoothAdapter; import android.content.BroadcastReceiver; import android.content.ContentResolver; @@ -1766,9 +1767,10 @@ public class WifiService extends IWifiManager.Stub { mNotification.when = 0; mNotification.icon = ICON_NETWORKS_AVAILABLE; mNotification.flags = Notification.FLAG_AUTO_CANCEL; - mNotification.contentIntent = PendingIntent.getActivityAsUser(mContext, 0, - new Intent(WifiManager.ACTION_PICK_WIFI_NETWORK), 0, - null, UserHandle.CURRENT); + mNotification.contentIntent = TaskStackBuilder.create(mContext) + .addNextIntentWithParentStack( + new Intent(WifiManager.ACTION_PICK_WIFI_NETWORK)) + .getPendingIntent(0, 0, null, UserHandle.CURRENT); } CharSequence title = mContext.getResources().getQuantityText( diff --git a/services/java/com/android/server/WiredAccessoryManager.java b/services/java/com/android/server/WiredAccessoryManager.java new file mode 100644 index 000000000000..63e8895c2a2f --- /dev/null +++ b/services/java/com/android/server/WiredAccessoryManager.java @@ -0,0 +1,432 @@ +/* + * Copyright (C) 2008 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.server; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.os.Handler; +import android.os.Looper; +import android.os.Message; +import android.os.PowerManager; +import android.os.PowerManager.WakeLock; +import android.os.UEventObserver; +import android.util.Slog; +import android.media.AudioManager; +import android.util.Log; +import android.view.InputDevice; + +import com.android.internal.R; +import com.android.server.input.InputManagerService; +import com.android.server.input.InputManagerService.WiredAccessoryCallbacks; +import static com.android.server.input.InputManagerService.SW_HEADPHONE_INSERT; +import static com.android.server.input.InputManagerService.SW_MICROPHONE_INSERT; +import static com.android.server.input.InputManagerService.SW_HEADPHONE_INSERT_BIT; +import static com.android.server.input.InputManagerService.SW_MICROPHONE_INSERT_BIT; + +import java.io.File; +import java.io.FileReader; +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.List; + +/** + * <p>WiredAccessoryManager monitors for a wired headset on the main board or dock using + * both the InputManagerService notifyWiredAccessoryChanged interface and the UEventObserver + * subsystem. + */ +final class WiredAccessoryManager implements WiredAccessoryCallbacks { + private static final String TAG = WiredAccessoryManager.class.getSimpleName(); + private static final boolean LOG = true; + + private static final int BIT_HEADSET = (1 << 0); + private static final int BIT_HEADSET_NO_MIC = (1 << 1); + private static final int BIT_USB_HEADSET_ANLG = (1 << 2); + private static final int BIT_USB_HEADSET_DGTL = (1 << 3); + private static final int BIT_HDMI_AUDIO = (1 << 4); + private static final int SUPPORTED_HEADSETS = (BIT_HEADSET|BIT_HEADSET_NO_MIC| + BIT_USB_HEADSET_ANLG|BIT_USB_HEADSET_DGTL| + BIT_HDMI_AUDIO); + + private static final String NAME_H2W = "h2w"; + private static final String NAME_USB_AUDIO = "usb_audio"; + private static final String NAME_HDMI_AUDIO = "hdmi_audio"; + private static final String NAME_HDMI = "hdmi"; + + private static final int MSG_NEW_DEVICE_STATE = 1; + + private final Object mLock = new Object(); + + private final WakeLock mWakeLock; // held while there is a pending route change + private final AudioManager mAudioManager; + + private int mHeadsetState; + + private int mSwitchValues; + + private final WiredAccessoryObserver mObserver; + private final InputManagerService mInputManager; + + private final boolean mUseDevInputEventForAudioJack; + + public WiredAccessoryManager(Context context, InputManagerService inputManager) { + PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE); + mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "WiredAccessoryManager"); + mWakeLock.setReferenceCounted(false); + mAudioManager = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE); + mInputManager = inputManager; + + mUseDevInputEventForAudioJack = + context.getResources().getBoolean(R.bool.config_useDevInputEventForAudioJack); + + mObserver = new WiredAccessoryObserver(); + + context.registerReceiver(new BroadcastReceiver() { + @Override + public void onReceive(Context ctx, Intent intent) { + bootCompleted(); + } + }, + new IntentFilter(Intent.ACTION_BOOT_COMPLETED), null, null); + } + + private void bootCompleted() { + if (mUseDevInputEventForAudioJack) { + int switchValues = 0; + if (mInputManager.getSwitchState(-1, InputDevice.SOURCE_ANY, SW_HEADPHONE_INSERT) == 1) { + switchValues |= SW_HEADPHONE_INSERT_BIT; + } + if (mInputManager.getSwitchState(-1, InputDevice.SOURCE_ANY, SW_MICROPHONE_INSERT) == 1) { + switchValues |= SW_MICROPHONE_INSERT_BIT; + } + notifyWiredAccessoryChanged(0, switchValues, + SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT); + } + + mObserver.init(); + } + + @Override + public void notifyWiredAccessoryChanged(long whenNanos, int switchValues, int switchMask) { + if (LOG) Slog.v(TAG, "notifyWiredAccessoryChanged: when=" + whenNanos + + " bits=" + switchCodeToString(switchValues, switchMask) + + " mask=" + Integer.toHexString(switchMask)); + + synchronized (mLock) { + int headset; + mSwitchValues = (mSwitchValues & ~switchMask) | switchValues; + switch (mSwitchValues & (SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT)) { + case 0: + headset = 0; + break; + + case SW_HEADPHONE_INSERT_BIT: + headset = BIT_HEADSET_NO_MIC; + break; + + case SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT: + headset = BIT_HEADSET; + break; + + case SW_MICROPHONE_INSERT_BIT: + headset = BIT_HEADSET; + break; + + default: + headset = 0; + break; + } + + updateLocked(NAME_H2W, headset); + } + } + + /** + * Compare the existing headset state with the new state and pass along accordingly. Note + * that this only supports a single headset at a time. Inserting both a usb and jacked headset + * results in support for the last one plugged in. Similarly, unplugging either is seen as + * unplugging all. + * + * @param newName One of the NAME_xxx variables defined above. + * @param newState 0 or one of the BIT_xxx variables defined above. + */ + private void updateLocked(String newName, int newState) { + // Retain only relevant bits + int headsetState = newState & SUPPORTED_HEADSETS; + int usb_headset_anlg = headsetState & BIT_USB_HEADSET_ANLG; + int usb_headset_dgtl = headsetState & BIT_USB_HEADSET_DGTL; + int h2w_headset = headsetState & (BIT_HEADSET | BIT_HEADSET_NO_MIC); + boolean h2wStateChange = true; + boolean usbStateChange = true; + if (LOG) Slog.v(TAG, "newName=" + newName + + " newState=" + newState + + " headsetState=" + headsetState + + " prev headsetState=" + mHeadsetState); + + if (mHeadsetState == headsetState) { + Log.e(TAG, "No state change."); + return; + } + + // reject all suspect transitions: only accept state changes from: + // - a: 0 headset to 1 headset + // - b: 1 headset to 0 headset + if (h2w_headset == (BIT_HEADSET | BIT_HEADSET_NO_MIC)) { + Log.e(TAG, "Invalid combination, unsetting h2w flag"); + h2wStateChange = false; + } + // - c: 0 usb headset to 1 usb headset + // - d: 1 usb headset to 0 usb headset + if (usb_headset_anlg == BIT_USB_HEADSET_ANLG && usb_headset_dgtl == BIT_USB_HEADSET_DGTL) { + Log.e(TAG, "Invalid combination, unsetting usb flag"); + usbStateChange = false; + } + if (!h2wStateChange && !usbStateChange) { + Log.e(TAG, "invalid transition, returning ..."); + return; + } + + mWakeLock.acquire(); + + Message msg = mHandler.obtainMessage(MSG_NEW_DEVICE_STATE, headsetState, + mHeadsetState, newName); + mHandler.sendMessage(msg); + + mHeadsetState = headsetState; + } + + private final Handler mHandler = new Handler(Looper.myLooper(), null, true) { + @Override + public void handleMessage(Message msg) { + switch (msg.what) { + case MSG_NEW_DEVICE_STATE: + setDevicesState(msg.arg1, msg.arg2, (String)msg.obj); + mWakeLock.release(); + } + } + }; + + private void setDevicesState( + int headsetState, int prevHeadsetState, String headsetName) { + synchronized (mLock) { + int allHeadsets = SUPPORTED_HEADSETS; + for (int curHeadset = 1; allHeadsets != 0; curHeadset <<= 1) { + if ((curHeadset & allHeadsets) != 0) { + setDeviceStateLocked(curHeadset, headsetState, prevHeadsetState, headsetName); + allHeadsets &= ~curHeadset; + } + } + } + } + + private void setDeviceStateLocked(int headset, + int headsetState, int prevHeadsetState, String headsetName) { + if ((headsetState & headset) != (prevHeadsetState & headset)) { + int device; + int state; + + if ((headsetState & headset) != 0) { + state = 1; + } else { + state = 0; + } + + if (headset == BIT_HEADSET) { + device = AudioManager.DEVICE_OUT_WIRED_HEADSET; + } else if (headset == BIT_HEADSET_NO_MIC){ + device = AudioManager.DEVICE_OUT_WIRED_HEADPHONE; + } else if (headset == BIT_USB_HEADSET_ANLG) { + device = AudioManager.DEVICE_OUT_ANLG_DOCK_HEADSET; + } else if (headset == BIT_USB_HEADSET_DGTL) { + device = AudioManager.DEVICE_OUT_DGTL_DOCK_HEADSET; + } else if (headset == BIT_HDMI_AUDIO) { + device = AudioManager.DEVICE_OUT_AUX_DIGITAL; + } else { + Slog.e(TAG, "setDeviceState() invalid headset type: "+headset); + return; + } + + if (LOG) + Slog.v(TAG, "device "+headsetName+((state == 1) ? " connected" : " disconnected")); + + mAudioManager.setWiredDeviceConnectionState(device, state, headsetName); + } + } + + private String switchCodeToString(int switchValues, int switchMask) { + StringBuffer sb = new StringBuffer(); + if ((switchMask & SW_HEADPHONE_INSERT_BIT) != 0 && + (switchValues & SW_HEADPHONE_INSERT_BIT) != 0) { + sb.append("SW_HEADPHONE_INSERT "); + } + if ((switchMask & SW_MICROPHONE_INSERT_BIT) != 0 && + (switchValues & SW_MICROPHONE_INSERT_BIT) != 0) { + sb.append("SW_MICROPHONE_INSERT"); + } + return sb.toString(); + } + + class WiredAccessoryObserver extends UEventObserver { + private final List<UEventInfo> mUEventInfo; + + public WiredAccessoryObserver() { + mUEventInfo = makeObservedUEventList(); + } + + void init() { + synchronized (mLock) { + if (LOG) Slog.v(TAG, "init()"); + char[] buffer = new char[1024]; + + for (int i = 0; i < mUEventInfo.size(); ++i) { + UEventInfo uei = mUEventInfo.get(i); + try { + int curState; + FileReader file = new FileReader(uei.getSwitchStatePath()); + int len = file.read(buffer, 0, 1024); + file.close(); + curState = Integer.valueOf((new String(buffer, 0, len)).trim()); + + if (curState > 0) { + updateStateLocked(uei.getDevPath(), uei.getDevName(), curState); + } + } catch (FileNotFoundException e) { + Slog.w(TAG, uei.getSwitchStatePath() + + " not found while attempting to determine initial switch state"); + } catch (Exception e) { + Slog.e(TAG, "" , e); + } + } + } + + // At any given time accessories could be inserted + // one on the board, one on the dock and one on HDMI: + // observe three UEVENTs + for (int i = 0; i < mUEventInfo.size(); ++i) { + UEventInfo uei = mUEventInfo.get(i); + startObserving("DEVPATH="+uei.getDevPath()); + } + } + + private List<UEventInfo> makeObservedUEventList() { + List<UEventInfo> retVal = new ArrayList<UEventInfo>(); + UEventInfo uei; + + // Monitor h2w + if (!mUseDevInputEventForAudioJack) { + uei = new UEventInfo(NAME_H2W, BIT_HEADSET, BIT_HEADSET_NO_MIC); + if (uei.checkSwitchExists()) { + retVal.add(uei); + } else { + Slog.w(TAG, "This kernel does not have wired headset support"); + } + } + + // Monitor USB + uei = new UEventInfo(NAME_USB_AUDIO, BIT_USB_HEADSET_ANLG, BIT_USB_HEADSET_DGTL); + if (uei.checkSwitchExists()) { + retVal.add(uei); + } else { + Slog.w(TAG, "This kernel does not have usb audio support"); + } + + // Monitor HDMI + // + // If the kernel has support for the "hdmi_audio" switch, use that. It will be + // signalled only when the HDMI driver has a video mode configured, and the downstream + // sink indicates support for audio in its EDID. + // + // If the kernel does not have an "hdmi_audio" switch, just fall back on the older + // "hdmi" switch instead. + uei = new UEventInfo(NAME_HDMI_AUDIO, BIT_HDMI_AUDIO, 0); + if (uei.checkSwitchExists()) { + retVal.add(uei); + } else { + uei = new UEventInfo(NAME_HDMI, BIT_HDMI_AUDIO, 0); + if (uei.checkSwitchExists()) { + retVal.add(uei); + } else { + Slog.w(TAG, "This kernel does not have HDMI audio support"); + } + } + + return retVal; + } + + @Override + public void onUEvent(UEventObserver.UEvent event) { + if (LOG) Slog.v(TAG, "Headset UEVENT: " + event.toString()); + + try { + String devPath = event.get("DEVPATH"); + String name = event.get("SWITCH_NAME"); + int state = Integer.parseInt(event.get("SWITCH_STATE")); + synchronized (mLock) { + updateStateLocked(devPath, name, state); + } + } catch (NumberFormatException e) { + Slog.e(TAG, "Could not parse switch state from event " + event); + } + } + + private void updateStateLocked(String devPath, String name, int state) { + for (int i = 0; i < mUEventInfo.size(); ++i) { + UEventInfo uei = mUEventInfo.get(i); + if (devPath.equals(uei.getDevPath())) { + updateLocked(name, uei.computeNewHeadsetState(mHeadsetState, state)); + return; + } + } + } + + private final class UEventInfo { + private final String mDevName; + private final int mState1Bits; + private final int mState2Bits; + + public UEventInfo(String devName, int state1Bits, int state2Bits) { + mDevName = devName; + mState1Bits = state1Bits; + mState2Bits = state2Bits; + } + + public String getDevName() { return mDevName; } + + public String getDevPath() { + return String.format("/devices/virtual/switch/%s", mDevName); + } + + public String getSwitchStatePath() { + return String.format("/sys/class/switch/%s/state", mDevName); + } + + public boolean checkSwitchExists() { + File f = new File(getSwitchStatePath()); + return f.exists(); + } + + public int computeNewHeadsetState(int headsetState, int switchState) { + int preserveMask = ~(mState1Bits | mState2Bits); + int setBits = ((switchState == 1) ? mState1Bits : + ((switchState == 2) ? mState2Bits : 0)); + + return ((headsetState & preserveMask) | setBits); + } + } + } +} diff --git a/services/java/com/android/server/WiredAccessoryObserver.java b/services/java/com/android/server/WiredAccessoryObserver.java deleted file mode 100644 index 56c0fdff8e70..000000000000 --- a/services/java/com/android/server/WiredAccessoryObserver.java +++ /dev/null @@ -1,319 +0,0 @@ -/* - * Copyright (C) 2008 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.server; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.os.Handler; -import android.os.Looper; -import android.os.Message; -import android.os.PowerManager; -import android.os.PowerManager.WakeLock; -import android.os.UEventObserver; -import android.util.Slog; -import android.media.AudioManager; -import android.util.Log; - -import java.io.File; -import java.io.FileReader; -import java.io.FileNotFoundException; -import java.util.ArrayList; -import java.util.List; - -/** - * <p>WiredAccessoryObserver monitors for a wired headset on the main board or dock. - */ -final class WiredAccessoryObserver extends UEventObserver { - private static final String TAG = WiredAccessoryObserver.class.getSimpleName(); - private static final boolean LOG = true; - private static final int BIT_HEADSET = (1 << 0); - private static final int BIT_HEADSET_NO_MIC = (1 << 1); - private static final int BIT_USB_HEADSET_ANLG = (1 << 2); - private static final int BIT_USB_HEADSET_DGTL = (1 << 3); - private static final int BIT_HDMI_AUDIO = (1 << 4); - private static final int SUPPORTED_HEADSETS = (BIT_HEADSET|BIT_HEADSET_NO_MIC| - BIT_USB_HEADSET_ANLG|BIT_USB_HEADSET_DGTL| - BIT_HDMI_AUDIO); - - private final Object mLock = new Object(); - - private final Context mContext; - private final WakeLock mWakeLock; // held while there is a pending route change - private final AudioManager mAudioManager; - private final List<UEventInfo> mUEventInfo; - - private int mHeadsetState; - private int mPrevHeadsetState; - private String mHeadsetName; - - public WiredAccessoryObserver(Context context) { - mContext = context; - - PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE); - mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "WiredAccessoryObserver"); - mWakeLock.setReferenceCounted(false); - mAudioManager = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE); - - mUEventInfo = makeObservedUEventList(); - - context.registerReceiver(new BootCompletedReceiver(), - new IntentFilter(Intent.ACTION_BOOT_COMPLETED), null, null); - } - - @Override - public void onUEvent(UEventObserver.UEvent event) { - if (LOG) Slog.v(TAG, "Headset UEVENT: " + event.toString()); - - try { - String devPath = event.get("DEVPATH"); - String name = event.get("SWITCH_NAME"); - int state = Integer.parseInt(event.get("SWITCH_STATE")); - synchronized (mLock) { - updateStateLocked(devPath, name, state); - } - } catch (NumberFormatException e) { - Slog.e(TAG, "Could not parse switch state from event " + event); - } - } - - private void bootCompleted() { - synchronized (mLock) { - char[] buffer = new char[1024]; - mPrevHeadsetState = mHeadsetState; - - if (LOG) Slog.v(TAG, "init()"); - - for (int i = 0; i < mUEventInfo.size(); ++i) { - UEventInfo uei = mUEventInfo.get(i); - try { - int curState; - FileReader file = new FileReader(uei.getSwitchStatePath()); - int len = file.read(buffer, 0, 1024); - file.close(); - curState = Integer.valueOf((new String(buffer, 0, len)).trim()); - - if (curState > 0) { - updateStateLocked(uei.getDevPath(), uei.getDevName(), curState); - } - } catch (FileNotFoundException e) { - Slog.w(TAG, uei.getSwitchStatePath() + - " not found while attempting to determine initial switch state"); - } catch (Exception e) { - Slog.e(TAG, "" , e); - } - } - } - - // At any given time accessories could be inserted - // one on the board, one on the dock and one on HDMI: - // observe three UEVENTs - for (int i = 0; i < mUEventInfo.size(); ++i) { - UEventInfo uei = mUEventInfo.get(i); - startObserving("DEVPATH="+uei.getDevPath()); - } - } - - private void updateStateLocked(String devPath, String name, int state) { - for (int i = 0; i < mUEventInfo.size(); ++i) { - UEventInfo uei = mUEventInfo.get(i); - if (devPath.equals(uei.getDevPath())) { - updateLocked(name, uei.computeNewHeadsetState(mHeadsetState, state)); - return; - } - } - } - - private void updateLocked(String newName, int newState) { - // Retain only relevant bits - int headsetState = newState & SUPPORTED_HEADSETS; - int usb_headset_anlg = headsetState & BIT_USB_HEADSET_ANLG; - int usb_headset_dgtl = headsetState & BIT_USB_HEADSET_DGTL; - int h2w_headset = headsetState & (BIT_HEADSET | BIT_HEADSET_NO_MIC); - boolean h2wStateChange = true; - boolean usbStateChange = true; - // reject all suspect transitions: only accept state changes from: - // - a: 0 heaset to 1 headset - // - b: 1 headset to 0 headset - if (LOG) Slog.v(TAG, "newState = "+newState+", headsetState = "+headsetState+"," - + "mHeadsetState = "+mHeadsetState); - if (mHeadsetState == headsetState || ((h2w_headset & (h2w_headset - 1)) != 0)) { - Log.e(TAG, "unsetting h2w flag"); - h2wStateChange = false; - } - // - c: 0 usb headset to 1 usb headset - // - d: 1 usb headset to 0 usb headset - if ((usb_headset_anlg >> 2) == 1 && (usb_headset_dgtl >> 3) == 1) { - Log.e(TAG, "unsetting usb flag"); - usbStateChange = false; - } - if (!h2wStateChange && !usbStateChange) { - Log.e(TAG, "invalid transition, returning ..."); - return; - } - - mHeadsetName = newName; - mPrevHeadsetState = mHeadsetState; - mHeadsetState = headsetState; - - mWakeLock.acquire(); - - Message msg = mHandler.obtainMessage(0, mHeadsetState, mPrevHeadsetState, mHeadsetName); - mHandler.sendMessage(msg); - } - - private void setDevicesState( - int headsetState, int prevHeadsetState, String headsetName) { - synchronized (mLock) { - int allHeadsets = SUPPORTED_HEADSETS; - for (int curHeadset = 1; allHeadsets != 0; curHeadset <<= 1) { - if ((curHeadset & allHeadsets) != 0) { - setDeviceStateLocked(curHeadset, headsetState, prevHeadsetState, headsetName); - allHeadsets &= ~curHeadset; - } - } - } - } - - private void setDeviceStateLocked(int headset, - int headsetState, int prevHeadsetState, String headsetName) { - if ((headsetState & headset) != (prevHeadsetState & headset)) { - int device; - int state; - - if ((headsetState & headset) != 0) { - state = 1; - } else { - state = 0; - } - - if (headset == BIT_HEADSET) { - device = AudioManager.DEVICE_OUT_WIRED_HEADSET; - } else if (headset == BIT_HEADSET_NO_MIC){ - device = AudioManager.DEVICE_OUT_WIRED_HEADPHONE; - } else if (headset == BIT_USB_HEADSET_ANLG) { - device = AudioManager.DEVICE_OUT_ANLG_DOCK_HEADSET; - } else if (headset == BIT_USB_HEADSET_DGTL) { - device = AudioManager.DEVICE_OUT_DGTL_DOCK_HEADSET; - } else if (headset == BIT_HDMI_AUDIO) { - device = AudioManager.DEVICE_OUT_AUX_DIGITAL; - } else { - Slog.e(TAG, "setDeviceState() invalid headset type: "+headset); - return; - } - - if (LOG) - Slog.v(TAG, "device "+headsetName+((state == 1) ? " connected" : " disconnected")); - - mAudioManager.setWiredDeviceConnectionState(device, state, headsetName); - } - } - - private static List<UEventInfo> makeObservedUEventList() { - List<UEventInfo> retVal = new ArrayList<UEventInfo>(); - UEventInfo uei; - - // Monitor h2w - uei = new UEventInfo("h2w", BIT_HEADSET, BIT_HEADSET_NO_MIC); - if (uei.checkSwitchExists()) { - retVal.add(uei); - } else { - Slog.w(TAG, "This kernel does not have wired headset support"); - } - - // Monitor USB - uei = new UEventInfo("usb_audio", BIT_USB_HEADSET_ANLG, BIT_USB_HEADSET_DGTL); - if (uei.checkSwitchExists()) { - retVal.add(uei); - } else { - Slog.w(TAG, "This kernel does not have usb audio support"); - } - - // Monitor HDMI - // - // If the kernel has support for the "hdmi_audio" switch, use that. It will be signalled - // only when the HDMI driver has a video mode configured, and the downstream sink indicates - // support for audio in its EDID. - // - // If the kernel does not have an "hdmi_audio" switch, just fall back on the older "hdmi" - // switch instead. - uei = new UEventInfo("hdmi_audio", BIT_HDMI_AUDIO, 0); - if (uei.checkSwitchExists()) { - retVal.add(uei); - } else { - uei = new UEventInfo("hdmi", BIT_HDMI_AUDIO, 0); - if (uei.checkSwitchExists()) { - retVal.add(uei); - } else { - Slog.w(TAG, "This kernel does not have HDMI audio support"); - } - } - - return retVal; - } - - private final Handler mHandler = new Handler(Looper.myLooper(), null, true) { - @Override - public void handleMessage(Message msg) { - setDevicesState(msg.arg1, msg.arg2, (String)msg.obj); - mWakeLock.release(); - } - }; - - private static final class UEventInfo { - private final String mDevName; - private final int mState1Bits; - private final int mState2Bits; - - public UEventInfo(String devName, int state1Bits, int state2Bits) { - mDevName = devName; - mState1Bits = state1Bits; - mState2Bits = state2Bits; - } - - public String getDevName() { return mDevName; } - - public String getDevPath() { - return String.format("/devices/virtual/switch/%s", mDevName); - } - - public String getSwitchStatePath() { - return String.format("/sys/class/switch/%s/state", mDevName); - } - - public boolean checkSwitchExists() { - File f = new File(getSwitchStatePath()); - return ((null != f) && f.exists()); - } - - public int computeNewHeadsetState(int headsetState, int switchState) { - int preserveMask = ~(mState1Bits | mState2Bits); - int setBits = ((switchState == 1) ? mState1Bits : - ((switchState == 2) ? mState2Bits : 0)); - - return ((headsetState & preserveMask) | setBits); - } - } - - private final class BootCompletedReceiver extends BroadcastReceiver { - @Override - public void onReceive(Context context, Intent intent) { - bootCompleted(); - } - } -} diff --git a/services/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/java/com/android/server/accessibility/AccessibilityManagerService.java index 8193a4f27a90..d23e5714804b 100644 --- a/services/java/com/android/server/accessibility/AccessibilityManagerService.java +++ b/services/java/com/android/server/accessibility/AccessibilityManagerService.java @@ -111,7 +111,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { // TODO: This is arbitrary. When there is time implement this by watching // when that accessibility services are bound. - private static final int WAIT_FOR_USER_STATE_FULLY_INITIALIZED_MILLIS = 5000; + private static final int WAIT_FOR_USER_STATE_FULLY_INITIALIZED_MILLIS = 3000; private static final String FUNCTION_REGISTER_UI_TEST_AUTOMATION_SERVICE = "registerUiTestAutomationService"; @@ -659,6 +659,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { oldUserState.mUserId, 0).sendToTarget(); } + // Announce user changes only if more that one exist. + UserManager userManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE); + final boolean announceNewUser = userManager.getUsers().size() > 1; + // The user changed. mCurrentUserId = userId; @@ -666,9 +670,11 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { mMainHandler.obtainMessage(MainHandler.MSG_SEND_RECREATE_INTERNAL_STATE, mCurrentUserId, 0).sendToTarget(); - // Schedule announcement of the current user if needed. - mMainHandler.sendEmptyMessageDelayed(MainHandler.MSG_ANNOUNCE_NEW_USER_IF_NEEDED, - WAIT_FOR_USER_STATE_FULLY_INITIALIZED_MILLIS); + if (announceNewUser) { + // Schedule announcement of the current user if needed. + mMainHandler.sendEmptyMessageDelayed(MainHandler.MSG_ANNOUNCE_NEW_USER_IF_NEEDED, + WAIT_FOR_USER_STATE_FULLY_INITIALIZED_MILLIS); + } } } diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index 3428326208b4..e90eef9e8682 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -181,6 +181,7 @@ public final class ActivityManagerService extends ActivityManagerNative static final boolean DEBUG_VISBILITY = localLOGV || false; static final boolean DEBUG_PROCESSES = localLOGV || false; static final boolean DEBUG_PROCESS_OBSERVERS = localLOGV || false; + static final boolean DEBUG_CLEANUP = localLOGV || false; static final boolean DEBUG_PROVIDER = localLOGV || false; static final boolean DEBUG_URI_PERMISSION = localLOGV || false; static final boolean DEBUG_USER_LEAVING = localLOGV || false; @@ -1968,7 +1969,7 @@ public final class ActivityManagerService extends ActivityManagerNative } else { // An application record is attached to a previous process, // clean it up now. - if (DEBUG_PROCESSES) Slog.v(TAG, "App died: " + app); + if (DEBUG_PROCESSES || DEBUG_CLEANUP) Slog.v(TAG, "App died: " + app); handleAppDiedLocked(app, true, true); } } @@ -2925,7 +2926,8 @@ public final class ActivityManagerService extends ActivityManagerNative // Just in case... if (mMainStack.mPausingActivity != null && mMainStack.mPausingActivity.app == app) { - if (DEBUG_PAUSE) Slog.v(TAG, "App died while pausing: " +mMainStack.mPausingActivity); + if (DEBUG_PAUSE || DEBUG_CLEANUP) Slog.v(TAG, + "App died while pausing: " + mMainStack.mPausingActivity); mMainStack.mPausingActivity = null; } if (mMainStack.mLastPausedActivity != null && mMainStack.mLastPausedActivity.app == app) { @@ -2933,61 +2935,7 @@ public final class ActivityManagerService extends ActivityManagerNative } // Remove this application's activities from active lists. - mMainStack.removeHistoryRecordsForAppLocked(app); - - boolean atTop = true; - boolean hasVisibleActivities = false; - - // Clean out the history list. - int i = mMainStack.mHistory.size(); - if (localLOGV) Slog.v( - TAG, "Removing app " + app + " from history with " + i + " entries"); - while (i > 0) { - i--; - ActivityRecord r = (ActivityRecord)mMainStack.mHistory.get(i); - if (localLOGV) Slog.v( - TAG, "Record #" + i + " " + r + ": app=" + r.app); - if (r.app == app) { - if ((!r.haveState && !r.stateNotNeeded) || r.finishing) { - if (ActivityStack.DEBUG_ADD_REMOVE) { - RuntimeException here = new RuntimeException("here"); - here.fillInStackTrace(); - Slog.i(TAG, "Removing activity " + r + " from stack at " + i - + ": haveState=" + r.haveState - + " stateNotNeeded=" + r.stateNotNeeded - + " finishing=" + r.finishing - + " state=" + r.state, here); - } - if (!r.finishing) { - Slog.w(TAG, "Force removing " + r + ": app died, no saved state"); - EventLog.writeEvent(EventLogTags.AM_FINISH_ACTIVITY, - r.userId, System.identityHashCode(r), - r.task.taskId, r.shortComponentName, - "proc died without state saved"); - } - mMainStack.removeActivityFromHistoryLocked(r); - - } else { - // We have the current state for this activity, so - // it can be restarted later when needed. - if (localLOGV) Slog.v( - TAG, "Keeping entry, setting app to null"); - if (r.visible) { - hasVisibleActivities = true; - } - r.app = null; - r.nowVisible = false; - if (!r.haveState) { - if (ActivityStack.DEBUG_SAVED_STATE) Slog.i(TAG, - "App died, clearing saved state of " + r); - r.icicle = null; - } - } - - r.stack.cleanUpActivityLocked(r, true, true); - } - atTop = false; - } + boolean hasVisibleActivities = mMainStack.removeHistoryRecordsForAppLocked(app); app.activities.clear(); @@ -3053,7 +3001,7 @@ public final class ActivityManagerService extends ActivityManagerNative + ") has died."); } EventLog.writeEvent(EventLogTags.AM_PROC_DIED, app.userId, app.pid, app.processName); - if (localLOGV) Slog.v( + if (DEBUG_CLEANUP) Slog.v( TAG, "Dying app: " + app + ", pid: " + pid + ", thread: " + thread.asBinder()); boolean doLowMem = app.instrumentationClass == null; @@ -10757,7 +10705,8 @@ public final class ActivityManagerService extends ActivityManagerNative // If the app is undergoing backup, tell the backup manager about it if (mBackupTarget != null && app.pid == mBackupTarget.app.pid) { - if (DEBUG_BACKUP) Slog.d(TAG, "App " + mBackupTarget.appInfo + " died during backup"); + if (DEBUG_BACKUP || DEBUG_CLEANUP) Slog.d(TAG, "App " + + mBackupTarget.appInfo + " died during backup"); try { IBackupManager bm = IBackupManager.Stub.asInterface( ServiceManager.getService(Context.BACKUP_SERVICE)); @@ -10783,7 +10732,7 @@ public final class ActivityManagerService extends ActivityManagerNative } if (!app.persistent || app.isolated) { - if (DEBUG_PROCESSES) Slog.v(TAG, + if (DEBUG_PROCESSES || DEBUG_CLEANUP) Slog.v(TAG, "Removing non-persistent process during cleanup: " + app); mProcessNames.remove(app.processName, app.uid); mIsolatedProcesses.remove(app.uid); @@ -10801,7 +10750,7 @@ public final class ActivityManagerService extends ActivityManagerNative restart = true; } } - if (DEBUG_PROCESSES && mProcessesOnHold.contains(app)) Slog.v(TAG, + if ((DEBUG_PROCESSES || DEBUG_CLEANUP) && mProcessesOnHold.contains(app)) Slog.v(TAG, "Clean-up removing on hold: " + app); mProcessesOnHold.remove(app); @@ -11745,7 +11694,7 @@ public final class ActivityManagerService extends ActivityManagerNative users = mStartedUserArray; } else { // Caller wants broadcast to go to one specific user. - users = mCurrentUserArray; + users = new int[] {userId}; } // Figure out who all will receive this broadcast. diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java index 2d44527421ff..90a7abcc515d 100755 --- a/services/java/com/android/server/am/ActivityStack.java +++ b/services/java/com/android/server/am/ActivityStack.java @@ -81,6 +81,7 @@ final class ActivityStack { static final boolean DEBUG_RESULTS = ActivityManagerService.DEBUG_RESULTS; static final boolean DEBUG_CONFIGURATION = ActivityManagerService.DEBUG_CONFIGURATION; static final boolean DEBUG_TASKS = ActivityManagerService.DEBUG_TASKS; + static final boolean DEBUG_CLEANUP = ActivityManagerService.DEBUG_CLEANUP; static final boolean DEBUG_STATES = false; static final boolean DEBUG_ADD_REMOVE = false; @@ -1142,9 +1143,13 @@ final class ActivityStack { resumeTopActivityLocked(prev); } else { checkReadyForSleepLocked(); - if (topRunningActivityLocked(null) == null) { - // If there are no more activities available to run, then - // do resume anyway to start something. + ActivityRecord top = topRunningActivityLocked(null); + if (top == null || (prev != null && top != prev)) { + // If there are no more activities available to run, + // do resume anyway to start something. Also if the top + // activity on the stack is not the just paused activity, + // we need to go ahead and resume it to ensure we complete + // an in-flight app switch. resumeTopActivityLocked(null); } } @@ -1461,7 +1466,8 @@ final class ActivityStack { // If we are currently pausing an activity, then don't do anything // until that is done. if (mPausingActivity != null) { - if (DEBUG_SWITCH) Slog.v(TAG, "Skip resume: pausing=" + mPausingActivity); + if (DEBUG_SWITCH || DEBUG_PAUSE) Slog.v(TAG, + "Skip resume: pausing=" + mPausingActivity); return false; } @@ -3862,6 +3868,7 @@ final class ActivityStack { if (setState) { if (DEBUG_STATES) Slog.v(TAG, "Moving to DESTROYED: " + r + " (cleaning up)"); r.state = ActivityState.DESTROYED; + r.app = null; } // Make sure this record is no longer in the pending finishes list. @@ -3905,26 +3912,26 @@ final class ActivityStack { } final void removeActivityFromHistoryLocked(ActivityRecord r) { - if (r.state != ActivityState.DESTROYED) { - finishActivityResultsLocked(r, Activity.RESULT_CANCELED, null); - r.makeFinishing(); - if (DEBUG_ADD_REMOVE) { - RuntimeException here = new RuntimeException("here"); - here.fillInStackTrace(); - Slog.i(TAG, "Removing activity " + r + " from stack"); - } - mHistory.remove(r); - r.takeFromHistory(); - if (DEBUG_STATES) Slog.v(TAG, "Moving to DESTROYED: " + r - + " (removed from history)"); - r.state = ActivityState.DESTROYED; - mService.mWindowManager.removeAppToken(r.appToken); - if (VALIDATE_TOKENS) { - validateAppTokensLocked(); - } - cleanUpActivityServicesLocked(r); - r.removeUriPermissionsLocked(); + finishActivityResultsLocked(r, Activity.RESULT_CANCELED, null); + r.makeFinishing(); + if (DEBUG_ADD_REMOVE) { + RuntimeException here = new RuntimeException("here"); + here.fillInStackTrace(); + Slog.i(TAG, "Removing activity " + r + " from stack"); + } + mHistory.remove(r); + r.takeFromHistory(); + removeTimeoutsForActivityLocked(r); + if (DEBUG_STATES) Slog.v(TAG, "Moving to DESTROYED: " + r + + " (removed from history)"); + r.state = ActivityState.DESTROYED; + r.app = null; + mService.mWindowManager.removeAppToken(r.appToken); + if (VALIDATE_TOKENS) { + validateAppTokensLocked(); } + cleanUpActivityServicesLocked(r); + r.removeUriPermissionsLocked(); } /** @@ -3992,7 +3999,7 @@ final class ActivityStack { */ final boolean destroyActivityLocked(ActivityRecord r, boolean removeFromApp, boolean oomAdj, String reason) { - if (DEBUG_SWITCH) Slog.v( + if (DEBUG_SWITCH || DEBUG_CLEANUP) Slog.v( TAG, "Removing activity from " + reason + ": token=" + r + ", app=" + (r.app != null ? r.app.processName : "(null)")); EventLog.writeEvent(EventLogTags.AM_DESTROY_ACTIVITY, @@ -4000,11 +4007,11 @@ final class ActivityStack { r.task.taskId, r.shortComponentName, reason); boolean removedFromHistory = false; - + cleanUpActivityLocked(r, false, false); final boolean hadApp = r.app != null; - + if (hadApp) { if (removeFromApp) { int idx = r.app.activities.indexOf(r); @@ -4040,7 +4047,6 @@ final class ActivityStack { } } - r.app = null; r.nowVisible = false; // If the activity is finishing, we need to wait on removing it @@ -4061,6 +4067,7 @@ final class ActivityStack { if (DEBUG_STATES) Slog.v(TAG, "Moving to DESTROYED: " + r + " (destroy skipped)"); r.state = ActivityState.DESTROYED; + r.app = null; } } else { // remove this record from the history. @@ -4071,6 +4078,7 @@ final class ActivityStack { if (DEBUG_STATES) Slog.v(TAG, "Moving to DESTROYED: " + r + " (no app)"); r.state = ActivityState.DESTROYED; + r.app = null; } } @@ -4106,30 +4114,85 @@ final class ActivityStack { } } - private void removeHistoryRecordsForAppLocked(ArrayList list, ProcessRecord app) { + private void removeHistoryRecordsForAppLocked(ArrayList list, ProcessRecord app, + String listName) { int i = list.size(); - if (localLOGV) Slog.v( - TAG, "Removing app " + app + " from list " + list + if (DEBUG_CLEANUP) Slog.v( + TAG, "Removing app " + app + " from list " + listName + " with " + i + " entries"); while (i > 0) { i--; ActivityRecord r = (ActivityRecord)list.get(i); - if (localLOGV) Slog.v( - TAG, "Record #" + i + " " + r + ": app=" + r.app); + if (DEBUG_CLEANUP) Slog.v(TAG, "Record #" + i + " " + r); if (r.app == app) { - if (localLOGV) Slog.v(TAG, "Removing this entry!"); + if (DEBUG_CLEANUP) Slog.v(TAG, "---> REMOVING this entry!"); list.remove(i); removeTimeoutsForActivityLocked(r); } } } - void removeHistoryRecordsForAppLocked(ProcessRecord app) { - removeHistoryRecordsForAppLocked(mLRUActivities, app); - removeHistoryRecordsForAppLocked(mStoppingActivities, app); - removeHistoryRecordsForAppLocked(mGoingToSleepActivities, app); - removeHistoryRecordsForAppLocked(mWaitingVisibleActivities, app); - removeHistoryRecordsForAppLocked(mFinishingActivities, app); + boolean removeHistoryRecordsForAppLocked(ProcessRecord app) { + removeHistoryRecordsForAppLocked(mLRUActivities, app, "mLRUActivities"); + removeHistoryRecordsForAppLocked(mStoppingActivities, app, "mStoppingActivities"); + removeHistoryRecordsForAppLocked(mGoingToSleepActivities, app, "mGoingToSleepActivities"); + removeHistoryRecordsForAppLocked(mWaitingVisibleActivities, app, + "mWaitingVisibleActivities"); + removeHistoryRecordsForAppLocked(mFinishingActivities, app, "mFinishingActivities"); + + boolean hasVisibleActivities = false; + + // Clean out the history list. + int i = mHistory.size(); + if (DEBUG_CLEANUP) Slog.v( + TAG, "Removing app " + app + " from history with " + i + " entries"); + while (i > 0) { + i--; + ActivityRecord r = (ActivityRecord)mHistory.get(i); + if (DEBUG_CLEANUP) Slog.v( + TAG, "Record #" + i + " " + r + ": app=" + r.app); + if (r.app == app) { + if ((!r.haveState && !r.stateNotNeeded) || r.finishing) { + if (ActivityStack.DEBUG_ADD_REMOVE || DEBUG_CLEANUP) { + RuntimeException here = new RuntimeException("here"); + here.fillInStackTrace(); + Slog.i(TAG, "Removing activity " + r + " from stack at " + i + + ": haveState=" + r.haveState + + " stateNotNeeded=" + r.stateNotNeeded + + " finishing=" + r.finishing + + " state=" + r.state, here); + } + if (!r.finishing) { + Slog.w(TAG, "Force removing " + r + ": app died, no saved state"); + EventLog.writeEvent(EventLogTags.AM_FINISH_ACTIVITY, + r.userId, System.identityHashCode(r), + r.task.taskId, r.shortComponentName, + "proc died without state saved"); + } + removeActivityFromHistoryLocked(r); + + } else { + // We have the current state for this activity, so + // it can be restarted later when needed. + if (localLOGV) Slog.v( + TAG, "Keeping entry, setting app to null"); + if (r.visible) { + hasVisibleActivities = true; + } + r.app = null; + r.nowVisible = false; + if (!r.haveState) { + if (ActivityStack.DEBUG_SAVED_STATE) Slog.i(TAG, + "App died, clearing saved state of " + r); + r.icicle = null; + } + } + + r.stack.cleanUpActivityLocked(r, true, true); + } + } + + return hasVisibleActivities; } /** @@ -4375,7 +4438,7 @@ final class ActivityStack { return null; } - // Remove all of this task's activies starting at the sub task. + // Remove all of this task's activities starting at the sub task. TaskAccessInfo.SubTask subtask = info.subtasks.get(subTaskIndex); performClearTaskAtIndexLocked(taskId, subtask.index); return subtask.activity; diff --git a/services/java/com/android/server/display/DisplayManagerService.java b/services/java/com/android/server/display/DisplayManagerService.java index f348cb619bc2..b8c6cd5a5035 100644 --- a/services/java/com/android/server/display/DisplayManagerService.java +++ b/services/java/com/android/server/display/DisplayManagerService.java @@ -209,7 +209,7 @@ public final class DisplayManagerService extends IDisplayManager.Stub { public void setWindowManager(WindowManagerFuncs windowManagerFuncs) { synchronized (mSyncRoot) { mWindowManagerFuncs = windowManagerFuncs; - scheduleTraversalLocked(); + scheduleTraversalLocked(false); } } @@ -220,7 +220,7 @@ public final class DisplayManagerService extends IDisplayManager.Stub { public void setInputManager(InputManagerFuncs inputManagerFuncs) { synchronized (mSyncRoot) { mInputManagerFuncs = inputManagerFuncs; - scheduleTraversalLocked(); + scheduleTraversalLocked(false); } } @@ -264,7 +264,7 @@ public final class DisplayManagerService extends IDisplayManager.Stub { display.setDisplayInfoOverrideFromWindowManagerLocked(info); if (!mTempDisplayInfo.equals(display.getDisplayInfoLocked())) { sendDisplayEventLocked(displayId, DisplayManagerGlobal.EVENT_DISPLAY_CHANGED); - scheduleTraversalLocked(); + scheduleTraversalLocked(false); } } } @@ -527,7 +527,7 @@ public final class DisplayManagerService extends IDisplayManager.Stub { mDisplayDevices.add(device); addLogicalDisplayLocked(device); - scheduleTraversalLocked(); + scheduleTraversalLocked(false); } } @@ -543,7 +543,7 @@ public final class DisplayManagerService extends IDisplayManager.Stub { device.applyPendingDisplayDeviceInfoChangesLocked(); if (updateLogicalDisplaysLocked()) { - scheduleTraversalLocked(); + scheduleTraversalLocked(false); } } } @@ -560,7 +560,7 @@ public final class DisplayManagerService extends IDisplayManager.Stub { mRemovedDisplayDevices.add(device); updateLogicalDisplaysLocked(); - scheduleTraversalLocked(); + scheduleTraversalLocked(false); } } @@ -668,13 +668,15 @@ public final class DisplayManagerService extends IDisplayManager.Stub { * * @param displayId The logical display id to update. * @param hasContent True if the logical display has content. + * @param inTraversal True if called from WindowManagerService during a window traversal prior + * to call to performTraversalInTransactionFromWindowManager. */ - public void setDisplayHasContent(int displayId, boolean hasContent) { + public void setDisplayHasContent(int displayId, boolean hasContent, boolean inTraversal) { synchronized (mSyncRoot) { LogicalDisplay display = mLogicalDisplays.get(displayId); if (display != null && display.hasContentLocked() != hasContent) { display.setHasContentLocked(hasContent); - scheduleTraversalLocked(); + scheduleTraversalLocked(inTraversal); } } } @@ -741,10 +743,12 @@ public final class DisplayManagerService extends IDisplayManager.Stub { // Requests that performTraversalsInTransactionFromWindowManager be called at a // later time to apply changes to surfaces and displays. - private void scheduleTraversalLocked() { + private void scheduleTraversalLocked(boolean inTraversal) { if (!mPendingTraversal && mWindowManagerFuncs != null) { mPendingTraversal = true; - mHandler.sendEmptyMessage(MSG_REQUEST_TRAVERSAL); + if (!inTraversal) { + mHandler.sendEmptyMessage(MSG_REQUEST_TRAVERSAL); + } } } @@ -911,7 +915,7 @@ public final class DisplayManagerService extends IDisplayManager.Stub { @Override public void onTraversalRequested() { synchronized (mSyncRoot) { - scheduleTraversalLocked(); + scheduleTraversalLocked(false); } } } diff --git a/services/java/com/android/server/display/WifiDisplayController.java b/services/java/com/android/server/display/WifiDisplayController.java index d533c941dcc8..39d042f5fc61 100644 --- a/services/java/com/android/server/display/WifiDisplayController.java +++ b/services/java/com/android/server/display/WifiDisplayController.java @@ -639,9 +639,9 @@ final class WifiDisplayController implements DumpUtils.Dump { } private void handlePeersChanged() { - if (mWfdEnabled) { - requestPeers(); - } + // Even if wfd is disabled, it is best to get the latest set of peers to + // keep in sync with the p2p framework + requestPeers(); } private void handleConnectionChanged(NetworkInfo networkInfo) { diff --git a/services/java/com/android/server/input/InputManagerService.java b/services/java/com/android/server/input/InputManagerService.java index 7b0c45237dbf..5e4907e6820d 100644 --- a/services/java/com/android/server/input/InputManagerService.java +++ b/services/java/com/android/server/input/InputManagerService.java @@ -113,6 +113,7 @@ public class InputManagerService extends IInputManager.Stub private final InputManagerHandler mHandler; private WindowManagerCallbacks mWindowManagerCallbacks; + private WiredAccessoryCallbacks mWiredAccessoryCallbacks; private boolean mSystemReady; private NotificationManager mNotificationManager; @@ -197,7 +198,7 @@ public class InputManagerService extends IInputManager.Stub // Key states (may be returned by queries about the current state of a // particular key code, scan code or switch). - + /** The key state is unknown or the requested key itself is not supported. */ public static final int KEY_STATE_UNKNOWN = -1; @@ -213,17 +214,41 @@ public class InputManagerService extends IInputManager.Stub /** Scan code: Mouse / trackball button. */ public static final int BTN_MOUSE = 0x110; + // Switch code values must match bionic/libc/kernel/common/linux/input.h /** Switch code: Lid switch. When set, lid is shut. */ public static final int SW_LID = 0x00; /** Switch code: Keypad slide. When set, keyboard is exposed. */ public static final int SW_KEYPAD_SLIDE = 0x0a; + /** Switch code: Headphone. When set, headphone is inserted. */ + public static final int SW_HEADPHONE_INSERT = 0x02; + + /** Switch code: Microphone. When set, microphone is inserted. */ + public static final int SW_MICROPHONE_INSERT = 0x04; + + /** Switch code: Headphone/Microphone Jack. When set, something is inserted. */ + public static final int SW_JACK_PHYSICAL_INSERT = 0x07; + + public static final int SW_LID_BIT = 1 << SW_LID; + public static final int SW_KEYPAD_SLIDE_BIT = 1 << SW_KEYPAD_SLIDE; + public static final int SW_HEADPHONE_INSERT_BIT = 1 << SW_HEADPHONE_INSERT; + public static final int SW_MICROPHONE_INSERT_BIT = 1 << SW_MICROPHONE_INSERT; + public static final int SW_JACK_PHYSICAL_INSERT_BIT = 1 << SW_JACK_PHYSICAL_INSERT; + public static final int SW_JACK_BITS = + SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT | SW_JACK_PHYSICAL_INSERT_BIT; + + /** Whether to use the dev/input/event or uevent subsystem for the audio jack. */ + final boolean mUseDevInputEventForAudioJack; + public InputManagerService(Context context, Handler handler) { this.mContext = context; this.mHandler = new InputManagerHandler(handler.getLooper()); - Slog.i(TAG, "Initializing input manager"); + mUseDevInputEventForAudioJack = + context.getResources().getBoolean(R.bool.config_useDevInputEventForAudioJack); + Slog.i(TAG, "Initializing input manager, mUseDevInputEventForAudioJack=" + + mUseDevInputEventForAudioJack); mPtr = nativeInit(this, mContext, mHandler.getLooper().getQueue()); } @@ -231,6 +256,10 @@ public class InputManagerService extends IInputManager.Stub mWindowManagerCallbacks = callbacks; } + public void setWiredAccessoryCallbacks(WiredAccessoryCallbacks callbacks) { + mWiredAccessoryCallbacks = callbacks; + } + public void start() { Slog.i(TAG, "Starting input manager"); nativeStart(mPtr); @@ -335,7 +364,7 @@ public class InputManagerService extends IInputManager.Stub public int getKeyCodeState(int deviceId, int sourceMask, int keyCode) { return nativeGetKeyCodeState(mPtr, deviceId, sourceMask, keyCode); } - + /** * Gets the current state of a key or button by scan code. * @param deviceId The input device id, or -1 to consult all devices. @@ -513,7 +542,7 @@ public class InputManagerService extends IInputManager.Stub /** * Gets information about the input device with the specified id. - * @param id The device id. + * @param deviceId The device id. * @return The input device or null if not found. */ @Override // Binder call @@ -976,8 +1005,8 @@ public class InputManagerService extends IInputManager.Stub // Must be called on handler. private void handleSwitchKeyboardLayout(int deviceId, int direction) { final InputDevice device = getInputDevice(deviceId); - final String inputDeviceDescriptor = device.getDescriptor(); if (device != null) { + final String inputDeviceDescriptor = device.getDescriptor(); final boolean changed; final String keyboardLayoutDescriptor; synchronized (mDataStore) { @@ -1214,6 +1243,7 @@ public class InputManagerService extends IInputManager.Stub } // Called by the heartbeat to ensure locks are not held indefinitely (for deadlock detection). + @Override public void monitor() { synchronized (mInputFilterLock) { } nativeMonitor(mPtr); @@ -1244,10 +1274,15 @@ public class InputManagerService extends IInputManager.Stub + ", mask=" + Integer.toHexString(switchMask)); } - if ((switchMask & (1 << SW_LID)) != 0) { - final boolean lidOpen = ((switchValues & (1 << SW_LID)) == 0); + if ((switchMask & SW_LID_BIT) != 0) { + final boolean lidOpen = ((switchValues & SW_LID_BIT) == 0); mWindowManagerCallbacks.notifyLidSwitchChanged(whenNanos, lidOpen); } + + if (mUseDevInputEventForAudioJack && (switchMask & SW_JACK_BITS) != 0) { + mWiredAccessoryCallbacks.notifyWiredAccessoryChanged(whenNanos, switchValues, + switchMask); + } } // Native callback. @@ -1431,7 +1466,6 @@ public class InputManagerService extends IInputManager.Stub return null; } - /** * Callback interface implemented by the Window Manager. */ @@ -1459,6 +1493,13 @@ public class InputManagerService extends IInputManager.Stub } /** + * Callback interface implemented by WiredAccessoryObserver. + */ + public interface WiredAccessoryCallbacks { + public void notifyWiredAccessoryChanged(long whenNanos, int switchValues, int switchMask); + } + + /** * Private handler for the input manager. */ private final class InputManagerHandler extends Handler { @@ -1498,6 +1539,7 @@ public class InputManagerService extends IInputManager.Stub mDisconnected = true; } + @Override public void sendInputEvent(InputEvent event, int policyFlags) { if (event == null) { throw new IllegalArgumentException("event must not be null"); diff --git a/services/java/com/android/server/location/GpsLocationProvider.java b/services/java/com/android/server/location/GpsLocationProvider.java index 84adb839166d..a254d748682c 100755 --- a/services/java/com/android/server/location/GpsLocationProvider.java +++ b/services/java/com/android/server/location/GpsLocationProvider.java @@ -40,10 +40,8 @@ import android.os.Binder; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; -import android.os.Looper; import android.os.Message; import android.os.PowerManager; -import android.os.Process; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemClock; @@ -75,7 +73,6 @@ import java.util.ArrayList; import java.util.Date; import java.util.Map.Entry; import java.util.Properties; -import java.util.concurrent.CountDownLatch; /** * A GPS implementation of LocationProvider used by LocationManager. @@ -287,12 +284,8 @@ public class GpsLocationProvider implements LocationProviderInterface { private Bundle mLocationExtras = new Bundle(); private ArrayList<Listener> mListeners = new ArrayList<Listener>(); - // GpsLocationProvider's handler thread - private final Thread mThread; - // Handler for processing events in mThread. + // Handler for processing events private Handler mHandler; - // Used to signal when our main thread has initialized everything - private final CountDownLatch mInitializedLatch = new CountDownLatch(1); private String mAGpsApn; private int mAGpsDataConnectionState; @@ -437,21 +430,6 @@ public class GpsLocationProvider implements LocationProviderInterface { mWakeupIntent = PendingIntent.getBroadcast(mContext, 0, new Intent(ALARM_WAKEUP), 0); mTimeoutIntent = PendingIntent.getBroadcast(mContext, 0, new Intent(ALARM_TIMEOUT), 0); - IntentFilter intentFilter = new IntentFilter(); - intentFilter.addAction(Intents.DATA_SMS_RECEIVED_ACTION); - intentFilter.addDataScheme("sms"); - intentFilter.addDataAuthority("localhost","7275"); - context.registerReceiver(mBroadcastReciever, intentFilter); - - intentFilter = new IntentFilter(); - intentFilter.addAction(Intents.WAP_PUSH_RECEIVED_ACTION); - try { - intentFilter.addDataType("application/vnd.omaloc-supl-init"); - } catch (IntentFilter.MalformedMimeTypeException e) { - Log.w(TAG, "Malformed SUPL init mime type"); - } - context.registerReceiver(mBroadcastReciever, intentFilter); - mConnMgr = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE); // Battery statistics service to be notified when GPS turns on or off @@ -487,26 +465,43 @@ public class GpsLocationProvider implements LocationProviderInterface { Log.w(TAG, "Could not open GPS configuration file " + PROPERTIES_FILE); } - // wait until we are fully initialized before returning - mThread = new GpsLocationProviderThread(); - mThread.start(); - while (true) { - try { - mInitializedLatch.await(); - break; - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); + // construct handler, listen for events + mHandler = new ProviderHandler(); + listenForBroadcasts(); + + // also listen for PASSIVE_PROVIDER updates + mHandler.post(new Runnable() { + @Override + public void run() { + LocationManager locManager = + (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE); + locManager.requestLocationUpdates(LocationManager.PASSIVE_PROVIDER, + 0, 0, new NetworkLocationListener(), mHandler.getLooper()); } - } + }); } - private void initialize() { - // register our receiver on our thread rather than the main thread + private void listenForBroadcasts() { IntentFilter intentFilter = new IntentFilter(); + intentFilter.addAction(Intents.DATA_SMS_RECEIVED_ACTION); + intentFilter.addDataScheme("sms"); + intentFilter.addDataAuthority("localhost","7275"); + mContext.registerReceiver(mBroadcastReciever, intentFilter, null, mHandler); + + intentFilter = new IntentFilter(); + intentFilter.addAction(Intents.WAP_PUSH_RECEIVED_ACTION); + try { + intentFilter.addDataType("application/vnd.omaloc-supl-init"); + } catch (IntentFilter.MalformedMimeTypeException e) { + Log.w(TAG, "Malformed SUPL init mime type"); + } + mContext.registerReceiver(mBroadcastReciever, intentFilter, null, mHandler); + + intentFilter = new IntentFilter(); intentFilter.addAction(ALARM_WAKEUP); intentFilter.addAction(ALARM_TIMEOUT); intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); - mContext.registerReceiver(mBroadcastReciever, intentFilter); + mContext.registerReceiver(mBroadcastReciever, intentFilter, null, mHandler); } /** @@ -1536,29 +1531,6 @@ public class GpsLocationProvider implements LocationProviderInterface { } }; - private final class GpsLocationProviderThread extends Thread { - - public GpsLocationProviderThread() { - super("GpsLocationProvider"); - } - - @Override - public void run() { - Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND); - initialize(); - Looper.prepare(); - - LocationManager locManager = - (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE); - mHandler = new ProviderHandler(); - // signal when we are initialized and ready to go - mInitializedLatch.countDown(); - locManager.requestLocationUpdates(LocationManager.PASSIVE_PROVIDER, - 0, 0, new NetworkLocationListener(), Looper.myLooper()); - Looper.loop(); - } - } - private final class NetworkLocationListener implements LocationListener { @Override public void onLocationChanged(Location location) { diff --git a/services/java/com/android/server/pm/Installer.java b/services/java/com/android/server/pm/Installer.java index ad85c0d6fa4e..8b1e80fc94b3 100644 --- a/services/java/com/android/server/pm/Installer.java +++ b/services/java/com/android/server/pm/Installer.java @@ -254,10 +254,12 @@ public final class Installer { return execute(builder.toString()); } - public int deleteCacheFiles(String name) { + public int deleteCacheFiles(String name, int userId) { StringBuilder builder = new StringBuilder("rmcache"); builder.append(' '); builder.append(name); + builder.append(' '); + builder.append(userId); return execute(builder.toString()); } diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java index 1eafd9c4f2f5..75bc265ffe4f 100644 --- a/services/java/com/android/server/pm/PackageManagerService.java +++ b/services/java/com/android/server/pm/PackageManagerService.java @@ -45,6 +45,7 @@ import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlSerializer; +import android.app.ActivityManager; import android.app.ActivityManagerNative; import android.app.IActivityManager; import android.app.admin.IDevicePolicyManager; @@ -5890,6 +5891,10 @@ public class PackageManagerService extends IPackageManager.Stub { // Check if installing from ADB if ((flags & PackageManager.INSTALL_FROM_ADB) != 0) { + // Do not run verification in a test harness environment + if (ActivityManager.isRunningInTestHarness()) { + return false; + } // Check if the developer does not want package verification for ADB installs if (android.provider.Settings.Global.getInt(mContext.getContentResolver(), android.provider.Settings.Global.PACKAGE_VERIFIER_INCLUDE_ADB, 1) == 0) { @@ -8535,11 +8540,10 @@ public class PackageManagerService extends IPackageManager.Stub { Slog.w(TAG, "Package " + packageName + " has no applicationInfo."); return false; } - // TODO: Pass userId to deleteCacheFiles - int retCode = mInstaller.deleteCacheFiles(packageName); + int retCode = mInstaller.deleteCacheFiles(packageName, userId); if (retCode < 0) { Slog.w(TAG, "Couldn't remove cache files for package: " - + packageName); + + packageName + " u" + userId); return false; } return true; diff --git a/services/java/com/android/server/power/DisplayPowerController.java b/services/java/com/android/server/power/DisplayPowerController.java index 5f4a7860f945..4f8cdde99941 100644 --- a/services/java/com/android/server/power/DisplayPowerController.java +++ b/services/java/com/android/server/power/DisplayPowerController.java @@ -44,7 +44,6 @@ import android.util.TimeUtils; import android.view.Display; import java.io.PrintWriter; -import java.io.StringWriter; import java.util.concurrent.Executor; /** @@ -95,7 +94,8 @@ final class DisplayPowerController { // when it is especially dark outside. The light sensor tends to perform // poorly at low light levels so we compensate for it by making an // assumption about the environment. - private static final boolean USE_TWILIGHT_ADJUSTMENT = true; + private static final boolean USE_TWILIGHT_ADJUSTMENT = + PowerManager.useTwilightAdjustmentFeature(); // Specifies the maximum magnitude of the time of day adjustment. private static final float TWILIGHT_ADJUSTMENT_MAX_GAMMA = 1.5f; diff --git a/services/java/com/android/server/power/PowerManagerService.java b/services/java/com/android/server/power/PowerManagerService.java index c2d47e582c23..664125ad95d6 100644 --- a/services/java/com/android/server/power/PowerManagerService.java +++ b/services/java/com/android/server/power/PowerManagerService.java @@ -266,6 +266,11 @@ public final class PowerManagerService extends IPowerManager.Stub // Use -1 to disable. private int mScreenBrightnessOverrideFromWindowManager = -1; + // The user activity timeout override from the window manager + // to allow the current foreground activity to override the user activity timeout. + // Use -1 to disable. + private long mUserActivityTimeoutOverrideFromWindowManager = -1; + // The screen brightness setting override from the settings application // to temporarily adjust the brightness until next updated, // Use -1 to disable. @@ -277,6 +282,9 @@ public final class PowerManagerService extends IPowerManager.Stub // Use NaN to disable. private float mTemporaryScreenAutoBrightnessAdjustmentSettingOverride = Float.NaN; + // Time when we last logged a warning about calling userActivity() without permission. + private long mLastWarningAboutUserActivityPermission = Long.MIN_VALUE; + private native void nativeInit(); private static native void nativeShutdown(); private static native void nativeReboot(String reason) throws IOException; @@ -683,12 +691,29 @@ public final class PowerManagerService extends IPowerManager.Stub @Override // Binder call public void userActivity(long eventTime, int event, int flags) { + final long now = SystemClock.uptimeMillis(); + if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER) + != PackageManager.PERMISSION_GRANTED) { + // Once upon a time applications could call userActivity(). + // Now we require the DEVICE_POWER permission. Log a warning and ignore the + // request instead of throwing a SecurityException so we don't break old apps. + synchronized (mLock) { + if (now >= mLastWarningAboutUserActivityPermission + (5 * 60 * 1000)) { + mLastWarningAboutUserActivityPermission = now; + Slog.w(TAG, "Ignoring call to PowerManager.userActivity() because the " + + "caller does not have DEVICE_POWER permission. " + + "Please fix your app! " + + " pid=" + Binder.getCallingPid() + + " uid=" + Binder.getCallingUid()); + } + } + return; + } + if (eventTime > SystemClock.uptimeMillis()) { throw new IllegalArgumentException("event time must not be in the future"); } - mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER, null); - final int uid = Binder.getCallingUid(); final long ident = Binder.clearCallingIdentity(); try { @@ -1156,6 +1181,9 @@ public final class PowerManagerService extends IPowerManager.Stub if (isMaximumScreenOffTimeoutFromDeviceAdminEnforcedLocked()) { timeout = Math.min(timeout, mMaximumScreenOffTimeoutFromDeviceAdmin); } + if (mUserActivityTimeoutOverrideFromWindowManager >= 0) { + timeout = (int)Math.min(timeout, mUserActivityTimeoutOverrideFromWindowManager); + } return Math.max(timeout, MINIMUM_SCREEN_OFF_TIMEOUT); } @@ -1573,18 +1601,6 @@ public final class PowerManagerService extends IPowerManager.Stub } } - @Override // Binder call - public void clearUserActivityTimeout(long now, long timeout) { - // TODO Auto-generated method stub - // Only used by phone app, delete this - } - - @Override // Binder call - public void setPokeLock(int pokey, IBinder lock, String tag) { - // TODO Auto-generated method stub - // Only used by phone app, delete this - } - /** * Set the setting that determines whether the device stays on when plugged in. * The argument is a bit string, with each bit specifying a power source that, @@ -1727,6 +1743,36 @@ public final class PowerManagerService extends IPowerManager.Stub } /** + * Used by the window manager to override the user activity timeout based on the + * current foreground activity. It can only be used to make the timeout shorter + * than usual, not longer. + * + * This method must only be called by the window manager. + * + * @param timeoutMillis The overridden timeout, or -1 to disable the override. + */ + public void setUserActivityTimeoutOverrideFromWindowManager(long timeoutMillis) { + mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER, null); + + final long ident = Binder.clearCallingIdentity(); + try { + setUserActivityTimeoutOverrideFromWindowManagerInternal(timeoutMillis); + } finally { + Binder.restoreCallingIdentity(ident); + } + } + + private void setUserActivityTimeoutOverrideFromWindowManagerInternal(long timeoutMillis) { + synchronized (mLock) { + if (mUserActivityTimeoutOverrideFromWindowManager != timeoutMillis) { + mUserActivityTimeoutOverrideFromWindowManager = timeoutMillis; + mDirty |= DIRTY_SETTINGS; + updatePowerStateLocked(); + } + } + } + + /** * Used by the settings application and brightness control widgets to * temporarily override the current screen brightness setting so that the * user can observe the effect of an intended settings change without applying @@ -1875,6 +1921,8 @@ public final class PowerManagerService extends IPowerManager.Stub pw.println(" mScreenBrightnessModeSetting=" + mScreenBrightnessModeSetting); pw.println(" mScreenBrightnessOverrideFromWindowManager=" + mScreenBrightnessOverrideFromWindowManager); + pw.println(" mUserActivityTimeoutOverrideFromWindowManager=" + + mUserActivityTimeoutOverrideFromWindowManager); pw.println(" mTemporaryScreenBrightnessSettingOverride=" + mTemporaryScreenBrightnessSettingOverride); pw.println(" mTemporaryScreenAutoBrightnessAdjustmentSettingOverride=" diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index 782d417b733d..3f7b67b1c980 100755 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -18,19 +18,24 @@ package com.android.server.wm; import static android.view.WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW; import static android.view.WindowManager.LayoutParams.FIRST_SUB_WINDOW; +import static android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; import static android.view.WindowManager.LayoutParams.FLAG_COMPATIBLE_WINDOW; import static android.view.WindowManager.LayoutParams.FLAG_DIM_BEHIND; import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; -import static android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; import static android.view.WindowManager.LayoutParams.LAST_APPLICATION_WINDOW; import static android.view.WindowManager.LayoutParams.LAST_SUB_WINDOW; +import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; +import static android.view.WindowManager.LayoutParams.TYPE_BOOT_PROGRESS; import static android.view.WindowManager.LayoutParams.TYPE_DREAM; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG; +import static android.view.WindowManager.LayoutParams.TYPE_KEYGUARD; +import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG; +import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ERROR; import static android.view.WindowManager.LayoutParams.TYPE_UNIVERSE_BACKGROUND; import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; @@ -593,7 +598,13 @@ public class WindowManagerService extends IWindowManager.Stub private boolean mSyswin = false; private float mScreenBrightness = -1; private float mButtonBrightness = -1; + private long mUserActivityTimeout = -1; private boolean mUpdateRotation = false; + + private static final int DISPLAY_CONTENT_UNKNOWN = 0; + private static final int DISPLAY_CONTENT_MIRROR = 1; + private static final int DISPLAY_CONTENT_UNIQUE = 2; + private int mDisplayHasContent = DISPLAY_CONTENT_UNKNOWN; } final LayoutFields mInnerFields = new LayoutFields(); @@ -1118,10 +1129,6 @@ public class WindowManagerService extends IWindowManager.Stub if (win.mAppToken != null && addToToken) { win.mAppToken.allAppWindows.add(win); } - - if (windows.size() == 1) { - mDisplayManagerService.setDisplayHasContent(win.getDisplayId(), true); - } } /** TODO(cmautner): Is this the same as {@link WindowState#canReceiveKeys()} */ @@ -1129,7 +1136,7 @@ public class WindowManagerService extends IWindowManager.Stub final int fl = w.mAttrs.flags & (FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM); if (fl == 0 || fl == (FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM) - || w.mAttrs.type == WindowManager.LayoutParams.TYPE_APPLICATION_STARTING) { + || w.mAttrs.type == TYPE_APPLICATION_STARTING) { if (DEBUG_INPUT_METHOD) { Slog.i(TAG, "isVisibleOrAdding " + w + ": " + w.isVisibleOrAdding()); if (!w.isVisibleOrAdding()) { @@ -1177,7 +1184,7 @@ public class WindowManagerService extends IWindowManager.Stub // is not actually looking to move the IME, look down below // for a real window to target... if (!willMove - && w.mAttrs.type == WindowManager.LayoutParams.TYPE_APPLICATION_STARTING + && w.mAttrs.type == TYPE_APPLICATION_STARTING && i > 0) { WindowState wb = windows.get(i-1); if (wb.mAppToken == w.mAppToken && canBeImeTarget(wb)) { @@ -1576,7 +1583,7 @@ public class WindowManagerService extends IWindowManager.Stub while (i > 0) { i--; w = windows.get(i); - if ((w.mAttrs.type == WindowManager.LayoutParams.TYPE_WALLPAPER)) { + if ((w.mAttrs.type == TYPE_WALLPAPER)) { if (topCurW == null) { topCurW = w; topCurI = i; @@ -2411,9 +2418,6 @@ public class WindowManagerService extends IWindowManager.Stub final WindowList windows = win.getWindowList(); windows.remove(win); - if (windows.isEmpty()) { - mDisplayManagerService.setDisplayHasContent(win.getDisplayId(), false); - } mPendingRemove.remove(win); mWindowsChanged = true; if (DEBUG_WINDOW_MOVEMENT) Slog.v(TAG, "Final remove of window: " + win); @@ -2774,13 +2778,11 @@ public class WindowManagerService extends IWindowManager.Stub win.mHScale = win.mVScale = 1; } - boolean imMayMove = (flagChanges&( - WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM | - WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE)) != 0; + boolean imMayMove = (flagChanges & (FLAG_ALT_FOCUSABLE_IM | FLAG_NOT_FOCUSABLE)) != 0; final boolean isDefaultDisplay = win.isDefaultDisplay(); boolean focusMayChange = isDefaultDisplay && (win.mViewVisibility != viewVisibility - || ((flagChanges&WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) != 0) + || ((flagChanges & FLAG_NOT_FOCUSABLE) != 0) || (!win.mRelayoutCalled)); boolean wallpaperMayMove = win.mViewVisibility != viewVisibility @@ -3094,8 +3096,7 @@ public class WindowManagerService extends IWindowManager.Stub final int windowCount = windows.size(); for (int i = 0; i < windowCount; i++) { WindowState window = windows.get(i); - if (window.isVisibleLw() || - window.mAttrs.type == WindowManager.LayoutParams.TYPE_UNIVERSE_BACKGROUND) { + if (window.isVisibleLw() || window.mAttrs.type == TYPE_UNIVERSE_BACKGROUND) { WindowInfo info = getWindowInfoForWindowStateLocked(window); outInfos.add(info); } @@ -3149,8 +3150,7 @@ public class WindowManagerService extends IWindowManager.Stub info.type = window.mAttrs.type; info.displayId = window.getDisplayId(); info.compatibilityScale = window.mGlobalScale; - info.visible = window.isVisibleLw() - || info.type == WindowManager.LayoutParams.TYPE_UNIVERSE_BACKGROUND; + info.visible = window.isVisibleLw() || info.type == TYPE_UNIVERSE_BACKGROUND; info.layer = window.mLayer; window.getTouchableRegion(mTempRegion); mTempRegion.getBounds(info.touchableRegion); @@ -4375,7 +4375,7 @@ public class WindowManagerService extends IWindowManager.Stub // an opaque window and our starting window transition animation // can still work. We just need to make sure the starting window // is also showing the wallpaper. - windowFlags |= WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; + windowFlags |= FLAG_SHOW_WALLPAPER; } else { return; } @@ -5497,7 +5497,7 @@ public class WindowManagerService extends IWindowManager.Stub final int N = windows.size(); for (int i=0; i<N; i++) { WindowState w = windows.get(i); - if (w.mAttrs.type == WindowManager.LayoutParams.TYPE_KEYGUARD) { + if (w.mAttrs.type == TYPE_KEYGUARD) { // Only if there is a keyguard attached to the window manager // will we consider ourselves as having a keyguard. If it // isn't attached, we don't know if it wants to be shown or @@ -5513,13 +5513,13 @@ public class WindowManagerService extends IWindowManager.Stub return; } if (w.isDrawnLw()) { - if (w.mAttrs.type == WindowManager.LayoutParams.TYPE_BOOT_PROGRESS) { + if (w.mAttrs.type == TYPE_BOOT_PROGRESS) { haveBootMsg = true; - } else if (w.mAttrs.type == WindowManager.LayoutParams.TYPE_APPLICATION) { + } else if (w.mAttrs.type == TYPE_APPLICATION) { haveApp = true; - } else if (w.mAttrs.type == WindowManager.LayoutParams.TYPE_WALLPAPER) { + } else if (w.mAttrs.type == TYPE_WALLPAPER) { haveWallpaper = true; - } else if (w.mAttrs.type == WindowManager.LayoutParams.TYPE_KEYGUARD) { + } else if (w.mAttrs.type == TYPE_KEYGUARD) { haveKeyguard = true; } } @@ -5715,9 +5715,8 @@ public class WindowManagerService extends IWindowManager.Stub dw = displayInfo.logicalWidth; dh = displayInfo.logicalHeight; - int aboveAppLayer = mPolicy.windowTypeToLayerLw( - WindowManager.LayoutParams.TYPE_APPLICATION) * TYPE_LAYER_MULTIPLIER - + TYPE_LAYER_OFFSET; + int aboveAppLayer = mPolicy.windowTypeToLayerLw(TYPE_APPLICATION) + * TYPE_LAYER_MULTIPLIER + TYPE_LAYER_OFFSET; aboveAppLayer += TYPE_LAYER_MULTIPLIER; boolean isImeTarget = mInputMethodTarget != null @@ -6676,9 +6675,6 @@ public class WindowManagerService extends IWindowManager.Stub int h = mPolicy.getNonDecorDisplayHeight(dw, dh, rotation); // Compute the screen layout size class for this rotation. - int screenLayoutSize; - boolean screenLayoutLong; - boolean screenLayoutCompatNeeded; int longSize = w; int shortSize = h; if (longSize < shortSize) { @@ -6688,64 +6684,7 @@ public class WindowManagerService extends IWindowManager.Stub } longSize = (int)(longSize/density); shortSize = (int)(shortSize/density); - - // These semi-magic numbers define our compatibility modes for - // applications with different screens. These are guarantees to - // app developers about the space they can expect for a particular - // configuration. DO NOT CHANGE! - if (longSize < 470) { - // This is shorter than an HVGA normal density screen (which - // is 480 pixels on its long side). - screenLayoutSize = Configuration.SCREENLAYOUT_SIZE_SMALL; - screenLayoutLong = false; - screenLayoutCompatNeeded = false; - } else { - // What size is this screen screen? - if (longSize >= 960 && shortSize >= 720) { - // 1.5xVGA or larger screens at medium density are the point - // at which we consider it to be an extra large screen. - screenLayoutSize = Configuration.SCREENLAYOUT_SIZE_XLARGE; - } else if (longSize >= 640 && shortSize >= 480) { - // VGA or larger screens at medium density are the point - // at which we consider it to be a large screen. - screenLayoutSize = Configuration.SCREENLAYOUT_SIZE_LARGE; - } else { - screenLayoutSize = Configuration.SCREENLAYOUT_SIZE_NORMAL; - } - - // If this screen is wider than normal HVGA, or taller - // than FWVGA, then for old apps we want to run in size - // compatibility mode. - if (shortSize > 321 || longSize > 570) { - screenLayoutCompatNeeded = true; - } else { - screenLayoutCompatNeeded = false; - } - - // Is this a long screen? - if (((longSize*3)/5) >= (shortSize-1)) { - // Anything wider than WVGA (5:3) is considering to be long. - screenLayoutLong = true; - } else { - screenLayoutLong = false; - } - } - - // Now reduce the last screenLayout to not be better than what we - // have found. - if (!screenLayoutLong) { - curLayout = (curLayout&~Configuration.SCREENLAYOUT_LONG_MASK) - | Configuration.SCREENLAYOUT_LONG_NO; - } - if (screenLayoutCompatNeeded) { - curLayout |= Configuration.SCREENLAYOUT_COMPAT_NEEDED; - } - int curSize = curLayout&Configuration.SCREENLAYOUT_SIZE_MASK; - if (screenLayoutSize < curSize) { - curLayout = (curLayout&~Configuration.SCREENLAYOUT_SIZE_MASK) - | screenLayoutSize; - } - return curLayout; + return Configuration.reduceScreenLayout(curLayout, longSize, shortSize); } private void computeSizeRangesAndScreenLayout(DisplayInfo displayInfo, boolean rotated, @@ -6772,15 +6711,13 @@ public class WindowManagerService extends IWindowManager.Stub adjustDisplaySizeRanges(displayInfo, Surface.ROTATION_90, unrotDh, unrotDw); adjustDisplaySizeRanges(displayInfo, Surface.ROTATION_180, unrotDw, unrotDh); adjustDisplaySizeRanges(displayInfo, Surface.ROTATION_270, unrotDh, unrotDw); - int sl = Configuration.SCREENLAYOUT_SIZE_XLARGE - | Configuration.SCREENLAYOUT_LONG_YES; + int sl = Configuration.resetScreenLayout(outConfig.screenLayout); sl = reduceConfigLayout(sl, Surface.ROTATION_0, density, unrotDw, unrotDh); sl = reduceConfigLayout(sl, Surface.ROTATION_90, density, unrotDh, unrotDw); sl = reduceConfigLayout(sl, Surface.ROTATION_180, density, unrotDw, unrotDh); sl = reduceConfigLayout(sl, Surface.ROTATION_270, density, unrotDh, unrotDw); outConfig.smallestScreenWidthDp = (int)(displayInfo.smallestNominalAppWidth / density); - outConfig.screenLayout = - sl|(outConfig.screenLayout&Configuration.SCREENLAYOUT_LAYOUTDIR_MASK); + outConfig.screenLayout = sl; } private int reduceCompatConfigWidthSize(int curSize, int rotation, DisplayMetrics dm, @@ -8056,8 +7993,7 @@ public class WindowManagerService extends IWindowManager.Stub numRemoved++; continue; } else if (lastBelow == i-1) { - if (w.mAttrs.type == WindowManager.LayoutParams.TYPE_WALLPAPER - || w.mAttrs.type == WindowManager.LayoutParams.TYPE_UNIVERSE_BACKGROUND) { + if (w.mAttrs.type == TYPE_WALLPAPER || w.mAttrs.type == TYPE_UNIVERSE_BACKGROUND) { lastBelow = i; } } @@ -8840,12 +8776,27 @@ public class WindowManagerService extends IWindowManager.Stub && mInnerFields.mButtonBrightness < 0) { mInnerFields.mButtonBrightness = w.mAttrs.buttonBrightness; } + if (!mInnerFields.mSyswin && w.mAttrs.userActivityTimeout >= 0 + && mInnerFields.mUserActivityTimeout < 0) { + mInnerFields.mUserActivityTimeout = w.mAttrs.userActivityTimeout; + } + + final int type = attrs.type; if (canBeSeen - && (attrs.type == WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG - || attrs.type == WindowManager.LayoutParams.TYPE_KEYGUARD - || attrs.type == WindowManager.LayoutParams.TYPE_SYSTEM_ERROR)) { + && (type == TYPE_SYSTEM_DIALOG + || type == TYPE_KEYGUARD + || type == TYPE_SYSTEM_ERROR)) { mInnerFields.mSyswin = true; } + + if (canBeSeen) { + if (type == TYPE_DREAM || type == TYPE_KEYGUARD) { + mInnerFields.mDisplayHasContent = LayoutFields.DISPLAY_CONTENT_MIRROR; + } else if (mInnerFields.mDisplayHasContent + == LayoutFields.DISPLAY_CONTENT_UNKNOWN) { + mInnerFields.mDisplayHasContent = LayoutFields.DISPLAY_CONTENT_UNIQUE; + } + } } boolean opaqueDrawn = canBeSeen && w.isOpaqueDrawn(); @@ -8864,7 +8815,7 @@ public class WindowManagerService extends IWindowManager.Stub final WindowStateAnimator winAnimator = w.mWinAnimator; if (!mAnimator.isDimmingLocked(winAnimator)) { final int width, height; - if (attrs.type == WindowManager.LayoutParams.TYPE_BOOT_PROGRESS) { + if (attrs.type == TYPE_BOOT_PROGRESS) { final DisplayInfo displayInfo = w.mDisplayContent.getDisplayInfo(); width = displayInfo.logicalWidth; height = displayInfo.logicalHeight; @@ -8929,6 +8880,9 @@ public class WindowManagerService extends IWindowManager.Stub mInnerFields.mHoldScreen = null; mInnerFields.mScreenBrightness = -1; mInnerFields.mButtonBrightness = -1; + mInnerFields.mUserActivityTimeout = -1; + mInnerFields.mDisplayHasContent = LayoutFields.DISPLAY_CONTENT_UNKNOWN; + mTransactionSequence++; final DisplayContent defaultDisplay = getDefaultDisplayContentLocked(); @@ -8948,10 +8902,6 @@ public class WindowManagerService extends IWindowManager.Stub mStrictModeFlash.positionSurface(defaultDw, defaultDh); } - // Give the display manager a chance to adjust properties - // like display rotation if it needs to. - mDisplayManagerService.performTraversalInTransactionFromWindowManager(); - boolean focusDisplayed = false; boolean updateAllDrawn = false; @@ -8967,6 +8917,11 @@ public class WindowManagerService extends IWindowManager.Stub final int innerDh = displayInfo.appHeight; final boolean isDefaultDisplay = (displayId == Display.DEFAULT_DISPLAY); + // Reset for each display unless we are forcing mirroring. + if (mInnerFields.mDisplayHasContent != LayoutFields.DISPLAY_CONTENT_MIRROR) { + mInnerFields.mDisplayHasContent = LayoutFields.DISPLAY_CONTENT_UNKNOWN; + } + int repeats = 0; do { repeats++; @@ -9086,9 +9041,8 @@ public class WindowManagerService extends IWindowManager.Stub final boolean committed = winAnimator.commitFinishDrawingLocked(currentTime); if (isDefaultDisplay && committed) { - if ((w.mAttrs.flags - & WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER) != 0) { - if (WindowManagerService.DEBUG_WALLPAPER) Slog.v(TAG, + if ((w.mAttrs.flags & FLAG_SHOW_WALLPAPER) != 0) { + if (DEBUG_WALLPAPER) Slog.v(TAG, "First draw done in potential wallpaper target " + w); mInnerFields.mWallpaperMayChange = true; displayContent.pendingLayoutChanges |= @@ -9104,7 +9058,8 @@ public class WindowManagerService extends IWindowManager.Stub winAnimator.setSurfaceBoundariesLocked(recoveringMemory); final AppWindowToken atoken = w.mAppToken; - if (DEBUG_STARTING_WINDOW && atoken != null && w == atoken.startingWindow) { + if (DEBUG_STARTING_WINDOW && atoken != null + && w == atoken.startingWindow) { Slog.d(TAG, "updateWindows: starting " + w + " isOnScreen=" + w.isOnScreen() + " allDrawn=" + atoken.allDrawn + " freezingScreen=" + atoken.mAppAnimator.freezingScreen); @@ -9116,8 +9071,7 @@ public class WindowManagerService extends IWindowManager.Stub atoken.numInterestingWindows = atoken.numDrawnWindows = 0; atoken.startingDisplayed = false; } - if ((w.isOnScreen() || winAnimator.mAttrType - == WindowManager.LayoutParams.TYPE_BASE_APPLICATION) + if ((w.isOnScreen() || winAnimator.mAttrType == TYPE_BASE_APPLICATION) && !w.mExiting && !w.mDestroying) { if (WindowManagerService.DEBUG_VISIBILITY || WindowManagerService.DEBUG_ORIENTATION) { @@ -9160,6 +9114,22 @@ public class WindowManagerService extends IWindowManager.Stub updateResizingWindows(w); } + final boolean hasUniqueContent; + switch (mInnerFields.mDisplayHasContent) { + case LayoutFields.DISPLAY_CONTENT_MIRROR: + hasUniqueContent = isDefaultDisplay; + break; + case LayoutFields.DISPLAY_CONTENT_UNIQUE: + hasUniqueContent = true; + break; + case LayoutFields.DISPLAY_CONTENT_UNKNOWN: + default: + hasUniqueContent = false; + break; + } + mDisplayManagerService.setDisplayHasContent(displayId, hasUniqueContent, + true /* inTraversal, must call performTraversalInTrans... below */); + if (!mInnerFields.mDimming && mAnimator.isDimmingLocked(displayId)) { stopDimmingLocked(displayId); } @@ -9172,6 +9142,11 @@ public class WindowManagerService extends IWindowManager.Stub if (focusDisplayed) { mH.sendEmptyMessage(H.REPORT_LOSING_FOCUS); } + + // Give the display manager a chance to adjust properties + // like display rotation if it needs to. + mDisplayManagerService.performTraversalInTransactionFromWindowManager(); + } catch (RuntimeException e) { Log.wtf(TAG, "Unhandled exception in Window Manager", e); } finally { @@ -9382,6 +9357,8 @@ public class WindowManagerService extends IWindowManager.Stub mPowerManager.setButtonBrightnessOverrideFromWindowManager( toBrightnessOverride(mInnerFields.mButtonBrightness)); } + mPowerManager.setUserActivityTimeoutOverrideFromWindowManager( + mInnerFields.mUserActivityTimeout); } if (mTurnOnScreen) { diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Grain.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Grain.java index cd54c2eb5bc1..8618cc8fc553 100644 --- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Grain.java +++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Grain.java @@ -45,19 +45,40 @@ public class Grain extends TestBase { mScript.set_gNoiseStrength(s); } + private int findHighBit(int v) { + int bit = 0; + while (v > 1) { + bit++; + v >>= 1; + } + return bit; + } + + public void createTest(android.content.res.Resources res) { int width = mInPixelsAllocation.getType().getX(); int height = mInPixelsAllocation.getType().getY(); + int noiseW = findHighBit(width); + int noiseH = findHighBit(height); + if (noiseW > 9) { + noiseW = 9; + } + if (noiseH > 9) { + noiseH = 9; + } + noiseW = 1 << noiseW; + noiseH = 1 << noiseH; + Type.Builder tb = new Type.Builder(mRS, Element.U8(mRS)); - tb.setX(width); - tb.setY(height); + tb.setX(noiseW); + tb.setY(noiseH); mNoise = Allocation.createTyped(mRS, tb.create()); mNoise2 = Allocation.createTyped(mRS, tb.create()); mScript = new ScriptC_grain(mRS, res, R.raw.grain); - mScript.set_gWidth(width); - mScript.set_gHeight(height); + mScript.set_gWMask(noiseW - 1); + mScript.set_gHMask(noiseH - 1); mScript.set_gNoiseStrength(0.5f); mScript.set_gBlendSource(mNoise); mScript.set_gNoise(mNoise2); diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.rs index ea425243c4e2..c8531f39c1bb 100644 --- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.rs +++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.rs @@ -38,15 +38,15 @@ void genRand(uchar *out) { * 1 2 1 */ -int32_t gWidth; -int32_t gHeight; +int32_t gWMask; +int32_t gHMask; rs_allocation gBlendSource; void blend9(uchar *out, uint32_t x, uint32_t y) { - uint32_t x1 = min((int32_t)x+1, (int32_t)(gWidth -1)); - uint32_t x2 = max((int32_t)x-1, (int32_t)0); - uint32_t y1 = min((int32_t)y+1, (int32_t)(gHeight -1)); - uint32_t y2 = max((int32_t)y-1, (int32_t)0); + uint32_t x1 = (x-1) & gWMask; + uint32_t x2 = (x+1) & gWMask; + uint32_t y1 = (y-1) & gHMask; + uint32_t y2 = (y+1) & gHMask; uint p00 = 56 * rsGetElementAt_uchar(gBlendSource, x1, y1); uint p01 = 114 * rsGetElementAt_uchar(gBlendSource, x, y1); @@ -78,7 +78,7 @@ float gNoiseStrength; rs_allocation gNoise; void root(const uchar4 *in, uchar4 *out, uint32_t x, uint32_t y) { float4 ip = convert_float4(*in); - float pnoise = (float) rsGetElementAt_uchar(gNoise, x, y); + float pnoise = (float) rsGetElementAt_uchar(gNoise, x & gWMask, y & gHMask); float energy_level = ip.r + ip.g + ip.b; float energy_mask = (28.f - sqrt(energy_level)) * 0.03571f; diff --git a/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/CameraPreviewActivity.java b/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/CameraPreviewActivity.java index f21331f76be1..89eec2c4c61b 100644 --- a/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/CameraPreviewActivity.java +++ b/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/CameraPreviewActivity.java @@ -305,8 +305,7 @@ public class CameraPreviewActivity extends Activity long t1 = java.lang.System.currentTimeMillis(); - mFilterYuv.execute(data); - mFilterYuv.copyOut(mCallbackBitmap); + mFilterYuv.execute(data, mCallbackBitmap); long t2 = java.lang.System.currentTimeMillis(); mTiming[mTimingSlot++] = t2 - t1; diff --git a/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/RsYuv.java b/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/RsYuv.java index cced198ff5b4..978ae12d2d80 100644 --- a/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/RsYuv.java +++ b/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/RsYuv.java @@ -42,6 +42,7 @@ public class RsYuv private Allocation mAllocationOut; private Allocation mAllocationIn; private ScriptC_yuv mScript; + private ScriptIntrinsicYuvToRGB mYuv; RsYuv(RenderScript rs, Resources res, int width, int height) { mHeight = height; @@ -50,6 +51,8 @@ public class RsYuv mScript = new ScriptC_yuv(mRS, res, R.raw.yuv); mScript.invoke_setSize(mWidth, mHeight); + mYuv = ScriptIntrinsicYuvToRGB.create(rs, Element.RGBA_8888(mRS)); + Type.Builder tb = new Type.Builder(mRS, Element.RGBA_8888(mRS)); tb.setX(mWidth); tb.setY(mHeight); @@ -58,34 +61,16 @@ public class RsYuv mAllocationIn = Allocation.createSized(rs, Element.U8(mRS), (mHeight * mWidth) + ((mHeight / 2) * (mWidth / 2) * 2)); - mScript.bind_gYuvIn(mAllocationIn); + mYuv.setInput(mAllocationIn); } private long mTiming[] = new long[50]; private int mTimingSlot = 0; - void execute(byte[] yuv) { + void execute(byte[] yuv, Bitmap b) { mAllocationIn.copyFrom(yuv); - mRS.finish(); - - long t1 = java.lang.System.currentTimeMillis(); - mScript.forEach_root(mAllocationOut); - mRS.finish(); - long t2 = java.lang.System.currentTimeMillis(); - - mTiming[mTimingSlot++] = t2 - t1; - if (mTimingSlot >= mTiming.length) { - float total = 0; - for (int i=0; i<mTiming.length; i++) { - total += (float)mTiming[i]; - } - total /= mTiming.length; - Log.e("yuv", "core time = " + total); - mTimingSlot = 0; - } - } - - void copyOut(Bitmap b) { + mYuv.forEach(mAllocationOut); + mScript.forEach_root(mAllocationOut, mAllocationOut); mAllocationOut.copyTo(b); } diff --git a/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/yuv.rs b/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/yuv.rs index 6057effe2f6c..884812da2580 100644 --- a/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/yuv.rs +++ b/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/yuv.rs @@ -3,8 +3,6 @@ #pragma rs java_package_name(com.android.rs.livepreview) #pragma rs_fp_relaxed -uchar *gYuvIn; - static int gWidth; static int gHeight; static uchar crossProcess_tableR[256]; @@ -80,13 +78,9 @@ static uchar4 vignette(uchar4 color, uint32_t x, uint32_t y) { return convert_uchar4(c); } -void root(uchar4 *out, uint32_t x, uint32_t y) { - uchar Y = gYuvIn[(y * gWidth) + x]; - uchar *uv = &gYuvIn[gWidth * gHeight]; - uv += (((x>>1)<<1) + (y>>1) * gWidth); - - uchar4 p = rsYuvToRGBA_uchar4(Y, uv[1], uv[0]); - p = crossProcess_i(p); +void root(const uchar4 *in, uchar4 *out, uint32_t x, uint32_t y) { + uchar4 p; + p = crossProcess_i(*in); p = vignette(p, x, y); out->rgba = p; diff --git a/tests/StatusBar/src/com/android/statusbartest/PowerTest.java b/tests/StatusBar/src/com/android/statusbartest/PowerTest.java index e38bb6ce0640..0cab10defb4f 100644 --- a/tests/StatusBar/src/com/android/statusbartest/PowerTest.java +++ b/tests/StatusBar/src/com/android/statusbartest/PowerTest.java @@ -21,9 +21,7 @@ import android.os.IBinder; import android.os.IPowerManager; import android.content.ComponentName; import android.content.pm.PackageManager; -import android.os.RemoteException; import android.os.Handler; -import android.os.LocalPowerManager; import android.os.ServiceManager; import android.os.PowerManager; @@ -106,69 +104,5 @@ public class PowerTest extends TestActivity }, 5000); } }, - new Test("Touch events don't poke") { - public void run() { - mPokeState |= LocalPowerManager.POKE_LOCK_IGNORE_TOUCH_EVENTS; - try { - mPowerManager.setPokeLock(mPokeState, mPokeToken, TAG); - } catch (RemoteException e) { - throw new RuntimeException(e); - } - } - }, - - new Test("Touch events poke") { - public void run() { - mPokeState &= ~LocalPowerManager.POKE_LOCK_IGNORE_TOUCH_EVENTS; - try { - mPowerManager.setPokeLock(mPokeState, mPokeToken, TAG); - } catch (RemoteException e) { - throw new RuntimeException(e); - } - } - }, - new Test("Short timeout") { - public void run() { - mPokeState &= ~LocalPowerManager.POKE_LOCK_TIMEOUT_MASK; - mPokeState |= LocalPowerManager.POKE_LOCK_SHORT_TIMEOUT; - try { - mPowerManager.setPokeLock(mPokeState, mPokeToken, TAG); - } catch (RemoteException e) { - throw new RuntimeException(e); - } - } - }, - new Test("Medium timeout") { - public void run() { - mPokeState &= ~LocalPowerManager.POKE_LOCK_TIMEOUT_MASK; - mPokeState |= LocalPowerManager.POKE_LOCK_MEDIUM_TIMEOUT; - try { - mPowerManager.setPokeLock(mPokeState, mPokeToken, TAG); - } catch (RemoteException e) { - throw new RuntimeException(e); - } - } - }, - new Test("Normal timeout") { - public void run() { - mPokeState &= ~LocalPowerManager.POKE_LOCK_TIMEOUT_MASK; - try { - mPowerManager.setPokeLock(mPokeState, mPokeToken, TAG); - } catch (RemoteException e) { - throw new RuntimeException(e); - } - } - }, - new Test("Illegal timeout") { - public void run() { - mPokeState |= LocalPowerManager.POKE_LOCK_SHORT_TIMEOUT - | LocalPowerManager.POKE_LOCK_MEDIUM_TIMEOUT; - try { - mPowerManager.setPokeLock(mPokeState, mPokeToken, TAG); - } catch (RemoteException e) { - throw new RuntimeException(e); - } - } - }, }; } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java index e882440f9274..5e23f24a5639 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java @@ -45,11 +45,6 @@ public class BridgePowerManager implements IPowerManager { } @Override - public void clearUserActivityTimeout(long arg0, long arg1) throws RemoteException { - // pass for now. - } - - @Override public void crash(String arg0) throws RemoteException { // pass for now. } @@ -95,11 +90,6 @@ public class BridgePowerManager implements IPowerManager { } @Override - public void setPokeLock(int arg0, IBinder arg1, String arg2) throws RemoteException { - // pass for now. - } - - @Override public void setStayOnSetting(int arg0) throws RemoteException { // pass for now. } diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java index ab9db8821282..db539e40d72d 100644 --- a/wifi/java/android/net/wifi/WifiStateMachine.java +++ b/wifi/java/android/net/wifi/WifiStateMachine.java @@ -1624,7 +1624,7 @@ public class WifiStateMachine extends StateMachine { Intent intent = new Intent(WifiManager.RSSI_CHANGED_ACTION); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); intent.putExtra(WifiManager.EXTRA_NEW_RSSI, newRssi); - mContext.sendBroadcastAsUser(intent, UserHandle.ALL); + mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); } private void sendNetworkStateChangeBroadcast(String bssid) { |