Fix lockscreen notification launch animation

When launching a notification from the lockscreen, we immediately
start an app transition because the app is started in invisible
/stopped state. Then, we try to take a screenshot, but nothing
is visible yet because the AppWindowToken is hidden.

Furthermore this fixes a bug where we were starting a remote
animation too aggressively.

Test: Launch anything from lockscreen
Test: go/wm-smoke
Change-Id: Iea9366813fa5780460a9ab2738f2a17f65fbeb15
Fixes: 73187454
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index fef615d..b70a8cd 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -2073,6 +2073,13 @@
         super.prepareSurfaces();
     }
 
+    /**
+     * @return Whether our {@link #getSurfaceControl} is currently showing.
+     */
+    boolean isSurfaceShowing() {
+        return mLastSurfaceShowing;
+    }
+
     boolean isFreezingScreen() {
         return mFreezingScreen;
     }