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

Commit 5dcfc0c1 authored by Jing Ji's avatar Jing Ji
Browse files

Clamp the scaling factor of battery usage in app battery tracker

Bug: 229035327
Bug: 203105544
Test: Manual
Test: atest FrameworksMockingServicesTests:BackgroundRestrictionTest
Change-Id: I39afeec2a5b57c63e839b710370bbc8a60af15b9
parent 66070d7c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -654,7 +654,7 @@ final class AppBatteryTracker extends BaseAppStateTracker<AppBatteryPolicy>
            final long start = stats.getStatsStartTimestamp();
            final long end = stats.getStatsEndTimestamp();
            final double scale = expectedDuration > 0
                    ? (expectedDuration * 1.0d) / (end - start) : 1.0d;
                    ? Math.min((expectedDuration * 1.0d) / (end - start), 1.0d) : 1.0d;
            final AppBatteryPolicy bgPolicy = mInjector.getPolicy();
            for (UidBatteryConsumer uidConsumer : uidConsumers) {
                // TODO: b/200326767 - as we are not supporting per proc state attribution yet,