use of com.android.settings.password.ChooseLockSettingsHelper in project Resurrection_packages_apps_Settings by ResurrectionRemix.
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, "".getBytes());
return true;
}
return helper.launchConfirmationActivity(request, res.getText(R.string.crypt_keeper_encrypt_title), true);
}
use of com.android.settings.password.ChooseLockSettingsHelper in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class LockUnificationPreferenceController method launchConfirmProfileLock.
private void launchConfirmProfileLock() {
final String title = mContext.getString(R.string.unlock_set_unlock_launch_picker_title_profile);
final ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(mHost.getActivity(), mHost);
if (!helper.launchConfirmationActivity(UNIFY_LOCK_CONFIRM_PROFILE_REQUEST, title, true, mProfileUserId)) {
unifyLocks();
// TODO: update relevant prefs.
// createPreferenceHierarchy();
}
}
use of com.android.settings.password.ChooseLockSettingsHelper in project android_packages_apps_Settings by LineageOS.
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();
}
}
}
use of com.android.settings.password.ChooseLockSettingsHelper in project android_packages_apps_Settings by LineageOS.
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 LineageOS.
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;
}
}
Aggregations