Merge "Trigger power hints for activity launch" into nyc-mr1-dev
This commit is contained in:
@@ -57,14 +57,19 @@ public abstract class PowerManagerInternal {
|
||||
/**
|
||||
* Power hint:
|
||||
* Interaction: The user is interacting with the device. The corresponding data field must be
|
||||
* the expected duration of the fling, or 0 if unknown.
|
||||
* the expected duration of the interaction, or 0 if unknown.
|
||||
*
|
||||
* Sustained Performance Mode: Enable/Disables Sustained Performance Mode.
|
||||
* Sustained Performance Mode: The corresponding data field must be Enable/Disable
|
||||
* Sustained Performance Mode.
|
||||
*
|
||||
* Launch: This is specific for activity launching. The corresponding data field must be
|
||||
* the expected duration of the required boost, or 0 if unknown.
|
||||
*
|
||||
* These must be kept in sync with the values in hardware/libhardware/include/hardware/power.h
|
||||
*/
|
||||
public static final int POWER_HINT_INTERACTION = 2;
|
||||
public static final int POWER_HINT_SUSTAINED_PERFORMANCE_MODE = 6;
|
||||
public static final int POWER_HINT_LAUNCH = 8;
|
||||
|
||||
public static String wakefulnessToString(int wakefulness) {
|
||||
switch (wakefulness) {
|
||||
|
||||
@@ -4416,6 +4416,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
|
||||
// Work Challenge is present) let startActivityInPackage handle the intercepting.
|
||||
if (!mService.mUserController.shouldConfirmCredentials(task.userId)
|
||||
&& task.getRootActivity() != null) {
|
||||
mService.mActivityStarter.sendPowerHintForLaunchIfNeeded(true /* forceSend */);
|
||||
mActivityMetricsLogger.notifyActivityLaunching();
|
||||
mService.moveTaskToFrontLocked(task.taskId, 0, bOptions);
|
||||
mActivityMetricsLogger.notifyActivityLaunched(ActivityManager.START_TASK_TO_FRONT,
|
||||
|
||||
@@ -102,6 +102,7 @@ import android.os.Binder;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.os.PowerManagerInternal;
|
||||
import android.os.RemoteException;
|
||||
import android.os.SystemClock;
|
||||
import android.os.UserHandle;
|
||||
@@ -172,6 +173,7 @@ class ActivityStarter {
|
||||
private boolean mNoAnimation;
|
||||
private boolean mKeepCurTransition;
|
||||
private boolean mAvoidMoveToFront;
|
||||
private boolean mPowerHintSent;
|
||||
|
||||
private IVoiceInteractionSession mVoiceSession;
|
||||
private IVoiceInteractor mVoiceInteractor;
|
||||
@@ -210,6 +212,8 @@ class ActivityStarter {
|
||||
mKeepCurTransition = false;
|
||||
mAvoidMoveToFront = false;
|
||||
|
||||
mPowerHintSent = false;
|
||||
|
||||
mVoiceSession = null;
|
||||
mVoiceInteractor = null;
|
||||
}
|
||||
@@ -942,6 +946,20 @@ class ActivityStarter {
|
||||
return START_SUCCESS;
|
||||
}
|
||||
|
||||
void sendPowerHintForLaunchIfNeeded(boolean forceSend) {
|
||||
// Trigger launch power hint if activity 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) {
|
||||
mService.mLocalPowerManager.powerHint(PowerManagerInternal.POWER_HINT_LAUNCH, 0);
|
||||
mPowerHintSent = true;
|
||||
}
|
||||
}
|
||||
|
||||
private int startActivityUnchecked(final ActivityRecord r, ActivityRecord sourceRecord,
|
||||
IVoiceInteractionSession voiceSession, IVoiceInteractor voiceInteractor,
|
||||
int startFlags, boolean doResume, ActivityOptions options, TaskRecord inTask) {
|
||||
@@ -1003,6 +1021,8 @@ class ActivityStarter {
|
||||
}
|
||||
}
|
||||
|
||||
sendPowerHintForLaunchIfNeeded(false /* forceSend */);
|
||||
|
||||
mReusedActivity = setTargetStackAndMoveToFrontIfNeeded(mReusedActivity);
|
||||
|
||||
if ((mStartFlags & START_FLAG_ONLY_IF_NEEDED) != 0) {
|
||||
@@ -1125,6 +1145,9 @@ class ActivityStarter {
|
||||
ActivityStack.logStartActivity(
|
||||
EventLogTags.AM_CREATE_ACTIVITY, mStartActivity, mStartActivity.task);
|
||||
mTargetStack.mLastPausedActivity = null;
|
||||
|
||||
sendPowerHintForLaunchIfNeeded(false /* forceSend */);
|
||||
|
||||
mTargetStack.startActivityLocked(mStartActivity, newTask, mKeepCurTransition, mOptions);
|
||||
if (mDoResume) {
|
||||
if (!mLaunchTaskBehind) {
|
||||
|
||||
Reference in New Issue
Block a user