summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockProviderPlugin.kt4
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java34
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 babe5700a01c..5b6a83c24e3d 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 7b781cef6717..cdaed878cc3c 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<KeyguardClockS
private final ContentObserver mShowWeatherObserver = new ContentObserver(null) {
@Override
public void onChange(boolean change) {
- setWeatherVisibility();
+ setDateWeatherVisibility();
}
};
@@ -236,7 +236,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
);
updateDoubleLineClock();
- setWeatherVisibility();
+ setDateWeatherVisibility();
mKeyguardUnlockAnimationController.addKeyguardUnlockAnimationListener(
mKeyguardUnlockAnimationListener);
@@ -337,6 +337,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
}
mCurrentClockSize = clockSize;
+ setDateWeatherVisibility();
ClockController clock = getClock();
boolean appeared = mView.switchToClock(clockSize, animate);
@@ -457,6 +458,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
mClockEventController.setClock(clock);
mView.setClock(clock, mStatusBarStateController.getState());
+ setDateWeatherVisibility();
}
@Nullable
@@ -478,11 +480,18 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
}
}
- private void setWeatherVisibility() {
- if (mWeatherView != null) {
- mUiExecutor.execute(
- () -> 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<KeyguardClockS
}
}
+ /** Returns true if the clock handles the display of weather information */
+ private boolean clockHasCustomWeatherDataDisplay() {
+ ClockController clock = getClock();
+ if (clock == null) {
+ return false;
+ }
+
+ return ((mCurrentClockSize == LARGE) ? clock.getLargeClock() : clock.getSmallClock())
+ .getEvents().getHasCustomWeatherDataDisplay();
+ }
+
/** Gets the animations for the current clock. */
@Nullable
public ClockAnimations getClockAnimations() {