From aac40cb9be0e44472dda19cfddb3ceeea9f6ddd2 Mon Sep 17 00:00:00 2001 From: Hawkwood Glazier Date: Fri, 12 May 2023 22:21:12 +0000 Subject: [PATCH] Cache and resend weather data when the clock changes Bug: 282231387 Test: Changed clock a few times. Observed weather data. Change-Id: I46c0f0ad2779f64ef023ebbe2b501c1486264520 --- .../SystemUI/src/com/android/keyguard/ClockEventController.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/SystemUI/src/com/android/keyguard/ClockEventController.kt b/packages/SystemUI/src/com/android/keyguard/ClockEventController.kt index 4bf7be6df5bea..c5b14e3c8722a 100644 --- a/packages/SystemUI/src/com/android/keyguard/ClockEventController.kt +++ b/packages/SystemUI/src/com/android/keyguard/ClockEventController.kt @@ -108,6 +108,7 @@ constructor( } updateFontSizes() updateTimeListeners() + cachedWeatherData?.let { value.events.onWeatherDataChanged(it) } value.smallClock.view.addOnAttachStateChangeListener( object : OnAttachStateChangeListener { override fun onViewAttachedToWindow(p0: View?) { @@ -239,6 +240,7 @@ constructor( var largeTimeListener: TimeListener? = null val shouldTimeListenerRun: Boolean get() = isKeyguardVisible && dozeAmount < DOZE_TICKRATE_THRESHOLD + private var cachedWeatherData: WeatherData? = null private var smallClockIsDark = true private var largeClockIsDark = true @@ -305,6 +307,7 @@ constructor( } override fun onWeatherDataChanged(data: WeatherData) { + cachedWeatherData = data clock?.run { events.onWeatherDataChanged(data) } } }