Merge "Hide multi user switcher on keyguard screen when disabled" into tm-dev am: 78ad1dd6f2
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18798706 Change-Id: Idc683da16fd5d77c561c263aa29a714d91558918 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -958,14 +958,16 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onFinishInflate() {
|
@VisibleForTesting
|
||||||
|
void onFinishInflate() {
|
||||||
loadDimens();
|
loadDimens();
|
||||||
mKeyguardStatusBar = mView.findViewById(R.id.keyguard_header);
|
mKeyguardStatusBar = mView.findViewById(R.id.keyguard_header);
|
||||||
|
|
||||||
FrameLayout userAvatarContainer = null;
|
FrameLayout userAvatarContainer = null;
|
||||||
KeyguardUserSwitcherView keyguardUserSwitcherView = null;
|
KeyguardUserSwitcherView keyguardUserSwitcherView = null;
|
||||||
|
|
||||||
if (mKeyguardUserSwitcherEnabled && mUserManager.isUserSwitcherEnabled()) {
|
if (mKeyguardUserSwitcherEnabled && mUserManager.isUserSwitcherEnabled(
|
||||||
|
mResources.getBoolean(R.bool.qs_show_user_switcher_for_single_user))) {
|
||||||
if (mKeyguardQsUserSwitchEnabled) {
|
if (mKeyguardQsUserSwitchEnabled) {
|
||||||
ViewStub stub = mView.findViewById(R.id.keyguard_qs_user_switch_stub);
|
ViewStub stub = mView.findViewById(R.id.keyguard_qs_user_switch_stub);
|
||||||
userAvatarContainer = (FrameLayout) stub.inflate();
|
userAvatarContainer = (FrameLayout) stub.inflate();
|
||||||
@@ -1191,7 +1193,8 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reInflateViews() {
|
@VisibleForTesting
|
||||||
|
void reInflateViews() {
|
||||||
if (DEBUG_LOGCAT) Log.d(TAG, "reInflateViews");
|
if (DEBUG_LOGCAT) Log.d(TAG, "reInflateViews");
|
||||||
// Re-inflate the status view group.
|
// Re-inflate the status view group.
|
||||||
KeyguardStatusView keyguardStatusView =
|
KeyguardStatusView keyguardStatusView =
|
||||||
@@ -1212,7 +1215,8 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
|
|
||||||
// Re-inflate the keyguard user switcher group.
|
// Re-inflate the keyguard user switcher group.
|
||||||
updateUserSwitcherFlags();
|
updateUserSwitcherFlags();
|
||||||
boolean isUserSwitcherEnabled = mUserManager.isUserSwitcherEnabled();
|
boolean isUserSwitcherEnabled = mUserManager.isUserSwitcherEnabled(
|
||||||
|
mResources.getBoolean(R.bool.qs_show_user_switcher_for_single_user));
|
||||||
boolean showQsUserSwitch = mKeyguardQsUserSwitchEnabled && isUserSwitcherEnabled;
|
boolean showQsUserSwitch = mKeyguardQsUserSwitchEnabled && isUserSwitcherEnabled;
|
||||||
boolean showKeyguardUserSwitcher =
|
boolean showKeyguardUserSwitcher =
|
||||||
!mKeyguardQsUserSwitchEnabled
|
!mKeyguardQsUserSwitchEnabled
|
||||||
|
|||||||
@@ -889,13 +889,42 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
|
|||||||
updateSmallestScreenWidth(300);
|
updateSmallestScreenWidth(300);
|
||||||
when(mResources.getBoolean(
|
when(mResources.getBoolean(
|
||||||
com.android.internal.R.bool.config_keyguardUserSwitcher)).thenReturn(true);
|
com.android.internal.R.bool.config_keyguardUserSwitcher)).thenReturn(true);
|
||||||
when(mUserManager.isUserSwitcherEnabled()).thenReturn(true);
|
when(mResources.getBoolean(R.bool.qs_show_user_switcher_for_single_user)).thenReturn(false);
|
||||||
|
when(mUserManager.isUserSwitcherEnabled(false)).thenReturn(true);
|
||||||
|
|
||||||
updateSmallestScreenWidth(800);
|
updateSmallestScreenWidth(800);
|
||||||
|
|
||||||
verify(mUserSwitcherStubView).inflate();
|
verify(mUserSwitcherStubView).inflate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFinishInflate_userSwitcherDisabled_doNotInflateUserSwitchView() {
|
||||||
|
givenViewAttached();
|
||||||
|
when(mResources.getBoolean(
|
||||||
|
com.android.internal.R.bool.config_keyguardUserSwitcher)).thenReturn(true);
|
||||||
|
when(mResources.getBoolean(R.bool.qs_show_user_switcher_for_single_user)).thenReturn(false);
|
||||||
|
when(mUserManager.isUserSwitcherEnabled(false /* showEvenIfNotActionable */))
|
||||||
|
.thenReturn(false);
|
||||||
|
|
||||||
|
mNotificationPanelViewController.onFinishInflate();
|
||||||
|
|
||||||
|
verify(mUserSwitcherStubView, never()).inflate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testReInflateViews_userSwitcherDisabled_doNotInflateUserSwitchView() {
|
||||||
|
givenViewAttached();
|
||||||
|
when(mResources.getBoolean(
|
||||||
|
com.android.internal.R.bool.config_keyguardUserSwitcher)).thenReturn(true);
|
||||||
|
when(mResources.getBoolean(R.bool.qs_show_user_switcher_for_single_user)).thenReturn(false);
|
||||||
|
when(mUserManager.isUserSwitcherEnabled(false /* showEvenIfNotActionable */))
|
||||||
|
.thenReturn(false);
|
||||||
|
|
||||||
|
mNotificationPanelViewController.reInflateViews();
|
||||||
|
|
||||||
|
verify(mUserSwitcherStubView, never()).inflate();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCanCollapsePanelOnTouch_trueForKeyGuard() {
|
public void testCanCollapsePanelOnTouch_trueForKeyGuard() {
|
||||||
mStatusBarStateController.setState(KEYGUARD);
|
mStatusBarStateController.setState(KEYGUARD);
|
||||||
@@ -1298,7 +1327,8 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateMultiUserSetting(boolean enabled) {
|
private void updateMultiUserSetting(boolean enabled) {
|
||||||
when(mUserManager.isUserSwitcherEnabled()).thenReturn(enabled);
|
when(mResources.getBoolean(R.bool.qs_show_user_switcher_for_single_user)).thenReturn(false);
|
||||||
|
when(mUserManager.isUserSwitcherEnabled(false)).thenReturn(enabled);
|
||||||
final ArgumentCaptor<ContentObserver> observerCaptor =
|
final ArgumentCaptor<ContentObserver> observerCaptor =
|
||||||
ArgumentCaptor.forClass(ContentObserver.class);
|
ArgumentCaptor.forClass(ContentObserver.class);
|
||||||
verify(mContentResolver)
|
verify(mContentResolver)
|
||||||
|
|||||||
Reference in New Issue
Block a user