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

Commit 6834b1e7 authored by Ashok Mutyala's avatar Ashok Mutyala
Browse files

Remove updateUsageBatteryStats in dump due to ANR

bgres-controller thread initiate update battery stats as part of system_server up , at the same time invoke dumpsys app battery which updates battery stats causes indefinite wait

Bug: 353142205

Test: system_server kill , start && dumpsys activity app-restrictions --proto
Change-Id: Ib2e9ac3c4115b00d15e1a77818725839b40bc61c
parent 92f0fc1e
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -818,8 +818,10 @@ final class AppBatteryTracker extends BaseAppStateTracker<AppBatteryPolicy>
    void dump(PrintWriter pw, String prefix) {
        pw.print(prefix);
        pw.println("APP BATTERY STATE TRACKER:");
        if (mInjector.getActivityManagerInternal().isBooted()) {
            // Force an update.
            updateBatteryUsageStatsIfNecessary(mInjector.currentTimeMillis(), true);
        }
        // Force a check.
        scheduleBgBatteryUsageStatsCheck();
        // Wait for its completion (as it runs in handler thread for the sake of thread safe)
@@ -878,8 +880,10 @@ final class AppBatteryTracker extends BaseAppStateTracker<AppBatteryPolicy>

    @Override
    void dumpAsProto(ProtoOutputStream proto, int uid) {
        if (mInjector.getActivityManagerInternal().isBooted()) {
            // Force an update.
            updateBatteryUsageStatsIfNecessary(mInjector.currentTimeMillis(), true);
        }
        synchronized (mLock) {
            final SparseArray<ImmutableBatteryUsage> uidConsumers = mUidBatteryUsageInWindow;
            if (uid != android.os.Process.INVALID_UID) {