Debug tracing for view hierarchy changing during pressHome

Bug: 155926212
Change-Id: Ie9e8470c23b954890ae41fc9a442422f21093855
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index dd170c5..ce7d39d 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -622,6 +622,8 @@
      * @return the Workspace object.
      */
     public Workspace pressHome() {
+        mInstrumentation.getUiAutomation().setOnAccessibilityEventListener(
+                e -> Log.d("b/155926212", e.toString()));
         try (LauncherInstrumentation.Closable e = eventsCheck()) {
             // Click home, then wait for any accessibility event, then wait until accessibility
             // events stop.
@@ -629,7 +631,9 @@
             // otherwise waitForIdle may return immediately in case when there was a big enough
             // pause in accessibility events prior to pressing Home.
             final String action;
+            Log.d("b/155926212", "Before isLauncherVisible()");
             final boolean launcherWasVisible = isLauncherVisible();
+            Log.d("b/155926212", "After isLauncherVisible(): " + launcherWasVisible);
             if (getNavigationModel() == NavigationModel.ZERO_BUTTON) {
                 checkForAnomaly();
 
@@ -685,6 +689,8 @@
                     "performed action to switch to Home - " + action)) {
                 return getWorkspace();
             }
+        } finally {
+            mInstrumentation.getUiAutomation().setOnAccessibilityEventListener(null);
         }
     }