Merge "Temporarily increase sched policy for dozing" into sc-dev
This commit is contained in:
@@ -1574,8 +1574,9 @@ public class OomAdjuster {
|
||||
state.setSystemNoUi(false);
|
||||
}
|
||||
if (!state.isSystemNoUi()) {
|
||||
if (mService.mWakefulness.get() == PowerManagerInternal.WAKEFULNESS_AWAKE) {
|
||||
// screen on, promote UI
|
||||
if (mService.mWakefulness.get() == PowerManagerInternal.WAKEFULNESS_AWAKE
|
||||
|| state.isRunningRemoteAnimation()) {
|
||||
// screen on or animating, promote UI
|
||||
state.setCurProcState(ActivityManager.PROCESS_STATE_PERSISTENT_UI);
|
||||
state.setCurrentSchedulingGroup(ProcessList.SCHED_GROUP_TOP_APP);
|
||||
} else {
|
||||
|
||||
@@ -302,6 +302,12 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
// started or finished.
|
||||
static final long ACTIVITY_BG_START_GRACE_PERIOD_MS = 10 * 1000;
|
||||
|
||||
/**
|
||||
* The duration to keep a process in animating state (top scheduling group) when the
|
||||
* wakefulness is changing from awake to doze or sleep.
|
||||
*/
|
||||
private static final long DOZE_ANIMATING_STATE_RETAIN_TIME_MS = 2000;
|
||||
|
||||
/** Used to indicate that an app transition should be animated. */
|
||||
static final boolean ANIMATE = true;
|
||||
|
||||
@@ -2758,12 +2764,35 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
});
|
||||
}
|
||||
|
||||
// The caller MUST NOT hold the global lock.
|
||||
public void onScreenAwakeChanged(boolean isAwake) {
|
||||
mH.post(() -> {
|
||||
for (int i = mScreenObservers.size() - 1; i >= 0; i--) {
|
||||
mScreenObservers.get(i).onAwakeStateChanged(isAwake);
|
||||
}
|
||||
});
|
||||
|
||||
if (isAwake) {
|
||||
return;
|
||||
}
|
||||
// If the device is going to sleep, keep a higher priority temporarily for potential
|
||||
// animation of system UI. Even if AOD is not enabled, it should be no harm.
|
||||
final WindowProcessController proc;
|
||||
synchronized (mGlobalLockWithoutBoost) {
|
||||
final WindowState notificationShade = mRootWindowContainer.getDefaultDisplay()
|
||||
.getDisplayPolicy().getNotificationShade();
|
||||
proc = notificationShade != null
|
||||
? mProcessMap.getProcess(notificationShade.mSession.mPid) : null;
|
||||
}
|
||||
if (proc == null) {
|
||||
return;
|
||||
}
|
||||
// Set to activity manager directly to make sure the state can be seen by the subsequent
|
||||
// update of scheduling group.
|
||||
proc.setRunningAnimationUnsafe();
|
||||
mH.removeMessages(H.UPDATE_PROCESS_ANIMATING_STATE, proc);
|
||||
mH.sendMessageDelayed(mH.obtainMessage(H.UPDATE_PROCESS_ANIMATING_STATE, proc),
|
||||
DOZE_ANIMATING_STATE_RETAIN_TIME_MS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -5028,7 +5057,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
|
||||
final class H extends Handler {
|
||||
static final int REPORT_TIME_TRACKER_MSG = 1;
|
||||
|
||||
static final int UPDATE_PROCESS_ANIMATING_STATE = 2;
|
||||
|
||||
static final int FIRST_ACTIVITY_TASK_MSG = 100;
|
||||
static final int FIRST_SUPERVISOR_TASK_MSG = 200;
|
||||
@@ -5045,6 +5074,13 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
tracker.deliverResult(mContext);
|
||||
}
|
||||
break;
|
||||
case UPDATE_PROCESS_ANIMATING_STATE: {
|
||||
final WindowProcessController proc = (WindowProcessController) msg.obj;
|
||||
synchronized (mGlobalLock) {
|
||||
proc.updateRunningRemoteOrRecentsAnimation();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1594,14 +1594,18 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio
|
||||
updateRunningRemoteOrRecentsAnimation();
|
||||
}
|
||||
|
||||
private void updateRunningRemoteOrRecentsAnimation() {
|
||||
|
||||
void updateRunningRemoteOrRecentsAnimation() {
|
||||
// Posting on handler so WM lock isn't held when we call into AM.
|
||||
mAtm.mH.sendMessage(PooledLambda.obtainMessage(
|
||||
WindowProcessListener::setRunningRemoteAnimation, mListener,
|
||||
mRunningRecentsAnimation || mRunningRemoteAnimation));
|
||||
}
|
||||
|
||||
/** Adjusts scheduling group for animation. This method MUST NOT be called inside WM lock. */
|
||||
void setRunningAnimationUnsafe() {
|
||||
mListener.setRunningRemoteAnimation(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return mOwner != null ? mOwner.toString() : null;
|
||||
|
||||
Reference in New Issue
Block a user