Search in sources :

Example 31 with ChooseLockSettingsHelper

use of com.android.settings.password.ChooseLockSettingsHelper in project platform_packages_apps_Settings by BlissRoms.

the class CryptKeeperSettings method runKeyguardConfirmation.

/**
 * Keyguard validation is run using the standard {@link ConfirmLockPattern}
 * component as a subactivity
 * @param request the request code to be returned once confirmation finishes
 * @return true if confirmation launched
 */
private boolean runKeyguardConfirmation(int request) {
    Resources res = getActivity().getResources();
    ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(getActivity(), this);
    if (helper.utils().getKeyguardStoredPasswordQuality(UserHandle.myUserId()) == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
        showFinalConfirmation(StorageManager.CRYPT_TYPE_DEFAULT, "");
        return true;
    }
    return helper.launchConfirmationActivity(request, res.getText(R.string.crypt_keeper_encrypt_title), true);
}
Also used : ChooseLockSettingsHelper(com.android.settings.password.ChooseLockSettingsHelper) Resources(android.content.res.Resources)

Example 32 with ChooseLockSettingsHelper

use of com.android.settings.password.ChooseLockSettingsHelper in project platform_packages_apps_Settings by BlissRoms.

the class FingerprintEnrollFindSensor method launchConfirmLock.

private void launchConfirmLock() {
    long challenge = Utils.getFingerprintManagerOrNull(this).preEnroll();
    ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(this);
    boolean launchedConfirmationActivity = false;
    if (mUserId == UserHandle.USER_NULL) {
        launchedConfirmationActivity = helper.launchConfirmationActivity(CONFIRM_REQUEST, getString(R.string.security_settings_fingerprint_preference_title), null, null, challenge);
    } else {
        launchedConfirmationActivity = helper.launchConfirmationActivity(CONFIRM_REQUEST, getString(R.string.security_settings_fingerprint_preference_title), null, null, challenge, mUserId);
    }
    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 33 with ChooseLockSettingsHelper

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

the class AddAccountSettings method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState != null) {
        mAddAccountCalled = savedInstanceState.getBoolean(KEY_ADD_CALLED);
        if (Log.isLoggable(TAG, Log.VERBOSE))
            Log.v(TAG, "restored");
    }
    final UserManager um = (UserManager) getSystemService(Context.USER_SERVICE);
    mUserHandle = Utils.getSecureTargetUser(getActivityToken(), um, null, /* arguments */
    getIntent().getExtras());
    if (um.hasUserRestriction(UserManager.DISALLOW_MODIFY_ACCOUNTS, mUserHandle)) {
        // We aren't allowed to add an account.
        Toast.makeText(this, R.string.user_cannot_add_accounts_message, Toast.LENGTH_LONG).show();
        finish();
        return;
    }
    if (mAddAccountCalled) {
        // We already called add account - maybe the callback was lost.
        finish();
        return;
    }
    if (Utils.startQuietModeDialogIfNecessary(this, um, mUserHandle.getIdentifier())) {
        finish();
        return;
    }
    if (um.isUserUnlocked(mUserHandle)) {
        requestChooseAccount();
    } else {
        // If the user is locked by fbe: we couldn't start the authenticator. So we must ask the
        // user to unlock it first.
        ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(this);
        if (!helper.launchConfirmationActivity(UNLOCK_WORK_PROFILE_REQUEST, getString(R.string.unlock_set_unlock_launch_picker_title), false, mUserHandle.getIdentifier())) {
            requestChooseAccount();
        }
    }
}
Also used : ChooseLockSettingsHelper(com.android.settings.password.ChooseLockSettingsHelper) UserManager(android.os.UserManager)

Example 34 with ChooseLockSettingsHelper

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

the class TrustAgentListPreferenceController method handlePreferenceTreeClick.

@Override
public boolean handlePreferenceTreeClick(Preference preference) {
    if (!TextUtils.equals(preference.getKey(), getPreferenceKey())) {
        return super.handlePreferenceTreeClick(preference);
    }
    final ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(mHost.getActivity(), mHost);
    mTrustAgentClickIntent = preference.getIntent();
    boolean confirmationLaunched = helper.launchConfirmationActivity(CHANGE_TRUST_AGENT_SETTINGS, preference.getTitle());
    if (!confirmationLaunched && mTrustAgentClickIntent != null) {
        // If this returns false, it means no password confirmation is required.
        mHost.startActivity(mTrustAgentClickIntent);
        mTrustAgentClickIntent = null;
    }
    return true;
}
Also used : ChooseLockSettingsHelper(com.android.settings.password.ChooseLockSettingsHelper)

Example 35 with ChooseLockSettingsHelper

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

the class StorageWizardMoveConfirm 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;
            }
        }
    }
    // Kick off move before we transition
    final String appName = getPackageManager().getApplicationLabel(mApp).toString();
    final int moveId = getPackageManager().movePackage(mPackageName, mVolume);
    final Intent intent = new Intent(this, StorageWizardMoveProgress.class);
    intent.putExtra(EXTRA_MOVE_ID, moveId);
    intent.putExtra(EXTRA_TITLE, appName);
    intent.putExtra(EXTRA_VOLUME_ID, mVolume.getId());
    startActivity(intent);
    finishAffinity();
}
Also used : ChooseLockSettingsHelper(com.android.settings.password.ChooseLockSettingsHelper) UserManager(android.os.UserManager) 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