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

Commit 371f9147 authored by Pavel Grafov's avatar Pavel Grafov Committed by Automerger Merge Worker
Browse files

Merge "Show work lock confirmation in a task overlay" into udc-dev am: d068214d

parents 105e59b1 d068214d
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -154,6 +154,14 @@ public class KeyguardManager {
    public static final String EXTRA_REMOTE_LOCKSCREEN_VALIDATION_SESSION =
            "android.app.extra.REMOTE_LOCKSCREEN_VALIDATION_SESSION";

    /**
     * A boolean indicating that credential confirmation activity should be a task overlay.
     * {@link #ACTION_CONFIRM_DEVICE_CREDENTIAL_WITH_USER}.
     * @hide
     */
    public static final String EXTRA_FORCE_TASK_OVERLAY =
            "android.app.KeyguardManager.FORCE_TASK_OVERLAY";

    /**
     * Result code returned by the activity started by
     * {@link #createConfirmFactoryResetCredentialIntent} or
+8 −4
Original line number Diff line number Diff line
@@ -176,10 +176,10 @@ public class WorkLockActivity extends Activity {
            return;
        }

        final Intent credential = getKeyguardManager()
        final Intent confirmCredentialIntent = getKeyguardManager()
                .createConfirmDeviceCredentialIntent(null, null, getTargetUserId(),
                true /* disallowBiometricsIfPolicyExists */);
        if (credential == null) {
        if (confirmCredentialIntent == null) {
            return;
        }

@@ -193,14 +193,18 @@ public class WorkLockActivity extends Activity {
                PendingIntent.FLAG_IMMUTABLE, options.toBundle());

        if (target != null) {
            credential.putExtra(Intent.EXTRA_INTENT, target.getIntentSender());
            confirmCredentialIntent.putExtra(Intent.EXTRA_INTENT, target.getIntentSender());
        }

        // WorkLockActivity is started as a task overlay, so unless credential confirmation is also
        // started as an overlay, it won't be visible.
        final ActivityOptions launchOptions = ActivityOptions.makeBasic();
        launchOptions.setLaunchTaskId(getTaskId());
        launchOptions.setTaskOverlay(true /* taskOverlay */, true /* canResume */);
        // Propagate it in case more than one activity is launched.
        confirmCredentialIntent.putExtra(KeyguardManager.EXTRA_FORCE_TASK_OVERLAY, true);

        startActivityForResult(credential, REQUEST_CODE_CONFIRM_CREDENTIALS,
        startActivityForResult(confirmCredentialIntent, REQUEST_CODE_CONFIRM_CREDENTIALS,
                launchOptions.toBundle());
    }