Added different flow for re-enrollment
In order to enable this new flow, a user must currently have an enrolled face and the security setting face_unlock_re_enroll must be non-zero. Ex. 1. Enroll Face. 2. adb shell settings put (secure face_unlock_re_enroll|secure_face_unlock_must_re_enroll) 1 3. If settings is opened, close it. 4. Open settings 5. Verify the new flow appears. Bug: 141380252 Bug: 141254937 Test: Verified that the user's face is deleted after clicking delete. Test: Verified that the user can re-enroll after removing their face. Change-Id: I2b36a0bda5cb10fb33dfb2a5627d8fa40f14fb7e
This commit is contained in:
committed by
Joshua Mccloskey
parent
af1e831ab7
commit
bba7632f28
@@ -26,6 +26,7 @@ import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.hardware.face.FaceManager;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.slice.Slice;
|
||||
import androidx.slice.SliceProvider;
|
||||
@@ -59,26 +60,58 @@ public class FaceSetupSliceTest {
|
||||
public void getSlice_noFaceManager_shouldReturnNull() {
|
||||
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_FACE)).thenReturn(false);
|
||||
final FaceSetupSlice setupSlice = new FaceSetupSlice(mContext);
|
||||
|
||||
assertThat(setupSlice.getSlice()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSlice_faceEnrolled_shouldReturnNull() {
|
||||
public void getSlice_faceEnrolled_noReEnroll_shouldReturnNull() {
|
||||
final FaceManager faceManager = mock(FaceManager.class);
|
||||
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_FACE)).thenReturn(true);
|
||||
when(faceManager.hasEnrolledTemplates(UserHandle.myUserId())).thenReturn(true);
|
||||
when(mContext.getSystemService(Context.FACE_SERVICE)).thenReturn(faceManager);
|
||||
Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.FACE_UNLOCK_RE_ENROLL,
|
||||
0);
|
||||
final FaceSetupSlice setupSlice = new FaceSetupSlice(mContext);
|
||||
|
||||
assertThat(setupSlice.getSlice()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSlice_faceNotEnrolled_shouldReturnNonNull() {
|
||||
public void getSlice_faceNotEnrolled_shouldReturnSlice() {
|
||||
final FaceManager faceManager = mock(FaceManager.class);
|
||||
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_FACE)).thenReturn(true);
|
||||
when(faceManager.hasEnrolledTemplates(UserHandle.myUserId())).thenReturn(false);
|
||||
when(mContext.getSystemService(Context.FACE_SERVICE)).thenReturn(faceManager);
|
||||
final FaceSetupSlice setupSlice = new FaceSetupSlice(mContext);
|
||||
|
||||
assertThat(setupSlice.getSlice()).isNotNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSlice_faceEnrolled_shouldReEnroll_shouldReturnSlice() {
|
||||
final FaceManager faceManager = mock(FaceManager.class);
|
||||
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_FACE)).thenReturn(true);
|
||||
when(faceManager.hasEnrolledTemplates(UserHandle.myUserId())).thenReturn(true);
|
||||
when(mContext.getSystemService(Context.FACE_SERVICE)).thenReturn(faceManager);
|
||||
Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.FACE_UNLOCK_RE_ENROLL,
|
||||
1);
|
||||
final FaceSetupSlice setupSlice = new FaceSetupSlice(mContext);
|
||||
|
||||
assertThat(setupSlice.getSlice()).isNotNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSlice_faceEnrolled_musteEnroll_shouldReturnSlice() {
|
||||
final FaceManager faceManager = mock(FaceManager.class);
|
||||
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_FACE)).thenReturn(true);
|
||||
when(faceManager.hasEnrolledTemplates(UserHandle.myUserId())).thenReturn(true);
|
||||
when(mContext.getSystemService(Context.FACE_SERVICE)).thenReturn(faceManager);
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
Settings.Secure.FACE_UNLOCK_MUST_RE_ENROLL,
|
||||
1);
|
||||
final FaceSetupSlice setupSlice = new FaceSetupSlice(mContext);
|
||||
|
||||
assertThat(setupSlice.getSlice()).isNotNull();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user