summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Florence Yang <florenceyang@google.com> 2022-12-12 02:58:43 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2022-12-12 02:58:43 +0000
commite87c348fcd9b8eba90b46be9f2e3558a8640f770 (patch)
tree5b9e6ff6c84a25bb831355c330a7c0fb51068e3e
parent369bce07d63583a1960ea5fcea188b8638e8c4f9 (diff)
parent529fba976e7a9093048240d855b8d889c8328dc3 (diff)
Merge "Enable Region Sampling Flag for Teamfood" into tm-qpr-dev
-rw-r--r--packages/SystemUI/src/com/android/keyguard/ClockEventController.kt9
-rw-r--r--packages/SystemUI/src/com/android/systemui/flags/Flags.kt2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceController.kt4
3 files changed, 11 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/ClockEventController.kt b/packages/SystemUI/src/com/android/keyguard/ClockEventController.kt
index 87e9d5630b74..8f38e5800015 100644
--- a/packages/SystemUI/src/com/android/keyguard/ClockEventController.kt
+++ b/packages/SystemUI/src/com/android/keyguard/ClockEventController.kt
@@ -15,6 +15,7 @@
*/
package com.android.keyguard
+import android.app.WallpaperManager
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
@@ -100,9 +101,13 @@ open class ClockEventController @Inject constructor(
private val regionSamplingEnabled = featureFlags.isEnabled(REGION_SAMPLING)
private fun updateColors() {
+
if (regionSamplingEnabled && smallRegionSampler != null && largeRegionSampler != null) {
- smallClockIsDark = smallRegionSampler!!.currentRegionDarkness().isDark
- largeClockIsDark = largeRegionSampler!!.currentRegionDarkness().isDark
+ val wallpaperManager = WallpaperManager.getInstance(context)
+ if (!wallpaperManager.lockScreenWallpaperExists()) {
+ smallClockIsDark = smallRegionSampler!!.currentRegionDarkness().isDark
+ largeClockIsDark = largeRegionSampler!!.currentRegionDarkness().isDark
+ }
} else {
val isLightTheme = TypedValue()
context.theme.resolveAttribute(android.R.attr.isLightTheme, isLightTheme, true)
diff --git a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt
index 3b8ed2a056fb..81de3bc1111c 100644
--- a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt
+++ b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt
@@ -253,7 +253,7 @@ object Flags {
// 801 - region sampling
// TODO(b/254512848): Tracking Bug
- val REGION_SAMPLING = unreleasedFlag(801, "region_sampling")
+ val REGION_SAMPLING = unreleasedFlag(801, "region_sampling", teamfood = true)
// 802 - wallpaper rendering
// TODO(b/254512923): Tracking Bug
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceController.kt
index a96edf525ebb..154518dceddf 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceController.kt
@@ -17,6 +17,7 @@
package com.android.systemui.statusbar.lockscreen
import android.app.PendingIntent
+import android.app.WallpaperManager
import android.app.smartspace.SmartspaceConfig
import android.app.smartspace.SmartspaceManager
import android.app.smartspace.SmartspaceSession
@@ -389,7 +390,8 @@ class LockscreenSmartspaceController @Inject constructor(
}
private fun updateTextColorFromWallpaper() {
- if (!regionSamplingEnabled) {
+ val wallpaperManager = WallpaperManager.getInstance(context)
+ if (!regionSamplingEnabled || wallpaperManager.lockScreenWallpaperExists()) {
val wallpaperTextColor =
Utils.getColorAttrDefaultColor(context, R.attr.wallpaperTextColor)
smartspaceViews.forEach { it.setPrimaryTextColor(wallpaperTextColor) }