Fix the system crash issue when secondary user clicks any 802.1x AP on

Wifi Picker.

Catch the exception when keystore failed to list the certs

Bug: 73794111
Test: test it with clicking the Google-A on Wifi Picker.
Test: make ROBOTEST_FILTER="(WifiConfigControllerTest)"
RunSettingsRoboTests -j32
RunSettingsRoboTests: OK (12 tests)

Change-Id: I0db66730261c72ef35d1b299bacd2aed7710d247
This commit is contained in:
Ecco Park
2018-03-12 11:37:51 -07:00
parent ec9606addb
commit bffd531aa3
2 changed files with 34 additions and 2 deletions

View File

@@ -1216,6 +1216,11 @@ public class WifiConfigController implements TextWatcher,
}
}
@VisibleForTesting
KeyStore getKeyStore() {
return KeyStore.getInstance();
}
private void loadCertificates(
Spinner spinner,
String prefix,
@@ -1232,8 +1237,12 @@ public class WifiConfigController implements TextWatcher,
if (showUsePreinstalledCertOption) {
certs.add(mUseSystemCertsString);
}
certs.addAll(
Arrays.asList(KeyStore.getInstance().list(prefix, android.os.Process.WIFI_UID)));
try {
certs.addAll(
Arrays.asList(getKeyStore().list(prefix, android.os.Process.WIFI_UID)));
} catch (Exception e) {
Log.e(TAG, "can't get the certificate list from KeyStore");
}
certs.add(noCertificateString);
final ArrayAdapter<String> adapter = new ArrayAdapter<String>(