Merge "vold: fix the range of stopped state of idleMaint" into tm-dev am: baee102002 am: cf75222aef

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/vold/+/18473902

Change-Id: I7a617370df2ccdb0370be6ef0c6ad3f1938e2421
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/IdleMaint.cpp b/IdleMaint.cpp
index 2bfe3d9..426be58 100644
--- a/IdleMaint.cpp
+++ b/IdleMaint.cpp
@@ -450,17 +450,17 @@
         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);