Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf2dfc3e authored by Winson Chung's avatar Winson Chung Committed by Riddle Hsu
Browse files

Defer ending launcher power mode hint until after transient transition

Because transient launch will resume the target activity, the power
mode will be cleared after the activity reported idle. But the
animation may be still running that causes some frame drops by lower
cpu frequency. So defer it until the transition is finished.

The power mode will be cleared from:
Transition#finishTransition
 > scheduleProcessStoppingAndFinishingActivitiesIfNeeded
  > allResumedActivitiesIdle
   > endLaunchPowerMode

Bug: 291284150
Test: atest TransitionTests#testTransientLaunch
Change-Id: If664fbc58554d7cfabae86c9ec282f3f7cf50526
parent 1a2f99d7
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -3212,6 +3212,10 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
                        + "not idle", rootTask.getRootTaskId(), resumedActivity);
                return false;
            }
            if (mTransitionController.isTransientLaunch(resumedActivity)) {
                // Not idle if the transient transition animation is running.
                return false;
            }
        }
        // End power mode launch when idle.
        mService.endLaunchPowerMode(ActivityTaskManagerService.POWER_MODE_REASON_START_ACTIVITY);
+10 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
@@ -1425,6 +1426,15 @@ public class TransitionTests extends WindowTestsBase {
        // No need to wait for the activity in transient hide task.
        assertEquals(WindowContainer.SYNC_STATE_NONE, activity1.mSyncState);

        // An active transient launch overrides idle state to avoid clearing power mode before the
        // transition is finished.
        spyOn(mRootWindowContainer.mTransitionController);
        doAnswer(invocation -> controller.isTransientLaunch(invocation.getArgument(0))).when(
                mRootWindowContainer.mTransitionController).isTransientLaunch(any());
        activity2.getTask().setResumedActivity(activity2, "test");
        activity2.idle = true;
        assertFalse(mRootWindowContainer.allResumedActivitiesIdle());

        activity1.setVisibleRequested(false);
        activity2.setVisibleRequested(true);
        activity2.setVisible(true);