Search in sources :

Example 16 with LockPatternUtils

use of com.android.internal.widget.LockPatternUtils in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ConfirmDeviceCredentialBaseFragment method onCreate.

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mAllowFpAuthentication = getActivity().getIntent().getBooleanExtra(ALLOW_FP_AUTHENTICATION, false);
    mReturnCredentials = getActivity().getIntent().getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_RETURN_CREDENTIALS, false);
    // Only take this argument into account if it belongs to the current profile.
    Intent intent = getActivity().getIntent();
    mUserId = Utils.getUserIdFromBundle(getActivity(), intent.getExtras());
    final UserManager userManager = UserManager.get(getActivity());
    mEffectiveUserId = userManager.getCredentialOwnerProfile(mUserId);
    mLockPatternUtils = new LockPatternUtils(getActivity());
    mIsStrongAuthRequired = isFingerprintDisallowedByStrongAuth();
    mAllowFpAuthentication = mAllowFpAuthentication && !isFingerprintDisabledByAdmin() && !mReturnCredentials && !mIsStrongAuthRequired;
}
Also used : UserManager(android.os.UserManager) LockPatternUtils(com.android.internal.widget.LockPatternUtils) Intent(android.content.Intent)

Example 17 with LockPatternUtils

use of com.android.internal.widget.LockPatternUtils in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ConfirmDeviceCredentialActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent intent = getIntent();
    String title = intent.getStringExtra(KeyguardManager.EXTRA_TITLE);
    String details = intent.getStringExtra(KeyguardManager.EXTRA_DESCRIPTION);
    int userId = Utils.getCredentialOwnerUserId(this);
    if (isInternalActivity()) {
        try {
            userId = Utils.getUserIdFromBundle(this, intent.getExtras());
        } catch (SecurityException se) {
            Log.e(TAG, "Invalid intent extra", se);
        }
    }
    final boolean isManagedProfile = Utils.isManagedProfile(UserManager.get(this), userId);
    // check whether there is a policy setting the organization name and use that as title
    if ((title == null) && isManagedProfile) {
        title = getTitleFromOrganizationName(userId);
    }
    ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(this);
    final LockPatternUtils lockPatternUtils = new LockPatternUtils(this);
    boolean launched;
    // challenge is unlocked.
    if (isManagedProfile && isInternalActivity() && !lockPatternUtils.isSeparateProfileChallengeEnabled(userId)) {
        // We set the challenge as 0L, so it will force to unlock managed profile when it
        // unlocks primary profile screen lock, by calling verifyTiedProfileChallenge()
        launched = helper.launchConfirmationActivityWithExternalAndChallenge(0, /* request code */
        null, /* title */
        title, details, true, /* isExternal */
        0L, /* challenge */
        userId);
    } else {
        launched = helper.launchConfirmationActivity(0, /* request code */
        null, /* title */
        title, details, false, /* returnCredentials */
        true, /* isExternal */
        userId);
    }
    if (!launched) {
        Log.d(TAG, "No pattern, password or PIN set.");
        setResult(Activity.RESULT_OK);
    }
    finish();
}
Also used : LockPatternUtils(com.android.internal.widget.LockPatternUtils) Intent(android.content.Intent)

Example 18 with LockPatternUtils

use of com.android.internal.widget.LockPatternUtils in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class AppNotificationSettings method updateDependents.

@Override
protected void updateDependents(int importance) {
    LockPatternUtils utils = new LockPatternUtils(getActivity());
    boolean lockscreenSecure = utils.isSecure(UserHandle.myUserId());
    UserInfo parentUser = mUm.getProfileParent(UserHandle.myUserId());
    if (parentUser != null) {
        lockscreenSecure |= utils.isSecure(parentUser.id);
    }
    if (getPreferenceScreen().findPreference(mBlock.getKey()) != null) {
        setVisible(mSilent, checkCanBeVisible(Ranking.IMPORTANCE_MIN, importance));
        mSilent.setChecked(importance == Ranking.IMPORTANCE_LOW || importance == Ranking.IMPORTANCE_VERY_LOW);
    }
    setVisible(mPriority, checkCanBeVisible(Ranking.IMPORTANCE_DEFAULT, importance) || (checkCanBeVisible(Ranking.IMPORTANCE_LOW, importance) && mDndVisualEffectsSuppressed));
    setVisible(mVisibilityOverride, checkCanBeVisible(Ranking.IMPORTANCE_MIN, importance));
}
Also used : LockPatternUtils(com.android.internal.widget.LockPatternUtils) UserInfo(android.content.pm.UserInfo)

Example 19 with LockPatternUtils

use of com.android.internal.widget.LockPatternUtils in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ConfigureNotificationSettings method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = getActivity();
    mProfileChallengeUserId = Utils.getManagedProfileId(UserManager.get(mContext), UserHandle.myUserId());
    final LockPatternUtils utils = new LockPatternUtils(getActivity());
    final boolean isUnified = !utils.isSeparateProfileChallengeEnabled(mProfileChallengeUserId);
    mSecure = utils.isSecure(UserHandle.myUserId());
    mSecureProfile = (mProfileChallengeUserId != UserHandle.USER_NULL) && (utils.isSecure(mProfileChallengeUserId) || (isUnified && mSecure));
    addPreferencesFromResource(R.xml.configure_notification_settings);
    initPulse();
    initLockscreenNotifications();
    if (mProfileChallengeUserId != UserHandle.USER_NULL) {
        addPreferencesFromResource(R.xml.configure_notification_settings_profile);
        initLockscreenNotificationsForProfile();
    }
}
Also used : LockPatternUtils(com.android.internal.widget.LockPatternUtils)

Example 20 with LockPatternUtils

use of com.android.internal.widget.LockPatternUtils in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class OwnerInfoSettings method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mUserId = UserHandle.myUserId();
    mLockPatternUtils = new LockPatternUtils(getActivity());
}
Also used : LockPatternUtils(com.android.internal.widget.LockPatternUtils)

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