Determine power hint behavior based on target activity.
Previously, logic was added surrounding whether to trigger a power
hint based on the start activity. However, this activity is not
always relevant in the calling context.
This change adjusts the logic by passing the target activity into
the method.
Fixes: 63913311
Test: press home button while on home and ensure power hint not
triggered.
Change-Id: I71ffcae7adbc2c55ef5b2994f4c55688d0aa0ca5
This commit is contained in:
@@ -5170,11 +5170,14 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
|
||||
// Work Challenge is present) let startActivityInPackage handle the intercepting.
|
||||
if (!mService.mUserController.shouldConfirmCredentials(task.userId)
|
||||
&& task.getRootActivity() != null) {
|
||||
mService.mActivityStarter.sendPowerHintForLaunchStartIfNeeded(true /* forceSend */);
|
||||
final ActivityRecord targetActivity = task.getTopActivity();
|
||||
|
||||
mService.mActivityStarter.sendPowerHintForLaunchStartIfNeeded(true /* forceSend */,
|
||||
targetActivity);
|
||||
mActivityMetricsLogger.notifyActivityLaunching();
|
||||
mService.moveTaskToFrontLocked(task.taskId, 0, bOptions, true /* fromRecents */);
|
||||
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
|
||||
// the window renders full-screen with the background filling the void. Also only
|
||||
|
||||
@@ -969,7 +969,7 @@ class ActivityStarter {
|
||||
return START_SUCCESS;
|
||||
}
|
||||
|
||||
void sendPowerHintForLaunchStartIfNeeded(boolean forceSend) {
|
||||
void sendPowerHintForLaunchStartIfNeeded(boolean forceSend, ActivityRecord targetActivity) {
|
||||
boolean sendHint = forceSend;
|
||||
|
||||
if (!sendHint) {
|
||||
@@ -978,7 +978,7 @@ class ActivityStarter {
|
||||
final ActivityRecord resumedActivity = mSupervisor.getResumedActivityLocked();
|
||||
sendHint = resumedActivity == null
|
||||
|| resumedActivity.app == null
|
||||
|| !resumedActivity.app.equals(mStartActivity.app);
|
||||
|| !resumedActivity.app.equals(targetActivity.app);
|
||||
}
|
||||
|
||||
if (sendHint && mService.mLocalPowerManager != null) {
|
||||
@@ -1098,7 +1098,7 @@ class ActivityStarter {
|
||||
}
|
||||
}
|
||||
|
||||
sendPowerHintForLaunchStartIfNeeded(false /* forceSend */);
|
||||
sendPowerHintForLaunchStartIfNeeded(false /* forceSend */, reusedActivity);
|
||||
|
||||
reusedActivity = setTargetStackAndMoveToFrontIfNeeded(reusedActivity);
|
||||
|
||||
@@ -1127,6 +1127,7 @@ class ActivityStarter {
|
||||
if (outActivity != null && outActivity.length > 0) {
|
||||
outActivity[0] = reusedActivity;
|
||||
}
|
||||
|
||||
return START_TASK_TO_FRONT;
|
||||
}
|
||||
}
|
||||
@@ -1218,7 +1219,7 @@ class ActivityStarter {
|
||||
EventLogTags.AM_CREATE_ACTIVITY, mStartActivity, mStartActivity.getTask());
|
||||
mTargetStack.mLastPausedActivity = null;
|
||||
|
||||
sendPowerHintForLaunchStartIfNeeded(false /* forceSend */);
|
||||
sendPowerHintForLaunchStartIfNeeded(false /* forceSend */, mStartActivity);
|
||||
|
||||
mTargetStack.startActivityLocked(mStartActivity, topFocused, newTask, mKeepCurTransition,
|
||||
mOptions);
|
||||
@@ -1520,7 +1521,8 @@ class ActivityStarter {
|
||||
if (mLaunchSingleInstance) {
|
||||
// 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.
|
||||
intentActivity = mSupervisor.findActivityLocked(mIntent, mStartActivity.info, false);
|
||||
intentActivity = mSupervisor.findActivityLocked(mIntent, mStartActivity.info,
|
||||
mStartActivity.isHomeActivity());
|
||||
} else if ((mLaunchFlags & FLAG_ACTIVITY_LAUNCH_ADJACENT) != 0) {
|
||||
// For the launch adjacent case we only want to put the activity in an existing
|
||||
// task if the activity already exists in the history.
|
||||
|
||||
Reference in New Issue
Block a user