From 269f49d9b852fd4ed6762dec16bdf8af9f751b96 Mon Sep 17 00:00:00 2001 From: JianYang Liu Date: Fri, 26 Jun 2020 14:18:11 -0700 Subject: [PATCH] Added systemui controller to control system bars. When config_remoteInsetsControllerControlsSystemBars is true, DisplaySystemBarsController provides its own policy of how system bars are displayed for specific packages. Currently limited to only auto versions of Android. Bug: 149585273 Test: Manual, atest BarControlPolicyTest, atest InsetsPolicyTest, atest DisplaySystemBarsControllerTest Change-Id: Ie6b1cc3e2760cbc9e48d62dfbd8bc3e23ffca20c Merged-In: Ie6b1cc3e2760cbc9e48d62dfbd8bc3e23ffca20c --- api/test-current.txt | 1 + .../view/IDisplayWindowInsetsController.aidl | 7 + core/java/android/view/IWindowManager.aidl | 10 - core/res/res/values/config.xml | 15 +- core/res/res/values/public.xml | 2 + core/res/res/values/symbols.xml | 2 +- .../android/systemui/CarSystemUIModule.java | 6 + .../android/systemui/wm/BarControlPolicy.java | 250 ++++++++++++++++++ .../wm/DisplaySystemBarsController.java | 168 ++++++++++++ ...DisplaySystemBarsInsetsControllerHost.java | 173 ++++++++++++ .../systemui/wm/BarControlPolicyTest.java | 195 ++++++++++++++ .../wm/DisplaySystemBarsControllerTest.java | 111 ++++++++ .../systemui/wm/DisplayImeController.java | 5 + .../com/android/server/wm/DisplayContent.java | 13 + .../com/android/server/wm/DisplayPolicy.java | 24 +- .../com/android/server/wm/InsetsPolicy.java | 58 +++- .../server/wm/WindowManagerService.java | 21 -- .../server/wm/DisplayContentTests.java | 25 -- .../server/wm/DisplayPolicyLayoutTests.java | 22 -- .../android/server/wm/InsetsPolicyTest.java | 5 +- .../server/wm/WindowManagerServiceTests.java | 18 -- .../android/server/wm/WindowTestsBase.java | 32 ++- 22 files changed, 1034 insertions(+), 129 deletions(-) create mode 100644 packages/CarSystemUI/src/com/android/systemui/wm/BarControlPolicy.java create mode 100644 packages/CarSystemUI/src/com/android/systemui/wm/DisplaySystemBarsController.java create mode 100644 packages/CarSystemUI/src/com/android/systemui/wm/DisplaySystemBarsInsetsControllerHost.java create mode 100644 packages/CarSystemUI/tests/src/com/android/systemui/wm/BarControlPolicyTest.java create mode 100644 packages/CarSystemUI/tests/src/com/android/systemui/wm/DisplaySystemBarsControllerTest.java diff --git a/api/test-current.txt b/api/test-current.txt index 3838bad57aa71..cf97b848e80bd 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -34,6 +34,7 @@ package android { public static final class R.bool { field public static final int config_assistantOnTopOfDream = 17891333; // 0x1110005 field public static final int config_perDisplayFocusEnabled = 17891332; // 0x1110004 + field public static final int config_remoteInsetsControllerControlsSystemBars = 17891334; // 0x1110006 } public static final class R.string { diff --git a/core/java/android/view/IDisplayWindowInsetsController.aidl b/core/java/android/view/IDisplayWindowInsetsController.aidl index 429c3aeba9b3d..a0d4a6587bcff 100644 --- a/core/java/android/view/IDisplayWindowInsetsController.aidl +++ b/core/java/android/view/IDisplayWindowInsetsController.aidl @@ -26,6 +26,13 @@ import android.view.InsetsState; */ oneway interface IDisplayWindowInsetsController { + /** + * Called when top focused window changes to determine whether or not to take over insets + * control. Won't be called if config_remoteInsetsControllerControlsSystemBars is false. + * @param packageName: Passes the top package name + */ + void topFocusedWindowChanged(String packageName); + /** * @see IWindow#insetsChanged */ diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl index 58597cf3fb6d8..00fc67214f75e 100644 --- a/core/java/android/view/IWindowManager.aidl +++ b/core/java/android/view/IWindowManager.aidl @@ -387,16 +387,6 @@ interface IWindowManager */ oneway void hideTransientBars(int displayId); - /** - * When set to {@code true} the system bars will always be shown. This is true even if an app - * requests to be fullscreen by setting the system ui visibility flags. The - * functionality was added for the automotive case as a way to guarantee required content stays - * on screen at all times. - * - * @hide - */ - oneway void setForceShowSystemBars(boolean show); - /** * Called by System UI to notify of changes to the visibility of Recents. */ diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 39d20bbff3ba9..2bb63f1ca8df2 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -712,10 +712,17 @@ case, this can be disabled (set to false). --> true - - false + + false diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index e2fbbf46608fb..e00aff1af37b7 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -3024,6 +3024,8 @@ + +