diff options
24 files changed, 218 insertions, 195 deletions
diff --git a/api/current.txt b/api/current.txt index 3a371cdf153d..6110d1c584fe 100644 --- a/api/current.txt +++ b/api/current.txt @@ -32174,7 +32174,6 @@ package android.provider { field public static final java.lang.String ACTION_SEARCH_SETTINGS = "android.search.action.SEARCH_SETTINGS"; field public static final java.lang.String ACTION_SECURITY_SETTINGS = "android.settings.SECURITY_SETTINGS"; field public static final java.lang.String ACTION_SETTINGS = "android.settings.SETTINGS"; - field public static final java.lang.String ACTION_SHOW_ADMIN_SUPPORT_DETAILS = "android.settings.SHOW_ADMIN_SUPPORT_DETAILS"; field public static final java.lang.String ACTION_SHOW_REGULATORY_INFO = "android.settings.SHOW_REGULATORY_INFO"; field public static final java.lang.String ACTION_SOUND_SETTINGS = "android.settings.SOUND_SETTINGS"; field public static final java.lang.String ACTION_SYNC_SETTINGS = "android.settings.SYNC_SETTINGS"; diff --git a/api/system-current.txt b/api/system-current.txt index 7ed4742419cf..c01f1c32d646 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -34661,7 +34661,6 @@ package android.provider { field public static final java.lang.String ACTION_SEARCH_SETTINGS = "android.search.action.SEARCH_SETTINGS"; field public static final java.lang.String ACTION_SECURITY_SETTINGS = "android.settings.SECURITY_SETTINGS"; field public static final java.lang.String ACTION_SETTINGS = "android.settings.SETTINGS"; - field public static final java.lang.String ACTION_SHOW_ADMIN_SUPPORT_DETAILS = "android.settings.SHOW_ADMIN_SUPPORT_DETAILS"; field public static final java.lang.String ACTION_SHOW_REGULATORY_INFO = "android.settings.SHOW_REGULATORY_INFO"; field public static final java.lang.String ACTION_SOUND_SETTINGS = "android.settings.SOUND_SETTINGS"; field public static final java.lang.String ACTION_SYNC_SETTINGS = "android.settings.SYNC_SETTINGS"; diff --git a/api/test-current.txt b/api/test-current.txt index cf7563cc1af0..96d29d1f9c48 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -32187,7 +32187,6 @@ package android.provider { field public static final java.lang.String ACTION_SEARCH_SETTINGS = "android.search.action.SEARCH_SETTINGS"; field public static final java.lang.String ACTION_SECURITY_SETTINGS = "android.settings.SECURITY_SETTINGS"; field public static final java.lang.String ACTION_SETTINGS = "android.settings.SETTINGS"; - field public static final java.lang.String ACTION_SHOW_ADMIN_SUPPORT_DETAILS = "android.settings.SHOW_ADMIN_SUPPORT_DETAILS"; field public static final java.lang.String ACTION_SHOW_REGULATORY_INFO = "android.settings.SHOW_REGULATORY_INFO"; field public static final java.lang.String ACTION_SOUND_SETTINGS = "android.settings.SOUND_SETTINGS"; field public static final java.lang.String ACTION_SYNC_SETTINGS = "android.settings.SYNC_SETTINGS"; diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 35b7c39338fc..52631d130e5c 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -263,8 +263,8 @@ public class Notification implements Parcelable * The view that will represent this notification in the notification list (which is pulled * down from the status bar). * - * As of N, this field is not used. The notification view is determined by the inputs to - * {@link Notification.Builder}; a custom RemoteViews can optionally be + * As of N, this field may be null. The notification view is determined by the inputs + * to {@link Notification.Builder}; a custom RemoteViews can optionally be * supplied with {@link Notification.Builder#setCustomContentView(RemoteViews)}. */ @Deprecated @@ -275,7 +275,7 @@ public class Notification implements Parcelable * opportunity to show more detail. The system UI may choose to show this * instead of the normal content view at its discretion. * - * As of N, this field is not used. The expanded notification view is determined by the + * As of N, this field may be null. The expanded notification view is determined by the * inputs to {@link Notification.Builder}; a custom RemoteViews can optionally be * supplied with {@link Notification.Builder#setCustomBigContentView(RemoteViews)}. */ @@ -289,7 +289,7 @@ public class Notification implements Parcelable * choose to show this as a heads-up notification, which will pop up so the user can see * it without leaving their current activity. * - * As of N, this field is not used. The heads-up notification view is determined by the + * As of N, this field may be null. The heads-up notification view is determined by the * inputs to {@link Notification.Builder}; a custom RemoteViews can optionally be * supplied with {@link Notification.Builder#setCustomHeadsUpContentView(RemoteViews)}. */ @@ -2129,8 +2129,23 @@ public class Notification implements Parcelable * </pre> */ public static class Builder { + /** + * @hide + */ + public static final String EXTRA_REBUILD_CONTENT_VIEW_ACTION_COUNT = + "android.rebuild.contentViewActionCount"; + /** + * @hide + */ + public static final String EXTRA_REBUILD_BIG_CONTENT_VIEW_ACTION_COUNT + = "android.rebuild.bigViewActionCount"; + /** + * @hide + */ + public static final String EXTRA_REBUILD_HEADS_UP_CONTENT_VIEW_ACTION_COUNT + = "android.rebuild.hudViewActionCount"; + private static final int MAX_ACTION_BUTTONS = 3; - private static final float LARGE_TEXT_SCALE = 1.3f; private Context mContext; private Notification mN; @@ -3566,19 +3581,6 @@ public class Notification implements Parcelable return null; } - private void setBuilderContentView(Notification n, RemoteViews contentView) { - n.contentView = contentView; - } - - private void setBuilderBigContentView(Notification n, RemoteViews bigContentView) { - n.bigContentView = bigContentView; - } - - private void setBuilderHeadsUpContentView(Notification n, - RemoteViews headsUpContentView) { - n.headsUpContentView = headsUpContentView; - } - /** * @deprecated Use {@link #build()} instead. */ @@ -3606,6 +3608,28 @@ public class Notification implements Parcelable mStyle.buildStyled(mN); } + if (mContext.getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.N) { + if (mN.contentView == null) { + mN.contentView = makeContentView(); + mN.extras.putInt(EXTRA_REBUILD_CONTENT_VIEW_ACTION_COUNT, + mN.contentView.getSequenceNumber()); + } + if (mN.bigContentView == null) { + mN.bigContentView = makeBigContentView(); + if (mN.bigContentView != null) { + mN.extras.putInt(EXTRA_REBUILD_BIG_CONTENT_VIEW_ACTION_COUNT, + mN.bigContentView.getSequenceNumber()); + } + } + if (mN.headsUpContentView == null) { + mN.headsUpContentView = makeHeadsUpContentView(); + if (mN.headsUpContentView != null) { + mN.extras.putInt(EXTRA_REBUILD_HEADS_UP_CONTENT_VIEW_ACTION_COUNT, + mN.headsUpContentView.getSequenceNumber()); + } + } + } + if ((mN.defaults & DEFAULT_LIGHTS) != 0) { mN.flags |= FLAG_SHOW_LIGHTS; } @@ -3623,6 +3647,40 @@ public class Notification implements Parcelable return n; } + /** + * @hide + */ + public static void stripForDelivery(Notification n) { + String templateClass = n.extras.getString(EXTRA_TEMPLATE); + if (TextUtils.isEmpty(templateClass)) { + return; + } + // Only strip views for known Styles because we won't know how to + // re-create them otherwise. + if (getNotificationStyleClass(templateClass) == null) { + return; + } + // Get rid of unmodified BuilderRemoteViews. + if (n.contentView instanceof BuilderRemoteViews && + n.extras.getInt(EXTRA_REBUILD_CONTENT_VIEW_ACTION_COUNT, -1) == + n.contentView.getSequenceNumber()) { + n.contentView = null; + n.extras.remove(EXTRA_REBUILD_CONTENT_VIEW_ACTION_COUNT); + } + if (n.bigContentView instanceof BuilderRemoteViews && + n.extras.getInt(EXTRA_REBUILD_BIG_CONTENT_VIEW_ACTION_COUNT, -1) == + n.bigContentView.getSequenceNumber()) { + n.bigContentView = null; + n.extras.remove(EXTRA_REBUILD_BIG_CONTENT_VIEW_ACTION_COUNT); + } + if (n.headsUpContentView instanceof BuilderRemoteViews && + n.extras.getInt(EXTRA_REBUILD_HEADS_UP_CONTENT_VIEW_ACTION_COUNT, -1) == + n.headsUpContentView.getSequenceNumber()) { + n.headsUpContentView = null; + n.extras.remove(EXTRA_REBUILD_HEADS_UP_CONTENT_VIEW_ACTION_COUNT); + } + } + private int getBaseLayoutResource() { return R.layout.notification_template_material_base; } diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java index 1f17024b1193..ff2cfd61cd12 100644 --- a/core/java/android/app/NotificationManager.java +++ b/core/java/android/app/NotificationManager.java @@ -246,6 +246,7 @@ public class NotificationManager } if (localLOGV) Log.v(TAG, pkg + ": notify(" + id + ", " + notification + ")"); final Notification copy = notification.clone(); + Builder.stripForDelivery(copy); try { service.enqueueNotificationWithTag(pkg, mContext.getOpPackageName(), tag, id, copy, idOut, user.getIdentifier()); diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 5ab2b001614a..9632ff7ee434 100755 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -1218,6 +1218,8 @@ public final class Settings { * Input: Nothing. * <p> * Output: Nothing. + * + * @hide */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_SHOW_ADMIN_SUPPORT_DETAILS diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 9e9ad677328c..70a0e014014a 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -21584,7 +21584,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ public void setPointerIcon(PointerIcon pointerIcon) { mPointerIcon = pointerIcon; - if (mAttachInfo == null) { + if (mAttachInfo == null || mAttachInfo.mHandlingPointerEvent) { return; } try { @@ -22637,6 +22637,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, boolean mHighContrastText; /** + * Set to true if a pointer event is currently being handled. + */ + boolean mHandlingPointerEvent; + + /** * Global to the view hierarchy used as a temporary for dealing with * x/y points in the transparent region computations. */ diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 6dc5ccc57073..05177885f3dc 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -4311,6 +4311,24 @@ public final class ViewRootImpl implements ViewParent, private int processPointerEvent(QueuedInputEvent q) { final MotionEvent event = (MotionEvent)q.mEvent; + mAttachInfo.mUnbufferedDispatchRequested = false; + final View eventTarget = + (event.isFromSource(InputDevice.SOURCE_MOUSE) && mCapturingView != null) ? + mCapturingView : mView; + mAttachInfo.mHandlingPointerEvent = true; + boolean handled = eventTarget.dispatchPointerEvent(event); + maybeUpdatePointerIcon(event); + mAttachInfo.mHandlingPointerEvent = false; + if (mAttachInfo.mUnbufferedDispatchRequested && !mUnbufferedInputDispatch) { + mUnbufferedInputDispatch = true; + if (mConsumeBatchedInputScheduled) { + scheduleConsumeBatchedInputImmediately(); + } + } + return handled ? FINISH_HANDLED : FORWARD; + } + + private void maybeUpdatePointerIcon(MotionEvent event) { if (event.getPointerCount() == 1 && event.isFromSource(InputDevice.SOURCE_MOUSE)) { if (event.getActionMasked() == MotionEvent.ACTION_HOVER_ENTER @@ -4327,19 +4345,6 @@ public final class ViewRootImpl implements ViewParent, } } } - - mAttachInfo.mUnbufferedDispatchRequested = false; - final View eventTarget = - (event.isFromSource(InputDevice.SOURCE_MOUSE) && mCapturingView != null) ? - mCapturingView : mView; - boolean handled = eventTarget.dispatchPointerEvent(event); - if (mAttachInfo.mUnbufferedDispatchRequested && !mUnbufferedInputDispatch) { - mUnbufferedInputDispatch = true; - if (mConsumeBatchedInputScheduled) { - scheduleConsumeBatchedInputImmediately(); - } - } - return handled ? FINISH_HANDLED : FORWARD; } private int processTrackballEvent(QueuedInputEvent q) { diff --git a/core/java/com/android/internal/util/Protocol.java b/core/java/com/android/internal/util/Protocol.java index a106f48745cf..5992f7a92e13 100644 --- a/core/java/com/android/internal/util/Protocol.java +++ b/core/java/com/android/internal/util/Protocol.java @@ -64,5 +64,6 @@ public class Protocol { public static final int BASE_NETWORK_AGENT = 0x00081000; public static final int BASE_NETWORK_MONITOR = 0x00082000; public static final int BASE_NETWORK_FACTORY = 0x00083000; + public static final int BASE_ETHERNET = 0x00084000; //TODO: define all used protocols } diff --git a/packages/SystemUI/res/layout-sw600dp/navigation_layout_rot90.xml b/packages/SystemUI/res/layout-sw600dp/navigation_layout_rot90.xml index 6f98509b2300..6f153c1086a1 100644 --- a/packages/SystemUI/res/layout-sw600dp/navigation_layout_rot90.xml +++ b/packages/SystemUI/res/layout-sw600dp/navigation_layout_rot90.xml @@ -41,26 +41,6 @@ </FrameLayout> - <FrameLayout - android:id="@+id/lights_out" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <LinearLayout - android:id="@+id/ends_group_lightsout" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="horizontal" /> - - <LinearLayout - android:id="@+id/center_group_lightsout" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:gravity="center" - android:orientation="horizontal" /> - - </FrameLayout> - <com.android.systemui.statusbar.policy.DeadZone android:id="@+id/deadzone" android:layout_height="match_parent" diff --git a/packages/SystemUI/res/layout/navigation_layout.xml b/packages/SystemUI/res/layout/navigation_layout.xml index 142d13a4129b..2bf4d9cb535f 100644 --- a/packages/SystemUI/res/layout/navigation_layout.xml +++ b/packages/SystemUI/res/layout/navigation_layout.xml @@ -42,26 +42,6 @@ </FrameLayout> - <FrameLayout - android:id="@+id/lights_out" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <LinearLayout - android:id="@+id/ends_group_lightsout" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="horizontal" /> - - <LinearLayout - android:id="@+id/center_group_lightsout" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:gravity="center" - android:orientation="horizontal" /> - - </FrameLayout> - <com.android.systemui.statusbar.policy.DeadZone android:id="@+id/deadzone" android:layout_height="match_parent" diff --git a/packages/SystemUI/res/layout/navigation_layout_rot90.xml b/packages/SystemUI/res/layout/navigation_layout_rot90.xml index 3b7b3696ea20..7601efc92a78 100644 --- a/packages/SystemUI/res/layout/navigation_layout_rot90.xml +++ b/packages/SystemUI/res/layout/navigation_layout_rot90.xml @@ -42,26 +42,6 @@ </FrameLayout> - <FrameLayout - android:id="@+id/lights_out" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <com.android.systemui.statusbar.phone.ReverseLinearLayout - android:id="@+id/ends_group_lightsout" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" /> - - <com.android.systemui.statusbar.phone.ReverseLinearLayout - android:id="@+id/center_group_lightsout" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:gravity="center" - android:orientation="vertical" /> - - </FrameLayout> - <com.android.systemui.statusbar.policy.DeadZone android:id="@+id/deadzone" android:layout_height="match_parent" diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/car/CarNavigationBarController.java b/packages/SystemUI/src/com/android/systemui/statusbar/car/CarNavigationBarController.java index a58fa86a477a..8a93c5b0d1c2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/car/CarNavigationBarController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/car/CarNavigationBarController.java @@ -23,6 +23,7 @@ import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.support.v4.util.SimpleArrayMap; +import android.util.SparseBooleanArray; import android.view.View; import android.widget.LinearLayout; @@ -71,6 +72,7 @@ class CarNavigationBarController { private int mCurrentFacetIndex; private String mCurrentPackageName; + private SparseBooleanArray mFacetHasMultipleAppsCache = new SparseBooleanArray(); public CarNavigationBarController(Context context, CarNavigationBarView navBar, @@ -96,6 +98,21 @@ class CarNavigationBarController { } } + public void onPackageChange(String packageName) { + if (mFacetPackageMap.containsKey(packageName)) { + int index = mFacetPackageMap.get(packageName); + mFacetHasMultipleAppsCache.put(index, facetHasMultiplePackages(index)); + // No need to check categories because we've already refreshed the cache. + return; + } + + String category = getPackageCategory(packageName); + if (mFacetCategoryMap.containsKey(category)) { + int index = mFacetCategoryMap.get(packageName); + mFacetHasMultipleAppsCache.put(index, facetHasMultiplePackages(index)); + } + } + private void bind() { // Read up arrays_car.xml and populate the navigation bar here. Resources r = mContext.getResources(); @@ -138,6 +155,7 @@ class CarNavigationBarController { initFacetFilterMaps(i, facetPackageNames.getString(i).split(FACET_FILTER_DEMILITER), facetCategories.getString(i).split(FACET_FILTER_DEMILITER)); + mFacetHasMultipleAppsCache.put(i, facetHasMultiplePackages(i)); } catch (URISyntaxException e) { throw new RuntimeException("Malformed intent uri", e); } @@ -229,7 +247,7 @@ class CarNavigationBarController { if (mNavButtons.get(index) != null) { mNavButtons.get(index).setSelected(true /* selected */, - facetHasMultiplePackages(index) /* showMoreIcon */); + mFacetHasMultipleAppsCache.get(index) /* showMoreIcon */); } mCurrentFacetIndex = index; } @@ -268,7 +286,7 @@ class CarNavigationBarController { private void startActivity(Intent intent) { if (mActivityStarter != null && intent != null) { - mActivityStarter.startActivity(intent, true); + mActivityStarter.startActivity(intent, false); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java index 08cd053b5903..c32ef0e9daf6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java @@ -18,7 +18,10 @@ package com.android.systemui.statusbar.car; import android.app.ActivityManager; import android.app.ITaskStackListener; +import android.content.BroadcastReceiver; import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; import android.graphics.PixelFormat; import android.os.Handler; import android.os.Looper; @@ -52,6 +55,7 @@ public class CarStatusBar extends PhoneStatusBar { mTaskStackListener = new TaskStackListenerImpl(mHandler); mSystemServicesProxy = new SystemServicesProxy(mContext); mSystemServicesProxy.registerTaskStackListener(mTaskStackListener); + registerPackageChangeReceivers(); } @Override @@ -81,6 +85,26 @@ public class CarStatusBar extends PhoneStatusBar { mController = new CarNavigationBarController(context, mCarNavigationBar, this /* ActivityStarter*/); mNavigationBarView = mCarNavigationBar; + + } + + private BroadcastReceiver mPackageChangeReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + if (intent.getData() == null || mController == null) { + return; + } + String packageName = intent.getData().getSchemeSpecificPart(); + mController.onPackageChange(packageName); + } + }; + + private void registerPackageChangeReceivers() { + IntentFilter filter = new IntentFilter(); + filter.addAction(Intent.ACTION_PACKAGE_ADDED); + filter.addAction(Intent.ACTION_PACKAGE_REMOVED); + filter.addDataScheme("package"); + mContext.registerReceiver(mPackageChangeReceiver, filter); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java index d625fc2bc738..260c9697c293 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java @@ -163,68 +163,29 @@ public class NavigationBarInflaterView extends FrameLayout implements TunerServi String[] start = sets[0].split(BUTTON_SEPARATOR); String[] center = sets[1].split(BUTTON_SEPARATOR); String[] end = sets[2].split(BUTTON_SEPARATOR); - inflateButtons(start, (ViewGroup) mRot0.findViewById(R.id.ends_group), - (ViewGroup) mRot0.findViewById(R.id.ends_group_lightsout), false); - inflateButtons(start, (ViewGroup) mRot90.findViewById(R.id.ends_group), - (ViewGroup) mRot90.findViewById(R.id.ends_group_lightsout), true); + inflateButtons(start, (ViewGroup) mRot0.findViewById(R.id.ends_group), false); + inflateButtons(start, (ViewGroup) mRot90.findViewById(R.id.ends_group), true); - inflateButtons(center, (ViewGroup) mRot0.findViewById(R.id.center_group), - (ViewGroup) mRot0.findViewById(R.id.center_group_lightsout), false); - inflateButtons(center, (ViewGroup) mRot90.findViewById(R.id.center_group), - (ViewGroup) mRot90.findViewById(R.id.center_group_lightsout), true); + inflateButtons(center, (ViewGroup) mRot0.findViewById(R.id.center_group), false); + inflateButtons(center, (ViewGroup) mRot90.findViewById(R.id.center_group), true); addGravitySpacer((LinearLayout) mRot0.findViewById(R.id.ends_group)); addGravitySpacer((LinearLayout) mRot90.findViewById(R.id.ends_group)); - inflateButtons(end, (ViewGroup) mRot0.findViewById(R.id.ends_group), - (ViewGroup) mRot0.findViewById(R.id.ends_group_lightsout), false); - inflateButtons(end, (ViewGroup) mRot90.findViewById(R.id.ends_group), - (ViewGroup) mRot90.findViewById(R.id.ends_group_lightsout), true); + inflateButtons(end, (ViewGroup) mRot0.findViewById(R.id.ends_group), false); + inflateButtons(end, (ViewGroup) mRot90.findViewById(R.id.ends_group), true); } private void addGravitySpacer(LinearLayout layout) { layout.addView(new Space(mContext), new LinearLayout.LayoutParams(0, 0, 1)); } - private void inflateButtons(String[] buttons, ViewGroup parent, ViewGroup lightsOutParent, - boolean landscape) { + private void inflateButtons(String[] buttons, ViewGroup parent, boolean landscape) { for (int i = 0; i < buttons.length; i++) { - copyToLightsout(inflateButton(buttons[i], parent, landscape), lightsOutParent); + inflateButton(buttons[i], parent, landscape); } } - private void copyToLightsout(View view, ViewGroup lightsOutParent) { - if (view == null) return; - - if (view instanceof FrameLayout) { - // The only ViewGroup we support in here is a FrameLayout, so copy those manually. - FrameLayout original = (FrameLayout) view; - FrameLayout layout = new FrameLayout(view.getContext()); - for (int i = 0; i < original.getChildCount(); i++) { - copyToLightsout(original.getChildAt(i), layout); - } - lightsOutParent.addView(layout, copy(view.getLayoutParams())); - } else if (view instanceof Space) { - lightsOutParent.addView(new Space(view.getContext()), copy(view.getLayoutParams())); - } else { - lightsOutParent.addView(generateLightsOutView(view), copy(view.getLayoutParams())); - } - } - - private View generateLightsOutView(View view) { - ImageView imageView = new ImageView(view.getContext()); - // Copy everything we can about the original view. - imageView.setPadding(view.getPaddingLeft(), view.getPaddingTop(), view.getPaddingRight(), - view.getPaddingBottom()); - imageView.setContentDescription(view.getContentDescription()); - imageView.setId(view.getId()); - // Only home gets a big dot, everything else will be little. - imageView.setImageResource(view.getId() == R.id.home - ? R.drawable.ic_sysbar_lights_out_dot_large - : R.drawable.ic_sysbar_lights_out_dot_small); - return imageView; - } - private ViewGroup.LayoutParams copy(ViewGroup.LayoutParams layoutParams) { if (layoutParams instanceof LinearLayout.LayoutParams) { return new LinearLayout.LayoutParams(layoutParams.width, layoutParams.height, @@ -348,9 +309,7 @@ public class NavigationBarInflaterView extends FrameLayout implements TunerServi } } clearAllChildren((ViewGroup) mRot0.findViewById(R.id.nav_buttons)); - clearAllChildren((ViewGroup) mRot0.findViewById(R.id.lights_out)); clearAllChildren((ViewGroup) mRot90.findViewById(R.id.nav_buttons)); - clearAllChildren((ViewGroup) mRot90.findViewById(R.id.lights_out)); } private void clearAllChildren(ViewGroup group) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java index 134c5798c94a..1fe01153ea81 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java @@ -64,42 +64,20 @@ public final class NavigationBarTransitions extends BarTransitions { mLightsOut = lightsOut; final View navButtons = mView.getCurrentView().findViewById(R.id.nav_buttons); - final View lowLights = mView.getCurrentView().findViewById(R.id.lights_out); // ok, everyone, stop it right there navButtons.animate().cancel(); - lowLights.animate().cancel(); - final float navButtonsAlpha = lightsOut ? 0f : 1f; - final float lowLightsAlpha = lightsOut ? 1f : 0f; + final float navButtonsAlpha = lightsOut ? 0.5f : 1f; if (!animate) { navButtons.setAlpha(navButtonsAlpha); - lowLights.setAlpha(lowLightsAlpha); - lowLights.setVisibility(lightsOut ? View.VISIBLE : View.GONE); } else { final int duration = lightsOut ? LIGHTS_OUT_DURATION : LIGHTS_IN_DURATION; navButtons.animate() .alpha(navButtonsAlpha) .setDuration(duration) .start(); - - lowLights.setOnTouchListener(mLightsOutListener); - if (lowLights.getVisibility() == View.GONE) { - lowLights.setAlpha(0f); - lowLights.setVisibility(View.VISIBLE); - } - lowLights.animate() - .alpha(lowLightsAlpha) - .setDuration(duration) - .setInterpolator(new AccelerateInterpolator(2.0f)) - .setListener(lightsOut ? null : new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator _a) { - lowLights.setVisibility(View.GONE); - } - }) - .start(); } } diff --git a/packages/SystemUI/src/com/android/systemui/tuner/NavBarTuner.java b/packages/SystemUI/src/com/android/systemui/tuner/NavBarTuner.java index 5ded8856d39d..ad424590f663 100644 --- a/packages/SystemUI/src/com/android/systemui/tuner/NavBarTuner.java +++ b/packages/SystemUI/src/com/android/systemui/tuner/NavBarTuner.java @@ -117,13 +117,9 @@ public class NavBarTuner extends Fragment implements TunerService.Tunable { if (isRotated) { mPreview.findViewById(R.id.rot0).setVisibility(View.GONE); final View rot90 = mPreview.findViewById(R.id.rot90); - rot90.findViewById(R.id.ends_group_lightsout).setVisibility(View.GONE); - rot90.findViewById(R.id.center_group_lightsout).setVisibility(View.GONE); } else { mPreview.findViewById(R.id.rot90).setVisibility(View.GONE); final View rot0 = mPreview.findViewById(R.id.rot0); - rot0.findViewById(R.id.ends_group_lightsout).setVisibility(View.GONE); - rot0.findViewById(R.id.center_group_lightsout).setVisibility(View.GONE); } } diff --git a/services/accessibility/java/com/android/server/accessibility/TouchExplorer.java b/services/accessibility/java/com/android/server/accessibility/TouchExplorer.java index 9e6cd002e889..3ecff405d756 100644 --- a/services/accessibility/java/com/android/server/accessibility/TouchExplorer.java +++ b/services/accessibility/java/com/android/server/accessibility/TouchExplorer.java @@ -467,17 +467,18 @@ class TouchExplorer implements EventStreamTransformation, AccessibilityGestureDe if (mCurrentState == STATE_GESTURE_DETECTING) { endGestureDetection(); } else if (mCurrentState == STATE_TOUCH_EXPLORING) { - final int pointerId = mReceivedPointerTracker.getPrimaryPointerId(); - final int pointerIdBits = (1 << pointerId); - - // Cache the event until we discern exploration from gesturing. - mSendHoverEnterAndMoveDelayed.addEvent(event); - - // We have just decided that the user is touch, - // exploring so start sending events. - mSendHoverEnterAndMoveDelayed.forceSendAndRemove(); - mSendHoverExitDelayed.cancel(); - sendMotionEvent(event, MotionEvent.ACTION_HOVER_MOVE, pointerIdBits, policyFlags); + // If the finger is still moving, pass the event on. + if (event.getActionMasked() == MotionEvent.ACTION_MOVE) { + final int pointerId = mReceivedPointerTracker.getPrimaryPointerId(); + final int pointerIdBits = (1 << pointerId); + + // We have just decided that the user is touch, + // exploring so start sending events. + mSendHoverEnterAndMoveDelayed.addEvent(event); + mSendHoverEnterAndMoveDelayed.forceSendAndRemove(); + mSendHoverExitDelayed.cancel(); + sendMotionEvent(event, MotionEvent.ACTION_HOVER_MOVE, pointerIdBits, policyFlags); + } } } diff --git a/services/core/java/com/android/server/notification/NotificationRecord.java b/services/core/java/com/android/server/notification/NotificationRecord.java index 12c70a3fa83d..2ca5534b3310 100644 --- a/services/core/java/com/android/server/notification/NotificationRecord.java +++ b/services/core/java/com/android/server/notification/NotificationRecord.java @@ -149,8 +149,9 @@ public final class NotificationRecord { } try { - final ApplicationInfo applicationInfo = mContext.getPackageManager().getApplicationInfo( - sbn.getPackageName(), 0); + final ApplicationInfo applicationInfo = + mContext.getPackageManager().getApplicationInfoAsUser(sbn.getPackageName(), + 0, sbn.getUser().getIdentifier()); if (applicationInfo.targetSdkVersion < Build.VERSION_CODES.N) { if (isNoisy) { if (importance >= IMPORTANCE_HIGH) { diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index cc5b80ee04e7..bf0073aae59e 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -3340,11 +3340,6 @@ public class PackageManagerService extends IPackageManager.Stub { + " with flags 0x" + Integer.toHexString(flags), new Throwable()); } - // Safe mode means we shouldn't match any third-party components - if (mSafeMode) { - flags |= PackageManager.MATCH_SYSTEM_ONLY; - } - return updateFlags(flags, userId); } @@ -3352,6 +3347,11 @@ public class PackageManagerService extends IPackageManager.Stub { * Update given flags when being used to request {@link ResolveInfo}. */ int updateFlagsForResolve(int flags, int userId, Object cookie) { + // Safe mode means we shouldn't match any third-party components + if (mSafeMode) { + flags |= PackageManager.MATCH_SYSTEM_ONLY; + } + return updateFlagsForComponent(flags, userId, cookie); } diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 79d2307c7648..6ec0ba11517d 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -5396,6 +5396,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } synchronized (this) { enforceCanSetDeviceOwnerLocked(userId); + if (getActiveAdminUncheckedLocked(admin, userId) == null) { + throw new IllegalArgumentException("Not active admin: " + admin); + } // Shutting down backup manager service permanently. long ident = mInjector.binderClearCallingIdentity(); @@ -5571,6 +5574,11 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } synchronized (this) { enforceCanSetProfileOwnerLocked(userHandle); + + if (getActiveAdminUncheckedLocked(who, userHandle) == null) { + throw new IllegalArgumentException("Not active admin: " + who); + } + mOwners.setProfileOwner(who, ownerName, userHandle); mOwners.writeProfileOwner(userHandle); return true; diff --git a/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java b/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java index b23ad50ee2fc..6d168b0abb5a 100644 --- a/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java +++ b/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java @@ -1668,7 +1668,12 @@ public class DevicePolicyManagerTest extends DpmTestBase { // that the test user is not affiliated anymore. dpm.clearProfileOwner(admin2); final ComponentName admin = new ComponentName("test", "test"); - markPackageAsInstalled(admin.getPackageName(), null, DpmMockContext.CALLER_USER_HANDLE); + + setUpPackageManagerForFakeAdmin(admin, DpmMockContext.CALLER_UID, + /* enabledSetting =*/ PackageManager.COMPONENT_ENABLED_STATE_ENABLED, + /* appTargetSdk = */ null, admin2); + + dpm.setActiveAdmin(admin, /* refreshing =*/ true, DpmMockContext.CALLER_USER_HANDLE); assertTrue(dpm.setProfileOwner(admin, "owner-name", DpmMockContext.CALLER_USER_HANDLE)); assertFalse(dpm.isAffiliatedUser()); diff --git a/services/tests/servicestests/src/com/android/server/devicepolicy/DpmTestBase.java b/services/tests/servicestests/src/com/android/server/devicepolicy/DpmTestBase.java index 53ca45dde5ae..ca436442d75a 100644 --- a/services/tests/servicestests/src/com/android/server/devicepolicy/DpmTestBase.java +++ b/services/tests/servicestests/src/com/android/server/devicepolicy/DpmTestBase.java @@ -19,6 +19,7 @@ package com.android.server.devicepolicy; import android.content.ComponentName; import android.content.Context; import android.content.Intent; +import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; @@ -96,12 +97,26 @@ public abstract class DpmTestBase extends AndroidTestCase { protected void setUpPackageManagerForAdmin(ComponentName admin, int packageUid, Integer enabledSetting, Integer appTargetSdk) throws Exception { + setUpPackageManagerForFakeAdmin(admin, packageUid, enabledSetting, appTargetSdk, + admin); + } + + /** + * Set up a component in the mock package manager to be an active admin. + * + * @param admin ComponentName that's visible to the test code, which doesn't have to exist. + * @param copyFromAdmin package information for {@code admin} will be built based on this + * component's information. + */ + protected void setUpPackageManagerForFakeAdmin(ComponentName admin, int packageUid, + Integer enabledSetting, Integer appTargetSdk, ComponentName copyFromAdmin) + throws Exception { // Set up getApplicationInfo(). final ApplicationInfo ai = DpmTestUtils.cloneParcelable( mRealTestContext.getPackageManager().getApplicationInfo( - admin.getPackageName(), + copyFromAdmin.getPackageName(), PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS)); ai.enabledSetting = enabledSetting == null @@ -111,6 +126,8 @@ public abstract class DpmTestBase extends AndroidTestCase { ai.targetSdkVersion = appTargetSdk; } ai.uid = packageUid; + ai.packageName = admin.getPackageName(); + ai.name = admin.getClassName(); doReturn(ai).when(mMockContext.ipackageManager).getApplicationInfo( eq(admin.getPackageName()), @@ -120,7 +137,7 @@ public abstract class DpmTestBase extends AndroidTestCase { // Set up queryBroadcastReceivers(). final Intent resolveIntent = new Intent(); - resolveIntent.setComponent(admin); + resolveIntent.setComponent(copyFromAdmin); final List<ResolveInfo> realResolveInfo = mRealTestContext.getPackageManager().queryBroadcastReceivers( resolveIntent, @@ -132,7 +149,10 @@ public abstract class DpmTestBase extends AndroidTestCase { realResolveInfo.set(0, DpmTestUtils.cloneParcelable(realResolveInfo.get(0))); // We need to rewrite the UID in the activity info. - realResolveInfo.get(0).activityInfo.applicationInfo = ai; + final ActivityInfo aci = realResolveInfo.get(0).activityInfo; + aci.applicationInfo = ai; + aci.packageName = admin.getPackageName(); + aci.name = admin.getClassName(); doReturn(realResolveInfo).when(mMockContext.packageManager).queryBroadcastReceiversAsUser( MockUtils.checkIntentComponent(admin), diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java index 189ecdc4e96a..9e390f68f128 100644 --- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java +++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java @@ -308,6 +308,10 @@ public final class CreateInfo implements ICreateInfo { "java.nio.charset.Charsets", "java.nio.charset.StandardCharsets", "java.lang.IntegralToString", "com.android.tools.layoutlib.java.IntegralToString", "java.lang.UnsafeByteSequence", "com.android.tools.layoutlib.java.UnsafeByteSequence", + // Use android.icu.text versions of DateFormat and SimpleDateFormat since the + // original ones do not match the Android implementation + "java.text.DateFormat", "android.icu.text.DateFormat", + "java.text.SimpleDateFormat", "android.icu.text.SimpleDateFormat" }; private final static String[] EXCLUDED_CLASSES = |