OSDN Git Service

Add launch hint for RecentsAnimation
authorJorim Jaggi <jjaggi@google.com>
Thu, 22 Mar 2018 22:20:36 +0000 (23:20 +0100)
committerJorim Jaggi <jjaggi@google.com>
Wed, 4 Apr 2018 12:26:24 +0000 (14:26 +0200)
We are starting an activity, so let's send launch hint to be
faster and consistent with other activity launches.

Test: Swipe up, check android.hardware.power in systrace
Bug: 73651529
Change-Id: Ia8f925d94cf6969d2501e00b86fa91617d093916

services/core/java/com/android/server/am/RecentsAnimation.java

index 99337b8..ad25099 100644 (file)
@@ -23,6 +23,7 @@ import static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION;
 import static android.os.Trace.TRACE_TAG_ACTIVITY_MANAGER;
 import static android.view.WindowManager.TRANSIT_NONE;
 import static com.android.server.am.ActivityStackSupervisor.PRESERVE_WINDOWS;
+import static com.android.server.wm.RecentsAnimationController.REORDER_KEEP_HOME_IN_PLACE;
 import static com.android.server.wm.RecentsAnimationController.REORDER_MOVE_HOME_TO_ORIGINAL_POSITION;
 import static com.android.server.wm.RecentsAnimationController.REORDER_MOVE_HOME_TO_TOP;
 
@@ -87,6 +88,13 @@ class RecentsAnimation implements RecentsAnimationCallbacks {
             }
         }
 
+        // Send launch hint if we are actually launching home. If it's already visible (shouldn't
+        // happen in general) we don't need to send it.
+        if (homeActivity == null || !homeActivity.visible) {
+            mStackSupervisor.sendPowerHintForLaunchStartIfNeeded(true /* forceSend */,
+                    homeActivity);
+        }
+
         mStackSupervisor.getActivityMetricsLogger().notifyActivityLaunching();
 
         mService.setRunningRemoteAnimation(mCallingPid, true);
@@ -147,6 +155,12 @@ class RecentsAnimation implements RecentsAnimationCallbacks {
         synchronized (mService) {
             if (mWindowManager.getRecentsAnimationController() == null) return;
 
+            // Just to be sure end the launch hint in case home was never launched. However, if
+            // we're keeping home and making it visible, we can leave it on.
+            if (reorderMode != REORDER_KEEP_HOME_IN_PLACE) {
+                mStackSupervisor.sendPowerHintForLaunchEndIfNeeded();
+            }
+
             mService.setRunningRemoteAnimation(mCallingPid, false);
 
             mWindowManager.inSurfaceTransaction(() -> {