From f22fbb7e836d5ba70ae05b91276e7bb99ee264de Mon Sep 17 00:00:00 2001 From: Hawkwood Glazier Date: Tue, 21 Mar 2023 18:22:33 +0000 Subject: [PATCH] Optionally hide default keygaurd weather view Bug: 274631066 Test: Manually checked relevant views on device Change-Id: I8bbcd1f15d3c01a2f02d93dc96c4cd6d7afaaf60 --- .../systemui/plugins/ClockProviderPlugin.kt | 4 +++ .../KeyguardClockSwitchController.java | 34 +++++++++++++++---- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockProviderPlugin.kt b/packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockProviderPlugin.kt index babe5700a01ca..5b6a83c24e3db 100644 --- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockProviderPlugin.kt +++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockProviderPlugin.kt @@ -154,6 +154,10 @@ interface ClockFaceEvents { val tickRate: ClockTickRate get() = ClockTickRate.PER_MINUTE + /** Call to check whether the clock consumes weather data */ + val hasCustomWeatherDataDisplay: Boolean + get() = false + /** Region Darkness specific to the clock face */ fun onRegionDarknessChanged(isDark: Boolean) {} diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java index 7b781cef67178..cdaed878cc3cd 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java @@ -110,7 +110,7 @@ public class KeyguardClockSwitchController extends ViewController mWeatherView.setVisibility( - mSmartspaceController.isWeatherEnabled() ? View.VISIBLE : View.GONE)); + private void setDateWeatherVisibility() { + if (mDateWeatherView != null || mWeatherView != null) { + mUiExecutor.execute(() -> { + if (mDateWeatherView != null) { + mDateWeatherView.setVisibility( + clockHasCustomWeatherDataDisplay() ? View.GONE : View.VISIBLE); + } + if (mWeatherView != null) { + mWeatherView.setVisibility( + mSmartspaceController.isWeatherEnabled() ? View.VISIBLE : View.GONE); + } + }); } } @@ -511,6 +520,17 @@ public class KeyguardClockSwitchController extends ViewController