From 2628c45e6b71b8d001ff6cd1ef55d95575a8e0b1 Mon Sep 17 00:00:00 2001 From: Jorge Gil Date: Wed, 15 Mar 2023 00:18:18 +0000 Subject: [PATCH 1/3] Update desktop mode caption bar to newest spec Updates the caption bar layout in proto1/proto2 to a new model with a close button and an app info view group. Also applies a small refactor so that ALL views are updated only from relayout using the latest task state instead of allowing certain views to be updated independently (such as caption/color from onTaskInfoChange or button clicks), which led to some synchronization issues leading to visual errors. Visual changes: 1. In proto 1 / proto 2 (desktop mode), the caption now has a close button and the handle bar was replaced with a left-aligned view group which contains the app icon, app name and an expand button which when clicked opens the handle menu. The middle section of the caption bar (between the app info and the close button) is now what allows dragging and moving the task. 2. In proto2, the handle menu is aligned to the left when in desktop mode. It continues to be centered when in fullscreen 3. Fixes issue where the app handle was sometimes invisible in proto2 on fullscreen tasks. 4. In proto1, the caption handle color was (sometimes) set based on whether desktop mode was active (to dark or light). This conflicted with other logic that sets it based on luminocity of the status bar color to provide contrast. This CL removes the logic based on desktop mode status since it didn't really make sense considering the whole caption is invisible when desktop mode is inactive. 5. In proto1, the caption visibility was set based on the task focus state. It is now always visible to match proto2 (desktop) behavior. Non-visual changes: 1. Split the window decoration layout into two xml files (one for each possible 'type' of caption): FOCUSED (used by proto1 and proto 2 when in fullscreen mode) and APP_CONTROLS (used by proto2 when in desktop). This simplifies the visibility/color updates that #relayout deals with. Instead of a single layout containing all possible views of the caption and having to hide and show some depending on which caption type was "active" at the time, the split layouts now contain only the views that are relevant to that type, so #relayout can check the type of caption and apply updates to only the views that are actually affected by the current state. Bug: 269618335 Bug: 270393915 Test: Enter desktop mode in proto2 and see new spec; Switch between modes in proto1 and make sure the new spec is visible in desktop mode only. Change-Id: I28b8f2668d0ed6ddd4c71b16c44533c051a01bee --- .../Shell/res/drawable/decor_handle_dark.xml | 11 +- .../drawable/ic_baseline_expand_more_24.xml | 21 ++ ...desktop_mode_app_controls_window_decor.xml | 93 ++++++++ .../layout/desktop_mode_decor_handle_menu.xml | 2 +- ... => desktop_mode_focused_window_decor.xml} | 23 +- .../WindowManager/Shell/res/values/colors.xml | 10 + .../DesktopModeWindowDecorViewModel.java | 12 +- .../DesktopModeWindowDecoration.java | 219 +++++++++--------- .../shell/windowdecor/WindowDecoration.java | 6 +- 9 files changed, 255 insertions(+), 142 deletions(-) create mode 100644 libs/WindowManager/Shell/res/drawable/ic_baseline_expand_more_24.xml create mode 100644 libs/WindowManager/Shell/res/layout/desktop_mode_app_controls_window_decor.xml rename libs/WindowManager/Shell/res/layout/{desktop_mode_window_decor.xml => desktop_mode_focused_window_decor.xml} (64%) diff --git a/libs/WindowManager/Shell/res/drawable/decor_handle_dark.xml b/libs/WindowManager/Shell/res/drawable/decor_handle_dark.xml index 27e0b184f4275..5d7771366bec3 100644 --- a/libs/WindowManager/Shell/res/drawable/decor_handle_dark.xml +++ b/libs/WindowManager/Shell/res/drawable/decor_handle_dark.xml @@ -14,13 +14,12 @@ ~ limitations under the License. --> + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + android:fillColor="@android:color/black" android:pathData="M3,5V3H21V5Z"/> diff --git a/libs/WindowManager/Shell/res/drawable/ic_baseline_expand_more_24.xml b/libs/WindowManager/Shell/res/drawable/ic_baseline_expand_more_24.xml new file mode 100644 index 0000000000000..3e0297ab612bf --- /dev/null +++ b/libs/WindowManager/Shell/res/drawable/ic_baseline_expand_more_24.xml @@ -0,0 +1,21 @@ + + + + + diff --git a/libs/WindowManager/Shell/res/layout/desktop_mode_app_controls_window_decor.xml b/libs/WindowManager/Shell/res/layout/desktop_mode_app_controls_window_decor.xml new file mode 100644 index 0000000000000..35562b650994f --- /dev/null +++ b/libs/WindowManager/Shell/res/layout/desktop_mode_app_controls_window_decor.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/WindowManager/Shell/res/layout/desktop_mode_decor_handle_menu.xml b/libs/WindowManager/Shell/res/layout/desktop_mode_decor_handle_menu.xml index f9aeb6a8448aa..ac13eaeda6f53 100644 --- a/libs/WindowManager/Shell/res/layout/desktop_mode_decor_handle_menu.xml +++ b/libs/WindowManager/Shell/res/layout/desktop_mode_decor_handle_menu.xml @@ -50,7 +50,7 @@ android:layout_marginEnd="10dp" android:contentDescription="@string/collapse_menu_text" android:layout_alignParentEnd="true" - android:background="@drawable/caption_collapse_menu_button" + android:background="@drawable/ic_baseline_expand_more_24" android:layout_centerVertical="true"/> -