Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e9e48a5b authored by Dmitry Dementyev's avatar Dmitry Dementyev
Browse files

Return GK_PW_HANDLE after remote LSKF verification.

Handle is returned when LSKF is set after successful verification.
It is used by SUW to add biometrics without asking for LSKF.

Bug: 272807192
Test: manual
Change-Id: I3fe6ed7fd6401421090ccd684509dfede9106076
parent 76452f3a
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -132,6 +132,11 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
            if (BiometricUtils.containsGatekeeperPasswordHandle(getIntent())) {
                mGkPwHandle = BiometricUtils.getGatekeeperPasswordHandle(getIntent());
            }
        } else if (WizardManagerHelper.isAnySetupWizard(getIntent())) {
            if (BiometricUtils.containsGatekeeperPasswordHandle(getIntent())) {
                mGkPwHandle = BiometricUtils.getGatekeeperPasswordHandle(getIntent());
            }

        }

        if (savedInstanceState != null) {
+1 −1
Original line number Diff line number Diff line
@@ -339,7 +339,7 @@ public final class ChooseLockSettingsHelper {
                Utils.enforceSameOwner(mActivity, mUserId);
            }

            if (mExternal && mReturnCredentials) {
            if (mExternal && mReturnCredentials && !mRemoteLockscreenValidation) {
                throw new IllegalArgumentException("External and ReturnCredentials specified. "
                        + " External callers should never be allowed to receive credentials in"
                        + " onActivityResult");
+3 −0
Original line number Diff line number Diff line
@@ -250,12 +250,15 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
                    .setRemoteLockscreenValidationSession(remoteLockscreenValidationSession)
                    .setRemoteLockscreenValidationServiceComponent(
                            remoteLockscreenValidationServiceComponent)
                    .setRequestGatekeeperPasswordHandle(true)
                    .setReturnCredentials(true) // returns only password handle.
                    .setHeader(mTitle) // Show the title in the header location
                    .setDescription(mDetails)
                    .setCheckboxLabel(checkboxLabel)
                    .setAlternateButton(alternateButton)
                    .setExternal(true)
                    .show();
            return;
        } else if (isEffectiveUserManagedProfile && isInternalActivity()) {
            mCredentialMode = CREDENTIAL_MANAGED;
            if (isBiometricAllowed(effectiveUserId, mUserId)) {
+12 −2
Original line number Diff line number Diff line
@@ -26,6 +26,10 @@ import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROF
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_PIN_REQUIRED;
import static android.app.admin.DevicePolicyResources.UNDEFINED;

import static com.android.settings.biometrics.GatekeeperPasswordProvider.containsGatekeeperPasswordHandle;
import static com.android.settings.biometrics.GatekeeperPasswordProvider.getGatekeeperPasswordHandle;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE;

import android.annotation.Nullable;
import android.app.KeyguardManager;
import android.app.RemoteLockscreenValidationResult;
@@ -614,7 +618,7 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
                        saveAndFinishWorker.setListener(this);
                        saveAndFinishWorker.start(
                                mLockPatternUtils,
                                /* requestGatekeeperPassword= */ false,
                                /* requestGatekeeperPassword= */ true,
                                mDeviceCredentialGuess,
                                /* currentCredential= */ null,
                                mEffectiveUserId);
@@ -705,8 +709,14 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
            if (mDeviceCredentialGuess != null) {
                mDeviceCredentialGuess.zeroize();
            }

            Intent result = new Intent();
            if (mRemoteValidation && containsGatekeeperPasswordHandle(resultData)) {
                result.putExtra(EXTRA_KEY_GK_PW_HANDLE, getGatekeeperPasswordHandle(resultData));
            }

            mGlifLayout.setProgressBarShown(false);
            mCredentialCheckResultTracker.setResult(/* matched= */ true, new Intent(),
            mCredentialCheckResultTracker.setResult(/* matched= */ true, result,
                    /* timeoutMs= */ 0, mEffectiveUserId);
        }
    }
+12 −2
Original line number Diff line number Diff line
@@ -22,6 +22,10 @@ import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROF
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_PATTERN_REQUIRED;
import static android.app.admin.DevicePolicyResources.UNDEFINED;

import static com.android.settings.biometrics.GatekeeperPasswordProvider.containsGatekeeperPasswordHandle;
import static com.android.settings.biometrics.GatekeeperPasswordProvider.getGatekeeperPasswordHandle;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE;

import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.app.Activity;
@@ -627,7 +631,7 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
                        saveAndFinishWorker.setListener(this);
                        saveAndFinishWorker.start(
                                mLockPatternUtils,
                                /* requestGatekeeperPassword= */ false,
                                /* requestGatekeeperPassword= */ true,
                                mDeviceCredentialGuess,
                                /* currentCredential= */ null,
                                mEffectiveUserId);
@@ -732,8 +736,14 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
            if (mDeviceCredentialGuess != null) {
                mDeviceCredentialGuess.zeroize();
            }

            Intent result = new Intent();
            if (mRemoteValidation && containsGatekeeperPasswordHandle(resultData)) {
                result.putExtra(EXTRA_KEY_GK_PW_HANDLE, getGatekeeperPasswordHandle(resultData));
            }

            mGlifLayout.setProgressBarShown(false);
            mCredentialCheckResultTracker.setResult(/* matched= */ true, new Intent(),
            mCredentialCheckResultTracker.setResult(/* matched= */ true, result,
                    /* timeoutMs= */ 0, mEffectiveUserId);
        }
    }