Loading policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java +1 −27 Original line number Diff line number Diff line Loading @@ -106,10 +106,6 @@ public class KeyguardHostView extends KeyguardViewBase { private boolean mSafeModeEnabled; // We can use the profile manager to override security private ProfileManager mProfileManager; /*package*/ interface TransportCallback { void onListenerDetached(); void onListenerAttached(); Loading Loading @@ -142,8 +138,6 @@ public class KeyguardHostView extends KeyguardViewBase { mViewStateManager = new KeyguardViewStateManager(this); mProfileManager = (ProfileManager) context.getSystemService(Context.PROFILE_SERVICE); DevicePolicyManager dpm = (DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE); if (dpm != null) { Loading Loading @@ -883,31 +877,11 @@ public class KeyguardHostView extends KeyguardViewBase { showPrimarySecurityScreen(false); } private boolean isSecure() { SecurityMode mode = mSecurityModel.getSecurityMode(); switch (mode) { case Pattern: return mLockPatternUtils.isLockPatternEnabled() && mProfileManager.getActiveProfile().getScreenLockMode()!= Profile.LockMode.INSECURE; case Password: case PIN: return mLockPatternUtils.isLockPasswordEnabled() && mProfileManager.getActiveProfile().getScreenLockMode() != Profile.LockMode.INSECURE; case SimPin: case SimPuk: case Account: return true; case None: return false; default: throw new IllegalStateException("Unknown security mode " + mode); } } @Override public void wakeWhenReadyTq(int keyCode) { if (DEBUG) Log.d(TAG, "onWakeKey"); if (keyCode == KeyEvent.KEYCODE_MENU && isSecure()) { if (keyCode == KeyEvent.KEYCODE_MENU && mSecurityModel.getSecurityMode() != SecurityMode.None) { if (DEBUG) Log.d(TAG, "switching screens to unlock screen because wake key was MENU"); showSecurityScreen(SecurityMode.None); } else { Loading policy/src/com/android/internal/policy/impl/keyguard/KeyguardSecurityModel.java +5 −17 Original line number Diff line number Diff line Loading @@ -88,45 +88,33 @@ public class KeyguardSecurityModel { } else if (simState == IccCardConstants.State.PUK_REQUIRED && mLockPatternUtils.isPukUnlockScreenEnable()) { mode = SecurityMode.SimPuk; } else { } else if (mProfileManager.getActiveProfile().getScreenLockMode() != Profile.LockMode.INSECURE) { final int security = mLockPatternUtils.getKeyguardStoredPasswordQuality(); switch (security) { case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC: if (mLockPatternUtils.isLockPasswordEnabled() && mProfileManager.getActiveProfile().getScreenLockMode() != Profile.LockMode.INSECURE) { if (mLockPatternUtils.isLockPasswordEnabled()) { mode = SecurityMode.PIN; } else { mode = SecurityMode.None; } break; case DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC: case DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC: case DevicePolicyManager.PASSWORD_QUALITY_COMPLEX: if (mLockPatternUtils.isLockPasswordEnabled() && mProfileManager.getActiveProfile().getScreenLockMode() != Profile.LockMode.INSECURE) { if (mLockPatternUtils.isLockPasswordEnabled()) { mode = SecurityMode.Password; } else { mode = SecurityMode.None; } break; case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING: case DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED: if (mLockPatternUtils.isLockPatternEnabled() && mProfileManager.getActiveProfile().getScreenLockMode() != Profile.LockMode.INSECURE) { if (mLockPatternUtils.isLockPatternEnabled()) { mode = mLockPatternUtils.isPermanentlyLocked() ? SecurityMode.Account : SecurityMode.Pattern; } else { mode = SecurityMode.None; } break; default: throw new IllegalStateException("Unknown unlock mode:" + mode); throw new IllegalStateException("Unknown unlock mode:" + security); } } return mode; Loading Loading
policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java +1 −27 Original line number Diff line number Diff line Loading @@ -106,10 +106,6 @@ public class KeyguardHostView extends KeyguardViewBase { private boolean mSafeModeEnabled; // We can use the profile manager to override security private ProfileManager mProfileManager; /*package*/ interface TransportCallback { void onListenerDetached(); void onListenerAttached(); Loading Loading @@ -142,8 +138,6 @@ public class KeyguardHostView extends KeyguardViewBase { mViewStateManager = new KeyguardViewStateManager(this); mProfileManager = (ProfileManager) context.getSystemService(Context.PROFILE_SERVICE); DevicePolicyManager dpm = (DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE); if (dpm != null) { Loading Loading @@ -883,31 +877,11 @@ public class KeyguardHostView extends KeyguardViewBase { showPrimarySecurityScreen(false); } private boolean isSecure() { SecurityMode mode = mSecurityModel.getSecurityMode(); switch (mode) { case Pattern: return mLockPatternUtils.isLockPatternEnabled() && mProfileManager.getActiveProfile().getScreenLockMode()!= Profile.LockMode.INSECURE; case Password: case PIN: return mLockPatternUtils.isLockPasswordEnabled() && mProfileManager.getActiveProfile().getScreenLockMode() != Profile.LockMode.INSECURE; case SimPin: case SimPuk: case Account: return true; case None: return false; default: throw new IllegalStateException("Unknown security mode " + mode); } } @Override public void wakeWhenReadyTq(int keyCode) { if (DEBUG) Log.d(TAG, "onWakeKey"); if (keyCode == KeyEvent.KEYCODE_MENU && isSecure()) { if (keyCode == KeyEvent.KEYCODE_MENU && mSecurityModel.getSecurityMode() != SecurityMode.None) { if (DEBUG) Log.d(TAG, "switching screens to unlock screen because wake key was MENU"); showSecurityScreen(SecurityMode.None); } else { Loading
policy/src/com/android/internal/policy/impl/keyguard/KeyguardSecurityModel.java +5 −17 Original line number Diff line number Diff line Loading @@ -88,45 +88,33 @@ public class KeyguardSecurityModel { } else if (simState == IccCardConstants.State.PUK_REQUIRED && mLockPatternUtils.isPukUnlockScreenEnable()) { mode = SecurityMode.SimPuk; } else { } else if (mProfileManager.getActiveProfile().getScreenLockMode() != Profile.LockMode.INSECURE) { final int security = mLockPatternUtils.getKeyguardStoredPasswordQuality(); switch (security) { case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC: if (mLockPatternUtils.isLockPasswordEnabled() && mProfileManager.getActiveProfile().getScreenLockMode() != Profile.LockMode.INSECURE) { if (mLockPatternUtils.isLockPasswordEnabled()) { mode = SecurityMode.PIN; } else { mode = SecurityMode.None; } break; case DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC: case DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC: case DevicePolicyManager.PASSWORD_QUALITY_COMPLEX: if (mLockPatternUtils.isLockPasswordEnabled() && mProfileManager.getActiveProfile().getScreenLockMode() != Profile.LockMode.INSECURE) { if (mLockPatternUtils.isLockPasswordEnabled()) { mode = SecurityMode.Password; } else { mode = SecurityMode.None; } break; case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING: case DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED: if (mLockPatternUtils.isLockPatternEnabled() && mProfileManager.getActiveProfile().getScreenLockMode() != Profile.LockMode.INSECURE) { if (mLockPatternUtils.isLockPatternEnabled()) { mode = mLockPatternUtils.isPermanentlyLocked() ? SecurityMode.Account : SecurityMode.Pattern; } else { mode = SecurityMode.None; } break; default: throw new IllegalStateException("Unknown unlock mode:" + mode); throw new IllegalStateException("Unknown unlock mode:" + security); } } return mode; Loading