Search in sources :

Example 51 with ChooseLockSettingsHelper

use of com.android.settings.password.ChooseLockSettingsHelper in project android_packages_apps_Settings by DirtyUnicorns.

the class SecuritySettings method launchConfirmDeviceLockForUnification.

private void launchConfirmDeviceLockForUnification() {
    final String title = getActivity().getString(R.string.unlock_set_unlock_launch_picker_title);
    final ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(getActivity(), this);
    if (!helper.launchConfirmationActivity(UNIFY_LOCK_CONFIRM_DEVICE_REQUEST, title, true, MY_USER_ID)) {
        launchConfirmProfileLockForUnification();
    }
}
Also used : ChooseLockSettingsHelper(com.android.settings.password.ChooseLockSettingsHelper)

Example 52 with ChooseLockSettingsHelper

use of com.android.settings.password.ChooseLockSettingsHelper in project android_packages_apps_Settings by DirtyUnicorns.

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 53 with ChooseLockSettingsHelper

use of com.android.settings.password.ChooseLockSettingsHelper in project android_packages_apps_Settings by crdroidandroid.

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 54 with ChooseLockSettingsHelper

use of com.android.settings.password.ChooseLockSettingsHelper in project android_packages_apps_Settings by crdroidandroid.

the class CredentialStorage method confirmKeyGuard.

/**
 * Confirm existing key guard, returning password via onActivityResult.
 */
private boolean confirmKeyGuard(int requestCode) {
    Resources res = getResources();
    boolean launched = new ChooseLockSettingsHelper(this).launchConfirmationActivity(requestCode, res.getText(R.string.credentials_title), true);
    return launched;
}
Also used : ChooseLockSettingsHelper(com.android.settings.password.ChooseLockSettingsHelper) Resources(android.content.res.Resources)

Example 55 with ChooseLockSettingsHelper

use of com.android.settings.password.ChooseLockSettingsHelper in project android_packages_apps_Settings by crdroidandroid.

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)

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