Search in sources :

Example 21 with LockPatternUtils

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());
}
Also used : LockPatternUtils(com.android.internal.widget.LockPatternUtils)

Example 22 with LockPatternUtils

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;
}
Also used : CmLockPatternUtils(org.cyanogenmod.internal.util.CmLockPatternUtils) LockPatternUtils(com.android.internal.widget.LockPatternUtils)

Example 23 with LockPatternUtils

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);
}
Also used : LockPatternUtils(com.android.internal.widget.LockPatternUtils) Intent(android.content.Intent)

Example 24 with LockPatternUtils

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);
    }
}
Also used : Context(android.content.Context) RestrictedSwitchPreference(com.android.settingslib.RestrictedSwitchPreference) LockPatternUtils(com.android.internal.widget.LockPatternUtils) PreferenceGroup(android.support.v7.preference.PreferenceGroup) EnforcedAdmin(com.android.settingslib.RestrictedLockUtils.EnforcedAdmin)

Example 25 with LockPatternUtils

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);
            }
        });
    }
}
Also used : LockPatternUtils(com.android.internal.widget.LockPatternUtils) UserInfo(android.content.pm.UserInfo)

Aggregations

LockPatternUtils (com.android.internal.widget.LockPatternUtils)96 ComponentName (android.content.ComponentName)24 UserInfo (android.content.pm.UserInfo)24 DevicePolicyManager (android.app.admin.DevicePolicyManager)19 UserManager (android.os.UserManager)16 IOException (java.io.IOException)11 IntentFilter (android.content.IntentFilter)10 Intent (android.content.Intent)9 View (android.view.View)9 Cursor (android.database.Cursor)6 RemoteException (android.os.RemoteException)6 ArrayList (java.util.ArrayList)6 ContentResolver (android.content.ContentResolver)5 Configuration (android.content.res.Configuration)5 Rect (android.graphics.Rect)5 SoundPool (android.media.SoundPool)5 IBinder (android.os.IBinder)5 IVrManager (android.service.vr.IVrManager)5 StatusBarIcon (com.android.internal.statusbar.StatusBarIcon)5 KeyguardDisplayManager (com.android.keyguard.KeyguardDisplayManager)5