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

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

Change-Id: Ib1e14c92c1fc2671d182a34a0806dc1bdb480dd2
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);