Merge "Do not hide lock screen settings conditionally"
This commit is contained in:
committed by
Android (Google) Code Review
commit
1e714110ca
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
package com.android.settings.security.screenlock;
|
package com.android.settings.security.screenlock;
|
||||||
|
|
||||||
import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
|
|
||||||
@@ -52,14 +50,7 @@ public class LockScreenPreferenceController extends BasePreferenceController imp
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAvailabilityStatus() {
|
public int getAvailabilityStatus() {
|
||||||
if (!mLockPatternUtils.isSecure(MY_USER_ID)) {
|
return AVAILABLE_UNSEARCHABLE;
|
||||||
return mLockPatternUtils.isLockScreenDisabled(MY_USER_ID)
|
|
||||||
? DISABLED_FOR_USER : AVAILABLE_UNSEARCHABLE;
|
|
||||||
} else {
|
|
||||||
return mLockPatternUtils.getKeyguardStoredPasswordQuality(MY_USER_ID)
|
|
||||||
== PASSWORD_QUALITY_UNSPECIFIED
|
|
||||||
? DISABLED_FOR_USER : AVAILABLE_UNSEARCHABLE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -22,7 +22,6 @@ import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED
|
|||||||
import static androidx.lifecycle.Lifecycle.Event.ON_RESUME;
|
import static androidx.lifecycle.Lifecycle.Event.ON_RESUME;
|
||||||
|
|
||||||
import static com.android.settings.core.BasePreferenceController.AVAILABLE_UNSEARCHABLE;
|
import static com.android.settings.core.BasePreferenceController.AVAILABLE_UNSEARCHABLE;
|
||||||
import static com.android.settings.core.BasePreferenceController.DISABLED_FOR_USER;
|
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
@@ -87,11 +86,11 @@ public class LockScreenPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAvailabilityStatus_notSecure_lockscreenDisabled_DISABLED() {
|
public void getAvailabilityStatus_notSecure_lockscreenDisabled_AVAILABLE() {
|
||||||
when(mLockPatternUtils.isSecure(anyInt())).thenReturn(false);
|
when(mLockPatternUtils.isSecure(anyInt())).thenReturn(false);
|
||||||
when(mLockPatternUtils.isLockScreenDisabled(anyInt())).thenReturn(true);
|
when(mLockPatternUtils.isLockScreenDisabled(anyInt())).thenReturn(true);
|
||||||
|
|
||||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(DISABLED_FOR_USER);
|
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE_UNSEARCHABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -112,12 +111,12 @@ public class LockScreenPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAvailabilityStatus_secure_noLockScreen_DISABLED() {
|
public void getAvailabilityStatus_secure_noLockScreen_AVAILABLE() {
|
||||||
when(mLockPatternUtils.isSecure(anyInt())).thenReturn(true);
|
when(mLockPatternUtils.isSecure(anyInt())).thenReturn(true);
|
||||||
when(mLockPatternUtils.getKeyguardStoredPasswordQuality(anyInt()))
|
when(mLockPatternUtils.getKeyguardStoredPasswordQuality(anyInt()))
|
||||||
.thenReturn(PASSWORD_QUALITY_UNSPECIFIED);
|
.thenReturn(PASSWORD_QUALITY_UNSPECIFIED);
|
||||||
|
|
||||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(DISABLED_FOR_USER);
|
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE_UNSEARCHABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Reference in New Issue
Block a user