Search in sources :

Example 6 with ChooseLockSettingsHelper

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

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_cm, 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();
        }
        mDevHitToast = Toast.makeText(mContext, R.string.show_dev_already_cm, 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)

Example 7 with ChooseLockSettingsHelper

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

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

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

the class SecuritySettings method onPreferenceChange.

@Override
public boolean onPreferenceChange(Preference preference, Object value) {
    boolean result = true;
    final String key = preference.getKey();
    final LockPatternUtils lockPatternUtils = mChooseLockSettingsHelper.utils();
    if (KEY_VISIBLE_PATTERN_PROFILE.equals(key)) {
        if (Utils.startQuietModeDialogIfNecessary(this.getActivity(), mUm, mProfileChallengeUserId)) {
            return false;
        }
        lockPatternUtils.setVisiblePatternEnabled((Boolean) value, mProfileChallengeUserId);
    } else if (KEY_UNIFICATION.equals(key)) {
        if (Utils.startQuietModeDialogIfNecessary(this.getActivity(), mUm, mProfileChallengeUserId)) {
            return false;
        }
        if ((Boolean) value) {
            final boolean compliantForDevice = (mLockPatternUtils.getKeyguardStoredPasswordQuality(mProfileChallengeUserId) >= DevicePolicyManager.PASSWORD_QUALITY_SOMETHING && mLockPatternUtils.isSeparateProfileChallengeAllowedToUnify(mProfileChallengeUserId));
            UnificationConfirmationDialog dialog = UnificationConfirmationDialog.newIntance(compliantForDevice);
            dialog.show(getChildFragmentManager(), TAG_UNIFICATION_DIALOG);
        } else {
            final String title = getActivity().getString(R.string.unlock_set_unlock_launch_picker_title);
            final ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(getActivity(), this);
            if (!helper.launchConfirmationActivity(UNUNIFY_LOCK_CONFIRM_DEVICE_REQUEST, title, true, MY_USER_ID)) {
                ununifyLocks();
            }
        }
    } else if (KEY_SHOW_PASSWORD.equals(key)) {
        Settings.System.putInt(getContentResolver(), Settings.System.TEXT_SHOW_PASSWORD, ((Boolean) value) ? 1 : 0);
        lockPatternUtils.setVisiblePasswordEnabled((Boolean) value, MY_USER_ID);
    }
    return result;
}
Also used : ChooseLockSettingsHelper(com.android.settings.password.ChooseLockSettingsHelper) LineageLockPatternUtils(org.lineageos.internal.util.LineageLockPatternUtils) LockPatternUtils(com.android.internal.widget.LockPatternUtils)

Example 9 with ChooseLockSettingsHelper

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

the class SecuritySettings method launchConfirmProfileLockForUnification.

private void launchConfirmProfileLockForUnification() {
    final String title = getActivity().getString(R.string.unlock_set_unlock_launch_picker_title_profile);
    final ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(getActivity(), this);
    if (!helper.launchConfirmationActivity(UNIFY_LOCK_CONFIRM_PROFILE_REQUEST, title, true, mProfileChallengeUserId)) {
        unifyLocks();
        createPreferenceHierarchy();
    }
}
Also used : ChooseLockSettingsHelper(com.android.settings.password.ChooseLockSettingsHelper)

Example 10 with ChooseLockSettingsHelper

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

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)

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