use of com.android.internal.widget.LockPatternUtils in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ToggleAccessibilityServicePreferenceFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mLockPatternUtils = new LockPatternUtils(getActivity());
}
use of com.android.internal.widget.LockPatternUtils in project Resurrection_packages_apps_Settings by ResurrectionRemix.
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);
} else if (KEY_TOGGLE_INSTALL_APPLICATIONS.equals(key)) {
if ((Boolean) value) {
mToggleAppInstallation.setChecked(false);
warnAppInstallation();
// Don't change Switch status until user makes choice in dialog, so return false.
result = false;
} else {
setNonMarketAppsAllowed(false);
}
}
return result;
}
use of com.android.internal.widget.LockPatternUtils in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SetupFingerprintEnrollIntroduction method onActivityResult.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == FINGERPRINT_FIND_SENSOR_REQUEST) {
if (data == null) {
data = new Intent();
}
LockPatternUtils lockPatternUtils = new LockPatternUtils(this);
data.putExtra(SetupChooseLockGeneric.SetupChooseLockGenericFragment.EXTRA_PASSWORD_QUALITY, lockPatternUtils.getKeyguardStoredPasswordQuality(UserHandle.myUserId()));
}
super.onActivityResult(requestCode, resultCode, data);
}
use of com.android.internal.widget.LockPatternUtils in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class TrustAgentSettings method updateAgents.
private void updateAgents() {
final Context context = getActivity();
if (mAvailableAgents == null) {
mAvailableAgents = findAvailableTrustAgents();
}
if (mLockPatternUtils == null) {
mLockPatternUtils = new LockPatternUtils(getActivity());
}
loadActiveAgents();
PreferenceGroup category = (PreferenceGroup) getPreferenceScreen().findPreference("trust_agents");
category.removeAll();
final EnforcedAdmin admin = RestrictedLockUtils.checkIfKeyguardFeaturesDisabled(context, DevicePolicyManager.KEYGUARD_DISABLE_TRUST_AGENTS, UserHandle.myUserId());
final int count = mAvailableAgents.size();
for (int i = 0; i < count; i++) {
AgentInfo agent = mAvailableAgents.valueAt(i);
final RestrictedSwitchPreference preference = new RestrictedSwitchPreference(getPrefContext());
preference.useAdminDisabledSummary(true);
agent.preference = preference;
preference.setPersistent(false);
preference.setTitle(agent.label);
preference.setIcon(agent.icon);
preference.setPersistent(false);
preference.setOnPreferenceChangeListener(this);
preference.setChecked(mActiveAgents.contains(agent.component));
if (admin != null && mDpm.getTrustAgentConfiguration(null, agent.component) == null) {
preference.setChecked(false);
preference.setDisabledByAdmin(admin);
}
category.addPreference(agent.preference);
}
}
use of com.android.internal.widget.LockPatternUtils in project android_frameworks_base by DirtyUnicorns.
the class RetailDemoModeService method onSwitchUser.
@Override
public void onSwitchUser(int userId) {
if (!mDeviceInDemoMode) {
return;
}
if (DEBUG) {
Slog.d(TAG, "onSwitchUser: " + userId);
}
final UserInfo ui = getUserManager().getUserInfo(userId);
if (!ui.isDemo()) {
Slog.wtf(TAG, "Should not allow switch to non-demo user in demo mode");
return;
}
if (!mIsCarrierDemoMode && !mWakeLock.isHeld()) {
mWakeLock.acquire();
}
mCurrentUserId = userId;
mAmi.updatePersistentConfigurationForUser(getSystemUsersConfiguration(), userId);
turnOffAllFlashLights();
muteVolumeStreams();
if (!mWifiManager.isWifiEnabled()) {
mWifiManager.setWifiEnabled(true);
}
// Disable lock screen for demo users.
LockPatternUtils lockPatternUtils = new LockPatternUtils(getContext());
lockPatternUtils.setLockScreenDisabled(true, userId);
if (!mIsCarrierDemoMode) {
// Show reset notification (except in carrier demo mode).
mNm.notifyAsUser(TAG, 1, createResetNotification(), UserHandle.of(userId));
synchronized (mActivityLock) {
mUserUntouched = true;
}
MetricsLogger.count(getContext(), DEMO_SESSION_COUNT, 1);
mHandler.removeMessages(MSG_INACTIVITY_TIME_OUT);
mHandler.post(new Runnable() {
@Override
public void run() {
mPreloadAppsInstaller.installApps(userId);
}
});
}
}
Aggregations