Loading packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockProviderPlugin.kt +4 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.view.View import com.android.internal.annotations.Keep import com.android.systemui.plugins.annotations.ProvidesInterface import com.android.systemui.plugins.log.LogBuffer import com.android.systemui.statusbar.Weather import java.io.PrintWriter import java.util.Locale import java.util.TimeZone Loading Loading @@ -111,6 +112,9 @@ interface ClockEvents { /** Call whenever the color palette should update */ fun onColorPaletteChanged(resources: Resources) {} /** Call whenever the weather data should update */ fun onWeatherDataChanged(data: Weather) {} } /** Methods which trigger various clock animations */ Loading packages/SystemUI/src/com/android/keyguard/ClockEventController.kt +7 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ import com.android.systemui.plugins.ClockTickRate import com.android.systemui.plugins.log.LogBuffer import com.android.systemui.plugins.log.LogLevel.DEBUG import com.android.systemui.shared.regionsampling.RegionSampler import com.android.systemui.statusbar.Weather import com.android.systemui.statusbar.policy.BatteryController import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChangeCallback import com.android.systemui.statusbar.policy.ConfigurationController Loading Loading @@ -273,6 +274,12 @@ open class ClockEventController @Inject constructor( override fun onUserSwitchComplete(userId: Int) { clock?.events?.onTimeFormatChanged(DateFormat.is24HourFormat(context)) } override fun onWeatherDataChanged(data: Weather?) { if (data != null) { clock?.events?.onWeatherDataChanged(data) } } } fun registerListeners(parent: View) { Loading packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +19 −1 Original line number Diff line number Diff line Loading @@ -108,7 +108,6 @@ import android.os.Looper; import android.os.Message; import android.os.PowerManager; import android.os.RemoteException; import android.os.SystemClock; import android.os.Trace; import android.os.UserHandle; import android.os.UserManager; Loading Loading @@ -153,6 +152,7 @@ import com.android.systemui.settings.UserTracker; import com.android.systemui.shared.system.TaskStackChangeListener; import com.android.systemui.shared.system.TaskStackChangeListeners; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.Weather; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.policy.DevicePostureController; import com.android.systemui.telephony.TelephonyListenerManager; Loading Loading @@ -3216,6 +3216,24 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab } } /** * @param data the weather data (temp, conditions, unit) for weather clock to use */ public void sendWeatherData(Weather data) { mHandler.post(()-> { handleWeatherDataUpdate(data); }); } private void handleWeatherDataUpdate(Weather data) { Assert.isMainThread(); for (int i = 0; i < mCallbacks.size(); i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { cb.onWeatherDataChanged(data); } } } /** * Handle {@link #MSG_BATTERY_UPDATE} */ Loading packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java +6 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import androidx.annotation.Nullable; import com.android.settingslib.fuelgauge.BatteryStatus; import com.android.systemui.statusbar.KeyguardIndicationController; import com.android.systemui.statusbar.Weather; import java.util.TimeZone; Loading Loading @@ -57,6 +58,11 @@ public class KeyguardUpdateMonitorCallback { */ public void onTimeFormatChanged(String timeFormat) { } /** * Called when receive new weather data. */ public void onWeatherDataChanged(Weather data) { } /** * Called when the carrier PLMN or SPN changes. */ Loading packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceController.kt +3 −1 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import android.util.Log import android.view.ContextThemeWrapper import android.view.View import android.view.ViewGroup import com.android.keyguard.KeyguardUpdateMonitor import com.android.settingslib.Utils import com.android.systemui.R import com.android.systemui.dagger.SysUISingleton Loading Loading @@ -83,6 +84,7 @@ constructor( private val statusBarStateController: StatusBarStateController, private val deviceProvisionedController: DeviceProvisionedController, private val bypassController: KeyguardBypassController, private val keyguardUpdateMonitor: KeyguardUpdateMonitor, private val execution: Execution, @Main private val uiExecutor: Executor, @Background private val bgExecutor: Executor, Loading Loading @@ -175,10 +177,10 @@ constructor( } if (weatherTarget != null) { val weatherData = Weather.fromBundle(weatherTarget.baseAction.extras) keyguardUpdateMonitor.sendWeatherData(weatherData) } } private val userTrackerCallback = object : UserTracker.Callback { override fun onUserChanged(newUser: Int, userContext: Context) { execution.assertIsMainThread() Loading Loading
packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockProviderPlugin.kt +4 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.view.View import com.android.internal.annotations.Keep import com.android.systemui.plugins.annotations.ProvidesInterface import com.android.systemui.plugins.log.LogBuffer import com.android.systemui.statusbar.Weather import java.io.PrintWriter import java.util.Locale import java.util.TimeZone Loading Loading @@ -111,6 +112,9 @@ interface ClockEvents { /** Call whenever the color palette should update */ fun onColorPaletteChanged(resources: Resources) {} /** Call whenever the weather data should update */ fun onWeatherDataChanged(data: Weather) {} } /** Methods which trigger various clock animations */ Loading
packages/SystemUI/src/com/android/keyguard/ClockEventController.kt +7 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ import com.android.systemui.plugins.ClockTickRate import com.android.systemui.plugins.log.LogBuffer import com.android.systemui.plugins.log.LogLevel.DEBUG import com.android.systemui.shared.regionsampling.RegionSampler import com.android.systemui.statusbar.Weather import com.android.systemui.statusbar.policy.BatteryController import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChangeCallback import com.android.systemui.statusbar.policy.ConfigurationController Loading Loading @@ -273,6 +274,12 @@ open class ClockEventController @Inject constructor( override fun onUserSwitchComplete(userId: Int) { clock?.events?.onTimeFormatChanged(DateFormat.is24HourFormat(context)) } override fun onWeatherDataChanged(data: Weather?) { if (data != null) { clock?.events?.onWeatherDataChanged(data) } } } fun registerListeners(parent: View) { Loading
packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +19 −1 Original line number Diff line number Diff line Loading @@ -108,7 +108,6 @@ import android.os.Looper; import android.os.Message; import android.os.PowerManager; import android.os.RemoteException; import android.os.SystemClock; import android.os.Trace; import android.os.UserHandle; import android.os.UserManager; Loading Loading @@ -153,6 +152,7 @@ import com.android.systemui.settings.UserTracker; import com.android.systemui.shared.system.TaskStackChangeListener; import com.android.systemui.shared.system.TaskStackChangeListeners; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.Weather; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.policy.DevicePostureController; import com.android.systemui.telephony.TelephonyListenerManager; Loading Loading @@ -3216,6 +3216,24 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab } } /** * @param data the weather data (temp, conditions, unit) for weather clock to use */ public void sendWeatherData(Weather data) { mHandler.post(()-> { handleWeatherDataUpdate(data); }); } private void handleWeatherDataUpdate(Weather data) { Assert.isMainThread(); for (int i = 0; i < mCallbacks.size(); i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { cb.onWeatherDataChanged(data); } } } /** * Handle {@link #MSG_BATTERY_UPDATE} */ Loading
packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java +6 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import androidx.annotation.Nullable; import com.android.settingslib.fuelgauge.BatteryStatus; import com.android.systemui.statusbar.KeyguardIndicationController; import com.android.systemui.statusbar.Weather; import java.util.TimeZone; Loading Loading @@ -57,6 +58,11 @@ public class KeyguardUpdateMonitorCallback { */ public void onTimeFormatChanged(String timeFormat) { } /** * Called when receive new weather data. */ public void onWeatherDataChanged(Weather data) { } /** * Called when the carrier PLMN or SPN changes. */ Loading
packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceController.kt +3 −1 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import android.util.Log import android.view.ContextThemeWrapper import android.view.View import android.view.ViewGroup import com.android.keyguard.KeyguardUpdateMonitor import com.android.settingslib.Utils import com.android.systemui.R import com.android.systemui.dagger.SysUISingleton Loading Loading @@ -83,6 +84,7 @@ constructor( private val statusBarStateController: StatusBarStateController, private val deviceProvisionedController: DeviceProvisionedController, private val bypassController: KeyguardBypassController, private val keyguardUpdateMonitor: KeyguardUpdateMonitor, private val execution: Execution, @Main private val uiExecutor: Executor, @Background private val bgExecutor: Executor, Loading Loading @@ -175,10 +177,10 @@ constructor( } if (weatherTarget != null) { val weatherData = Weather.fromBundle(weatherTarget.baseAction.extras) keyguardUpdateMonitor.sendWeatherData(weatherData) } } private val userTrackerCallback = object : UserTracker.Callback { override fun onUserChanged(newUser: Int, userContext: Context) { execution.assertIsMainThread() Loading