vold: add gc period in setGCUrgentPace

To make gc period changable, added a new gcPeriod parameter to
setGCUrgentPace.

Test: adb shell device_config put storage_native_boot smart_idle_maint_period 10
Bug: 202283480
Bug: 181079477
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Change-Id: I4e44a80ea5b51d9a7cde69d25e129dd0673b271f
diff --git a/IdleMaint.cpp b/IdleMaint.cpp
index 2fc0d4b..597d609 100644
--- a/IdleMaint.cpp
+++ b/IdleMaint.cpp
@@ -87,7 +87,7 @@
 static const int DEVGC_TIMEOUT_SEC = 120;
 static const int KBYTES_IN_SEGMENT = 2048;
 static const int MIN_GC_URGENT_SLEEP_TIME = 500;
-static const int ONE_HOUR_IN_MS = 3600000;
+static const int ONE_MINUTE_IN_MS = 60000;
 static const int GC_NORMAL_MODE = 0;
 static const int GC_URGENT_MID_MODE = 3;
 
@@ -531,7 +531,7 @@
 }
 
 void SetGCUrgentPace(int32_t neededSegments, int32_t minSegmentThreshold, float dirtyReclaimRate,
-                     float reclaimWeight) {
+                     float reclaimWeight, int32_t gcPeriod) {
     std::list<std::string> paths;
     bool needGC = true;
 
@@ -586,7 +586,7 @@
     if (neededSegments == 0) {
         sleepTime = MIN_GC_URGENT_SLEEP_TIME;
     } else {
-        sleepTime = ONE_HOUR_IN_MS / neededSegments;
+        sleepTime = gcPeriod * ONE_MINUTE_IN_MS / neededSegments;
         if (sleepTime < MIN_GC_URGENT_SLEEP_TIME) {
             sleepTime = MIN_GC_URGENT_SLEEP_TIME;
         }