Merge "Do not kill process bound with WAIVE_PRIORITY / ALLOW_OOM_MANAGEMENT" into sc-dev am: 35b2d00e79
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14766840 Change-Id: I82068dc0ec0b8c48cf00eab78cd27d2f5444d0b3
This commit is contained in:
@@ -1573,6 +1573,7 @@ public class OomAdjuster {
|
||||
state.setAdjTarget(null);
|
||||
state.setEmpty(false);
|
||||
state.setCached(false);
|
||||
state.setNoKillOnForcedAppStandbyAndIdle(false);
|
||||
state.resetAllowStartFgsState();
|
||||
app.mOptRecord.setShouldNotFreeze(false);
|
||||
|
||||
@@ -2061,6 +2062,9 @@ public class OomAdjuster {
|
||||
// Similar to BIND_WAIVE_PRIORITY, keep it unfrozen.
|
||||
if (clientAdj < ProcessList.CACHED_APP_MIN_ADJ) {
|
||||
app.mOptRecord.setShouldNotFreeze(true);
|
||||
// Similarly, we shouldn't kill it when it's in forced-app-standby
|
||||
// mode and cached & idle state.
|
||||
app.mState.setNoKillOnForcedAppStandbyAndIdle(true);
|
||||
}
|
||||
// Not doing bind OOM management, so treat
|
||||
// this guy more like a started service.
|
||||
@@ -2265,6 +2269,9 @@ public class OomAdjuster {
|
||||
// unfrozen.
|
||||
if (clientAdj < ProcessList.CACHED_APP_MIN_ADJ) {
|
||||
app.mOptRecord.setShouldNotFreeze(true);
|
||||
// Similarly, we shouldn't kill it when it's in forced-app-standby
|
||||
// mode and cached & idle state.
|
||||
app.mState.setNoKillOnForcedAppStandbyAndIdle(true);
|
||||
}
|
||||
}
|
||||
if ((cr.flags&Context.BIND_TREAT_LIKE_ACTIVITY) != 0) {
|
||||
|
||||
@@ -5043,6 +5043,7 @@ public final class ProcessList {
|
||||
final UidRecord uidRec = app.getUidRecord();
|
||||
if (mService.mConstants.mKillForceAppStandByAndCachedIdle
|
||||
&& uidRec != null && uidRec.isIdle()
|
||||
&& !app.mState.shouldNotKillOnForcedAppStandbyAndIdle()
|
||||
&& app.isCached() && app.mState.isForcedAppStandby()) {
|
||||
app.killLocked("cached idle & forced-app-standby",
|
||||
ApplicationExitInfo.REASON_OTHER,
|
||||
|
||||
@@ -363,6 +363,13 @@ final class ProcessStateRecord {
|
||||
@ElapsedRealtimeLong
|
||||
private long mLastInvisibleTime;
|
||||
|
||||
/**
|
||||
* Whether or not this process could be killed when it's in forced-app-standby mode
|
||||
* and cached & idle state.
|
||||
*/
|
||||
@GuardedBy("mService")
|
||||
private boolean mNoKillOnForcedAppStandbyAndIdle;
|
||||
|
||||
// Below are the cached task info for OomAdjuster only
|
||||
private static final int VALUE_INVALID = -1;
|
||||
private static final int VALUE_FALSE = 0;
|
||||
@@ -1143,6 +1150,16 @@ final class ProcessStateRecord {
|
||||
return mLastInvisibleTime;
|
||||
}
|
||||
|
||||
@GuardedBy("mService")
|
||||
void setNoKillOnForcedAppStandbyAndIdle(boolean shouldNotKill) {
|
||||
mNoKillOnForcedAppStandbyAndIdle = shouldNotKill;
|
||||
}
|
||||
|
||||
@GuardedBy("mService")
|
||||
boolean shouldNotKillOnForcedAppStandbyAndIdle() {
|
||||
return mNoKillOnForcedAppStandbyAndIdle;
|
||||
}
|
||||
|
||||
@GuardedBy({"mService", "mProcLock"})
|
||||
void dump(PrintWriter pw, String prefix, long nowUptime) {
|
||||
if (mReportedInteraction || mFgInteractionTime != 0) {
|
||||
|
||||
Reference in New Issue
Block a user