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

Commit 834abec8 authored by Bryce Lee's avatar Bryce Lee
Browse files

Amend logic for sending power hint on activity start.

We previously used task boundaries to determine when to send the hint.
This does not properly capture the target use case. Additionally, the
implementation does not identify this condition properly.

The new check is based on comparing the process of the existing resumed
activity in the stack. We will send the hint if the process is changing
or there is no resumed activity.

Bug:32640289
Test: Manual - ran systrace capture script and verified regression
       resolved (observed consistently over multiple attempts).
Change-Id: Ie3cdd17773f3466d9b3c7abb6ec5b4093ddc3631
parent 16ea7f76
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -949,14 +949,18 @@ class ActivityStarter {
    }

    void sendPowerHintForLaunchStartIfNeeded(boolean forceSend) {
        // Trigger launch power hint if activity being launched is not in the current task
        final ActivityStack focusStack = mSupervisor.getFocusedStack();
        final ActivityRecord curTop = (focusStack == null)
            ? null : focusStack.topRunningNonDelayedActivityLocked(mNotTop);
        if ((forceSend || (!mPowerHintSent && curTop != null &&
                curTop.task != null && mStartActivity != null &&
                curTop.task != mStartActivity.task )) &&
                mService.mLocalPowerManager != null) {
        boolean sendHint = forceSend;

        if (!sendHint) {
            // If not forced, send power hint when the activity's process is different than the
            // current resumed activity.
            final ActivityRecord resumedActivity = mSupervisor.getResumedActivityLocked();
            sendHint = resumedActivity == null
                || resumedActivity.app == null
                || !resumedActivity.app.equals(mStartActivity.app);
        }

        if (sendHint && mService.mLocalPowerManager != null) {
            mService.mLocalPowerManager.powerHint(PowerHint.LAUNCH, 1);
            mPowerHintSent = true;
        }