Loading services/core/java/com/android/server/am/ActivityManagerService.java +3 −3 Original line number Diff line number Diff line Loading @@ -2217,7 +2217,7 @@ public class ActivityManagerService extends IActivityManager.Stub mConstants = hasHandlerThread ? new ActivityManagerConstants(this, mHandler) : null; final ActiveUids activeUids = new ActiveUids(this, false /* postChangesToAtm */); mProcessList.init(this, activeUids); mOomAdjuster = new OomAdjuster(this, mProcessList, activeUids); mOomAdjuster = new OomAdjuster(this, mProcessList, activeUids, new Object()); mIntentFirewall = hasHandlerThread ? new IntentFirewall(new IntentFirewallInterface(), mHandler) : null; Loading Loading @@ -2265,7 +2265,7 @@ public class ActivityManagerService extends IActivityManager.Stub mConstants = new ActivityManagerConstants(this, mHandler); final ActiveUids activeUids = new ActiveUids(this, true /* postChangesToAtm */); mProcessList.init(this, activeUids); mOomAdjuster = new OomAdjuster(this, mProcessList, activeUids); mOomAdjuster = new OomAdjuster(this, mProcessList, activeUids, atm.getGlobalLock()); // Broadcast policy parameters final BroadcastConstants foreConstants = new BroadcastConstants( Loading Loading @@ -3091,7 +3091,7 @@ public class ActivityManagerService extends IActivityManager.Stub } else { UidRecord validateUid = mValidateUids.get(item.uid); if (validateUid == null) { validateUid = new UidRecord(item.uid, mAtmInternal); validateUid = new UidRecord(item.uid); mValidateUids.put(item.uid, validateUid); } if ((item.change & UidRecord.CHANGE_IDLE) != 0) { Loading services/core/java/com/android/server/am/OomAdjuster.java +19 −1 Original line number Diff line number Diff line Loading @@ -127,8 +127,18 @@ public final class OomAdjuster { private final ActivityManagerService mService; private final ProcessList mProcessList; OomAdjuster(ActivityManagerService service, ProcessList processList, ActiveUids activeUids) { /** * Used to lock {@link #updateOomAdjImpl} for state consistency. It also reduces frequency lock * and unlock when getting and setting value to {@link ProcessRecord#mWindowProcessController}. * Note it is declared as Object type so the locked-region-code-injection won't wrap the * unnecessary priority booster. */ private final Object mAtmGlobalLock; OomAdjuster(ActivityManagerService service, ProcessList processList, ActiveUids activeUids, Object atmGlobalLock) { mService = service; mAtmGlobalLock = atmGlobalLock; mProcessList = processList; mActiveUids = activeUids; Loading Loading @@ -186,6 +196,13 @@ public final class OomAdjuster { @GuardedBy("mService") final void updateOomAdjLocked() { synchronized (mAtmGlobalLock) { updateOomAdjImpl(); } } @GuardedBy({"mService", "mAtmGlobalLock"}) private void updateOomAdjImpl() { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "updateOomAdj"); mService.mOomAdjProfiler.oomAdjStarted(); final ProcessRecord TOP_APP = mService.getTopAppLocked(); Loading Loading @@ -534,6 +551,7 @@ public final class OomAdjuster { uidRec.setProcState = uidRec.getCurProcState(); uidRec.setWhitelist = uidRec.curWhitelist; uidRec.setIdle = uidRec.idle; mService.mAtmInternal.onUidProcStateChanged(uidRec.uid, uidRec.setProcState); mService.enqueueUidChangeLocked(uidRec, -1, uidChange); mService.noteUidProcessState(uidRec.uid, uidRec.getCurProcState()); if (uidRec.foregroundServices) { Loading services/core/java/com/android/server/am/ProcessList.java +1 −1 Original line number Diff line number Diff line Loading @@ -2197,7 +2197,7 @@ public final class ProcessList { } UidRecord uidRec = mActiveUids.get(proc.uid); if (uidRec == null) { uidRec = new UidRecord(proc.uid, mService.mAtmInternal); uidRec = new UidRecord(proc.uid); // This is the first appearance of the uid, report it now! if (DEBUG_UID_OBSERVERS) Slog.i(TAG_UID_OBSERVERS, "Creating new process uid: " + uidRec); Loading services/core/java/com/android/server/am/ProcessRecord.java +0 −8 Original line number Diff line number Diff line Loading @@ -655,10 +655,6 @@ final class ProcessRecord implements WindowProcessListener { return mWindowProcessController.hasActivities(); } void clearActivities() { mWindowProcessController.clearActivities(); } boolean hasActivitiesOrRecentTasks() { return mWindowProcessController.hasActivitiesOrRecentTasks(); } Loading @@ -667,10 +663,6 @@ final class ProcessRecord implements WindowProcessListener { return mWindowProcessController.hasRecentTasks(); } void clearRecentTasks() { mWindowProcessController.clearRecentTasks(); } /** * This method returns true if any of the activities within the process record are interesting * to the user. See HistoryRecord.isInterestingToUserLocked() Loading services/core/java/com/android/server/am/UidRecord.java +1 −7 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ import android.util.proto.ProtoOutputStream; import android.util.proto.ProtoUtils; import com.android.internal.annotations.GuardedBy; import com.android.server.wm.ActivityTaskManagerInternal; /** * Overall information about a uid that has actively running processes. Loading @@ -43,7 +42,6 @@ public final class UidRecord { boolean idle; boolean setIdle; int numProcs; final ActivityTaskManagerInternal mAtmInternal; /** * Sequence number associated with the {@link #mCurProcState}. This is incremented using Loading Loading @@ -117,10 +115,9 @@ public final class UidRecord { ChangeItem pendingChange; int lastReportedChange; public UidRecord(int _uid, ActivityTaskManagerInternal atmInternal) { public UidRecord(int _uid) { uid = _uid; idle = true; mAtmInternal = atmInternal; reset(); } Loading @@ -130,9 +127,6 @@ public final class UidRecord { public void setCurProcState(int curProcState) { mCurProcState = curProcState; if (mAtmInternal != null) { mAtmInternal.onUidProcStateChanged(uid, curProcState); } } public void reset() { Loading Loading
services/core/java/com/android/server/am/ActivityManagerService.java +3 −3 Original line number Diff line number Diff line Loading @@ -2217,7 +2217,7 @@ public class ActivityManagerService extends IActivityManager.Stub mConstants = hasHandlerThread ? new ActivityManagerConstants(this, mHandler) : null; final ActiveUids activeUids = new ActiveUids(this, false /* postChangesToAtm */); mProcessList.init(this, activeUids); mOomAdjuster = new OomAdjuster(this, mProcessList, activeUids); mOomAdjuster = new OomAdjuster(this, mProcessList, activeUids, new Object()); mIntentFirewall = hasHandlerThread ? new IntentFirewall(new IntentFirewallInterface(), mHandler) : null; Loading Loading @@ -2265,7 +2265,7 @@ public class ActivityManagerService extends IActivityManager.Stub mConstants = new ActivityManagerConstants(this, mHandler); final ActiveUids activeUids = new ActiveUids(this, true /* postChangesToAtm */); mProcessList.init(this, activeUids); mOomAdjuster = new OomAdjuster(this, mProcessList, activeUids); mOomAdjuster = new OomAdjuster(this, mProcessList, activeUids, atm.getGlobalLock()); // Broadcast policy parameters final BroadcastConstants foreConstants = new BroadcastConstants( Loading Loading @@ -3091,7 +3091,7 @@ public class ActivityManagerService extends IActivityManager.Stub } else { UidRecord validateUid = mValidateUids.get(item.uid); if (validateUid == null) { validateUid = new UidRecord(item.uid, mAtmInternal); validateUid = new UidRecord(item.uid); mValidateUids.put(item.uid, validateUid); } if ((item.change & UidRecord.CHANGE_IDLE) != 0) { Loading
services/core/java/com/android/server/am/OomAdjuster.java +19 −1 Original line number Diff line number Diff line Loading @@ -127,8 +127,18 @@ public final class OomAdjuster { private final ActivityManagerService mService; private final ProcessList mProcessList; OomAdjuster(ActivityManagerService service, ProcessList processList, ActiveUids activeUids) { /** * Used to lock {@link #updateOomAdjImpl} for state consistency. It also reduces frequency lock * and unlock when getting and setting value to {@link ProcessRecord#mWindowProcessController}. * Note it is declared as Object type so the locked-region-code-injection won't wrap the * unnecessary priority booster. */ private final Object mAtmGlobalLock; OomAdjuster(ActivityManagerService service, ProcessList processList, ActiveUids activeUids, Object atmGlobalLock) { mService = service; mAtmGlobalLock = atmGlobalLock; mProcessList = processList; mActiveUids = activeUids; Loading Loading @@ -186,6 +196,13 @@ public final class OomAdjuster { @GuardedBy("mService") final void updateOomAdjLocked() { synchronized (mAtmGlobalLock) { updateOomAdjImpl(); } } @GuardedBy({"mService", "mAtmGlobalLock"}) private void updateOomAdjImpl() { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "updateOomAdj"); mService.mOomAdjProfiler.oomAdjStarted(); final ProcessRecord TOP_APP = mService.getTopAppLocked(); Loading Loading @@ -534,6 +551,7 @@ public final class OomAdjuster { uidRec.setProcState = uidRec.getCurProcState(); uidRec.setWhitelist = uidRec.curWhitelist; uidRec.setIdle = uidRec.idle; mService.mAtmInternal.onUidProcStateChanged(uidRec.uid, uidRec.setProcState); mService.enqueueUidChangeLocked(uidRec, -1, uidChange); mService.noteUidProcessState(uidRec.uid, uidRec.getCurProcState()); if (uidRec.foregroundServices) { Loading
services/core/java/com/android/server/am/ProcessList.java +1 −1 Original line number Diff line number Diff line Loading @@ -2197,7 +2197,7 @@ public final class ProcessList { } UidRecord uidRec = mActiveUids.get(proc.uid); if (uidRec == null) { uidRec = new UidRecord(proc.uid, mService.mAtmInternal); uidRec = new UidRecord(proc.uid); // This is the first appearance of the uid, report it now! if (DEBUG_UID_OBSERVERS) Slog.i(TAG_UID_OBSERVERS, "Creating new process uid: " + uidRec); Loading
services/core/java/com/android/server/am/ProcessRecord.java +0 −8 Original line number Diff line number Diff line Loading @@ -655,10 +655,6 @@ final class ProcessRecord implements WindowProcessListener { return mWindowProcessController.hasActivities(); } void clearActivities() { mWindowProcessController.clearActivities(); } boolean hasActivitiesOrRecentTasks() { return mWindowProcessController.hasActivitiesOrRecentTasks(); } Loading @@ -667,10 +663,6 @@ final class ProcessRecord implements WindowProcessListener { return mWindowProcessController.hasRecentTasks(); } void clearRecentTasks() { mWindowProcessController.clearRecentTasks(); } /** * This method returns true if any of the activities within the process record are interesting * to the user. See HistoryRecord.isInterestingToUserLocked() Loading
services/core/java/com/android/server/am/UidRecord.java +1 −7 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ import android.util.proto.ProtoOutputStream; import android.util.proto.ProtoUtils; import com.android.internal.annotations.GuardedBy; import com.android.server.wm.ActivityTaskManagerInternal; /** * Overall information about a uid that has actively running processes. Loading @@ -43,7 +42,6 @@ public final class UidRecord { boolean idle; boolean setIdle; int numProcs; final ActivityTaskManagerInternal mAtmInternal; /** * Sequence number associated with the {@link #mCurProcState}. This is incremented using Loading Loading @@ -117,10 +115,9 @@ public final class UidRecord { ChangeItem pendingChange; int lastReportedChange; public UidRecord(int _uid, ActivityTaskManagerInternal atmInternal) { public UidRecord(int _uid) { uid = _uid; idle = true; mAtmInternal = atmInternal; reset(); } Loading @@ -130,9 +127,6 @@ public final class UidRecord { public void setCurProcState(int curProcState) { mCurProcState = curProcState; if (mAtmInternal != null) { mAtmInternal.onUidProcStateChanged(uid, curProcState); } } public void reset() { Loading