Loading packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockPlugin.java +7 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ import android.view.View; import com.android.systemui.plugins.annotations.ProvidesInterface; import java.util.TimeZone; /** * This plugin is used to replace main clock in keyguard. */ Loading Loading @@ -55,4 +57,9 @@ public interface ClockPlugin extends Plugin { * @param darkAmount Amount of transition to doze: 1f for doze and 0f for awake. */ default void setDarkAmount(float darkAmount) {} /** * Notifies that the time zone has changed. */ default void onTimeZoneChanged(TimeZone timeZone) {} } packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java +10 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ import com.android.systemui.plugins.PluginListener; import com.android.systemui.shared.plugins.PluginManager; import java.util.Objects; import java.util.TimeZone; /** * Switch to show plugin clock when plugin is connected, otherwise it will show default clock. Loading Loading @@ -161,6 +162,15 @@ public class KeyguardClockSwitch extends FrameLayout { } } /** * Notifies that the time zone has changed. */ public void onTimeZoneChanged(TimeZone timeZone) { if (mClockPlugin != null) { mClockPlugin.onTimeZoneChanged(timeZone); } } /** * When plugin changes, set all kept parameters into newer plugin. */ Loading packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java +10 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ import com.android.systemui.statusbar.policy.ConfigurationController; import com.google.android.collect.Sets; import java.util.Locale; import java.util.TimeZone; public class KeyguardStatusView extends GridLayout implements ConfigurationController.ConfigurationListener, View.OnLayoutChangeListener { Loading Loading @@ -84,6 +85,11 @@ public class KeyguardStatusView extends GridLayout implements refreshTime(); } @Override public void onTimeZoneChanged(TimeZone timeZone) { updateTimeZone(timeZone); } @Override public void onKeyguardVisibilityChanged(boolean showing) { if (showing) { Loading Loading @@ -282,6 +288,10 @@ public class KeyguardStatusView extends GridLayout implements mClockView.refresh(); } private void updateTimeZone(TimeZone timeZone) { mClockView.onTimeZoneChanged(timeZone); } private void refreshFormat() { Patterns.update(mContext); mClockView.setFormat12Hour(Patterns.clockView12); Loading packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +25 −2 Original line number Diff line number Diff line Loading @@ -98,6 +98,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map.Entry; import java.util.TimeZone; /** * Watches for updates that may be interesting to the keyguard, and provides Loading Loading @@ -151,6 +152,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { private static final int MSG_BIOMETRIC_AUTHENTICATION_CONTINUE = 336; private static final int MSG_DEVICE_POLICY_MANAGER_STATE_CHANGED = 337; private static final int MSG_TELEPHONY_CAPABLE = 338; private static final int MSG_TIMEZONE_UPDATE = 339; /** Biometric authentication state: Not listening. */ private static final int BIOMETRIC_STATE_STOPPED = 0; Loading Loading @@ -260,6 +262,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { case MSG_TIME_UPDATE: handleTimeUpdate(); break; case MSG_TIMEZONE_UPDATE: handleTimeZoneUpdate((String) msg.obj); break; case MSG_BATTERY_UPDATE: handleBatteryUpdate((BatteryStatus) msg.obj); break; Loading Loading @@ -964,9 +969,12 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { if (DEBUG) Log.d(TAG, "received broadcast " + action); if (Intent.ACTION_TIME_TICK.equals(action) || Intent.ACTION_TIME_CHANGED.equals(action) || Intent.ACTION_TIMEZONE_CHANGED.equals(action)) { || Intent.ACTION_TIME_CHANGED.equals(action)) { mHandler.sendEmptyMessage(MSG_TIME_UPDATE); } else if (Intent.ACTION_TIMEZONE_CHANGED.equals(action)) { final Message msg = mHandler.obtainMessage( MSG_TIMEZONE_UPDATE, intent.getStringExtra("time-zone")); mHandler.sendMessage(msg); } else if (Intent.ACTION_BATTERY_CHANGED.equals(action)) { final int status = intent.getIntExtra(EXTRA_STATUS, BATTERY_STATUS_UNKNOWN); final int plugged = intent.getIntExtra(EXTRA_PLUGGED, 0); Loading Loading @@ -1859,6 +1867,21 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { } } /** * Handle (@line #MSG_TIMEZONE_UPDATE} */ private void handleTimeZoneUpdate(String timeZone) { if (DEBUG) Log.d(TAG, "handleTimeZoneUpdate"); for (int i = 0; i < mCallbacks.size(); i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { cb.onTimeZoneChanged(TimeZone.getTimeZone(timeZone)); // Also notify callbacks about time change to remain compatible. cb.onTimeChanged(); } } } /** * Handle {@link #MSG_BATTERY_UPDATE} */ Loading packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java +9 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ import android.view.WindowManagerPolicyConstants; import com.android.internal.telephony.IccCardConstants; import com.android.systemui.statusbar.KeyguardIndicationController; import java.util.TimeZone; /** * Callback for general information relevant to lock screen. */ Loading @@ -48,6 +50,13 @@ public class KeyguardUpdateMonitorCallback { */ public void onTimeChanged() { } /** * Called when time zone changes. * * @note When time zone changes, onTimeChanged will be called too. */ public void onTimeZoneChanged(TimeZone timeZone) { } /** * Called when the carrier PLMN or SPN changes. */ Loading Loading
packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockPlugin.java +7 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ import android.view.View; import com.android.systemui.plugins.annotations.ProvidesInterface; import java.util.TimeZone; /** * This plugin is used to replace main clock in keyguard. */ Loading Loading @@ -55,4 +57,9 @@ public interface ClockPlugin extends Plugin { * @param darkAmount Amount of transition to doze: 1f for doze and 0f for awake. */ default void setDarkAmount(float darkAmount) {} /** * Notifies that the time zone has changed. */ default void onTimeZoneChanged(TimeZone timeZone) {} }
packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java +10 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ import com.android.systemui.plugins.PluginListener; import com.android.systemui.shared.plugins.PluginManager; import java.util.Objects; import java.util.TimeZone; /** * Switch to show plugin clock when plugin is connected, otherwise it will show default clock. Loading Loading @@ -161,6 +162,15 @@ public class KeyguardClockSwitch extends FrameLayout { } } /** * Notifies that the time zone has changed. */ public void onTimeZoneChanged(TimeZone timeZone) { if (mClockPlugin != null) { mClockPlugin.onTimeZoneChanged(timeZone); } } /** * When plugin changes, set all kept parameters into newer plugin. */ Loading
packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java +10 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ import com.android.systemui.statusbar.policy.ConfigurationController; import com.google.android.collect.Sets; import java.util.Locale; import java.util.TimeZone; public class KeyguardStatusView extends GridLayout implements ConfigurationController.ConfigurationListener, View.OnLayoutChangeListener { Loading Loading @@ -84,6 +85,11 @@ public class KeyguardStatusView extends GridLayout implements refreshTime(); } @Override public void onTimeZoneChanged(TimeZone timeZone) { updateTimeZone(timeZone); } @Override public void onKeyguardVisibilityChanged(boolean showing) { if (showing) { Loading Loading @@ -282,6 +288,10 @@ public class KeyguardStatusView extends GridLayout implements mClockView.refresh(); } private void updateTimeZone(TimeZone timeZone) { mClockView.onTimeZoneChanged(timeZone); } private void refreshFormat() { Patterns.update(mContext); mClockView.setFormat12Hour(Patterns.clockView12); Loading
packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +25 −2 Original line number Diff line number Diff line Loading @@ -98,6 +98,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map.Entry; import java.util.TimeZone; /** * Watches for updates that may be interesting to the keyguard, and provides Loading Loading @@ -151,6 +152,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { private static final int MSG_BIOMETRIC_AUTHENTICATION_CONTINUE = 336; private static final int MSG_DEVICE_POLICY_MANAGER_STATE_CHANGED = 337; private static final int MSG_TELEPHONY_CAPABLE = 338; private static final int MSG_TIMEZONE_UPDATE = 339; /** Biometric authentication state: Not listening. */ private static final int BIOMETRIC_STATE_STOPPED = 0; Loading Loading @@ -260,6 +262,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { case MSG_TIME_UPDATE: handleTimeUpdate(); break; case MSG_TIMEZONE_UPDATE: handleTimeZoneUpdate((String) msg.obj); break; case MSG_BATTERY_UPDATE: handleBatteryUpdate((BatteryStatus) msg.obj); break; Loading Loading @@ -964,9 +969,12 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { if (DEBUG) Log.d(TAG, "received broadcast " + action); if (Intent.ACTION_TIME_TICK.equals(action) || Intent.ACTION_TIME_CHANGED.equals(action) || Intent.ACTION_TIMEZONE_CHANGED.equals(action)) { || Intent.ACTION_TIME_CHANGED.equals(action)) { mHandler.sendEmptyMessage(MSG_TIME_UPDATE); } else if (Intent.ACTION_TIMEZONE_CHANGED.equals(action)) { final Message msg = mHandler.obtainMessage( MSG_TIMEZONE_UPDATE, intent.getStringExtra("time-zone")); mHandler.sendMessage(msg); } else if (Intent.ACTION_BATTERY_CHANGED.equals(action)) { final int status = intent.getIntExtra(EXTRA_STATUS, BATTERY_STATUS_UNKNOWN); final int plugged = intent.getIntExtra(EXTRA_PLUGGED, 0); Loading Loading @@ -1859,6 +1867,21 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { } } /** * Handle (@line #MSG_TIMEZONE_UPDATE} */ private void handleTimeZoneUpdate(String timeZone) { if (DEBUG) Log.d(TAG, "handleTimeZoneUpdate"); for (int i = 0; i < mCallbacks.size(); i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { cb.onTimeZoneChanged(TimeZone.getTimeZone(timeZone)); // Also notify callbacks about time change to remain compatible. cb.onTimeChanged(); } } } /** * Handle {@link #MSG_BATTERY_UPDATE} */ Loading
packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java +9 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ import android.view.WindowManagerPolicyConstants; import com.android.internal.telephony.IccCardConstants; import com.android.systemui.statusbar.KeyguardIndicationController; import java.util.TimeZone; /** * Callback for general information relevant to lock screen. */ Loading @@ -48,6 +50,13 @@ public class KeyguardUpdateMonitorCallback { */ public void onTimeChanged() { } /** * Called when time zone changes. * * @note When time zone changes, onTimeChanged will be called too. */ public void onTimeZoneChanged(TimeZone timeZone) { } /** * Called when the carrier PLMN or SPN changes. */ Loading