Loading src/com/android/settings/password/ChooseLockGenericController.java +4 −3 Original line number Diff line number Diff line Loading @@ -72,13 +72,14 @@ public class ChooseLockGenericController { * Whether the given screen lock type should be visible in the given context. */ public boolean isScreenLockVisible(ScreenLockType type) { final boolean managedProfile = mUserId != UserHandle.myUserId(); switch (type) { case NONE: return !mContext.getResources().getBoolean(R.bool.config_hide_none_security_option); return !mContext.getResources().getBoolean(R.bool.config_hide_none_security_option) && !managedProfile; // Profiles should use unified challenge instead. case SWIPE: return !mContext.getResources().getBoolean(R.bool.config_hide_swipe_security_option) // Swipe doesn't make sense for profiles. && mUserId == UserHandle.myUserId(); && !managedProfile; // Swipe doesn't make sense for profiles. case MANAGED: return mManagedPasswordProvider.isManagedPasswordChoosable(); } Loading tests/robotests/src/com/android/settings/password/ChooseLockGenericControllerTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -88,10 +88,12 @@ public class ChooseLockGenericControllerTest { } @Test public void isScreenLockVisible_notCurrentUser_shouldHideSwipe() { public void isScreenLockVisible_notCurrentUser_shouldHideInsecure() { mController = new ChooseLockGenericController(application, 1 /* userId */); assertThat(mController.isScreenLockVisible(ScreenLockType.SWIPE)).named("SWIPE visible") .isFalse(); assertThat(mController.isScreenLockVisible(ScreenLockType.NONE)).named("NONE visible") .isFalse(); } @Test Loading Loading
src/com/android/settings/password/ChooseLockGenericController.java +4 −3 Original line number Diff line number Diff line Loading @@ -72,13 +72,14 @@ public class ChooseLockGenericController { * Whether the given screen lock type should be visible in the given context. */ public boolean isScreenLockVisible(ScreenLockType type) { final boolean managedProfile = mUserId != UserHandle.myUserId(); switch (type) { case NONE: return !mContext.getResources().getBoolean(R.bool.config_hide_none_security_option); return !mContext.getResources().getBoolean(R.bool.config_hide_none_security_option) && !managedProfile; // Profiles should use unified challenge instead. case SWIPE: return !mContext.getResources().getBoolean(R.bool.config_hide_swipe_security_option) // Swipe doesn't make sense for profiles. && mUserId == UserHandle.myUserId(); && !managedProfile; // Swipe doesn't make sense for profiles. case MANAGED: return mManagedPasswordProvider.isManagedPasswordChoosable(); } Loading
tests/robotests/src/com/android/settings/password/ChooseLockGenericControllerTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -88,10 +88,12 @@ public class ChooseLockGenericControllerTest { } @Test public void isScreenLockVisible_notCurrentUser_shouldHideSwipe() { public void isScreenLockVisible_notCurrentUser_shouldHideInsecure() { mController = new ChooseLockGenericController(application, 1 /* userId */); assertThat(mController.isScreenLockVisible(ScreenLockType.SWIPE)).named("SWIPE visible") .isFalse(); assertThat(mController.isScreenLockVisible(ScreenLockType.NONE)).named("NONE visible") .isFalse(); } @Test Loading