Fix for NPE with pattern recovery (issue 7341237)
-> Dealt with this NPE, and guarded against all related NPEs (which probably can't happen, but given the stakes of a system crash, this is safer). Change-Id: I3c207839ae0279033b6f3dad791d710b19415439
This commit is contained in:
@@ -84,6 +84,9 @@ public class KeyguardAccountView extends LinearLayout implements KeyguardSecurit
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
|
||||
// We always set a dummy NavigationManager to avoid null checks
|
||||
mSecurityMessageDisplay = new KeyguardNavigationManager(null);
|
||||
|
||||
mLogin = (EditText) findViewById(R.id.login);
|
||||
mLogin.setFilters(new InputFilter[] { new LoginFilter.UsernameFilterGeneric() } );
|
||||
mLogin.addTextChangedListener(this);
|
||||
@@ -315,7 +318,8 @@ public class KeyguardAccountView extends LinearLayout implements KeyguardSecurit
|
||||
|
||||
@Override
|
||||
public void setSecurityMessageDisplay(SecurityMessageDisplay display) {
|
||||
mSecurityMessageDisplay = display;
|
||||
mSecurityMessageDisplay = display;
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,16 +23,20 @@ public class KeyguardNavigationManager implements SecurityMessageDisplay {
|
||||
private TextView mMessageArea;
|
||||
|
||||
public KeyguardNavigationManager(TextView messageArea) {
|
||||
mMessageArea = messageArea;
|
||||
mMessageArea.setSelected(true); // Make marquee work
|
||||
if (messageArea != null) {
|
||||
mMessageArea = messageArea;
|
||||
mMessageArea.setSelected(true); // Make marquee work
|
||||
}
|
||||
}
|
||||
|
||||
public void setMessage(CharSequence msg, boolean important) {
|
||||
if (mMessageArea == null) return;
|
||||
mMessageArea.setText(msg);
|
||||
mMessageArea.announceForAccessibility(mMessageArea.getText());
|
||||
}
|
||||
|
||||
public void setMessage(int resId, boolean important) {
|
||||
if (mMessageArea == null) return;
|
||||
if (resId != 0) {
|
||||
mMessageArea.setText(resId);
|
||||
mMessageArea.announceForAccessibility(mMessageArea.getText());
|
||||
@@ -42,6 +46,7 @@ public class KeyguardNavigationManager implements SecurityMessageDisplay {
|
||||
}
|
||||
|
||||
public void setMessage(int resId, boolean important, Object... formatArgs) {
|
||||
if (mMessageArea == null) return;
|
||||
if (resId != 0) {
|
||||
mMessageArea.setText(mMessageArea.getContext().getString(resId, formatArgs));
|
||||
mMessageArea.announceForAccessibility(mMessageArea.getText());
|
||||
|
||||
@@ -109,6 +109,9 @@ public class KeyguardPasswordView extends LinearLayout
|
||||
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
// We always set a dummy NavigationManager to avoid null checks
|
||||
mSecurityMessageDisplay = new KeyguardNavigationManager(null);
|
||||
|
||||
mLockPatternUtils = new LockPatternUtils(mContext); // TODO: use common one
|
||||
|
||||
final int quality = mLockPatternUtils.getKeyguardStoredPasswordQuality();
|
||||
@@ -366,10 +369,10 @@ public class KeyguardPasswordView extends LinearLayout
|
||||
public void afterTextChanged(Editable s) {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setSecurityMessageDisplay(SecurityMessageDisplay display) {
|
||||
mSecurityMessageDisplay = display;
|
||||
mSecurityMessageDisplay = display;
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -111,6 +111,9 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
|
||||
// We always set a dummy NavigationManager to avoid null checks
|
||||
mSecurityMessageDisplay = new KeyguardNavigationManager(null);
|
||||
|
||||
mLockPatternUtils = mLockPatternUtils == null
|
||||
? new LockPatternUtils(mContext) : mLockPatternUtils;
|
||||
|
||||
@@ -371,7 +374,8 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
|
||||
|
||||
@Override
|
||||
public void setSecurityMessageDisplay(SecurityMessageDisplay display) {
|
||||
mSecurityMessageDisplay = display;
|
||||
mSecurityMessageDisplay = display;
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +76,9 @@ public class KeyguardSimPinView extends LinearLayout
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
|
||||
// We always set a dummy NavigationManager to avoid null checks
|
||||
mSecurityMessageDisplay = new KeyguardNavigationManager(null);
|
||||
|
||||
mPinEntry = (EditText) findViewById(R.id.sim_pin_entry);
|
||||
mPinEntry.setOnEditorActionListener(this);
|
||||
mPinEntry.addTextChangedListener(this);
|
||||
@@ -110,9 +113,7 @@ public class KeyguardSimPinView extends LinearLayout
|
||||
|
||||
public void reset() {
|
||||
// start fresh
|
||||
if (mSecurityMessageDisplay != null) {
|
||||
mSecurityMessageDisplay.setMessage(R.string.kg_sim_pin_instructions, true);
|
||||
}
|
||||
mSecurityMessageDisplay.setMessage(R.string.kg_sim_pin_instructions, true);
|
||||
|
||||
// make sure that the number of entered digits is consistent when we
|
||||
// erase the SIM unlock code, including orientation changes.
|
||||
|
||||
@@ -107,9 +107,7 @@ public class KeyguardSimPukView extends LinearLayout implements View.OnClickList
|
||||
mPinText="";
|
||||
mPukText="";
|
||||
state = ENTER_PUK;
|
||||
if (mSecurityMessageDisplay != null) {
|
||||
mSecurityMessageDisplay.setMessage(R.string.kg_puk_enter_puk_hint, true);
|
||||
}
|
||||
mSecurityMessageDisplay.setMessage(R.string.kg_puk_enter_puk_hint, true);
|
||||
mSimPinEntry.requestFocus();
|
||||
}
|
||||
}
|
||||
@@ -132,6 +130,9 @@ public class KeyguardSimPukView extends LinearLayout implements View.OnClickList
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
|
||||
// We always set a dummy NavigationManager to avoid null checks
|
||||
mSecurityMessageDisplay = new KeyguardNavigationManager(null);
|
||||
|
||||
mSimPinEntry = (TextView) findViewById(R.id.sim_pin_entry);
|
||||
mSimPinEntry.setOnEditorActionListener(this);
|
||||
mSimPinEntry.addTextChangedListener(this);
|
||||
|
||||
Reference in New Issue
Block a user