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,13 +247,17 @@ public class IccLockSettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updatePreferences() {
|
private void updatePreferences() {
|
||||||
|
if (mPinDialog != null) {
|
||||||
mPinDialog.setEnabled(mPhone != null);
|
mPinDialog.setEnabled(mPhone != null);
|
||||||
|
}
|
||||||
|
if (mPinToggle != null) {
|
||||||
mPinToggle.setEnabled(mPhone != null);
|
mPinToggle.setEnabled(mPhone != null);
|
||||||
|
|
||||||
if (mPhone != null) {
|
if (mPhone != null) {
|
||||||
mPinToggle.setChecked(mPhone.getIccCard().getIccLockEnabled());
|
mPinToggle.setChecked(mPhone.getIccCard().getIccLockEnabled());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getMetricsCategory() {
|
protected int getMetricsCategory() {
|
||||||
|
Reference in New Issue
Block a user