Close InputStream in BatteryStatsHelper

Bug: 17760659
Bug: 27376093
Change-Id: I5e6471f73b3258067fb670a4b66ddc51be62b6ec
(cherry picked from commit e618b53081d9a173305b7c72cab4c2ed6ca2dcec)
This commit is contained in:
Nimrod Gileadi
2016-02-29 12:33:13 +00:00
parent f3179cf56a
commit e9be5da686

View File

@@ -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);