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

Commit 94d755fb authored by Bryce Lee's avatar Bryce Lee Committed by android-build-merger
Browse files

Merge "Determine power hint behavior based on target activity." into oc-dr1-dev am: b845700d

am: 0cdc7bac

Change-Id: I4345ff812fc128311a3e3ce5b2d46f25f50536fb
parents db6c2cfb 0cdc7bac
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -4699,11 +4699,14 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
            // Work Challenge is present) let startActivityInPackage handle the intercepting.
            // Work Challenge is present) let startActivityInPackage handle the intercepting.
            if (!mService.mUserController.shouldConfirmCredentials(task.userId)
            if (!mService.mUserController.shouldConfirmCredentials(task.userId)
                    && task.getRootActivity() != null) {
                    && task.getRootActivity() != null) {
                mService.mActivityStarter.sendPowerHintForLaunchStartIfNeeded(true /* forceSend */);
                final ActivityRecord targetActivity = task.getTopActivity();

                mService.mActivityStarter.sendPowerHintForLaunchStartIfNeeded(true /* forceSend */,
                        targetActivity);
                mActivityMetricsLogger.notifyActivityLaunching();
                mActivityMetricsLogger.notifyActivityLaunching();
                mService.moveTaskToFrontLocked(task.taskId, 0, bOptions, true /* fromRecents */);
                mService.moveTaskToFrontLocked(task.taskId, 0, bOptions, true /* fromRecents */);
                mActivityMetricsLogger.notifyActivityLaunched(ActivityManager.START_TASK_TO_FRONT,
                mActivityMetricsLogger.notifyActivityLaunched(ActivityManager.START_TASK_TO_FRONT,
                        task.getTopActivity());
                        targetActivity);


                // If we are launching the task in the docked stack, put it into resizing mode so
                // If we are launching the task in the docked stack, put it into resizing mode so
                // the window renders full-screen with the background filling the void. Also only
                // the window renders full-screen with the background filling the void. Also only
+7 −5
Original line number Original line Diff line number Diff line
@@ -951,7 +951,7 @@ class ActivityStarter {
        return START_SUCCESS;
        return START_SUCCESS;
    }
    }


    void sendPowerHintForLaunchStartIfNeeded(boolean forceSend) {
    void sendPowerHintForLaunchStartIfNeeded(boolean forceSend, ActivityRecord targetActivity) {
        boolean sendHint = forceSend;
        boolean sendHint = forceSend;


        if (!sendHint) {
        if (!sendHint) {
@@ -960,7 +960,7 @@ class ActivityStarter {
            final ActivityRecord resumedActivity = mSupervisor.getResumedActivityLocked();
            final ActivityRecord resumedActivity = mSupervisor.getResumedActivityLocked();
            sendHint = resumedActivity == null
            sendHint = resumedActivity == null
                || resumedActivity.app == null
                || resumedActivity.app == null
                || !resumedActivity.app.equals(mStartActivity.app);
                || !resumedActivity.app.equals(targetActivity.app);
        }
        }


        if (sendHint && mService.mLocalPowerManager != null) {
        if (sendHint && mService.mLocalPowerManager != null) {
@@ -1080,7 +1080,7 @@ class ActivityStarter {
                }
                }
            }
            }


            sendPowerHintForLaunchStartIfNeeded(false /* forceSend */);
            sendPowerHintForLaunchStartIfNeeded(false /* forceSend */, reusedActivity);


            reusedActivity = setTargetStackAndMoveToFrontIfNeeded(reusedActivity);
            reusedActivity = setTargetStackAndMoveToFrontIfNeeded(reusedActivity);


@@ -1109,6 +1109,7 @@ class ActivityStarter {
                if (outActivity != null && outActivity.length > 0) {
                if (outActivity != null && outActivity.length > 0) {
                    outActivity[0] = reusedActivity;
                    outActivity[0] = reusedActivity;
                }
                }

                return START_TASK_TO_FRONT;
                return START_TASK_TO_FRONT;
            }
            }
        }
        }
@@ -1200,7 +1201,7 @@ class ActivityStarter {
                EventLogTags.AM_CREATE_ACTIVITY, mStartActivity, mStartActivity.getTask());
                EventLogTags.AM_CREATE_ACTIVITY, mStartActivity, mStartActivity.getTask());
        mTargetStack.mLastPausedActivity = null;
        mTargetStack.mLastPausedActivity = null;


        sendPowerHintForLaunchStartIfNeeded(false /* forceSend */);
        sendPowerHintForLaunchStartIfNeeded(false /* forceSend */, mStartActivity);


        mTargetStack.startActivityLocked(mStartActivity, topFocused, newTask, mKeepCurTransition,
        mTargetStack.startActivityLocked(mStartActivity, topFocused, newTask, mKeepCurTransition,
                mOptions);
                mOptions);
@@ -1502,7 +1503,8 @@ class ActivityStarter {
            if (mLaunchSingleInstance) {
            if (mLaunchSingleInstance) {
                // There can be one and only one instance of single instance activity in the
                // There can be one and only one instance of single instance activity in the
                // history, and it is always in its own unique task, so we do a special search.
                // history, and it is always in its own unique task, so we do a special search.
               intentActivity = mSupervisor.findActivityLocked(mIntent, mStartActivity.info, false);
               intentActivity = mSupervisor.findActivityLocked(mIntent, mStartActivity.info,
                       mStartActivity.isHomeActivity());
            } else if ((mLaunchFlags & FLAG_ACTIVITY_LAUNCH_ADJACENT) != 0) {
            } else if ((mLaunchFlags & FLAG_ACTIVITY_LAUNCH_ADJACENT) != 0) {
                // For the launch adjacent case we only want to put the activity in an existing
                // For the launch adjacent case we only want to put the activity in an existing
                // task if the activity already exists in the history.
                // task if the activity already exists in the history.