Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c771c23 authored by Vova Sharaienko's avatar Vova Sharaienko
Browse files

StatsPullAtomCallbackImpl: fixed StrictMode policy violation

- The caller of getBatteryUsageStats must call close() on the resulting BatteryUsageStats object

Flag: com.android.server.power.optimization.add_battery_usage_stats_slice_atom

Bug: 353536815
Test: adb shell cmd stats pull-source 10209; and review logcat for warnings
Change-Id: I038464c66bd1759a29637c0d994be6e09e0f806b
parent 74fe960d
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1122,7 +1122,11 @@ public final class BatteryStatsService extends IBatteryStats.Stub
                    throw new UnsupportedOperationException("Unknown tagId=" + atomTag);
            }
            final byte[] statsProto = bus.getStatsProto();

            try {
                bus.close();
            } catch (IOException e) {
                Slog.w(TAG, "Failure close BatteryUsageStats", e);
            }
            data.add(FrameworkStatsLog.buildStatsEvent(atomTag, statsProto));

            return StatsManager.PULL_SUCCESS;