Search in sources :

Example 16 with ChooseLockSettingsHelper

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

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

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

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

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

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

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

the class BuildNumberPreferenceController method handlePreferenceTreeClick.

@Override
public boolean handlePreferenceTreeClick(Preference preference) {
    if (!TextUtils.equals(preference.getKey(), KEY_BUILD_NUMBER)) {
        return false;
    }
    if (Utils.isMonkeyRunning()) {
        return false;
    }
    // Don't enable developer options for secondary users.
    if (!mUm.isAdminUser()) {
        mMetricsFeatureProvider.action(mContext, MetricsEvent.ACTION_SETTINGS_BUILD_NUMBER_PREF);
        return false;
    }
    // Don't enable developer options until device has been provisioned
    if (!Utils.isDeviceProvisioned(mContext)) {
        mMetricsFeatureProvider.action(mContext, MetricsEvent.ACTION_SETTINGS_BUILD_NUMBER_PREF);
        return false;
    }
    if (mUm.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES)) {
        if (mDebuggingFeaturesDisallowedAdmin != null && !mDebuggingFeaturesDisallowedBySystem) {
            RestrictedLockUtils.sendShowAdminSupportDetailsIntent(mContext, mDebuggingFeaturesDisallowedAdmin);
        }
        mMetricsFeatureProvider.action(mContext, MetricsEvent.ACTION_SETTINGS_BUILD_NUMBER_PREF);
        return false;
    }
    if (mDevHitCountdown > 0) {
        mDevHitCountdown--;
        if (mDevHitCountdown == 0 && !mProcessingLastDevHit) {
            // Add 1 count back, then start password confirmation flow.
            mDevHitCountdown++;
            final ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(mActivity, mFragment);
            mProcessingLastDevHit = helper.launchConfirmationActivity(REQUEST_CONFIRM_PASSWORD_FOR_DEV_PREF, mContext.getString(R.string.unlock_set_unlock_launch_picker_title));
            if (!mProcessingLastDevHit) {
                enableDevelopmentSettings();
            }
            mMetricsFeatureProvider.action(mContext, MetricsEvent.ACTION_SETTINGS_BUILD_NUMBER_PREF, Pair.create(MetricsEvent.FIELD_SETTINGS_BUILD_NUMBER_DEVELOPER_MODE_ENABLED, mProcessingLastDevHit ? 0 : 1));
        } else if (mDevHitCountdown > 0 && mDevHitCountdown < (TAPS_TO_BE_A_DEVELOPER - 2)) {
            if (mDevHitToast != null) {
                mDevHitToast.cancel();
            }
            mDevHitToast = Toast.makeText(mContext, mContext.getResources().getQuantityString(R.plurals.show_dev_countdown_custom, mDevHitCountdown, mDevHitCountdown), Toast.LENGTH_SHORT);
            mDevHitToast.show();
        }
        mMetricsFeatureProvider.action(mContext, MetricsEvent.ACTION_SETTINGS_BUILD_NUMBER_PREF, Pair.create(MetricsEvent.FIELD_SETTINGS_BUILD_NUMBER_DEVELOPER_MODE_ENABLED, 0));
    } else if (mDevHitCountdown < 0) {
        if (mDevHitToast != null) {
            mDevHitToast.cancel();
        }
        Random randomInsult = new Random();
        final int toasts = randomInsult.nextInt(mInsults.length);
        mDevHitToast = Toast.makeText(mContext, mInsults[toasts], Toast.LENGTH_LONG);
        mDevHitToast.show();
        mMetricsFeatureProvider.action(mContext, MetricsEvent.ACTION_SETTINGS_BUILD_NUMBER_PREF, Pair.create(MetricsEvent.FIELD_SETTINGS_BUILD_NUMBER_DEVELOPER_MODE_ENABLED, 1));
    }
    return true;
}
Also used : ChooseLockSettingsHelper(com.android.settings.password.ChooseLockSettingsHelper) Random(java.util.Random)

Example 20 with ChooseLockSettingsHelper

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

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)

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