am 972dd431: Merge "Final icon for notifications panel" into jb-mr1-dev
* commit '972dd431f81432f1bbb33d2e7f34fcd5f4764870':
Final icon for notifications panel
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
index 01d8908..83ba6fe 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
@@ -77,7 +77,6 @@
private SecurityMode mCurrentSecuritySelection = SecurityMode.Invalid;
private int mAppWidgetToShow;
- private boolean mBootCompleted = false;
private boolean mCheckAppWidgetConsistencyOnBootCompleted = false;
protected OnDismissAction mDismissAction;
@@ -149,7 +148,6 @@
new KeyguardUpdateMonitorCallback() {
@Override
public void onBootCompleted() {
- mBootCompleted = true;
if (mCheckAppWidgetConsistencyOnBootCompleted) {
checkAppWidgetConsistency();
mSwitchPageRunnable.run();
@@ -1111,7 +1109,7 @@
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) {
+ if (!KeyguardUpdateMonitor.getInstance(mContext).hasBootCompleted()) {
mCheckAppWidgetConsistencyOnBootCompleted = true;
return;
}
@@ -1302,42 +1300,65 @@
if (!UserManager.supportsMultipleUsers()) {
return; // device doesn't support multi-user mode
}
+ UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
+ if (um == null) {
+ Throwable t = new Throwable();
+ t.fillInStackTrace();
+ Log.e(TAG, "user service is null.", t);
+ return;
+ }
// if there are multiple users, we need to enable to multi-user switcher
- UserManager mUm = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
- List<UserInfo> users = mUm.getUsers(true);
+ List<UserInfo> users = um.getUsers(true);
+ if (users == null) {
+ Throwable t = new Throwable();
+ t.fillInStackTrace();
+ Log.e(TAG, "list of users is null.", t);
+ return;
+ }
if (users.size() > 1) {
- KeyguardMultiUserSelectorView multiUser =
- (KeyguardMultiUserSelectorView) findViewById(R.id.keyguard_user_selector);
- multiUser.setVisibility(View.VISIBLE);
- multiUser.addUsers(mUm.getUsers(true));
- UserSwitcherCallback callback = new UserSwitcherCallback() {
- @Override
- public void hideSecurityView(int duration) {
- mSecurityViewContainer.animate().alpha(0).setDuration(duration);
- }
-
- @Override
- public void showSecurityView() {
- mSecurityViewContainer.setAlpha(1.0f);
- }
-
- @Override
- public void showUnlockHint() {
- if (mKeyguardSelectorView != null) {
- mKeyguardSelectorView.showUsabilityHint();
+ View multiUserView = findViewById(R.id.keyguard_user_selector);
+ if (multiUserView instanceof KeyguardMultiUserSelectorView) {
+ KeyguardMultiUserSelectorView multiUser =
+ (KeyguardMultiUserSelectorView) multiUserView;
+ multiUser.setVisibility(View.VISIBLE);
+ multiUser.addUsers(users);
+ UserSwitcherCallback callback = new UserSwitcherCallback() {
+ @Override
+ public void hideSecurityView(int duration) {
+ mSecurityViewContainer.animate().alpha(0).setDuration(duration);
}
- }
- @Override
- public void userActivity() {
- if (mViewMediatorCallback != null) {
- mViewMediatorCallback.userActivity();
+ @Override
+ public void showSecurityView() {
+ mSecurityViewContainer.setAlpha(1.0f);
}
+
+ @Override
+ public void showUnlockHint() {
+ if (mKeyguardSelectorView != null) {
+ mKeyguardSelectorView.showUsabilityHint();
+ }
+ }
+
+ @Override
+ public void userActivity() {
+ if (mViewMediatorCallback != null) {
+ mViewMediatorCallback.userActivity();
+ }
+ }
+ };
+ multiUser.setCallback(callback);
+ } else {
+ Throwable t = new Throwable();
+ t.fillInStackTrace();
+ if (multiUserView == null) {
+ Log.e(TAG, "could not find the user_selector.", t);
+ } else {
+ Log.e(TAG, "user_selector is the wrong type.", t);
}
- };
- multiUser.setCallback(callback);
+ }
}
}
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor.java
index 51f0418..e1007f9 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor.java
@@ -95,6 +95,7 @@
private int mRingMode;
private int mPhoneState;
private boolean mKeyguardIsVisible;
+ private boolean mBootCompleted;
// Device provisioning state
private boolean mDeviceProvisioned;
@@ -431,6 +432,7 @@
* Handle {@link #MSG_BOOT_COMPLETED}
*/
protected void handleBootCompleted() {
+ mBootCompleted = true;
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
@@ -440,6 +442,14 @@
}
/**
+ * We need to store this state in the KeyguardUpdateMonitor since this class will not be
+ * destroyed.
+ */
+ public boolean hasBootCompleted() {
+ return mBootCompleted;
+ }
+
+ /**
* Handle {@link #MSG_USER_SWITCHED}
*/
protected void handleUserRemoved(int userId) {