am 33987528: Merge "Fix inoperative "Forgot pattern" button when face unlock enabled" into jb-mr1-dev
* commit '339875283263dbbe3587388f94f603439e59af5f': Fix inoperative "Forgot pattern" button when face unlock enabled
This commit is contained in:
@@ -79,7 +79,7 @@ public class KeyguardHostView extends KeyguardViewBase {
|
|||||||
private boolean mEnableMenuKey;
|
private boolean mEnableMenuKey;
|
||||||
private boolean mIsVerifyUnlockOnly;
|
private boolean mIsVerifyUnlockOnly;
|
||||||
private boolean mEnableFallback; // TODO: This should get the value from KeyguardPatternView
|
private boolean mEnableFallback; // TODO: This should get the value from KeyguardPatternView
|
||||||
private SecurityMode mCurrentSecuritySelection = SecurityMode.None;
|
private SecurityMode mCurrentSecuritySelection = SecurityMode.Invalid;
|
||||||
|
|
||||||
protected Runnable mLaunchRunnable;
|
protected Runnable mLaunchRunnable;
|
||||||
|
|
||||||
@@ -433,7 +433,8 @@ public class KeyguardHostView extends KeyguardViewBase {
|
|||||||
*/
|
*/
|
||||||
private void showBackupSecurityScreen() {
|
private void showBackupSecurityScreen() {
|
||||||
if (DEBUG) Log.d(TAG, "showBackupSecurity()");
|
if (DEBUG) Log.d(TAG, "showBackupSecurity()");
|
||||||
showSecurityScreen(mSecurityModel.getBackupSecurityMode());
|
SecurityMode backup = mSecurityModel.getBackupSecurityMode(mCurrentSecuritySelection);
|
||||||
|
showSecurityScreen(backup);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean showNextSecurityScreenIfPresent() {
|
public boolean showNextSecurityScreenIfPresent() {
|
||||||
@@ -543,6 +544,45 @@ public class KeyguardHostView extends KeyguardViewBase {
|
|||||||
|
|
||||||
private KeyguardStatusViewManager mKeyguardStatusViewManager;
|
private KeyguardStatusViewManager mKeyguardStatusViewManager;
|
||||||
|
|
||||||
|
// Used to ignore callbacks from methods that are no longer current (e.g. face unlock).
|
||||||
|
// This avoids unwanted asynchronous events from messing with the state.
|
||||||
|
private KeyguardSecurityCallback mNullCallback = new KeyguardSecurityCallback() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void userActivity(long timeout) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showBackupSecurity() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOnDismissRunnable(Runnable runnable) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reportSuccessfulUnlockAttempt() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reportFailedUnlockAttempt() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isVerifyUnlockOnly() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getFailedAttempts() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dismiss(boolean securityVerified) {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reset() {
|
public void reset() {
|
||||||
mIsVerifyUnlockOnly = false;
|
mIsVerifyUnlockOnly = false;
|
||||||
@@ -568,9 +608,10 @@ public class KeyguardHostView extends KeyguardViewBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
boolean simPukFullScreen = getResources().getBoolean(R.bool.kg_sim_puk_account_full_screen);
|
boolean simPukFullScreen = getResources().getBoolean(R.bool.kg_sim_puk_account_full_screen);
|
||||||
if (view == null) {
|
int layoutId = getLayoutIdFor(securityMode);
|
||||||
|
if (view == null && layoutId != 0) {
|
||||||
final LayoutInflater inflater = LayoutInflater.from(mContext);
|
final LayoutInflater inflater = LayoutInflater.from(mContext);
|
||||||
View v = inflater.inflate(getLayoutIdFor(securityMode), this, false);
|
View v = inflater.inflate(layoutId, this, false);
|
||||||
mSecurityViewContainer.addView(v);
|
mSecurityViewContainer.addView(v);
|
||||||
updateSecurityView(v);
|
updateSecurityView(v);
|
||||||
|
|
||||||
@@ -617,8 +658,12 @@ public class KeyguardHostView extends KeyguardViewBase {
|
|||||||
KeyguardSecurityView newView = getSecurityView(securityMode);
|
KeyguardSecurityView newView = getSecurityView(securityMode);
|
||||||
|
|
||||||
// Emulate Activity life cycle
|
// Emulate Activity life cycle
|
||||||
oldView.onPause();
|
if (oldView != null) {
|
||||||
|
oldView.onPause();
|
||||||
|
oldView.setKeyguardCallback(mNullCallback); // ignore requests from old view
|
||||||
|
}
|
||||||
newView.onResume();
|
newView.onResume();
|
||||||
|
newView.setKeyguardCallback(mCallback);
|
||||||
|
|
||||||
final boolean needsInput = newView.needsInput();
|
final boolean needsInput = newView.needsInput();
|
||||||
if (mViewMediatorCallback != null) {
|
if (mViewMediatorCallback != null) {
|
||||||
@@ -749,7 +794,7 @@ public class KeyguardHostView extends KeyguardViewBase {
|
|||||||
case SimPin: return R.layout.keyguard_sim_pin_view;
|
case SimPin: return R.layout.keyguard_sim_pin_view;
|
||||||
case SimPuk: return R.layout.keyguard_sim_puk_view;
|
case SimPuk: return R.layout.keyguard_sim_puk_view;
|
||||||
default:
|
default:
|
||||||
throw new RuntimeException("No layout for securityMode " + securityMode);
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public class KeyguardSecurityModel {
|
|||||||
* @see com.android.internal.policy.impl.LockPatternKeyguardView#getUnlockMode()
|
* @see com.android.internal.policy.impl.LockPatternKeyguardView#getUnlockMode()
|
||||||
*/
|
*/
|
||||||
enum SecurityMode {
|
enum SecurityMode {
|
||||||
|
Invalid, // NULL state
|
||||||
None, // No security enabled
|
None, // No security enabled
|
||||||
Pattern, // Unlock by drawing a pattern.
|
Pattern, // Unlock by drawing a pattern.
|
||||||
Password, // Unlock by entering a password or PIN
|
Password, // Unlock by entering a password or PIN
|
||||||
@@ -53,7 +54,7 @@ public class KeyguardSecurityModel {
|
|||||||
* Returns true if biometric unlock is installed and selected. If this returns false there is
|
* Returns true if biometric unlock is installed and selected. If this returns false there is
|
||||||
* no need to even construct the biometric unlock.
|
* no need to even construct the biometric unlock.
|
||||||
*/
|
*/
|
||||||
private boolean isBiometricUnlockEnabled() {
|
boolean isBiometricUnlockEnabled() {
|
||||||
return mLockPatternUtils.usingBiometricWeak()
|
return mLockPatternUtils.usingBiometricWeak()
|
||||||
&& mLockPatternUtils.isBiometricWeakInstalled();
|
&& mLockPatternUtils.isBiometricWeakInstalled();
|
||||||
}
|
}
|
||||||
@@ -128,15 +129,7 @@ public class KeyguardSecurityModel {
|
|||||||
*
|
*
|
||||||
* @return backup method or current security mode
|
* @return backup method or current security mode
|
||||||
*/
|
*/
|
||||||
SecurityMode getBackupSecurityMode() {
|
SecurityMode getBackupSecurityMode(SecurityMode mode) {
|
||||||
SecurityMode mode = getSecurityMode();
|
|
||||||
|
|
||||||
// Note that getAlternateFor() cannot be called here because we want to get the backup for
|
|
||||||
// biometric unlock even if it's suppressed; it just has to be enabled.
|
|
||||||
if (isBiometricUnlockEnabled()
|
|
||||||
&& (mode == SecurityMode.Password || mode == SecurityMode.Pattern)) {
|
|
||||||
mode = SecurityMode.Biometric;
|
|
||||||
}
|
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
case Biometric:
|
case Biometric:
|
||||||
return getSecurityMode();
|
return getSecurityMode();
|
||||||
|
|||||||
Reference in New Issue
Block a user