Loading core/java/android/app/Profile.java +13 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.app; import android.app.admin.DevicePolicyManager; import android.content.Context; import android.media.AudioManager; import android.os.Parcel; Loading Loading @@ -290,6 +291,18 @@ public final class Profile implements Parcelable, Comparable { mDirty = true; } public int getScreenLockModeWithDPM(Context context) { // Check device policy DevicePolicyManager dpm = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE); if (dpm.requireSecureKeyguard()) { // Always enforce lock screen return LockMode.DEFAULT; } return mScreenLockMode; } public int getScreenLockMode() { return mScreenLockMode; } Loading core/java/android/app/admin/DevicePolicyManager.java +17 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.os.RemoteCallback; import android.os.RemoteException; import android.os.ServiceManager; import android.os.UserHandle; import android.security.KeyStore; import android.util.Log; import java.io.IOException; Loading Loading @@ -1513,4 +1514,20 @@ public class DevicePolicyManager { } } } /** * CM: check if secure keyguard is required * @hide */ public boolean requireSecureKeyguard() { int encryptionStatus = getStorageEncryptionStatus(); if (getPasswordQuality(null) > PASSWORD_QUALITY_UNSPECIFIED || !KeyStore.getInstance().isEmpty() || encryptionStatus == DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE || encryptionStatus == DevicePolicyManager.ENCRYPTION_STATUS_ACTIVATING) { // Require secure keyguard return true; } return false; } } core/java/com/android/internal/widget/LockPatternUtils.java +1 −1 Original line number Diff line number Diff line Loading @@ -1279,7 +1279,7 @@ public class LockPatternUtils { || mode == DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC || mode == DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC || mode == DevicePolicyManager.PASSWORD_QUALITY_COMPLEX; final boolean isProfileSecure = mProfileManager.getActiveProfile().getScreenLockMode() == Profile.LockMode.DEFAULT; final boolean isProfileSecure = mProfileManager.getActiveProfile().getScreenLockModeWithDPM(mContext) == Profile.LockMode.DEFAULT; final boolean secure = (isPattern && isLockPatternEnabled() && savedPatternExists() || isPassword && savedPasswordExists()) && isProfileSecure; return secure; Loading policy/src/com/android/internal/policy/impl/keyguard/KeyguardSecurityModel.java +1 −1 Original line number Diff line number Diff line Loading @@ -88,7 +88,7 @@ public class KeyguardSecurityModel { } else if (simState == IccCardConstants.State.PUK_REQUIRED && mLockPatternUtils.isPukUnlockScreenEnable()) { mode = SecurityMode.SimPuk; } else if (mProfileManager.getActiveProfile().getScreenLockMode() != Profile.LockMode.INSECURE) { } else if (mProfileManager.getActiveProfile().getScreenLockModeWithDPM(mContext) != Profile.LockMode.INSECURE) { final int security = mLockPatternUtils.getKeyguardStoredPasswordQuality(); switch (security) { case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC: Loading policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java +1 −1 Original line number Diff line number Diff line Loading @@ -924,7 +924,7 @@ public class KeyguardViewMediator { Profile profile = mProfileManager.getActiveProfile(); if (profile != null) { if (!lockedOrMissing && profile.getScreenLockMode() == Profile.LockMode.DISABLE) { && profile.getScreenLockModeWithDPM(mContext) == Profile.LockMode.DISABLE) { if (DEBUG) Log.d(TAG, "doKeyguard: not showing because of profile override"); return; } Loading Loading
core/java/android/app/Profile.java +13 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.app; import android.app.admin.DevicePolicyManager; import android.content.Context; import android.media.AudioManager; import android.os.Parcel; Loading Loading @@ -290,6 +291,18 @@ public final class Profile implements Parcelable, Comparable { mDirty = true; } public int getScreenLockModeWithDPM(Context context) { // Check device policy DevicePolicyManager dpm = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE); if (dpm.requireSecureKeyguard()) { // Always enforce lock screen return LockMode.DEFAULT; } return mScreenLockMode; } public int getScreenLockMode() { return mScreenLockMode; } Loading
core/java/android/app/admin/DevicePolicyManager.java +17 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.os.RemoteCallback; import android.os.RemoteException; import android.os.ServiceManager; import android.os.UserHandle; import android.security.KeyStore; import android.util.Log; import java.io.IOException; Loading Loading @@ -1513,4 +1514,20 @@ public class DevicePolicyManager { } } } /** * CM: check if secure keyguard is required * @hide */ public boolean requireSecureKeyguard() { int encryptionStatus = getStorageEncryptionStatus(); if (getPasswordQuality(null) > PASSWORD_QUALITY_UNSPECIFIED || !KeyStore.getInstance().isEmpty() || encryptionStatus == DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE || encryptionStatus == DevicePolicyManager.ENCRYPTION_STATUS_ACTIVATING) { // Require secure keyguard return true; } return false; } }
core/java/com/android/internal/widget/LockPatternUtils.java +1 −1 Original line number Diff line number Diff line Loading @@ -1279,7 +1279,7 @@ public class LockPatternUtils { || mode == DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC || mode == DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC || mode == DevicePolicyManager.PASSWORD_QUALITY_COMPLEX; final boolean isProfileSecure = mProfileManager.getActiveProfile().getScreenLockMode() == Profile.LockMode.DEFAULT; final boolean isProfileSecure = mProfileManager.getActiveProfile().getScreenLockModeWithDPM(mContext) == Profile.LockMode.DEFAULT; final boolean secure = (isPattern && isLockPatternEnabled() && savedPatternExists() || isPassword && savedPasswordExists()) && isProfileSecure; return secure; Loading
policy/src/com/android/internal/policy/impl/keyguard/KeyguardSecurityModel.java +1 −1 Original line number Diff line number Diff line Loading @@ -88,7 +88,7 @@ public class KeyguardSecurityModel { } else if (simState == IccCardConstants.State.PUK_REQUIRED && mLockPatternUtils.isPukUnlockScreenEnable()) { mode = SecurityMode.SimPuk; } else if (mProfileManager.getActiveProfile().getScreenLockMode() != Profile.LockMode.INSECURE) { } else if (mProfileManager.getActiveProfile().getScreenLockModeWithDPM(mContext) != Profile.LockMode.INSECURE) { final int security = mLockPatternUtils.getKeyguardStoredPasswordQuality(); switch (security) { case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC: Loading
policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java +1 −1 Original line number Diff line number Diff line Loading @@ -924,7 +924,7 @@ public class KeyguardViewMediator { Profile profile = mProfileManager.getActiveProfile(); if (profile != null) { if (!lockedOrMissing && profile.getScreenLockMode() == Profile.LockMode.DISABLE) { && profile.getScreenLockModeWithDPM(mContext) == Profile.LockMode.DISABLE) { if (DEBUG) Log.d(TAG, "doKeyguard: not showing because of profile override"); return; } Loading