From 2cf45dd2242632152d3109130b135f5c9bd2d98b Mon Sep 17 00:00:00 2001 From: Heemin Seog Date: Mon, 24 Feb 2020 15:43:29 -0800 Subject: [PATCH] Replace TYPE_STATUS_BAR_PANEL with TYPE_STATUS_BAR_ADDITIONAL Deprecate TYPE_STATUS_BAR_PANEL. Currently TYPE_STATUS_BAR_ADDITIONAL maps to the same z order as TYPE_NOTIFICATION_SHADE. This will be updated in a subsequent CL. Also move everything in TYPE_STATUS_BAR_PANEL to TYPE_STATUS_BAR_SUB_PANEL so that it remains above the notification shade / keyguard layer. TYPE_STATUS_BAR_PANEL will no longer be valid. As part of the work on having more flexible inset mapping (for Android Automotive) we want to use the TYPE_STATUS_BAR_ADDITIONAL to be used for system bars in different places (i.e. Status Bar on the left side of the screen). Bug: 140423092 Bug: 145242835 Test: boot (sdk_gphone_x86, hawk), existing tests (atest SystemUITests) Change-Id: I0ce3c4152fd05a948c06ed1a96c3ba279bd7097a --- api/current.txt | 2 +- core/java/android/view/ViewRootImpl.java | 4 ++-- core/java/android/view/WindowManager.java | 12 ++++++++++++ .../systemui/biometrics/AuthContainerView.java | 2 +- .../row/ChannelEditorDialogController.kt | 2 +- .../systemui/statusbar/phone/SystemUIDialog.java | 8 +++----- .../accessibility/AccessibilityWindowManager.java | 2 +- .../android/server/policy/WindowManagerPolicy.java | 6 +++--- .../java/com/android/server/wm/DisplayPolicy.java | 11 +++++++---- .../android/server/wm/ImmersiveModeConfirmation.java | 2 +- .../core/java/com/android/server/wm/WindowState.java | 4 ++-- .../src/com/android/server/wm/ZOrderingTests.java | 5 +++-- 12 files changed, 37 insertions(+), 23 deletions(-) diff --git a/api/current.txt b/api/current.txt index 1227006dbe046..4aacbc8ab0970 100644 --- a/api/current.txt +++ b/api/current.txt @@ -55700,7 +55700,7 @@ package android.view { field public static final int TYPE_PRIVATE_PRESENTATION = 2030; // 0x7ee field public static final int TYPE_SEARCH_BAR = 2001; // 0x7d1 field public static final int TYPE_STATUS_BAR = 2000; // 0x7d0 - field public static final int TYPE_STATUS_BAR_PANEL = 2014; // 0x7de + field @Deprecated public static final int TYPE_STATUS_BAR_PANEL = 2014; // 0x7de field @Deprecated public static final int TYPE_SYSTEM_ALERT = 2003; // 0x7d3 field public static final int TYPE_SYSTEM_DIALOG = 2008; // 0x7d8 field @Deprecated public static final int TYPE_SYSTEM_ERROR = 2010; // 0x7da diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 4a093e6038b8c..28ce1ea8dcd52 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -55,7 +55,7 @@ import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DECOR_V import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE; import static android.view.WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD; -import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL; +import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_ADDITIONAL; import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ALERT; import static android.view.WindowManager.LayoutParams.TYPE_TOAST; import static android.view.WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY; @@ -2265,7 +2265,7 @@ public final class ViewRootImpl implements ViewParent, } private static boolean shouldUseDisplaySize(final WindowManager.LayoutParams lp) { - return lp.type == TYPE_STATUS_BAR_PANEL + return lp.type == TYPE_STATUS_BAR_ADDITIONAL || lp.type == TYPE_INPUT_METHOD || lp.type == TYPE_VOLUME_OVERLAY; } diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index b0d0a14c4d416..67bf0f1c04d27 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -1026,7 +1026,11 @@ public interface WindowManager extends ViewManager { /** * Window type: panel that slides out from over the status bar * In multiuser systems shows on all users' windows. + * + * @deprecated This became API by accident and was never intended to be used for + * applications. */ + @Deprecated public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14; /** @@ -1220,6 +1224,14 @@ public interface WindowManager extends ViewManager { */ public static final int TYPE_NOTIFICATION_SHADE = FIRST_SYSTEM_WINDOW + 40; + /** + * Window type: used to show the status bar in non conventional parts of the screen (i.e. + * the left or the bottom of the screen). + * In multiuser systems shows on all users' windows. + * @hide + */ + public static final int TYPE_STATUS_BAR_ADDITIONAL = FIRST_SYSTEM_WINDOW + 41; + /** * End of types of system windows. */ diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java index 12216eba672fa..cbb19824eadfe 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java @@ -595,7 +595,7 @@ public class AuthContainerView extends LinearLayout final WindowManager.LayoutParams lp = new WindowManager.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, - WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL, + WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL, windowFlags, PixelFormat.TRANSLUCENT); lp.privateFlags |= WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ChannelEditorDialogController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ChannelEditorDialogController.kt index 5b4a927bb8f00..e75b705112508 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ChannelEditorDialogController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ChannelEditorDialogController.kt @@ -285,7 +285,7 @@ class ChannelEditorDialogController @Inject constructor( window?.apply { setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) addFlags(wmFlags) - setType(WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL) + setType(WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL) setWindowAnimations(com.android.internal.R.style.Animation_InputMethod) attributes = attributes.apply { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java index 06105f532eb62..1e98c75f26168 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java @@ -103,19 +103,17 @@ public class SystemUIDialog extends AlertDialog { } public static void setWindowOnTop(Dialog dialog) { + final Window window = dialog.getWindow(); + window.setType(LayoutParams.TYPE_STATUS_BAR_SUB_PANEL); if (Dependency.get(KeyguardStateController.class).isShowing()) { - final Window window = dialog.getWindow(); - window.setType(LayoutParams.TYPE_STATUS_BAR_PANEL); window.getAttributes().setFitInsetsTypes( window.getAttributes().getFitInsetsTypes() & ~Type.statusBars()); - } else { - dialog.getWindow().setType(LayoutParams.TYPE_STATUS_BAR_SUB_PANEL); } } public static AlertDialog applyFlags(AlertDialog dialog) { final Window window = dialog.getWindow(); - window.setType(WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL); + window.setType(WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL); window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); window.getAttributes().setFitInsetsTypes( diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityWindowManager.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityWindowManager.java index 446e8821298f2..5d699c01d1384 100644 --- a/services/accessibility/java/com/android/server/accessibility/AccessibilityWindowManager.java +++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityWindowManager.java @@ -717,7 +717,7 @@ public class AccessibilityWindowManager { case WindowManager.LayoutParams.TYPE_SEARCH_BAR: case WindowManager.LayoutParams.TYPE_STATUS_BAR: case WindowManager.LayoutParams.TYPE_NOTIFICATION_SHADE: - case WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL: + case WindowManager.LayoutParams.TYPE_STATUS_BAR_ADDITIONAL: case WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL: case WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY: case WindowManager.LayoutParams.TYPE_SYSTEM_ALERT: diff --git a/services/core/java/com/android/server/policy/WindowManagerPolicy.java b/services/core/java/com/android/server/policy/WindowManagerPolicy.java index 9d417c9e98e00..efe2af3352c26 100644 --- a/services/core/java/com/android/server/policy/WindowManagerPolicy.java +++ b/services/core/java/com/android/server/policy/WindowManagerPolicy.java @@ -50,7 +50,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_SCREENSHOT; import static android.view.WindowManager.LayoutParams.TYPE_SEARCH_BAR; import static android.view.WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY; import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR; -import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL; +import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_ADDITIONAL; import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL; import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ALERT; import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG; @@ -817,9 +817,9 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants { return 16; case TYPE_STATUS_BAR: return 17; - case TYPE_NOTIFICATION_SHADE: + case TYPE_STATUS_BAR_ADDITIONAL: return 18; - case TYPE_STATUS_BAR_PANEL: + case TYPE_NOTIFICATION_SHADE: return 19; case TYPE_STATUS_BAR_SUB_PANEL: return 20; diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index f02a9dd611074..0637835df0abd 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -80,6 +80,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_NOTIFICATION_SHADE; import static android.view.WindowManager.LayoutParams.TYPE_SCREENSHOT; import static android.view.WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY; import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR; +import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_ADDITIONAL; import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL; import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL; import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ALERT; @@ -981,13 +982,15 @@ public class DisplayPolicy { "DisplayPolicy"); } break; - case TYPE_STATUS_BAR_PANEL: + case TYPE_STATUS_BAR_ADDITIONAL: case TYPE_STATUS_BAR_SUB_PANEL: case TYPE_VOICE_INTERACTION_STARTING: mContext.enforcePermission( android.Manifest.permission.STATUS_BAR_SERVICE, callingPid, callingUid, "DisplayPolicy"); break; + case TYPE_STATUS_BAR_PANEL: + return WindowManagerGlobal.ADD_INVALID_TYPE; } return ADD_OKAY; } @@ -2105,7 +2108,7 @@ public class DisplayPolicy { setAttachedWindowFrames(win, fl, adjust, attached, true, pf, df, cf, vf, displayFrames); } else { - if (type == TYPE_STATUS_BAR_PANEL || type == TYPE_STATUS_BAR_SUB_PANEL) { + if (type == TYPE_STATUS_BAR_ADDITIONAL || type == TYPE_STATUS_BAR_SUB_PANEL) { // Status bar panels are the only windows who can go on top of the status // bar. They are protected by the STATUS_BAR_SERVICE permission, so they // have the same privileges as the status bar itself. @@ -2172,7 +2175,7 @@ public class DisplayPolicy { + "): IN_SCREEN"); // A window that has requested to fill the entire screen just // gets everything, period. - if (type == TYPE_STATUS_BAR_PANEL || type == TYPE_STATUS_BAR_SUB_PANEL) { + if (type == TYPE_STATUS_BAR_ADDITIONAL || type == TYPE_STATUS_BAR_SUB_PANEL) { cf.set(displayFrames.mUnrestricted); df.set(displayFrames.mUnrestricted); pf.set(displayFrames.mUnrestricted); @@ -2254,7 +2257,7 @@ public class DisplayPolicy { + "): normal window"); // Otherwise, a normal window must be placed inside the content // of all screen decorations. - if (type == TYPE_STATUS_BAR_PANEL) { + if (type == TYPE_STATUS_BAR_ADDITIONAL) { // Status bar panels can go on // top of the status bar. They are protected by the STATUS_BAR_SERVICE // permission, so they have the same privileges as the status bar itself. diff --git a/services/core/java/com/android/server/wm/ImmersiveModeConfirmation.java b/services/core/java/com/android/server/wm/ImmersiveModeConfirmation.java index 2f02ffb17d3af..8b1a0c93cfa3d 100644 --- a/services/core/java/com/android/server/wm/ImmersiveModeConfirmation.java +++ b/services/core/java/com/android/server/wm/ImmersiveModeConfirmation.java @@ -185,7 +185,7 @@ public class ImmersiveModeConfirmation { final WindowManager.LayoutParams lp = new WindowManager.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, - WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL, + WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL, WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL, diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index b25008373a7bd..11fe2ccac8a06 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -81,7 +81,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_PRIORITY_PHONE; import static android.view.WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION; import static android.view.WindowManager.LayoutParams.TYPE_SEARCH_BAR; import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR; -import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL; +import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_ADDITIONAL; import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL; import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG; import static android.view.WindowManager.LayoutParams.TYPE_TOAST; @@ -3239,7 +3239,7 @@ class WindowState extends WindowContainer implements WindowManagerP case TYPE_SEARCH_BAR: case TYPE_STATUS_BAR: case TYPE_NOTIFICATION_SHADE: - case TYPE_STATUS_BAR_PANEL: + case TYPE_STATUS_BAR_ADDITIONAL: case TYPE_STATUS_BAR_SUB_PANEL: case TYPE_SYSTEM_DIALOG: case TYPE_VOLUME_OVERLAY: diff --git a/services/tests/wmtests/src/com/android/server/wm/ZOrderingTests.java b/services/tests/wmtests/src/com/android/server/wm/ZOrderingTests.java index 63b50b5a9b2b8..e6b4e0f4baf88 100644 --- a/services/tests/wmtests/src/com/android/server/wm/ZOrderingTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/ZOrderingTests.java @@ -31,7 +31,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_PANEL; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL; -import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL; +import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_ADDITIONAL; import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL; import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY; @@ -376,7 +376,8 @@ public class ZOrderingTests extends WindowTestsBase { final WindowState navBarPanel = createWindow(null, TYPE_NAVIGATION_BAR_PANEL, mDisplayContent, "NavBarPanel"); final WindowState statusBarPanel = - createWindow(null, TYPE_STATUS_BAR_PANEL, mDisplayContent, "StatusBarPanel"); + createWindow(null, TYPE_STATUS_BAR_ADDITIONAL, mDisplayContent, + "StatusBarAdditional"); final WindowState statusBarSubPanel = createWindow(null, TYPE_STATUS_BAR_SUB_PANEL, mDisplayContent, "StatusBarSubPanel"); mDisplayContent.assignChildLayers(mTransaction);