Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c2a9e723 authored by Matt Sziklay's avatar Matt Sziklay Committed by Automerger Merge Worker
Browse files

Merge "Use status bar appearance to determine header element brightness." into...

Merge "Use status bar appearance to determine header element brightness." into udc-qpr-dev am: f502b113 am: e32c6e28

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23517670



Change-Id: I0d64a2c28d09fc13fff4460d84009eb2f7554d03
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 5e5d120f e32c6e28
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ import android.app.ActivityManager.RunningTaskInfo
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].
@@ -23,6 +23,10 @@ internal abstract class DesktopModeWindowDecorationViewHolder(rootView: View) {
     * with the caption background color.
     */
    protected fun shouldUseLightCaptionColors(taskInfo: RunningTaskInfo): Boolean {
        return Color.valueOf(taskInfo.taskDescription.statusBarColor).luminance() < 0.5
        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
        }
    }
}