Merge "Temporarily increase sched policy for dozing" into sc-dev am: 750d0ebd3f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15160790 Change-Id: Id295e717dba9f74d24ba8b8d91dc1562949c6092
This commit is contained in:
@@ -1574,8 +1574,9 @@ public class OomAdjuster {
|
|||||||
state.setSystemNoUi(false);
|
state.setSystemNoUi(false);
|
||||||
}
|
}
|
||||||
if (!state.isSystemNoUi()) {
|
if (!state.isSystemNoUi()) {
|
||||||
if (mService.mWakefulness.get() == PowerManagerInternal.WAKEFULNESS_AWAKE) {
|
if (mService.mWakefulness.get() == PowerManagerInternal.WAKEFULNESS_AWAKE
|
||||||
// screen on, promote UI
|
|| state.isRunningRemoteAnimation()) {
|
||||||
|
// screen on or animating, promote UI
|
||||||
state.setCurProcState(ActivityManager.PROCESS_STATE_PERSISTENT_UI);
|
state.setCurProcState(ActivityManager.PROCESS_STATE_PERSISTENT_UI);
|
||||||
state.setCurrentSchedulingGroup(ProcessList.SCHED_GROUP_TOP_APP);
|
state.setCurrentSchedulingGroup(ProcessList.SCHED_GROUP_TOP_APP);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -302,6 +302,12 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
|||||||
// started or finished.
|
// started or finished.
|
||||||
static final long ACTIVITY_BG_START_GRACE_PERIOD_MS = 10 * 1000;
|
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. */
|
/** Used to indicate that an app transition should be animated. */
|
||||||
static final boolean ANIMATE = true;
|
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) {
|
public void onScreenAwakeChanged(boolean isAwake) {
|
||||||
mH.post(() -> {
|
mH.post(() -> {
|
||||||
for (int i = mScreenObservers.size() - 1; i >= 0; i--) {
|
for (int i = mScreenObservers.size() - 1; i >= 0; i--) {
|
||||||
mScreenObservers.get(i).onAwakeStateChanged(isAwake);
|
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
|
@Override
|
||||||
@@ -5028,7 +5057,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
|||||||
|
|
||||||
final class H extends Handler {
|
final class H extends Handler {
|
||||||
static final int REPORT_TIME_TRACKER_MSG = 1;
|
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_ACTIVITY_TASK_MSG = 100;
|
||||||
static final int FIRST_SUPERVISOR_TASK_MSG = 200;
|
static final int FIRST_SUPERVISOR_TASK_MSG = 200;
|
||||||
@@ -5045,6 +5074,13 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
|||||||
tracker.deliverResult(mContext);
|
tracker.deliverResult(mContext);
|
||||||
}
|
}
|
||||||
break;
|
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();
|
updateRunningRemoteOrRecentsAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateRunningRemoteOrRecentsAnimation() {
|
void updateRunningRemoteOrRecentsAnimation() {
|
||||||
|
|
||||||
// Posting on handler so WM lock isn't held when we call into AM.
|
// Posting on handler so WM lock isn't held when we call into AM.
|
||||||
mAtm.mH.sendMessage(PooledLambda.obtainMessage(
|
mAtm.mH.sendMessage(PooledLambda.obtainMessage(
|
||||||
WindowProcessListener::setRunningRemoteAnimation, mListener,
|
WindowProcessListener::setRunningRemoteAnimation, mListener,
|
||||||
mRunningRecentsAnimation || mRunningRemoteAnimation));
|
mRunningRecentsAnimation || mRunningRemoteAnimation));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Adjusts scheduling group for animation. This method MUST NOT be called inside WM lock. */
|
||||||
|
void setRunningAnimationUnsafe() {
|
||||||
|
mListener.setRunningRemoteAnimation(true);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return mOwner != null ? mOwner.toString() : null;
|
return mOwner != null ? mOwner.toString() : null;
|
||||||
|
|||||||
Reference in New Issue
Block a user