Avoid reading XML file when it doesn't exist.

The XML file doesn't exist for first time OTA boot or clean device
flash, avoid reading from it.

Bug: b/181346262
Test: adb logcat no longer shows stack trace
Test: atest GameManagerServiceSettingsTests
Change-Id: I833004e9b85a49ce75c24afaeba413da3ca1d969
This commit is contained in:
Peiyong Lin
2021-03-07 22:01:19 +00:00
parent 13227f7a6f
commit a7f461fcdc

View File

@@ -137,6 +137,11 @@ public class GameManagerSettings {
boolean readPersistentDataLocked() {
mGameModes.clear();
if (!mSettingsFile.exists()) {
Slog.v(GameManagerService.TAG, "Settings file doesn't exists, skip reading");
return false;
}
try {
final FileInputStream str = mSettingsFile.openRead();