Merge "Fix "Display root layer not found""
diff --git a/build/tasks/tests/instrumentation_test_list.mk b/build/tasks/tests/instrumentation_test_list.mk
index f6761d9..5ef9952 100644
--- a/build/tasks/tests/instrumentation_test_list.mk
+++ b/build/tasks/tests/instrumentation_test_list.mk
@@ -70,9 +70,6 @@
     FrameworksPrivacyLibraryTests \
     SettingsUITests \
     ExtServicesUnitTests\
-    NexusLauncherOutOfProcTests\
-    NexusLauncherDebug\
-    NexusLauncherTests\
     FrameworksNetSmokeTests\
 
 
diff --git a/build/tasks/tests/native_test_list.mk b/build/tasks/tests/native_test_list.mk
index 0ff1395..0d7693a 100644
--- a/build/tasks/tests/native_test_list.mk
+++ b/build/tasks/tests/native_test_list.mk
@@ -130,7 +130,6 @@
     NeuralNetworksTest_mt_static \
     NeuralNetworksTest_operations \
     NeuralNetworksTest_static \
-    NeuralNetworksTest_static_asan \
     SurfaceFlinger_test \
     lmkd_unit_test \
     vrflinger_test
diff --git a/build/tasks/tests/platform_test_list.mk b/build/tasks/tests/platform_test_list.mk
index d77a7d1..e235b43 100644
--- a/build/tasks/tests/platform_test_list.mk
+++ b/build/tasks/tests/platform_test_list.mk
@@ -86,7 +86,6 @@
     PermissionFunctionalTests \
     PermissionTestAppMV1 \
     PermissionUtils \
-    PlatformScenarioTests \
     PowerPerfTest \
     root-canal \
     SettingsUITests \
diff --git a/libraries/app-helpers/interfaces/handheld/src/android/platform/helpers/IPhotosHelper.java b/libraries/app-helpers/interfaces/handheld/src/android/platform/helpers/IPhotosHelper.java
index 85b243d..15684fd 100644
--- a/libraries/app-helpers/interfaces/handheld/src/android/platform/helpers/IPhotosHelper.java
+++ b/libraries/app-helpers/interfaces/handheld/src/android/platform/helpers/IPhotosHelper.java
@@ -112,22 +112,22 @@
     public void openPicture(int index);
 
     /**
-     * Setup expectations: Photos is open and a picture album is open.
+     * Setup expectations: Photos is open and a picture is open.
      *
-     * This method will scroll the picture album in the specified direction.
+     * <p>This method will scroll to next or previous picture in the specified direction.
      *
      * @param direction The direction to scroll, must be LEFT or RIGHT.
-     * @return Returns whether album can be still scrolled in the given direction
+     * @return Returns whether picture can be still scrolled in the given direction
      */
-    public boolean scrollAlbum(Direction direction);
+    public boolean scrollPicture(Direction direction);
 
     /**
-     * Setup expectations: Photos is open and a picture folder is open.
+     * Setup expectations: Photos is open and a page contains pictures or albums is open.
      *
-     * This method will scroll the Photos grid view in the specified direction.
+     * <p>This method will scroll the page in the specified direction.
      *
      * @param direction The direction of the scroll, must be UP or DOWN.
      * @return Returns whether the object can still scroll in the given direction
      */
-    public boolean scrollGridView(Direction direction);
+    public boolean scrollPage(Direction direction);
 }
diff --git a/libraries/collectors-helper/jank/src/com/android/helpers/SfStatsCollectionHelper.java b/libraries/collectors-helper/jank/src/com/android/helpers/SfStatsCollectionHelper.java
index aaa5d2d..b2c0948 100644
--- a/libraries/collectors-helper/jank/src/com/android/helpers/SfStatsCollectionHelper.java
+++ b/libraries/collectors-helper/jank/src/com/android/helpers/SfStatsCollectionHelper.java
@@ -37,7 +37,8 @@
 
     private static final String LOG_TAG = SfStatsCollectionHelper.class.getSimpleName();
 
-    private static final Pattern KEY_VALUE_PATTERN = Pattern.compile("^(\\w+)\\s+=\\s+(\\S+)");
+    private static final Pattern KEY_VALUE_PATTERN =
+            Pattern.compile("^(\\w+)\\s+=\\s+(\\d+\\.?\\d*|.*).*");
     private static final Pattern HISTOGRAM_PATTERN =
             Pattern.compile("([^\\n]+)\\n((\\d+ms=\\d+\\s+)+)");
 
diff --git a/libraries/collectors-helper/jank/test/src/com/android/helpers/SfStatsCollectionHelperTest.java b/libraries/collectors-helper/jank/test/src/com/android/helpers/SfStatsCollectionHelperTest.java
index 3d851ea..c986a67 100644
--- a/libraries/collectors-helper/jank/test/src/com/android/helpers/SfStatsCollectionHelperTest.java
+++ b/libraries/collectors-helper/jank/test/src/com/android/helpers/SfStatsCollectionHelperTest.java
@@ -85,7 +85,25 @@
                     + "post2present histogram is as below:\n"
                     + "0ms=0 1ms=0 2ms=0 3ms=0 4ms=0 5ms=0 6ms=0 7ms=0 8ms=264 9ms=0\n"
                     + "post2acquire histogram is as below:\n"
-                    + "0ms=0 1ms=0 2ms=0 3ms=0 4ms=0 5ms=0 6ms=0 7ms=0 8ms=264 9ms=0";
+                    + "0ms=0 1ms=0 2ms=0 3ms=0 4ms=0 5ms=0 6ms=0 7ms=0 8ms=264 9ms=0\n"
+                    + "\n"
+                    + "layerName = SurfaceView - com.mxtech.videoplayer.ad/com.mxtech.videoplayer.ad.ActivityScreen#0\n"
+                    + "packageName = \n"
+                    + "totalFrames = 2352\n"
+                    + "droppedFrames = 0\n"
+                    + "averageFPS = 59.999\n"
+                    + "present2present histogram is as below:\n"
+                    + "0ms=0 1ms=0 2ms=0 3ms=0 4ms=0 5ms=0 6ms=0 7ms=0 8ms=2352 9ms=0\n"
+                    + "latch2present histogram is as below:\n"
+                    + "0ms=0 1ms=0 2ms=0 3ms=0 4ms=0 5ms=0 6ms=0 7ms=0 8ms=2352 9ms=0\n"
+                    + "desired2present histogram is as below:\n"
+                    + "0ms=0 1ms=0 2ms=0 3ms=0 4ms=0 5ms=0 6ms=0 7ms=0 8ms=2352 9ms=0\n"
+                    + "acquire2present histogram is as below:\n"
+                    + "0ms=0 1ms=0 2ms=0 3ms=0 4ms=0 5ms=0 6ms=0 7ms=0 8ms=2352 9ms=0\n"
+                    + "post2present histogram is as below:\n"
+                    + "0ms=0 1ms=0 2ms=0 3ms=0 4ms=0 5ms=0 6ms=0 7ms=0 8ms=2352 9ms=0\n"
+                    + "post2acquire histogram is as below:\n"
+                    + "0ms=0 1ms=0 2ms=0 3ms=0 4ms=0 5ms=0 6ms=0 7ms=0 8ms=2352 9ms=0";
 
     private static final String LOG_TAG = SfStatsCollectionHelperTest.class.getSimpleName();
 
@@ -140,6 +158,27 @@
                                 constructKey(
                                         SFSTATS_METRICS_PREFIX,
                                         "GLOBAL",
+                                        "clientCompositionFrames".toUpperCase())))
+                .isEqualTo(Double.valueOf(0));
+        assertThat(
+                        metrics.get(
+                                constructKey(
+                                        SFSTATS_METRICS_PREFIX,
+                                        "GLOBAL",
+                                        "displayOnTime".toUpperCase())))
+                .isEqualTo(Double.valueOf(2485421));
+        assertThat(
+                        metrics.get(
+                                constructKey(
+                                        SFSTATS_METRICS_PREFIX,
+                                        "GLOBAL",
+                                        "totalP2PTime".toUpperCase())))
+                .isEqualTo(Double.valueOf(2674034));
+        assertThat(
+                        metrics.get(
+                                constructKey(
+                                        SFSTATS_METRICS_PREFIX,
+                                        "GLOBAL",
                                         "FRAME_CPU_DURATION_AVG")))
                 .isEqualTo(Double.valueOf(5.5));
         assertThat(
@@ -191,6 +230,27 @@
                                         "com.google.android.nexuslauncher.NexusLauncherActivity#0",
                                         "AVERAGE_FPS")))
                 .isEqualTo(84.318);
+        assertThat(
+                        metrics.get(
+                                constructKey(
+                                        SFSTATS_METRICS_PREFIX,
+                                        "SurfaceView - com.mxtech.videoplayer.ad/com.mxtech.videoplayer.ad.ActivityScreen#0",
+                                        "TOTAL_FRAMES")))
+                .isEqualTo(Double.valueOf(2352));
+        assertThat(
+                        metrics.get(
+                                constructKey(
+                                        SFSTATS_METRICS_PREFIX,
+                                        "SurfaceView - com.mxtech.videoplayer.ad/com.mxtech.videoplayer.ad.ActivityScreen#0",
+                                        "DROPPED_FRAMES")))
+                .isEqualTo(Double.valueOf(0));
+        assertThat(
+                        metrics.get(
+                                constructKey(
+                                        SFSTATS_METRICS_PREFIX,
+                                        "SurfaceView - com.mxtech.videoplayer.ad/com.mxtech.videoplayer.ad.ActivityScreen#0",
+                                        "AVERAGE_FPS")))
+                .isEqualTo(59.999);
         mHelper.stopCollecting();
     }
 
diff --git a/tests/health/scenarios/src/android/platform/test/scenario/system/ScreenOff.java b/tests/health/scenarios/src/android/platform/test/scenario/system/ScreenOff.java
index 1f5e234..a2e1290 100644
--- a/tests/health/scenarios/src/android/platform/test/scenario/system/ScreenOff.java
+++ b/tests/health/scenarios/src/android/platform/test/scenario/system/ScreenOff.java
@@ -57,8 +57,11 @@
     @After
     public void tearDown() throws RemoteException {
         if (mTurnScreenBackOn.get()) {
-            mDevice.wakeUp();
+            // Wake up the display. wakeUp() is not used here as when the duration is short, the
+            // device might register a double power button press and launch camera.
+            mDevice.pressMenu();
             mDevice.waitForIdle();
+            // Unlock the screen.
             mDevice.pressMenu();
             mDevice.waitForIdle();
         }