Fix check for task bar assertions on OpenAppFromNotificationWarm

Test is incorrectly running for phones and not for tablets at the moment

Also fix other broken nav bar tests

Test: atest FlickerTests WMShellFlickerTests
Change-Id: I4215feaa640d6d35be88c7b9b84358298139240b
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt
index eddb553..c6a7c88 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt
@@ -20,10 +20,10 @@
 import com.android.server.wm.flicker.helpers.WindowUtils
 import com.android.server.wm.flicker.traces.region.RegionSubject
 import com.android.server.wm.traces.common.ComponentNameMatcher
-import com.android.server.wm.traces.common.IComponentMatcher
+import com.android.server.wm.traces.common.IComponentNameMatcher
 
 /**
- * Checks that [ComponentMatcher.STATUS_BAR] window is visible and above the app windows in
+ * Checks that [ComponentNameMatcher.STATUS_BAR] window is visible and above the app windows in
  * all WM trace entries
  */
 fun FlickerTestParameter.statusBarWindowIsAlwaysVisible() {
@@ -33,7 +33,7 @@
 }
 
 /**
- * Checks that [ComponentMatcher.NAV_BAR] window is visible and above the app windows in
+ * Checks that [ComponentNameMatcher.NAV_BAR] window is visible and above the app windows in
  * all WM trace entries
  */
 fun FlickerTestParameter.navBarWindowIsAlwaysVisible() {
@@ -43,20 +43,36 @@
 }
 
 /**
- * Checks that [ComponentMatcher.NAV_BAR] window is visible and above the app windows at the start
+ * Checks that [ComponentNameMatcher.NAV_BAR] window is visible and above the app windows at the start
  * and end of the WM trace
  */
 fun FlickerTestParameter.navBarWindowIsVisibleAtStartAndEnd() {
+    this.navBarWindowIsVisibleAtStart()
+    this.navBarWindowIsVisibleAtEnd()
+}
+
+/**
+ * Checks that [ComponentNameMatcher.NAV_BAR] window is visible and above the app windows at the start
+ * of the WM trace
+ */
+fun FlickerTestParameter.navBarWindowIsVisibleAtStart() {
     assertWmStart {
         this.isAboveAppWindowVisible(ComponentNameMatcher.NAV_BAR)
     }
+}
+
+/**
+ * Checks that [ComponentNameMatcher.NAV_BAR] window is visible and above the app windows at the
+ * end of the WM trace
+ */
+fun FlickerTestParameter.navBarWindowIsVisibleAtEnd() {
     assertWmEnd {
         this.isAboveAppWindowVisible(ComponentNameMatcher.NAV_BAR)
     }
 }
 
 /**
- * Checks that [ComponentMatcher.TASK_BAR] window is visible and above the app windows in
+ * Checks that [ComponentNameMatcher.TASK_BAR] window is visible and above the app windows in
  * all WM trace entries
  */
 fun FlickerTestParameter.taskBarWindowIsAlwaysVisible() {
@@ -66,7 +82,7 @@
 }
 
 /**
- * Checks that [ComponentMatcher.TASK_BAR] window is visible and above the app windows in
+ * Checks that [ComponentNameMatcher.TASK_BAR] window is visible and above the app windows in
  * all WM trace entries
  */
 fun FlickerTestParameter.taskBarWindowIsVisibleAtEnd() {
@@ -109,20 +125,34 @@
 }
 
 /**
- * Checks that [ComponentMatcher.NAV_BAR] layer is visible at the start and end of the SF
- * trace
+ * Checks that [ComponentNameMatcher.NAV_BAR] layer is visible at the start of the SF trace
  */
-fun FlickerTestParameter.navBarLayerIsVisibleAtStartAndEnd() {
+fun FlickerTestParameter.navBarLayerIsVisibleAtStart() {
     assertLayersStart {
         this.isVisible(ComponentNameMatcher.NAV_BAR)
     }
+}
+
+/**
+ * Checks that [ComponentNameMatcher.NAV_BAR] layer is visible at the end of the SF trace
+ */
+fun FlickerTestParameter.navBarLayerIsVisibleAtEnd() {
     assertLayersEnd {
         this.isVisible(ComponentNameMatcher.NAV_BAR)
     }
 }
 
 /**
- * Checks that [ComponentMatcher.TASK_BAR] layer is visible at the start and end of the SF
+ * Checks that [ComponentNameMatcher.NAV_BAR] layer is visible at the start and end of the SF
+ * trace
+ */
+fun FlickerTestParameter.navBarLayerIsVisibleAtStartAndEnd() {
+    this.navBarLayerIsVisibleAtStart()
+    this.navBarLayerIsVisibleAtEnd()
+}
+
+/**
+ * Checks that [ComponentNameMatcher.TASK_BAR] layer is visible at the start and end of the SF
  * trace
  */
 fun FlickerTestParameter.taskBarLayerIsVisibleAtStartAndEnd() {
@@ -131,7 +161,7 @@
 }
 
 /**
- * Checks that [ComponentMatcher.TASK_BAR] layer is visible at the start of the SF
+ * Checks that [ComponentNameMatcher.TASK_BAR] layer is visible at the start of the SF
  * trace
  */
 fun FlickerTestParameter.taskBarLayerIsVisibleAtStart() {
@@ -141,7 +171,7 @@
 }
 
 /**
- * Checks that [ComponentMatcher.TASK_BAR] layer is visible at the end of the SF
+ * Checks that [ComponentNameMatcher.TASK_BAR] layer is visible at the end of the SF
  * trace
  */
 fun FlickerTestParameter.taskBarLayerIsVisibleAtEnd() {
@@ -151,7 +181,7 @@
 }
 
 /**
- * Checks that [ComponentMatcher.STATUS_BAR] layer is visible at the start and end of the SF
+ * Checks that [ComponentNameMatcher.STATUS_BAR] layer is visible at the start and end of the SF
  * trace
  */
 fun FlickerTestParameter.statusBarLayerIsVisibleAtStartAndEnd() {
@@ -164,7 +194,7 @@
 }
 
 /**
- * Asserts that the [ComponentMatcher.NAV_BAR] layer is at the correct position at the start
+ * Asserts that the [ComponentNameMatcher.NAV_BAR] layer is at the correct position at the start
  * of the SF trace
  */
 fun FlickerTestParameter.navBarLayerPositionAtStart() {
@@ -177,7 +207,7 @@
 }
 
 /**
- * Asserts that the [ComponentMatcher.NAV_BAR] layer is at the correct position at the end
+ * Asserts that the [ComponentNameMatcher.NAV_BAR] layer is at the correct position at the end
  * of the SF trace
  */
 fun FlickerTestParameter.navBarLayerPositionAtEnd() {
@@ -190,7 +220,7 @@
 }
 
 /**
- * Asserts that the [ComponentMatcher.NAV_BAR] layer is at the correct position at the start
+ * Asserts that the [ComponentNameMatcher.NAV_BAR] layer is at the correct position at the start
  * and end of the SF trace
  */
 fun FlickerTestParameter.navBarLayerPositionAtStartAndEnd() {
@@ -199,7 +229,7 @@
 }
 
 /**
- * Asserts that the [ComponentMatcher.STATUS_BAR] layer is at the correct position at the start
+ * Asserts that the [ComponentNameMatcher.STATUS_BAR] layer is at the correct position at the start
  * of the SF trace
  */
 fun FlickerTestParameter.statusBarLayerPositionAtStart() {
@@ -212,7 +242,7 @@
 }
 
 /**
- * Asserts that the [ComponentMatcher.STATUS_BAR] layer is at the correct position at the end
+ * Asserts that the [ComponentNameMatcher.STATUS_BAR] layer is at the correct position at the end
  * of the SF trace
  */
 fun FlickerTestParameter.statusBarLayerPositionAtEnd() {
@@ -225,7 +255,7 @@
 }
 
 /**
- * Asserts that the [ComponentMatcher.STATUS_BAR] layer is at the correct position at the start
+ * Asserts that the [ComponentNameMatcher.STATUS_BAR] layer is at the correct position at the start
  * and end of the SF trace
  */
 fun FlickerTestParameter.statusBarLayerPositionAtStartAndEnd() {
@@ -234,11 +264,11 @@
 }
 
 /**
- * Asserts that the visibleRegion of the [ComponentMatcher.SNAPSHOT] layer can cover
+ * Asserts that the visibleRegion of the [ComponentNameMatcher.SNAPSHOT] layer can cover
  * the visibleRegion of the given app component exactly
  */
 fun FlickerTestParameter.snapshotStartingWindowLayerCoversExactlyOnApp(
-    component: IComponentMatcher
+    component: IComponentNameMatcher
 ) {
     assertLayers {
         invoke("snapshotStartingWindowLayerCoversExactlyOnApp") {
@@ -281,8 +311,8 @@
  *      otherwise we won't and the layer must appear immediately.
  */
 fun FlickerTestParameter.replacesLayer(
-    originalLayer: IComponentMatcher,
-    newLayer: IComponentMatcher,
+    originalLayer: IComponentNameMatcher,
+    newLayer: IComponentNameMatcher,
     ignoreEntriesWithRotationLayer: Boolean = false,
     ignoreSnapshot: Boolean = false,
     ignoreSplashscreen: Boolean = true
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationWarm.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationWarm.kt
index e65cecb1..a1815fa3c 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationWarm.kt
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationWarm.kt
@@ -25,7 +25,9 @@
 import com.android.server.wm.flicker.FlickerTestParameterFactory
 import com.android.server.wm.flicker.annotation.Group1
 import com.android.server.wm.flicker.dsl.FlickerBuilder
+import com.android.server.wm.flicker.navBarLayerIsVisibleAtEnd
 import com.android.server.wm.flicker.navBarLayerPositionAtEnd
+import com.android.server.wm.flicker.navBarWindowIsVisibleAtEnd
 import com.android.server.wm.flicker.statusBarLayerPositionAtEnd
 import com.android.server.wm.traces.common.ComponentNameMatcher
 import org.junit.Assume
@@ -102,8 +104,8 @@
     @Test
     @Postsubmit
     fun screenLockedStart() {
-        testSpec.assertLayersStart {
-            isEmpty()
+        testSpec.assertWmStart {
+            isKeyguardShowing()
         }
     }
 
@@ -120,11 +122,11 @@
 
     /** {@inheritDoc} */
     @Test
-    @Ignore("Not applicable to this CUJ. Display starts off and app is full screen at the end")
+    @Ignore("Not applicable to this CUJ. Display starts locked and app is full screen at the end")
     override fun navBarLayerPositionAtStartAndEnd() { }
 
     /**
-     * Checks the position of the [ComponentMatcher.NAV_BAR] at the end of the transition
+     * Checks the position of the [ComponentNameMatcher.NAV_BAR] at the end of the transition
      */
     @Postsubmit
     @Test
@@ -139,7 +141,7 @@
     override fun statusBarLayerPositionAtStartAndEnd() { }
 
     /**
-     * Checks the position of the [ComponentMatcher.STATUS_BAR] at the start and end of the
+     * Checks the position of the [ComponentNameMatcher.STATUS_BAR] at the start and end of the
      * transition
      */
     @Postsubmit
@@ -147,15 +149,25 @@
     fun statusBarLayerPositionEnd() = testSpec.statusBarLayerPositionAtEnd()
 
     /** {@inheritDoc} */
-    @Postsubmit
     @Test
-    override fun navBarLayerIsVisibleAtStartAndEnd() = super.navBarLayerIsVisibleAtStartAndEnd()
+    @Ignore("Not applicable to this CUJ. Display starts locked and app is full screen at the end")
+    override fun navBarLayerIsVisibleAtStartAndEnd() =
+        super.navBarLayerIsVisibleAtStartAndEnd()
 
     /** {@inheritDoc} */
     @Postsubmit
     @Test
+    fun navBarLayerIsVisibleAtEnd() = testSpec.navBarLayerIsVisibleAtEnd()
+
+    /** {@inheritDoc} */
+    @Test
+    @Ignore("Not applicable to this CUJ. Display starts locked and app is full screen at the end")
     override fun navBarWindowIsAlwaysVisible() = super.navBarWindowIsAlwaysVisible()
 
+    @Postsubmit
+    @Test
+    fun navBarWindowIsVisibleAtEnd() = testSpec.navBarWindowIsVisibleAtEnd()
+
     /** {@inheritDoc} */
     @Postsubmit
     @Test
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromNotificationWarm.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromNotificationWarm.kt
index 78baddf..915b702 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromNotificationWarm.kt
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromNotificationWarm.kt
@@ -34,6 +34,7 @@
 import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
 import com.android.server.wm.flicker.taskBarLayerIsVisibleAtEnd
 import com.android.server.wm.flicker.taskBarWindowIsVisibleAtEnd
+import com.android.server.wm.traces.common.ComponentNameMatcher
 import org.junit.Assume
 import org.junit.FixMethodOrder
 import org.junit.Ignore
@@ -235,26 +236,28 @@
     }
 
     /**
-     * Checks that the [ComponentMatcher.TASK_BAR] window is visible at the end of the transition
+     * Checks that the [ComponentNameMatcher.TASK_BAR] window is visible at the end of the
+     * transition
      *
      * Note: Large screen only
      */
     @Postsubmit
     @Test
     open fun taskBarWindowIsVisibleAtEnd() {
-        Assume.assumeFalse(testSpec.isTablet)
+        Assume.assumeTrue(testSpec.isTablet)
         testSpec.taskBarWindowIsVisibleAtEnd()
     }
 
     /**
-     * Checks that the [ComponentMatcher.TASK_BAR] layer is visible at the end of the transition
+     * Checks that the [ComponentNameMatcher.TASK_BAR] layer is visible at the end of the
+     * transition
      *
      * Note: Large screen only
      */
     @Postsubmit
     @Test
     open fun taskBarLayerIsVisibleAtEnd() {
-        Assume.assumeFalse(testSpec.isTablet)
+        Assume.assumeTrue(testSpec.isTablet)
         testSpec.taskBarLayerIsVisibleAtEnd()
     }