Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 29b548a4 authored by David van Tonder's avatar David van Tonder Committed by Gerrit Code Review
Browse files

Merge "LockPatternUtils: isSecure: respect profile settings" into cm-10.1

parents 8a96d5d1 ccab0c0b
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@
package com.android.internal.widget;

import android.app.ActivityManagerNative;
import android.app.Profile;
import android.app.ProfileManager;
import android.app.admin.DevicePolicyManager;
import android.appwidget.AppWidgetManager;
import android.content.ContentResolver;
@@ -158,6 +160,7 @@ public class LockPatternUtils {
    private final ContentResolver mContentResolver;
    private DevicePolicyManager mDevicePolicyManager;
    private ILockSettings mLockSettingsService;
    private ProfileManager mProfileManager;

    // The current user is set by KeyguardViewMediator and shared by all LockPatternUtils.
    private static volatile int sCurrentUserId = UserHandle.USER_NULL;
@@ -180,6 +183,7 @@ public class LockPatternUtils {
    public LockPatternUtils(Context context) {
        mContext = context;
        mContentResolver = context.getContentResolver();
        mProfileManager = (ProfileManager) context.getSystemService(Context.PROFILE_SERVICE);
    }

    private ILockSettings getLockSettings() {
@@ -1275,8 +1279,9 @@ public class LockPatternUtils {
                || mode == DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC
                || mode == DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC
                || mode == DevicePolicyManager.PASSWORD_QUALITY_COMPLEX;
        final boolean secure = isPattern && isLockPatternEnabled() && savedPatternExists()
                || isPassword && savedPasswordExists();
        final boolean isProfileSecure = mProfileManager.getActiveProfile().getScreenLockMode() == Profile.LockMode.DEFAULT;
        final boolean secure = (isPattern && isLockPatternEnabled() && savedPatternExists()
                || isPassword && savedPasswordExists()) && isProfileSecure;
        return secure;
    }