diff options
author | Kenny Guy <kennyguy@google.com> | 2014-02-25 13:01:38 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-02-25 13:01:38 +0000 |
commit | e21c52a8c9ef27c348f784daa8ec384152c3264e (patch) | |
tree | f3a830421493265b9733289edf86afe564807813 /packages | |
parent | f5a9ad1cd046439d8fe0eba883c35717a052943e (diff) | |
parent | 1a447535cef7e3739d5f763dfe13e568568b9789 (diff) | |
download | frameworks_base-e21c52a8c9ef27c348f784daa8ec384152c3264e.zip frameworks_base-e21c52a8c9ef27c348f784daa8ec384152c3264e.tar.gz frameworks_base-e21c52a8c9ef27c348f784daa8ec384152c3264e.tar.bz2 |
Merge "Hide managed profiles from user switchers."
Diffstat (limited to 'packages')
4 files changed, 42 insertions, 51 deletions
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java index 7ac94bd..1e79ee4 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java @@ -1051,9 +1051,6 @@ public class KeyguardHostView extends KeyguardViewBase { } private void enableUserSelectorIfNecessary() { - if (!UserManager.supportsMultipleUsers()) { - return; // device doesn't support multi-user mode - } final UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE); if (um == null) { Throwable t = new Throwable(); @@ -1063,61 +1060,53 @@ public class KeyguardHostView extends KeyguardViewBase { } // if there are multiple users, we need to enable to multi-user switcher - final List<UserInfo> users = um.getUsers(true); - if (users == null) { - Throwable t = new Throwable(); - t.fillInStackTrace(); - Log.e(TAG, "list of users is null.", t); + if (!um.isUserSwitcherEnabled()) { return; } final View multiUserView = findViewById(R.id.keyguard_user_selector); if (multiUserView == null) { - Throwable t = new Throwable(); - t.fillInStackTrace(); - Log.e(TAG, "can't find user_selector in layout.", t); + if (DEBUG) Log.d(TAG, "can't find user_selector in layout."); return; } - if (users.size() > 1) { - if (multiUserView instanceof KeyguardMultiUserSelectorView) { - mKeyguardMultiUserSelectorView = (KeyguardMultiUserSelectorView) multiUserView; - mKeyguardMultiUserSelectorView.setVisibility(View.VISIBLE); - mKeyguardMultiUserSelectorView.addUsers(users); - UserSwitcherCallback callback = new UserSwitcherCallback() { - @Override - public void hideSecurityView(int duration) { - getSecurityContainer().animate().alpha(0).setDuration(duration); - } + if (multiUserView instanceof KeyguardMultiUserSelectorView) { + mKeyguardMultiUserSelectorView = (KeyguardMultiUserSelectorView) multiUserView; + mKeyguardMultiUserSelectorView.setVisibility(View.VISIBLE); + mKeyguardMultiUserSelectorView.addUsers(um.getUsers(true)); + UserSwitcherCallback callback = new UserSwitcherCallback() { + @Override + public void hideSecurityView(int duration) { + getSecurityContainer().animate().alpha(0).setDuration(duration); + } - @Override - public void showSecurityView() { - getSecurityContainer().setAlpha(1.0f); - } + @Override + public void showSecurityView() { + getSecurityContainer().setAlpha(1.0f); + } - @Override - public void showUnlockHint() { - if (getSecurityContainer() != null) { - getSecurityContainer().showUsabilityHint(); - } + @Override + public void showUnlockHint() { + if (getSecurityContainer() != null) { + getSecurityContainer().showUsabilityHint(); } + } - @Override - public void userActivity() { - if (mViewMediatorCallback != null) { - mViewMediatorCallback.userActivity(); - } + @Override + public void userActivity() { + if (mViewMediatorCallback != null) { + mViewMediatorCallback.userActivity(); } - }; - mKeyguardMultiUserSelectorView.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); } + }; + mKeyguardMultiUserSelectorView.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); } } } diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardMultiUserSelectorView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardMultiUserSelectorView.java index 7975d8e..06815e1 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardMultiUserSelectorView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardMultiUserSelectorView.java @@ -76,11 +76,13 @@ public class KeyguardMultiUserSelectorView extends FrameLayout implements View.O Collections.sort(users, mOrderAddedComparator); for (UserInfo user: users) { - KeyguardMultiUserAvatar uv = createAndAddUser(user); - if (user.id == activeUser.id) { - mActiveUserAvatar = uv; + if (user.supportsSwitchTo()) { + KeyguardMultiUserAvatar uv = createAndAddUser(user); + if (user.id == activeUser.id) { + mActiveUserAvatar = uv; + } + uv.setActive(false, false, null); } - uv.setActive(false, false, null); } mActiveUserAvatar.lockPressed(true); } diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardViewMediator.java b/packages/Keyguard/src/com/android/keyguard/KeyguardViewMediator.java index e0ee4e0..151177e 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardViewMediator.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardViewMediator.java @@ -704,7 +704,7 @@ public class KeyguardViewMediator { private void maybeSendUserPresentBroadcast() { if (mSystemReady && mLockPatternUtils.isLockScreenDisabled() - && mUserManager.getUsers(true).size() == 1) { + && !mUserManager.isUserSwitcherEnabled()) { // Lock screen is disabled because the user has set the preference to "None". // In this case, send out ACTION_USER_PRESENT here instead of in // handleKeyguardDone() @@ -940,7 +940,7 @@ public class KeyguardViewMediator { return; } - if (mUserManager.getUsers(true).size() < 2 + if (!mUserManager.isUserSwitcherEnabled() && mLockPatternUtils.isLockScreenDisabled() && !lockedOrMissing) { if (DEBUG) Log.d(TAG, "doKeyguard: not showing because lockscreen is off"); return; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java index 4d7ff5e..bcb818a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettings.java @@ -312,7 +312,7 @@ class QuickSettings { public void onClick(View v) { collapsePanels(); final UserManager um = UserManager.get(mContext); - if (um.getUsers(true).size() > 1) { + if (um.isUserSwitcherEnabled()) { // Since keyguard and systemui were merged into the same process to save // memory, they share the same Looper and graphics context. As a result, // there's no way to allow concurrent animation while keyguard inflates. |