Add a generic microbenchmark for opening apps.
am: a7d6fbfc9c

Change-Id: I2356da2359e5f14b6b97bf47b5dd7259e56746ea
(cherry picked from commit 36555e4d713defc6c2bbf8f3fb21e6d63a2f877c)

Bug: 142557911
Test: manual

Merged-In: I6af93061866cd529b17a88ee104b47ea66990027
Merged-In: I02c9b5dca258cef11d059d9f136d9abf3390d996
diff --git a/tests/health/scenarios/tests/Android.bp b/tests/health/scenarios/tests/Android.bp
index 69b1ff1..9ac9a37 100644
--- a/tests/health/scenarios/tests/Android.bp
+++ b/tests/health/scenarios/tests/Android.bp
@@ -50,6 +50,7 @@
         "guava",
         "longevity-device-lib",
         "microbenchmark-device-lib",
+        "platform-test-options",
         "platform-test-rules",
     ],
 }
diff --git a/tests/health/scenarios/tests/src/android/platform/test/scenario/generic/OpenAppMicrobenchmark.java b/tests/health/scenarios/tests/src/android/platform/test/scenario/generic/OpenAppMicrobenchmark.java
new file mode 100644
index 0000000..8e950be
--- /dev/null
+++ b/tests/health/scenarios/tests/src/android/platform/test/scenario/generic/OpenAppMicrobenchmark.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.platform.test.scenario.generic;
+
+import android.platform.test.microbenchmark.Microbenchmark;
+import android.platform.test.rule.CompilationFilterRule;
+import android.platform.test.rule.DropCachesRule;
+import android.platform.test.rule.KillAppsRule;
+import android.platform.test.rule.PressHomeRule;
+
+import org.junit.Rule;
+import org.junit.rules.RuleChain;
+import org.junit.runner.RunWith;
+
+@RunWith(Microbenchmark.class)
+public class OpenAppMicrobenchmark extends OpenApp {
+    // Method-level rules
+    @Rule
+    public RuleChain rules =
+            RuleChain.outerRule(new KillAppsRule(mPkgOption.get()))
+                    .around(new DropCachesRule())
+                    .around(new CompilationFilterRule(mPkgOption.get()))
+                    .around(new PressHomeRule());
+}