Invoke close() method for BatteryUsageStats to close cursor window

invoke close() method for BatteryUsageStats to close cursor window,
since BatteryUsageStats will implement "Closeable" interface in T.
(from Dimitri's request)

Bug: 201229421
Test: make SettingsRoboTests
Change-Id: Ibfca404d00cce51405cffddb636f685869ac130b
This commit is contained in:
ykhung
2021-09-29 00:44:11 +08:00
parent 96a8e63ebd
commit 454698d97e
4 changed files with 43 additions and 3 deletions

View File

@@ -405,6 +405,11 @@ public class BatteryUtils {
batteryUsageStats, estimate, elapsedRealtimeUs, false /* shortString */);
BatteryUtils.logRuntime(tag, "BatteryInfoLoader.loadInBackground", startTime);
try {
batteryUsageStats.close();
} catch (Exception e) {
Log.e(TAG, "BatteryUsageStats.close() failed", e);
}
return batteryInfo;
}