Excessive battery usage fix.

Using wake to forcefully wake up the looper instead of 1s timeout.

Fixed: 168156055
Test: atest ApkVerityTest:com.android.apkverity.ApkVerityTest PackageManagerShellCommandTest PackageManagerShellCommandIncrementalTest IncrementalServiceTest
Change-Id: If65f65f9214b34bf057ed5f1877348d835251d14
Merged-In: If65f65f9214b34bf057ed5f1877348d835251d14
This commit is contained in:
Alex Buynytskyy
2020-09-22 11:39:53 -07:00
parent 8abad0504e
commit bd8444d1e3

View File

@@ -305,6 +305,7 @@ IncrementalService::~IncrementalService() {
}
mJobCondition.notify_all();
mJobProcessor.join();
mLooper->wake();
mCmdLooperThread.join();
mTimedQueue->stop();
// Ensure that mounts are destroyed while the service is still valid.
@@ -1377,7 +1378,7 @@ bool IncrementalService::mountExistingImage(std::string_view root) {
}
void IncrementalService::runCmdLooper() {
constexpr auto kTimeoutMsecs = 1000;
constexpr auto kTimeoutMsecs = -1;
while (mRunning.load(std::memory_order_relaxed)) {
mLooper->pollAll(kTimeoutMsecs);
}