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

Commit 7f05f6a5 authored by Gavin Corkery's avatar Gavin Corkery
Browse files

Call startObservingHealth on handler thread

Both RescueParty and PackageWatchdog receive DeviceConfig callbacks.
RescueParty may act on this callback by calling startObservingHealth,
while PackageWatchdog will call updateConfigs. There may be a
contention for PackageWatchdog#mLock in this case. Move some of the
logic in startObservingHealth to the long task handler thread to avoid
this.

Bug: 150114865
Test: atest StagedRollbackTest
Test: atest RescuePartyTest
Change-Id: I74e1b21b7adddf35759e70211c47d31acfcae7f2
parent ea6a210c
Loading
Loading
Loading
Loading
+21 −18
Original line number Diff line number Diff line
@@ -315,6 +315,7 @@ public class PackageWatchdog {
        // causing any elapsed time to be deducted from all existing packages before we add new
        // packages. This maintains the invariant that the elapsed time for ALL (new and existing)
        // packages is the same.
        mLongTaskHandler.post(() -> {
            syncState("observing new packages");

            synchronized (mLock) {
@@ -337,6 +338,8 @@ public class PackageWatchdog {
            // Sync after we add the new packages to the observers. We may have received packges
            // requiring an earlier schedule than we are currently scheduled for.
            syncState("updated observers");
        });

    }

    /**