Loading src/com/android/settings/biometrics/BiometricEnrollActivity.java +4 −4 Original line number Diff line number Diff line Loading @@ -104,13 +104,13 @@ public class BiometricEnrollActivity extends InstrumentedActivity { .getByteArrayExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN); final int userId = getIntent() .getIntExtra(Intent.EXTRA_USER_ID, UserHandle.USER_NULL); final byte[] gkPw = getIntent().getByteArrayExtra( ChooseLockSettingsHelper.EXTRA_KEY_GK_PW); final long gkPwHandle = getIntent().getLongExtra( ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE, 0L); intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, token); intent.putExtra(Intent.EXTRA_USER_ID, userId); if (gkPw != null) { intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_GK_PW, gkPw); if (gkPwHandle != 0L) { intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE, gkPwHandle); } } Loading src/com/android/settings/biometrics/BiometricEnrollBase.java +1 −1 Original line number Diff line number Diff line Loading @@ -190,7 +190,7 @@ public abstract class BiometricEnrollBase extends InstrumentedActivity { final ChooseLockSettingsHelper.Builder builder = new ChooseLockSettingsHelper.Builder(this); builder.setRequestCode(CONFIRM_REQUEST) .setTitle(getString(titleResId)) .setRequestGatekeeperPassword(true) .setRequestGatekeeperPasswordHandle(true) .setForegroundOnly(true) .setReturnCredentials(true); Loading src/com/android/settings/biometrics/BiometricEnrollIntroduction.java +3 −1 Original line number Diff line number Diff line Loading @@ -224,7 +224,7 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase intent.putExtra(ChooseLockGeneric.ChooseLockGenericFragment.MINIMUM_QUALITY_KEY, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING); intent.putExtra(ChooseLockGeneric.ChooseLockGenericFragment.HIDE_DISABLED_PREFS, true); intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW, true); intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW_HANDLE, true); intent.putExtra(getExtraKeyForBiometric(), true); if (mUserId != UserHandle.USER_NULL) { intent.putExtra(Intent.EXTRA_USER_ID, mUserId); Loading Loading @@ -278,6 +278,7 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase getNextButton().setEnabled(false); getChallenge(((sensorId, challenge) -> { mToken = BiometricUtils.requestGatekeeperHat(this, data, mUserId, challenge); BiometricUtils.removeGatekeeperPasswordHandle(this, data); getNextButton().setEnabled(true); })); } else { Loading @@ -291,6 +292,7 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase getNextButton().setEnabled(false); getChallenge(((sensorId, challenge) -> { mToken = BiometricUtils.requestGatekeeperHat(this, data, mUserId, challenge); BiometricUtils.removeGatekeeperPasswordHandle(this, data); getNextButton().setEnabled(true); })); } else { Loading src/com/android/settings/biometrics/BiometricUtils.java +28 −7 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.settings.biometrics; import android.app.Activity; import android.content.Context; import android.content.Intent; Loading @@ -39,20 +38,42 @@ public class BiometricUtils { */ public static byte[] requestGatekeeperHat(Context context, Intent result, int userId, long challenge) { final byte[] gkPassword = result.getByteArrayExtra( ChooseLockSettingsHelper.EXTRA_KEY_GK_PW); if (gkPassword == null) { throw new IllegalStateException("Gatekeeper Password is null!!"); final long gatekeeperPasswordHandle = result.getLongExtra( ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE, 0L); if (gatekeeperPasswordHandle == 0L) { throw new IllegalStateException("Gatekeeper Password is missing!!"); } final LockPatternUtils utils = new LockPatternUtils(context); return utils.verifyGatekeeperPassword(gkPassword, challenge, userId).getGatekeeperHAT(); return utils.verifyGatekeeperPasswordHandle(gatekeeperPasswordHandle, challenge, userId) .getGatekeeperHAT(); } public static boolean containsGatekeeperPassword(Intent data) { if (data == null) { return false; } return data.getByteArrayExtra(ChooseLockSettingsHelper.EXTRA_KEY_GK_PW) != null; return data.getLongExtra(ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE, 0L) != 0L; } /** * Requests {@link com.android.server.locksettings.LockSettingsService} to remove the * gatekeeper password associated with a previous * {@link ChooseLockSettingsHelper.Builder#setRequestGatekeeperPasswordHandle(boolean)} * * @param context Caller's context * @param data The onActivityResult intent from ChooseLock* or ConfirmLock* */ public static void removeGatekeeperPasswordHandle(Context context, Intent data) { if (data == null) { return; } final long gatekeeperPasswordsHandle = data.getLongExtra( ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE, 0L); if (gatekeeperPasswordsHandle == 0L) { return; } final LockPatternUtils utils = new LockPatternUtils(context); utils.removeGatekeeperPasswordHandle(gatekeeperPasswordsHandle); } } src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java +1 −0 Original line number Diff line number Diff line Loading @@ -105,6 +105,7 @@ public class FaceEnrollIntroduction extends BiometricEnrollIntroduction { // the challenge is ready. Let's just do this for now. mFaceManager.generateChallenge((sensorId, challenge) -> { mToken = BiometricUtils.requestGatekeeperHat(this, getIntent(), mUserId, challenge); BiometricUtils.removeGatekeeperPasswordHandle(this, getIntent()); mFooterBarMixin.getPrimaryButton().setEnabled(true); }); } Loading Loading
src/com/android/settings/biometrics/BiometricEnrollActivity.java +4 −4 Original line number Diff line number Diff line Loading @@ -104,13 +104,13 @@ public class BiometricEnrollActivity extends InstrumentedActivity { .getByteArrayExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN); final int userId = getIntent() .getIntExtra(Intent.EXTRA_USER_ID, UserHandle.USER_NULL); final byte[] gkPw = getIntent().getByteArrayExtra( ChooseLockSettingsHelper.EXTRA_KEY_GK_PW); final long gkPwHandle = getIntent().getLongExtra( ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE, 0L); intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, token); intent.putExtra(Intent.EXTRA_USER_ID, userId); if (gkPw != null) { intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_GK_PW, gkPw); if (gkPwHandle != 0L) { intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE, gkPwHandle); } } Loading
src/com/android/settings/biometrics/BiometricEnrollBase.java +1 −1 Original line number Diff line number Diff line Loading @@ -190,7 +190,7 @@ public abstract class BiometricEnrollBase extends InstrumentedActivity { final ChooseLockSettingsHelper.Builder builder = new ChooseLockSettingsHelper.Builder(this); builder.setRequestCode(CONFIRM_REQUEST) .setTitle(getString(titleResId)) .setRequestGatekeeperPassword(true) .setRequestGatekeeperPasswordHandle(true) .setForegroundOnly(true) .setReturnCredentials(true); Loading
src/com/android/settings/biometrics/BiometricEnrollIntroduction.java +3 −1 Original line number Diff line number Diff line Loading @@ -224,7 +224,7 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase intent.putExtra(ChooseLockGeneric.ChooseLockGenericFragment.MINIMUM_QUALITY_KEY, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING); intent.putExtra(ChooseLockGeneric.ChooseLockGenericFragment.HIDE_DISABLED_PREFS, true); intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW, true); intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW_HANDLE, true); intent.putExtra(getExtraKeyForBiometric(), true); if (mUserId != UserHandle.USER_NULL) { intent.putExtra(Intent.EXTRA_USER_ID, mUserId); Loading Loading @@ -278,6 +278,7 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase getNextButton().setEnabled(false); getChallenge(((sensorId, challenge) -> { mToken = BiometricUtils.requestGatekeeperHat(this, data, mUserId, challenge); BiometricUtils.removeGatekeeperPasswordHandle(this, data); getNextButton().setEnabled(true); })); } else { Loading @@ -291,6 +292,7 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase getNextButton().setEnabled(false); getChallenge(((sensorId, challenge) -> { mToken = BiometricUtils.requestGatekeeperHat(this, data, mUserId, challenge); BiometricUtils.removeGatekeeperPasswordHandle(this, data); getNextButton().setEnabled(true); })); } else { Loading
src/com/android/settings/biometrics/BiometricUtils.java +28 −7 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.settings.biometrics; import android.app.Activity; import android.content.Context; import android.content.Intent; Loading @@ -39,20 +38,42 @@ public class BiometricUtils { */ public static byte[] requestGatekeeperHat(Context context, Intent result, int userId, long challenge) { final byte[] gkPassword = result.getByteArrayExtra( ChooseLockSettingsHelper.EXTRA_KEY_GK_PW); if (gkPassword == null) { throw new IllegalStateException("Gatekeeper Password is null!!"); final long gatekeeperPasswordHandle = result.getLongExtra( ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE, 0L); if (gatekeeperPasswordHandle == 0L) { throw new IllegalStateException("Gatekeeper Password is missing!!"); } final LockPatternUtils utils = new LockPatternUtils(context); return utils.verifyGatekeeperPassword(gkPassword, challenge, userId).getGatekeeperHAT(); return utils.verifyGatekeeperPasswordHandle(gatekeeperPasswordHandle, challenge, userId) .getGatekeeperHAT(); } public static boolean containsGatekeeperPassword(Intent data) { if (data == null) { return false; } return data.getByteArrayExtra(ChooseLockSettingsHelper.EXTRA_KEY_GK_PW) != null; return data.getLongExtra(ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE, 0L) != 0L; } /** * Requests {@link com.android.server.locksettings.LockSettingsService} to remove the * gatekeeper password associated with a previous * {@link ChooseLockSettingsHelper.Builder#setRequestGatekeeperPasswordHandle(boolean)} * * @param context Caller's context * @param data The onActivityResult intent from ChooseLock* or ConfirmLock* */ public static void removeGatekeeperPasswordHandle(Context context, Intent data) { if (data == null) { return; } final long gatekeeperPasswordsHandle = data.getLongExtra( ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE, 0L); if (gatekeeperPasswordsHandle == 0L) { return; } final LockPatternUtils utils = new LockPatternUtils(context); utils.removeGatekeeperPasswordHandle(gatekeeperPasswordsHandle); } }
src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java +1 −0 Original line number Diff line number Diff line Loading @@ -105,6 +105,7 @@ public class FaceEnrollIntroduction extends BiometricEnrollIntroduction { // the challenge is ready. Let's just do this for now. mFaceManager.generateChallenge((sensorId, challenge) -> { mToken = BiometricUtils.requestGatekeeperHat(this, getIntent(), mUserId, challenge); BiometricUtils.removeGatekeeperPasswordHandle(this, getIntent()); mFooterBarMixin.getPrimaryButton().setEnabled(true); }); } Loading