Add functions to handle idle maintenance
runIdleMaint is equivalent with:
1. echo 1 > /sys/fs/f2fs/sdX/gc_urgent
2. wait until /sys/fs/f2fs/sdX/dirty_segments
<= threshold or timeout
3. echo 0 > /sys/fs/f2fs/sdX/gc_urgent
4. fstrim
abortIdleMaint forces the wait loop above to exit and
skips fstrim. However, if fstrim is already running,
abortIdleMaint will just leave it run to completion.
Test: adb shell sm idle-maint [run|abort]
Bug: 67776637
Change-Id: I4adff8d9b6bbd63bce41368cea55dc9e9b117eb6
diff --git a/VoldNativeService.h b/VoldNativeService.h
index 7ca72e5..d107138 100644
--- a/VoldNativeService.h
+++ b/VoldNativeService.h
@@ -66,6 +66,10 @@
binder::Status fstrim(int32_t fstrimFlags,
const android::sp<android::os::IVoldTaskListener>& listener);
+ binder::Status runIdleMaint(
+ const android::sp<android::os::IVoldTaskListener>& listener);
+ binder::Status abortIdleMaint(
+ const android::sp<android::os::IVoldTaskListener>& listener);
binder::Status mountAppFuse(int32_t uid, int32_t pid, int32_t mountId,
android::base::unique_fd* _aidl_return);