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

Commit 3eb12fab authored by Eric Biggers's avatar Eric Biggers Committed by Automerger Merge Worker
Browse files

Merge "Unlock non-secure users automatically (2/2)" into main am: fcaf0ace

parents c711d1c3 fcaf0ace
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.util.Log;
import android.view.View;
import android.widget.Toast;

import com.android.internal.widget.LockPatternUtils;
import com.android.settings.R;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.password.ChooseLockSettingsHelper;
@@ -97,10 +98,19 @@ public class StorageWizardMigrateConfirm extends StorageWizardBase {
    @Override
    public void onNavigateNext(View view) {
        // Ensure that all users are unlocked so that we can move their data
        final LockPatternUtils lpu = new LockPatternUtils(this);
        if (StorageManager.isFileEncrypted()) {
            for (UserInfo user : getSystemService(UserManager.class).getUsers()) {
                if (!StorageManager.isUserKeyUnlocked(user.id)) {
                    Log.d(TAG, "User " + user.id + " is currently locked; requesting unlock");
                if (StorageManager.isUserKeyUnlocked(user.id)) {
                    continue;
                }
                if (!lpu.isSecure(user.id)) {
                    Log.d(TAG, "Unsecured user " + user.id + " is currently locked; attempting "
                            + "automatic unlock");
                    lpu.unlockUserKeyIfUnsecured(user.id);
                } else {
                    Log.d(TAG, "Secured user " + user.id + " is currently locked; requesting "
                            + "manual unlock");
                    final CharSequence description = TextUtils.expandTemplate(
                            getText(R.string.storage_wizard_move_unlock), user.name);
                    final ChooseLockSettingsHelper.Builder builder =
+12 −2
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.util.Log;
import android.view.View;

import com.android.internal.util.Preconditions;
import com.android.internal.widget.LockPatternUtils;
import com.android.settings.R;
import com.android.settings.password.ChooseLockSettingsHelper;

@@ -79,10 +80,19 @@ public class StorageWizardMoveConfirm extends StorageWizardBase {
    @Override
    public void onNavigateNext(View view) {
        // Ensure that all users are unlocked so that we can move their data
        final LockPatternUtils lpu = new LockPatternUtils(this);
        if (StorageManager.isFileEncrypted()) {
            for (UserInfo user : getSystemService(UserManager.class).getUsers()) {
                if (!StorageManager.isUserKeyUnlocked(user.id)) {
                    Log.d(TAG, "User " + user.id + " is currently locked; requesting unlock");
                if (StorageManager.isUserKeyUnlocked(user.id)) {
                    continue;
                }
                if (!lpu.isSecure(user.id)) {
                    Log.d(TAG, "Unsecured user " + user.id + " is currently locked; attempting "
                            + "automatic unlock");
                    lpu.unlockUserKeyIfUnsecured(user.id);
                } else {
                    Log.d(TAG, "Secured user " + user.id + " is currently locked; requesting "
                            + "manual unlock");
                    final CharSequence description = TextUtils.expandTemplate(
                            getText(R.string.storage_wizard_move_unlock), user.name);
                    final ChooseLockSettingsHelper.Builder builder =