Loading policy/src/com/android/internal/policy/impl/keyguard/KeyguardSelectorView.java +0 −1 Original line number Diff line number Diff line Loading @@ -149,7 +149,6 @@ public class KeyguardSelectorView extends LinearLayout implements KeyguardSecuri mGlowPadView = (GlowPadView) findViewById(R.id.glow_pad_view); mGlowPadView.setOnTriggerListener(mOnTriggerListener); mEmergencyCallButton = (Button) findViewById(R.id.emergency_call_button); KeyguardUpdateMonitor.getInstance(getContext()).registerCallback(mInfoCallback); updateTargets(); } Loading policy/src/com/android/internal/policy/impl/keyguard/KeyguardStatusView.java +3 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import android.util.AttributeSet; import android.widget.GridLayout; public class KeyguardStatusView extends GridLayout { private KeyguardStatusViewManager mStatusViewManager; public KeyguardStatusView(Context context) { this(context, null, 0); } Loading @@ -38,7 +40,7 @@ public class KeyguardStatusView extends GridLayout { super.onFinishInflate(); // StatusView manages all of the widgets in this view. new KeyguardStatusViewManager(this); mStatusViewManager = new KeyguardStatusViewManager(this); } } policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor.java +31 −24 Original line number Diff line number Diff line Loading @@ -100,7 +100,7 @@ public class KeyguardUpdateMonitor { private boolean mClockVisible; private ArrayList<WeakReference<KeyguardUpdateMonitorCallback>> private final ArrayList<WeakReference<KeyguardUpdateMonitorCallback>> mCallbacks = Lists.newArrayList(); private ContentObserver mContentObserver; Loading Loading @@ -586,20 +586,38 @@ public class KeyguardUpdateMonitor { /** * Remove the given observer's callback. * * @param observer The observer to remove * @param callback The callback to remove */ public void removeCallback(Object observer) { mCallbacks.remove(observer); public void removeCallback(KeyguardUpdateMonitorCallback callback) { if (DEBUG) Log.v(TAG, "*** unregister callback for " + callback); for (int i = mCallbacks.size() - 1; i >= 0; i--) { if (mCallbacks.get(i).get() == callback) { mCallbacks.remove(i); } } } /** * Register to receive notifications about general keyguard information * (see {@link InfoCallback}. * @param callback The callback. * @param callback The callback to register */ public void registerCallback(KeyguardUpdateMonitorCallback callback) { if (!mCallbacks.contains(callback)) { if (DEBUG) Log.v(TAG, "*** register callback for " + callback); // Prevent adding duplicate callbacks for (int i = 0; i < mCallbacks.size(); i++) { if (mCallbacks.get(i).get() == callback) { if (DEBUG) Log.e(TAG, "Object tried to add another callback", new Exception("Called by")); return; } } mCallbacks.add(new WeakReference<KeyguardUpdateMonitorCallback>(callback)); removeCallback(null); // remove unused references sendUpdates(callback); } private void sendUpdates(KeyguardUpdateMonitorCallback callback) { // Notify listener of the current state callback.onRefreshBatteryInfo(mBatteryStatus); callback.onTimeChanged(); Loading @@ -608,17 +626,6 @@ public class KeyguardUpdateMonitor { callback.onRefreshCarrierInfo(mTelephonyPlmn, mTelephonySpn); callback.onClockVisibilityChanged(); callback.onSimStateChanged(mSimState); } else { if (DEBUG) Log.e(TAG, "Object tried to add another callback", new Exception("Called by")); } // Clean up any unused references for (int i = mCallbacks.size() - 1; i >= 0; i--) { if (mCallbacks.get(i).get() == null) { mCallbacks.remove(i); } } } public void reportClockVisible(boolean visible) { Loading Loading
policy/src/com/android/internal/policy/impl/keyguard/KeyguardSelectorView.java +0 −1 Original line number Diff line number Diff line Loading @@ -149,7 +149,6 @@ public class KeyguardSelectorView extends LinearLayout implements KeyguardSecuri mGlowPadView = (GlowPadView) findViewById(R.id.glow_pad_view); mGlowPadView.setOnTriggerListener(mOnTriggerListener); mEmergencyCallButton = (Button) findViewById(R.id.emergency_call_button); KeyguardUpdateMonitor.getInstance(getContext()).registerCallback(mInfoCallback); updateTargets(); } Loading
policy/src/com/android/internal/policy/impl/keyguard/KeyguardStatusView.java +3 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import android.util.AttributeSet; import android.widget.GridLayout; public class KeyguardStatusView extends GridLayout { private KeyguardStatusViewManager mStatusViewManager; public KeyguardStatusView(Context context) { this(context, null, 0); } Loading @@ -38,7 +40,7 @@ public class KeyguardStatusView extends GridLayout { super.onFinishInflate(); // StatusView manages all of the widgets in this view. new KeyguardStatusViewManager(this); mStatusViewManager = new KeyguardStatusViewManager(this); } }
policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor.java +31 −24 Original line number Diff line number Diff line Loading @@ -100,7 +100,7 @@ public class KeyguardUpdateMonitor { private boolean mClockVisible; private ArrayList<WeakReference<KeyguardUpdateMonitorCallback>> private final ArrayList<WeakReference<KeyguardUpdateMonitorCallback>> mCallbacks = Lists.newArrayList(); private ContentObserver mContentObserver; Loading Loading @@ -586,20 +586,38 @@ public class KeyguardUpdateMonitor { /** * Remove the given observer's callback. * * @param observer The observer to remove * @param callback The callback to remove */ public void removeCallback(Object observer) { mCallbacks.remove(observer); public void removeCallback(KeyguardUpdateMonitorCallback callback) { if (DEBUG) Log.v(TAG, "*** unregister callback for " + callback); for (int i = mCallbacks.size() - 1; i >= 0; i--) { if (mCallbacks.get(i).get() == callback) { mCallbacks.remove(i); } } } /** * Register to receive notifications about general keyguard information * (see {@link InfoCallback}. * @param callback The callback. * @param callback The callback to register */ public void registerCallback(KeyguardUpdateMonitorCallback callback) { if (!mCallbacks.contains(callback)) { if (DEBUG) Log.v(TAG, "*** register callback for " + callback); // Prevent adding duplicate callbacks for (int i = 0; i < mCallbacks.size(); i++) { if (mCallbacks.get(i).get() == callback) { if (DEBUG) Log.e(TAG, "Object tried to add another callback", new Exception("Called by")); return; } } mCallbacks.add(new WeakReference<KeyguardUpdateMonitorCallback>(callback)); removeCallback(null); // remove unused references sendUpdates(callback); } private void sendUpdates(KeyguardUpdateMonitorCallback callback) { // Notify listener of the current state callback.onRefreshBatteryInfo(mBatteryStatus); callback.onTimeChanged(); Loading @@ -608,17 +626,6 @@ public class KeyguardUpdateMonitor { callback.onRefreshCarrierInfo(mTelephonyPlmn, mTelephonySpn); callback.onClockVisibilityChanged(); callback.onSimStateChanged(mSimState); } else { if (DEBUG) Log.e(TAG, "Object tried to add another callback", new Exception("Called by")); } // Clean up any unused references for (int i = mCallbacks.size() - 1; i >= 0; i--) { if (mCallbacks.get(i).get() == null) { mCallbacks.remove(i); } } } public void reportClockVisible(boolean visible) { Loading