Loading services/core/java/com/android/server/am/OomAdjuster.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -1573,6 +1573,7 @@ public class OomAdjuster { state.setAdjTarget(null); state.setAdjTarget(null); state.setEmpty(false); state.setEmpty(false); state.setCached(false); state.setCached(false); state.setNoKillOnForcedAppStandbyAndIdle(false); state.resetAllowStartFgsState(); state.resetAllowStartFgsState(); app.mOptRecord.setShouldNotFreeze(false); app.mOptRecord.setShouldNotFreeze(false); Loading Loading @@ -2061,6 +2062,9 @@ public class OomAdjuster { // Similar to BIND_WAIVE_PRIORITY, keep it unfrozen. // Similar to BIND_WAIVE_PRIORITY, keep it unfrozen. if (clientAdj < ProcessList.CACHED_APP_MIN_ADJ) { if (clientAdj < ProcessList.CACHED_APP_MIN_ADJ) { app.mOptRecord.setShouldNotFreeze(true); 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 // Not doing bind OOM management, so treat // this guy more like a started service. // this guy more like a started service. Loading Loading @@ -2265,6 +2269,9 @@ public class OomAdjuster { // unfrozen. // unfrozen. if (clientAdj < ProcessList.CACHED_APP_MIN_ADJ) { if (clientAdj < ProcessList.CACHED_APP_MIN_ADJ) { app.mOptRecord.setShouldNotFreeze(true); 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) { if ((cr.flags&Context.BIND_TREAT_LIKE_ACTIVITY) != 0) { Loading services/core/java/com/android/server/am/ProcessList.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -5043,6 +5043,7 @@ public final class ProcessList { final UidRecord uidRec = app.getUidRecord(); final UidRecord uidRec = app.getUidRecord(); if (mService.mConstants.mKillForceAppStandByAndCachedIdle if (mService.mConstants.mKillForceAppStandByAndCachedIdle && uidRec != null && uidRec.isIdle() && uidRec != null && uidRec.isIdle() && !app.mState.shouldNotKillOnForcedAppStandbyAndIdle() && app.isCached() && app.mState.isForcedAppStandby()) { && app.isCached() && app.mState.isForcedAppStandby()) { app.killLocked("cached idle & forced-app-standby", app.killLocked("cached idle & forced-app-standby", ApplicationExitInfo.REASON_OTHER, ApplicationExitInfo.REASON_OTHER, Loading services/core/java/com/android/server/am/ProcessStateRecord.java +17 −0 Original line number Original line Diff line number Diff line Loading @@ -363,6 +363,13 @@ final class ProcessStateRecord { @ElapsedRealtimeLong @ElapsedRealtimeLong private long mLastInvisibleTime; 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 // Below are the cached task info for OomAdjuster only private static final int VALUE_INVALID = -1; private static final int VALUE_INVALID = -1; private static final int VALUE_FALSE = 0; private static final int VALUE_FALSE = 0; Loading Loading @@ -1143,6 +1150,16 @@ final class ProcessStateRecord { return mLastInvisibleTime; return mLastInvisibleTime; } } @GuardedBy("mService") void setNoKillOnForcedAppStandbyAndIdle(boolean shouldNotKill) { mNoKillOnForcedAppStandbyAndIdle = shouldNotKill; } @GuardedBy("mService") boolean shouldNotKillOnForcedAppStandbyAndIdle() { return mNoKillOnForcedAppStandbyAndIdle; } @GuardedBy({"mService", "mProcLock"}) @GuardedBy({"mService", "mProcLock"}) void dump(PrintWriter pw, String prefix, long nowUptime) { void dump(PrintWriter pw, String prefix, long nowUptime) { if (mReportedInteraction || mFgInteractionTime != 0) { if (mReportedInteraction || mFgInteractionTime != 0) { Loading Loading
services/core/java/com/android/server/am/OomAdjuster.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -1573,6 +1573,7 @@ public class OomAdjuster { state.setAdjTarget(null); state.setAdjTarget(null); state.setEmpty(false); state.setEmpty(false); state.setCached(false); state.setCached(false); state.setNoKillOnForcedAppStandbyAndIdle(false); state.resetAllowStartFgsState(); state.resetAllowStartFgsState(); app.mOptRecord.setShouldNotFreeze(false); app.mOptRecord.setShouldNotFreeze(false); Loading Loading @@ -2061,6 +2062,9 @@ public class OomAdjuster { // Similar to BIND_WAIVE_PRIORITY, keep it unfrozen. // Similar to BIND_WAIVE_PRIORITY, keep it unfrozen. if (clientAdj < ProcessList.CACHED_APP_MIN_ADJ) { if (clientAdj < ProcessList.CACHED_APP_MIN_ADJ) { app.mOptRecord.setShouldNotFreeze(true); 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 // Not doing bind OOM management, so treat // this guy more like a started service. // this guy more like a started service. Loading Loading @@ -2265,6 +2269,9 @@ public class OomAdjuster { // unfrozen. // unfrozen. if (clientAdj < ProcessList.CACHED_APP_MIN_ADJ) { if (clientAdj < ProcessList.CACHED_APP_MIN_ADJ) { app.mOptRecord.setShouldNotFreeze(true); 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) { if ((cr.flags&Context.BIND_TREAT_LIKE_ACTIVITY) != 0) { Loading
services/core/java/com/android/server/am/ProcessList.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -5043,6 +5043,7 @@ public final class ProcessList { final UidRecord uidRec = app.getUidRecord(); final UidRecord uidRec = app.getUidRecord(); if (mService.mConstants.mKillForceAppStandByAndCachedIdle if (mService.mConstants.mKillForceAppStandByAndCachedIdle && uidRec != null && uidRec.isIdle() && uidRec != null && uidRec.isIdle() && !app.mState.shouldNotKillOnForcedAppStandbyAndIdle() && app.isCached() && app.mState.isForcedAppStandby()) { && app.isCached() && app.mState.isForcedAppStandby()) { app.killLocked("cached idle & forced-app-standby", app.killLocked("cached idle & forced-app-standby", ApplicationExitInfo.REASON_OTHER, ApplicationExitInfo.REASON_OTHER, Loading
services/core/java/com/android/server/am/ProcessStateRecord.java +17 −0 Original line number Original line Diff line number Diff line Loading @@ -363,6 +363,13 @@ final class ProcessStateRecord { @ElapsedRealtimeLong @ElapsedRealtimeLong private long mLastInvisibleTime; 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 // Below are the cached task info for OomAdjuster only private static final int VALUE_INVALID = -1; private static final int VALUE_INVALID = -1; private static final int VALUE_FALSE = 0; private static final int VALUE_FALSE = 0; Loading Loading @@ -1143,6 +1150,16 @@ final class ProcessStateRecord { return mLastInvisibleTime; return mLastInvisibleTime; } } @GuardedBy("mService") void setNoKillOnForcedAppStandbyAndIdle(boolean shouldNotKill) { mNoKillOnForcedAppStandbyAndIdle = shouldNotKill; } @GuardedBy("mService") boolean shouldNotKillOnForcedAppStandbyAndIdle() { return mNoKillOnForcedAppStandbyAndIdle; } @GuardedBy({"mService", "mProcLock"}) @GuardedBy({"mService", "mProcLock"}) void dump(PrintWriter pw, String prefix, long nowUptime) { void dump(PrintWriter pw, String prefix, long nowUptime) { if (mReportedInteraction || mFgInteractionTime != 0) { if (mReportedInteraction || mFgInteractionTime != 0) { Loading