Run gc + fstrim for idle maintenance
Test:
adb shell cmd jobscheduler get-job-state android 808
adb shell cmd jobscheduler run android 808
adb shell cmd jobscheduler timeout android 808
Bug: 67776637
Change-Id: I8e0d01891a689f9a9181160611657e2cda531c0f
diff --git a/services/core/java/com/android/server/MountServiceIdler.java b/services/core/java/com/android/server/MountServiceIdler.java
index d8bd0bb..1891ba9 100644
--- a/services/core/java/com/android/server/MountServiceIdler.java
+++ b/services/core/java/com/android/server/MountServiceIdler.java
@@ -72,7 +72,7 @@
synchronized (mFinishCallback) {
mStarted = true;
}
- ms.runIdleMaintenance(mFinishCallback);
+ ms.runIdleMaint(mFinishCallback);
}
return ms != null;
}
@@ -82,8 +82,12 @@
// Once we kick off the fstrim we aren't actually interruptible; just note
// that we don't need to call jobFinished(), and let everything happen in
// the callback from the mount service.
- synchronized (mFinishCallback) {
- mStarted = false;
+ StorageManagerService ms = StorageManagerService.sSelf;
+ if (ms != null) {
+ ms.abortIdleMaint(mFinishCallback);
+ synchronized (mFinishCallback) {
+ mStarted = false;
+ }
}
return false;
}