Revert "Reverted the sleep scenario to before using test options."

This reverts commit e30fc4b61f0b8ef0fbead649e6ff627048c4d17f.

Reason for revert: root cause for b/138307123 has been fixed, so reverting this temporary fix.

Bug: 138307123
Change-Id: Ie0879de49c19a46a6aaeab95640457af894d76fa
diff --git a/tests/health/scenarios/src/android/platform/test/scenario/sleep/Idle.java b/tests/health/scenarios/src/android/platform/test/scenario/sleep/Idle.java
index 7ed3278..882523c 100644
--- a/tests/health/scenarios/src/android/platform/test/scenario/sleep/Idle.java
+++ b/tests/health/scenarios/src/android/platform/test/scenario/sleep/Idle.java
@@ -17,10 +17,10 @@
 package android.platform.test.scenario.sleep;
 
 import android.os.SystemClock;
+import android.platform.test.option.LongOption;
 import android.platform.test.scenario.annotation.Scenario;
-import androidx.test.InstrumentationRegistry;
 
-import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
@@ -31,26 +31,10 @@
 @Scenario
 @RunWith(JUnit4.class)
 public class Idle {
-    private static final String DURATION_OPTION = "durationMs";
-    private static final String DURATION_DEFAULT = "1000";
-
-    private long mDurationMs = 0L;
-
-    @Before
-    public void setUp() {
-        String durationMsString =
-                InstrumentationRegistry.getArguments().getString(DURATION_OPTION, DURATION_DEFAULT);
-        try {
-            mDurationMs = Long.parseLong(durationMsString);
-        } catch (NumberFormatException e) {
-            throw new IllegalArgumentException(
-                    String.format(
-                            "Failed to parse option %s: %s", DURATION_OPTION, durationMsString));
-        }
-    }
+    @Rule public final LongOption mDurationMs = new LongOption("durationMs").setDefault(1000L);
 
     @Test
     public void testDoingNothing() {
-        SystemClock.sleep(mDurationMs);
+        SystemClock.sleep(mDurationMs.get());
     }
 }