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
This commit is contained in:
mattsziklay
2023-06-05 17:15:00 -07:00
committed by Brian Egizi
parent 1d62ef33f4
commit b6149ff1d3
3 changed files with 34 additions and 23 deletions

View File

@@ -13,13 +13,20 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group android:translateY="8.0">
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="128dp"
android:height="4dp"
android:viewportWidth="128"
android:viewportHeight="4"
>
<group>
<clip-path
android:pathData="M2 0H126C127.105 0 128 0.895431 128 2C128 3.10457 127.105 4 126 4H2C0.895431 4 0 3.10457 0 2C0 0.895431 0.895431 0 2 0Z"
/>
<path
android:fillColor="@android:color/black" android:pathData="M3,5V3H21V5Z"/>
android:pathData="M0 0V4H128V0"
android:fillColor="@android:color/black"
/>
</group>
</vector>

View File

@@ -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"

View File

@@ -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
}
}
}