From 372b3510b5de10db3bb65abe1a47dd314c2a78a8 Mon Sep 17 00:00:00 2001 From: Daeho Jeong Date: Wed, 18 May 2022 09:03:15 -0700 Subject: [PATCH] vold: fix the range of stopped state of idleMaint When it is stuck in runDevGC() for an unexpected reason, now it cannot prevent the other callers from entering into it again. Fix it. Bug: 232297944 Test: run "sm idle-maint run" twice & check whether they are overlapped Signed-off-by: Daeho Jeong Change-Id: I785c8aeebd8fcf58c34d9be9968d99634d0b420a --- IdleMaint.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/IdleMaint.cpp b/IdleMaint.cpp index 2bfe3d9..426be58 100644 --- a/IdleMaint.cpp +++ b/IdleMaint.cpp @@ -450,17 +450,17 @@ int RunIdleMaint(bool needGC, const android::sp& stopGc(paths); } + if (!gc_aborted) { + Trim(nullptr); + runDevGc(); + } + lk.lock(); idle_maint_stat = IdleMaintStats::kStopped; lk.unlock(); cv_stop.notify_one(); - if (!gc_aborted) { - Trim(nullptr); - runDevGc(); - } - if (listener) { android::os::PersistableBundle extras; listener->onFinished(0, extras);