Loading policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java +24 −1 Original line number Diff line number Diff line Loading @@ -75,6 +75,9 @@ public class KeyguardHostView extends KeyguardViewBase { private SecurityMode mCurrentSecuritySelection = SecurityMode.Invalid; private int mAppWidgetToShow; private boolean mBootCompleted = false; private boolean mCheckAppWidgetConsistencyOnBootCompleted = false; protected Runnable mLaunchRunnable; protected int mFailedAttempts; Loading Loading @@ -140,6 +143,19 @@ public class KeyguardHostView extends KeyguardViewBase { } } private KeyguardUpdateMonitorCallback mUpdateMonitorCallbacks = new KeyguardUpdateMonitorCallback() { @Override public void onBootCompleted() { mBootCompleted = true; if (mCheckAppWidgetConsistencyOnBootCompleted) { checkAppWidgetConsistency(); mSwitchPageRunnable.run(); mCheckAppWidgetConsistencyOnBootCompleted = false; } } }; @Override public boolean onTouchEvent(MotionEvent ev) { boolean result = super.onTouchEvent(ev); Loading Loading @@ -263,12 +279,14 @@ public class KeyguardHostView extends KeyguardViewBase { protected void onAttachedToWindow() { super.onAttachedToWindow(); mAppWidgetHost.startListening(); KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mUpdateMonitorCallbacks); } @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); mAppWidgetHost.stopListening(); KeyguardUpdateMonitor.getInstance(mContext).removeCallback(mUpdateMonitorCallbacks); } private AppWidgetHost getAppWidgetHost() { Loading Loading @@ -1086,8 +1104,13 @@ public class KeyguardHostView extends KeyguardViewBase { } return appWidgetId; } public void checkAppWidgetConsistency() { // Since this method may bind a widget (which we can't do until boot completed) we // may have to defer it until after boot complete. if (!mBootCompleted) { mCheckAppWidgetConsistencyOnBootCompleted = true; return; } final int childCount = mAppWidgetContainer.getChildCount(); boolean widgetPageExists = false; for (int i = 0; i < childCount; i++) { Loading policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor.java +20 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,8 @@ public class KeyguardUpdateMonitor { private static final int MSG_USER_SWITCHED = 310; private static final int MSG_USER_REMOVED = 311; private static final int MSG_KEYGUARD_VISIBILITY_CHANGED = 312; protected static final int MSG_BOOT_COMPLETED = 313; private static KeyguardUpdateMonitor sInstance; Loading Loading @@ -152,6 +154,9 @@ public class KeyguardUpdateMonitor { case MSG_KEYGUARD_VISIBILITY_CHANGED: handleKeyguardVisibilityChanged(msg.arg1); break; case MSG_BOOT_COMPLETED: handleBootCompleted(); break; } } Loading Loading @@ -198,6 +203,8 @@ public class KeyguardUpdateMonitor { } else if (Intent.ACTION_USER_REMOVED.equals(action)) { mHandler.sendMessage(mHandler.obtainMessage(MSG_USER_REMOVED, intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0), 0)); } else if (Intent.ACTION_BOOT_COMPLETED.equals(action)) { mHandler.sendMessage(mHandler.obtainMessage(MSG_BOOT_COMPLETED)); } } }; Loading Loading @@ -340,6 +347,7 @@ public class KeyguardUpdateMonitor { filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION); filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED); filter.addAction(Intent.ACTION_USER_REMOVED); filter.addAction(Intent.ACTION_BOOT_COMPLETED); context.registerReceiver(mBroadcastReceiver, filter); try { Loading Loading @@ -419,6 +427,18 @@ public class KeyguardUpdateMonitor { } } /** * Handle {@link #MSG_BOOT_COMPLETED} */ protected void handleBootCompleted() { for (int i = 0; i < mCallbacks.size(); i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { cb.onBootCompleted(); } } } /** * Handle {@link #MSG_USER_SWITCHED} */ Loading policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitorCallback.java +8 −0 Original line number Diff line number Diff line Loading @@ -99,4 +99,12 @@ class KeyguardUpdateMonitorCallback { * Called when a user is removed. */ void onUserRemoved(int userId) { } /** * Called when boot completed. * * Note, this callback will only be received if boot complete occurs after registering with * KeyguardUpdateMonitor. */ void onBootCompleted() { } } Loading
policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java +24 −1 Original line number Diff line number Diff line Loading @@ -75,6 +75,9 @@ public class KeyguardHostView extends KeyguardViewBase { private SecurityMode mCurrentSecuritySelection = SecurityMode.Invalid; private int mAppWidgetToShow; private boolean mBootCompleted = false; private boolean mCheckAppWidgetConsistencyOnBootCompleted = false; protected Runnable mLaunchRunnable; protected int mFailedAttempts; Loading Loading @@ -140,6 +143,19 @@ public class KeyguardHostView extends KeyguardViewBase { } } private KeyguardUpdateMonitorCallback mUpdateMonitorCallbacks = new KeyguardUpdateMonitorCallback() { @Override public void onBootCompleted() { mBootCompleted = true; if (mCheckAppWidgetConsistencyOnBootCompleted) { checkAppWidgetConsistency(); mSwitchPageRunnable.run(); mCheckAppWidgetConsistencyOnBootCompleted = false; } } }; @Override public boolean onTouchEvent(MotionEvent ev) { boolean result = super.onTouchEvent(ev); Loading Loading @@ -263,12 +279,14 @@ public class KeyguardHostView extends KeyguardViewBase { protected void onAttachedToWindow() { super.onAttachedToWindow(); mAppWidgetHost.startListening(); KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mUpdateMonitorCallbacks); } @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); mAppWidgetHost.stopListening(); KeyguardUpdateMonitor.getInstance(mContext).removeCallback(mUpdateMonitorCallbacks); } private AppWidgetHost getAppWidgetHost() { Loading Loading @@ -1086,8 +1104,13 @@ public class KeyguardHostView extends KeyguardViewBase { } return appWidgetId; } public void checkAppWidgetConsistency() { // Since this method may bind a widget (which we can't do until boot completed) we // may have to defer it until after boot complete. if (!mBootCompleted) { mCheckAppWidgetConsistencyOnBootCompleted = true; return; } final int childCount = mAppWidgetContainer.getChildCount(); boolean widgetPageExists = false; for (int i = 0; i < childCount; i++) { Loading
policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor.java +20 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,8 @@ public class KeyguardUpdateMonitor { private static final int MSG_USER_SWITCHED = 310; private static final int MSG_USER_REMOVED = 311; private static final int MSG_KEYGUARD_VISIBILITY_CHANGED = 312; protected static final int MSG_BOOT_COMPLETED = 313; private static KeyguardUpdateMonitor sInstance; Loading Loading @@ -152,6 +154,9 @@ public class KeyguardUpdateMonitor { case MSG_KEYGUARD_VISIBILITY_CHANGED: handleKeyguardVisibilityChanged(msg.arg1); break; case MSG_BOOT_COMPLETED: handleBootCompleted(); break; } } Loading Loading @@ -198,6 +203,8 @@ public class KeyguardUpdateMonitor { } else if (Intent.ACTION_USER_REMOVED.equals(action)) { mHandler.sendMessage(mHandler.obtainMessage(MSG_USER_REMOVED, intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0), 0)); } else if (Intent.ACTION_BOOT_COMPLETED.equals(action)) { mHandler.sendMessage(mHandler.obtainMessage(MSG_BOOT_COMPLETED)); } } }; Loading Loading @@ -340,6 +347,7 @@ public class KeyguardUpdateMonitor { filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION); filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED); filter.addAction(Intent.ACTION_USER_REMOVED); filter.addAction(Intent.ACTION_BOOT_COMPLETED); context.registerReceiver(mBroadcastReceiver, filter); try { Loading Loading @@ -419,6 +427,18 @@ public class KeyguardUpdateMonitor { } } /** * Handle {@link #MSG_BOOT_COMPLETED} */ protected void handleBootCompleted() { for (int i = 0; i < mCallbacks.size(); i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { cb.onBootCompleted(); } } } /** * Handle {@link #MSG_USER_SWITCHED} */ Loading
policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitorCallback.java +8 −0 Original line number Diff line number Diff line Loading @@ -99,4 +99,12 @@ class KeyguardUpdateMonitorCallback { * Called when a user is removed. */ void onUserRemoved(int userId) { } /** * Called when boot completed. * * Note, this callback will only be received if boot complete occurs after registering with * KeyguardUpdateMonitor. */ void onBootCompleted() { } }