From b6149ff1d3129ff28e8fd076262e7631971771ea Mon Sep 17 00:00:00 2001 From: mattsziklay Date: Mon, 5 Jun 2023 17:15:00 -0700 Subject: [PATCH] Update fullscreen handle appearance. Makes fullscreen desktop handle rounder and aligns its brightness with notification icons. Before: https://screenshot.googleplex.com/89zkkMpUefHc39L After: https://screenshot.googleplex.com/3ceqjybE6QvHsWe Cherry picked I4cd9a65366c2e3f17c22f54c85a64e53b50e6b9a to master due to b/286408867. Code was merged via `-s ours` and is missing even though the sha exists on the target branch. Cherry pick is required to bring in the code. Manually remove the "Merged in" directive to allow for downstream propagation. Bug: 280830923 Test: Manual (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:6980cec2dd5770595e0c804083ef011f7fd81570) Change-Id: Id1dfe3f02875155700cd1f3e32222b8a6dfbdf0e --- .../Shell/res/drawable/decor_handle_dark.xml | 21 +++++++---- .../desktop_mode_focused_window_decor.xml | 1 + .../DesktopModeWindowDecorationViewHolder.kt | 35 ++++++++++--------- 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/libs/WindowManager/Shell/res/drawable/decor_handle_dark.xml b/libs/WindowManager/Shell/res/drawable/decor_handle_dark.xml index 5d7771366bec3..ce242751c1729 100644 --- a/libs/WindowManager/Shell/res/drawable/decor_handle_dark.xml +++ b/libs/WindowManager/Shell/res/drawable/decor_handle_dark.xml @@ -13,13 +13,20 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - - + + + + android:pathData="M0 0V4H128V0" + android:fillColor="@android:color/black" + /> diff --git a/libs/WindowManager/Shell/res/layout/desktop_mode_focused_window_decor.xml b/libs/WindowManager/Shell/res/layout/desktop_mode_focused_window_decor.xml index 1d6864c152c23..0ca912e205270 100644 --- a/libs/WindowManager/Shell/res/layout/desktop_mode_focused_window_decor.xml +++ b/libs/WindowManager/Shell/res/layout/desktop_mode_focused_window_decor.xml @@ -28,6 +28,7 @@ android:layout_width="176dp" android:layout_height="42dp" android:paddingHorizontal="24dp" + android:paddingVertical="19dp" android:contentDescription="@string/handle_text" android:src="@drawable/decor_handle_dark" tools:tint="@color/desktop_mode_caption_handle_bar_dark" diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/DesktopModeWindowDecorationViewHolder.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/DesktopModeWindowDecorationViewHolder.kt index 76c80f7bbe85e..d293cf73a0f78 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/DesktopModeWindowDecorationViewHolder.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/viewholder/DesktopModeWindowDecorationViewHolder.kt @@ -1,32 +1,35 @@ package com.android.wm.shell.windowdecor.viewholder import android.app.ActivityManager.RunningTaskInfo +import android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM import android.content.Context import android.graphics.Color import android.view.View import android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS + /** * Encapsulates the root [View] of a window decoration and its children to facilitate looking up * children (via findViewById) and updating to the latest data from [RunningTaskInfo]. */ internal abstract class DesktopModeWindowDecorationViewHolder(rootView: View) { - val context: Context = rootView.context + val context: Context = rootView.context - /** - * A signal to the view holder that new data is available and that the views should be updated - * to reflect it. - */ - abstract fun bindData(taskInfo: RunningTaskInfo) + /** + * A signal to the view holder that new data is available and that the views should be updated to + * reflect it. + */ + abstract fun bindData(taskInfo: RunningTaskInfo) - /** - * Whether the caption items should use the 'light' color variant so that there's good contrast - * with the caption background color. - */ - protected fun shouldUseLightCaptionColors(taskInfo: RunningTaskInfo): Boolean { - return if (Color.alpha(taskInfo.taskDescription.statusBarColor) != 0) { - Color.valueOf(taskInfo.taskDescription.statusBarColor).luminance() < 0.5 - } else { - taskInfo.taskDescription.statusBarAppearance and APPEARANCE_LIGHT_STATUS_BARS == 0 - } + /** + * Whether the caption items should use the 'light' color variant so that there's good contrast + * with the caption background color. + */ + protected fun shouldUseLightCaptionColors(taskInfo: RunningTaskInfo): Boolean { + return if (Color.alpha(taskInfo.taskDescription.statusBarColor) != 0 && + taskInfo.windowingMode == WINDOWING_MODE_FREEFORM) { + Color.valueOf(taskInfo.taskDescription.statusBarColor).luminance() < 0.5 + } else { + taskInfo.taskDescription.statusBarAppearance and APPEARANCE_LIGHT_STATUS_BARS == 0 } + } }