Close InputStream in BatteryStatsHelper
Bug: 17760659 Bug: 27376093 Change-Id: I5e6471f73b3258067fb670a4b66ddc51be62b6ec (cherry picked from commit e618b53081d9a173305b7c72cab4c2ed6ca2dcec)
This commit is contained in:
@@ -754,8 +754,7 @@ public final class BatteryStatsHelper {
|
||||
try {
|
||||
ParcelFileDescriptor pfd = service.getStatisticsStream();
|
||||
if (pfd != null) {
|
||||
FileInputStream fis = new ParcelFileDescriptor.AutoCloseInputStream(pfd);
|
||||
try {
|
||||
try (FileInputStream fis = new ParcelFileDescriptor.AutoCloseInputStream(pfd)) {
|
||||
byte[] data = readFully(fis, MemoryFile.getSize(pfd.getFileDescriptor()));
|
||||
Parcel parcel = Parcel.obtain();
|
||||
parcel.unmarshall(data, 0, data.length);
|
||||
|
||||
Reference in New Issue
Block a user