Search in sources :

Example 66 with ChooseLockSettingsHelper

use of com.android.settings.password.ChooseLockSettingsHelper in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class LockUnificationPreferenceController method launchConfirmDeviceAndProfileLock.

/**
 * Asks the user to confirm device lock (if there is one) and proceeds to ask profile lock.
 */
private void launchConfirmDeviceAndProfileLock() {
    final String title = mContext.getString(R.string.unlock_set_unlock_launch_picker_title);
    final ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(mHost.getActivity(), mHost);
    if (!helper.launchConfirmationActivity(UNIFY_LOCK_CONFIRM_DEVICE_REQUEST, title, true, MY_USER_ID)) {
        launchConfirmProfileLock();
    }
}
Also used : ChooseLockSettingsHelper(com.android.settings.password.ChooseLockSettingsHelper)

Example 67 with ChooseLockSettingsHelper

use of com.android.settings.password.ChooseLockSettingsHelper in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class BiometricEnrollBase method launchConfirmLock.

protected void launchConfirmLock(int titleResId, long challenge) {
    ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(this);
    boolean launchedConfirmationActivity;
    if (mUserId == UserHandle.USER_NULL) {
        launchedConfirmationActivity = helper.launchConfirmationActivity(CONFIRM_REQUEST, getString(titleResId), null, null, challenge, true);
    } else {
        launchedConfirmationActivity = helper.launchConfirmationActivity(CONFIRM_REQUEST, getString(titleResId), null, null, challenge, mUserId, true);
    }
    if (!launchedConfirmationActivity) {
        // This shouldn't happen, as we should only end up at this step if a lock thingy is
        // already set.
        finish();
    } else {
        mLaunchedConfirmLock = true;
    }
}
Also used : ChooseLockSettingsHelper(com.android.settings.password.ChooseLockSettingsHelper)

Example 68 with ChooseLockSettingsHelper

use of com.android.settings.password.ChooseLockSettingsHelper in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class StorageWizardMigrateConfirm method onNavigateNext.

@Override
public void onNavigateNext(View view) {
    // Ensure that all users are unlocked so that we can move their data
    if (StorageManager.isFileEncryptedNativeOrEmulated()) {
        for (UserInfo user : getSystemService(UserManager.class).getUsers()) {
            if (!StorageManager.isUserKeyUnlocked(user.id)) {
                Log.d(TAG, "User " + user.id + " is currently locked; requesting unlock");
                final CharSequence description = TextUtils.expandTemplate(getText(R.string.storage_wizard_move_unlock), user.name);
                new ChooseLockSettingsHelper(this).launchConfirmationActivityForAnyUser(REQUEST_CREDENTIAL, null, null, description, user.id);
                return;
            }
        }
    }
    // We only expect exceptions from StorageManagerService#setPrimaryStorageUuid
    int moveId;
    try {
        moveId = getPackageManager().movePrimaryStorage(mVolume);
    } catch (IllegalArgumentException e) {
        StorageManager sm = (StorageManager) getSystemService(STORAGE_SERVICE);
        if (Objects.equals(mVolume.getFsUuid(), sm.getPrimaryStorageVolume().getUuid())) {
            final Intent intent = new Intent(this, StorageWizardReady.class);
            intent.putExtra(DiskInfo.EXTRA_DISK_ID, getIntent().getStringExtra(DiskInfo.EXTRA_DISK_ID));
            startActivity(intent);
            finishAffinity();
            return;
        } else {
            throw e;
        }
    } catch (IllegalStateException e) {
        Toast.makeText(this, getString(R.string.another_migration_already_in_progress), Toast.LENGTH_LONG).show();
        finishAffinity();
        return;
    }
    FeatureFactory.getFactory(this).getMetricsFeatureProvider().action(this, SettingsEnums.ACTION_STORAGE_MIGRATE_NOW);
    final Intent intent = new Intent(this, StorageWizardMigrateProgress.class);
    intent.putExtra(VolumeInfo.EXTRA_VOLUME_ID, mVolume.getId());
    intent.putExtra(PackageManager.EXTRA_MOVE_ID, moveId);
    startActivity(intent);
    finishAffinity();
}
Also used : ChooseLockSettingsHelper(com.android.settings.password.ChooseLockSettingsHelper) UserManager(android.os.UserManager) StorageManager(android.os.storage.StorageManager) UserInfo(android.content.pm.UserInfo) Intent(android.content.Intent)

Aggregations

ChooseLockSettingsHelper (com.android.settings.password.ChooseLockSettingsHelper)68 Resources (android.content.res.Resources)13 LockPatternUtils (com.android.internal.widget.LockPatternUtils)11 UserManager (android.os.UserManager)8 Bundle (android.os.Bundle)6 PersistableBundle (android.os.PersistableBundle)6 ChooseLockGenericFragment (com.android.settings.password.ChooseLockGeneric.ChooseLockGenericFragment)6 Activity (android.app.Activity)5 EnterprisePrivacyPreferenceController (com.android.settings.enterprise.EnterprisePrivacyPreferenceController)5 ManageDeviceAdminPreferenceController (com.android.settings.enterprise.ManageDeviceAdminPreferenceController)5 LockScreenNotificationPreferenceController (com.android.settings.notification.LockScreenNotificationPreferenceController)5 LineageLockPatternUtils (org.lineageos.internal.util.LineageLockPatternUtils)5 Intent (android.content.Intent)3 UserInfo (android.content.pm.UserInfo)2 ComponentName (android.content.ComponentName)1 ResolveInfo (android.content.pm.ResolveInfo)1 StorageManager (android.os.storage.StorageManager)1 Random (java.util.Random)1