NullPointerException when running monkey test in IccLockSettings
In Android N, finish() in onCreate() cannot avoid onViewCreated() lifecycle in Fragment, so a crash occurs in com.android.settings.IccLockSettings because of insecure call in updatePreference(). It's a tiny bug only appears when running monkey test. Test: run monkey test with page IccLockSettings. This bug was reported to Google Issue Tracker. Link: https://issuetracker.google.com/issues/38152568 Change-Id: I143b046fd7ac5ffba55e51254c7dd068274d342e Signed-off-by: xudiwen <xudiwen@xiaomi.com>
This commit is contained in:
@@ -247,11 +247,15 @@ public class IccLockSettings extends SettingsPreferenceFragment
|
||||
}
|
||||
|
||||
private void updatePreferences() {
|
||||
mPinDialog.setEnabled(mPhone != null);
|
||||
mPinToggle.setEnabled(mPhone != null);
|
||||
if (mPinDialog != null) {
|
||||
mPinDialog.setEnabled(mPhone != null);
|
||||
}
|
||||
if (mPinToggle != null) {
|
||||
mPinToggle.setEnabled(mPhone != null);
|
||||
|
||||
if (mPhone != null) {
|
||||
mPinToggle.setChecked(mPhone.getIccCard().getIccLockEnabled());
|
||||
if (mPhone != null) {
|
||||
mPinToggle.setChecked(mPhone.getIccCard().getIccLockEnabled());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user