Show work lock confirmation in a task overlay
WorkLockActivity is added on top of each task that has any work activity when the profile is locked. This activity is a task overlay meaning it stays on top of other activities. It then starts ConfirmDeviceCredentialActivity, also as an overlay because otherwise it will sink under WorkLockActivity. But when CDCA launches CofirmLockPattern, it is not set as an overlay and as a result is not visible. These CLs add a boolean extra to instruct CDCA to launch CLP (or other activities) as an overlay. Bug: 271840143 Bug: 234002331 Test: manual, with TestDPC setting password reset token. Change-Id: Ib3f82279cdc8b070c3fb716232459c8315c59602
This commit is contained in:
@@ -154,6 +154,14 @@ public class KeyguardManager {
|
||||
public static final String EXTRA_START_LOCKSCREEN_VALIDATION_REQUEST =
|
||||
"android.app.extra.START_LOCKSCREEN_VALIDATION_REQUEST";
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user