Merge "Trigger power hints for activity launch" into nyc-mr1-dev
am: 2ab4ac3835
* commit '2ab4ac38350b51c239fe564bc89727b201036205':
Trigger power hints for activity launch
Change-Id: I2c16d792bfa2617bb8120529f204d50fc817bab0
This commit is contained in:
@@ -57,14 +57,19 @@ public abstract class PowerManagerInternal {
|
|||||||
/**
|
/**
|
||||||
* Power hint:
|
* Power hint:
|
||||||
* Interaction: The user is interacting with the device. The corresponding data field must be
|
* 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
|
* 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_INTERACTION = 2;
|
||||||
public static final int POWER_HINT_SUSTAINED_PERFORMANCE_MODE = 6;
|
public static final int POWER_HINT_SUSTAINED_PERFORMANCE_MODE = 6;
|
||||||
|
public static final int POWER_HINT_LAUNCH = 8;
|
||||||
|
|
||||||
public static String wakefulnessToString(int wakefulness) {
|
public static String wakefulnessToString(int wakefulness) {
|
||||||
switch (wakefulness) {
|
switch (wakefulness) {
|
||||||
|
|||||||
@@ -4416,6 +4416,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
|
|||||||
// 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.sendPowerHintForLaunchIfNeeded(true /* forceSend */);
|
||||||
mActivityMetricsLogger.notifyActivityLaunching();
|
mActivityMetricsLogger.notifyActivityLaunching();
|
||||||
mService.moveTaskToFrontLocked(task.taskId, 0, bOptions);
|
mService.moveTaskToFrontLocked(task.taskId, 0, bOptions);
|
||||||
mActivityMetricsLogger.notifyActivityLaunched(ActivityManager.START_TASK_TO_FRONT,
|
mActivityMetricsLogger.notifyActivityLaunched(ActivityManager.START_TASK_TO_FRONT,
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ import android.os.Binder;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
|
import android.os.PowerManagerInternal;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
@@ -172,6 +173,7 @@ class ActivityStarter {
|
|||||||
private boolean mNoAnimation;
|
private boolean mNoAnimation;
|
||||||
private boolean mKeepCurTransition;
|
private boolean mKeepCurTransition;
|
||||||
private boolean mAvoidMoveToFront;
|
private boolean mAvoidMoveToFront;
|
||||||
|
private boolean mPowerHintSent;
|
||||||
|
|
||||||
private IVoiceInteractionSession mVoiceSession;
|
private IVoiceInteractionSession mVoiceSession;
|
||||||
private IVoiceInteractor mVoiceInteractor;
|
private IVoiceInteractor mVoiceInteractor;
|
||||||
@@ -210,6 +212,8 @@ class ActivityStarter {
|
|||||||
mKeepCurTransition = false;
|
mKeepCurTransition = false;
|
||||||
mAvoidMoveToFront = false;
|
mAvoidMoveToFront = false;
|
||||||
|
|
||||||
|
mPowerHintSent = false;
|
||||||
|
|
||||||
mVoiceSession = null;
|
mVoiceSession = null;
|
||||||
mVoiceInteractor = null;
|
mVoiceInteractor = null;
|
||||||
}
|
}
|
||||||
@@ -942,6 +946,20 @@ class ActivityStarter {
|
|||||||
return START_SUCCESS;
|
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,
|
private int startActivityUnchecked(final ActivityRecord r, ActivityRecord sourceRecord,
|
||||||
IVoiceInteractionSession voiceSession, IVoiceInteractor voiceInteractor,
|
IVoiceInteractionSession voiceSession, IVoiceInteractor voiceInteractor,
|
||||||
int startFlags, boolean doResume, ActivityOptions options, TaskRecord inTask) {
|
int startFlags, boolean doResume, ActivityOptions options, TaskRecord inTask) {
|
||||||
@@ -1003,6 +1021,8 @@ class ActivityStarter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sendPowerHintForLaunchIfNeeded(false /* forceSend */);
|
||||||
|
|
||||||
mReusedActivity = setTargetStackAndMoveToFrontIfNeeded(mReusedActivity);
|
mReusedActivity = setTargetStackAndMoveToFrontIfNeeded(mReusedActivity);
|
||||||
|
|
||||||
if ((mStartFlags & START_FLAG_ONLY_IF_NEEDED) != 0) {
|
if ((mStartFlags & START_FLAG_ONLY_IF_NEEDED) != 0) {
|
||||||
@@ -1125,6 +1145,9 @@ class ActivityStarter {
|
|||||||
ActivityStack.logStartActivity(
|
ActivityStack.logStartActivity(
|
||||||
EventLogTags.AM_CREATE_ACTIVITY, mStartActivity, mStartActivity.task);
|
EventLogTags.AM_CREATE_ACTIVITY, mStartActivity, mStartActivity.task);
|
||||||
mTargetStack.mLastPausedActivity = null;
|
mTargetStack.mLastPausedActivity = null;
|
||||||
|
|
||||||
|
sendPowerHintForLaunchIfNeeded(false /* forceSend */);
|
||||||
|
|
||||||
mTargetStack.startActivityLocked(mStartActivity, newTask, mKeepCurTransition, mOptions);
|
mTargetStack.startActivityLocked(mStartActivity, newTask, mKeepCurTransition, mOptions);
|
||||||
if (mDoResume) {
|
if (mDoResume) {
|
||||||
if (!mLaunchTaskBehind) {
|
if (!mLaunchTaskBehind) {
|
||||||
|
|||||||
Reference in New Issue
Block a user