Don't resume PowerStatsDataStorage read on Exception

If there is a problem with the PowerStatsDataStorage file, the read
should end, instead of catching the excpetion and resuming.

Fixes: 192639542
Test: atest PowerStatsServiceTest (the logcat should not be spammed with
many PowerStats errors)

Change-Id: If2617ab13a8177b75142d52bcad458f80eb5ed2c
This commit is contained in:
Michael Wachenschwanz
2021-07-26 22:27:50 -07:00
parent 72922c8a85
commit 9f6044a2bc

View File

@@ -124,12 +124,8 @@ public class PowerStatsDataStorage {
@Override
public void read(InputStream in) throws IOException {
while (in.available() > 0) {
try {
DataElement dataElement = new DataElement(in);
mCallback.onReadDataElement(dataElement.getData());
} catch (IOException e) {
Slog.e(TAG, "Failed to read from storage. " + e.getMessage());
}
DataElement dataElement = new DataElement(in);
mCallback.onReadDataElement(dataElement.getData());
}
}
}