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;
}
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;
}
}
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;
}
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();
}
}
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();
}
}
Aggregations