Skip first frame for app transitions when possible

In most of our standard app transitions, the first frame of a
transition results in the same contents on the screen. This is
inefficient, as we can directly skip to the second frame of the
transition, introduce no jank, but execute the transition 16ms
faster.

Change-Id: If58337eae5558eae3acced691ae01c769f0ec2b9
diff --git a/services/core/java/com/android/server/wm/AppTransition.java b/services/core/java/com/android/server/wm/AppTransition.java
index cd4555d5..5995e9c 100644
--- a/services/core/java/com/android/server/wm/AppTransition.java
+++ b/services/core/java/com/android/server/wm/AppTransition.java
@@ -950,6 +950,16 @@
         return prepareThumbnailAnimation(a, appWidth, appHeight, transit);
     }
 
+    /**
+     * @return true if and only if the first frame of the transition can be skipped, i.e. the first
+     *         frame of the transition doesn't change the visuals on screen, so we can start
+     *         directly with the second one
+     */
+    boolean canSkipFirstFrame() {
+        return mNextAppTransitionType != NEXT_TRANSIT_TYPE_CUSTOM
+                && mNextAppTransitionType != NEXT_TRANSIT_TYPE_CUSTOM_IN_PLACE
+                && mNextAppTransitionType != NEXT_TRANSIT_TYPE_CLIP_REVEAL;
+    }
 
     Animation loadAnimation(WindowManager.LayoutParams lp, int transit, boolean enter,
             int appWidth, int appHeight, int orientation, Rect containingFrame, Rect contentInsets,