Unlock all users before moving or migrating.

When moving apps or shared storage between storage media on FBE
devices, we need all users to be unlocked to successfully move
the data.  This change asks the user to enter the credentials for
any locked users as part of the moving/migration wizard flows.

To do this we relax Utils.enforceSameOwner() to let us prompt for the
credentials of unrelated users, but we carefully only extend this
capability to callers interacting with the "internal" activities,
which require the MANAGE_USERS permission.

Test: builds, boots, users are unlocked before moving
Bug: 29923055, 25861755
Change-Id: Ifaeb2557c4f8c4354e1d380eaa0e413768ee239f
This commit is contained in:
Jeff Sharkey
2017-12-19 14:57:39 -07:00
parent 35d37784d0
commit 219ec91e1a
7 changed files with 169 additions and 26 deletions

View File

@@ -45,10 +45,15 @@ public abstract class ConfirmDeviceCredentialBaseActivity extends SettingsActivi
private boolean mIsKeyguardLocked = false;
private ConfirmCredentialTheme mConfirmCredentialTheme;
private boolean isInternalActivity() {
return (this instanceof ConfirmLockPassword.InternalActivity)
|| (this instanceof ConfirmLockPattern.InternalActivity);
}
@Override
protected void onCreate(Bundle savedState) {
int credentialOwnerUserId = Utils.getCredentialOwnerUserId(this,
Utils.getUserIdFromBundle(this, getIntent().getExtras()));
Utils.getUserIdFromBundle(this, getIntent().getExtras(), isInternalActivity()));
if (UserManager.get(this).isManagedProfile(credentialOwnerUserId)) {
setTheme(R.style.Theme_ConfirmDeviceCredentialsWork);
mConfirmCredentialTheme = ConfirmCredentialTheme.WORK;