Loading services/core/java/com/android/server/am/ActiveServices.java +16 −11 Original line number Diff line number Diff line Loading @@ -861,7 +861,7 @@ public final class ActiveServices { final ServiceState stracker = r.getTracker(); if (stracker != null) { stracker.setForeground(true, mAm.mProcessStats.getMemFactorLocked(), r.lastActivity); SystemClock.uptimeMillis()); // Use current time, not lastActivity. } } mAm.mAppOpsService.startOperation(AppOpsManager.getToken(mAm.mAppOpsService), Loading Loading @@ -1137,7 +1137,8 @@ public final class ActiveServices { synchronized (mAm.mProcessStats.mLock) { final ServiceState stracker = r.getTracker(); if (stracker != null) { stracker.setStarted(true, mAm.mProcessStats.getMemFactorLocked(), r.lastActivity); stracker.setStarted(true, mAm.mProcessStats.getMemFactorLocked(), SystemClock.uptimeMillis()); // Use current time, not lastActivity. } } r.callStart = false; Loading Loading @@ -1974,7 +1975,8 @@ public final class ActiveServices { final ServiceState stracker = r.getTracker(); if (stracker != null) { stracker.setForeground(true, mAm.mProcessStats.getMemFactorLocked(), r.lastActivity); mAm.mProcessStats.getMemFactorLocked(), SystemClock.uptimeMillis()); } } } else { Loading Loading @@ -2843,7 +2845,7 @@ public final class ActiveServices { final ServiceState stracker = s.getTracker(); if (stracker != null) { stracker.setBound(true, mAm.mProcessStats.getMemFactorLocked(), s.lastActivity); SystemClock.uptimeMillis()); } } } Loading Loading @@ -3509,14 +3511,14 @@ public final class ActiveServices { timeoutNeeded = false; } long now = SystemClock.uptimeMillis(); ProcessServiceRecord psr; if (r.executeNesting == 0) { r.executeFg = fg; synchronized (mAm.mProcessStats.mLock) { final ServiceState stracker = r.getTracker(); if (stracker != null) { stracker.setExecuting(true, mAm.mProcessStats.getMemFactorLocked(), now); stracker.setExecuting(true, mAm.mProcessStats.getMemFactorLocked(), SystemClock.uptimeMillis()); } } if (r.app != null) { Loading Loading @@ -3547,7 +3549,7 @@ public final class ActiveServices { } r.executeFg |= fg; r.executeNesting++; r.executingStart = now; r.executingStart = SystemClock.uptimeMillis(); return oomAdjusted; } Loading Loading @@ -3734,7 +3736,8 @@ public final class ActiveServices { if (oldPosInRestarting == -1) { r.createdFromFg = false; synchronized (mAm.mProcessStats.mLock) { r.makeRestarting(mAm.mProcessStats.getMemFactorLocked(), now); r.makeRestarting(mAm.mProcessStats.getMemFactorLocked(), SystemClock.uptimeMillis()); } } boolean added = false; Loading Loading @@ -4500,7 +4503,6 @@ public final class ActiveServices { } } final long now = SystemClock.uptimeMillis(); // Check to see if the service had been started as foreground, but being // brought down before actually showing a notification. That is not allowed. if (r.fgRequired) { Loading @@ -4511,7 +4513,8 @@ public final class ActiveServices { synchronized (mAm.mProcessStats.mLock) { ServiceState stracker = r.getTracker(); if (stracker != null) { stracker.setForeground(false, mAm.mProcessStats.getMemFactorLocked(), now); stracker.setForeground(false, mAm.mProcessStats.getMemFactorLocked(), SystemClock.uptimeMillis()); } } mAm.mAppOpsService.finishOperation(AppOpsManager.getToken(mAm.mAppOpsService), Loading Loading @@ -4573,7 +4576,8 @@ public final class ActiveServices { synchronized (mAm.mProcessStats.mLock) { ServiceState stracker = r.getTracker(); if (stracker != null) { stracker.setForeground(false, mAm.mProcessStats.getMemFactorLocked(), now); stracker.setForeground(false, mAm.mProcessStats.getMemFactorLocked(), SystemClock.uptimeMillis()); } } mAm.mAppOpsService.finishOperation( Loading Loading @@ -4650,6 +4654,7 @@ public final class ActiveServices { synchronized (mAm.mProcessStats.mLock) { final int memFactor = mAm.mProcessStats.getMemFactorLocked(); if (r.tracker != null) { final long now = SystemClock.uptimeMillis(); r.tracker.setStarted(false, memFactor, now); r.tracker.setBound(false, memFactor, now); if (r.executeNesting == 0) { Loading services/core/java/com/android/server/am/ActivityManagerService.java +2 −2 Original line number Diff line number Diff line Loading @@ -14743,10 +14743,10 @@ public class ActivityManagerService extends IActivityManager.Stub } @GuardedBy(anyOf = {"this", "mProcLock"}) final void setProcessTrackerStateLOSP(ProcessRecord proc, int memFactor, long now) { final void setProcessTrackerStateLOSP(ProcessRecord proc, int memFactor) { if (proc.getThread() != null) { proc.mProfile.setProcessTrackerState( proc.mState.getReportedProcState(), memFactor, now); proc.mState.getReportedProcState(), memFactor); } } services/core/java/com/android/server/am/AppProfiler.java +4 −3 Original line number Diff line number Diff line Loading @@ -953,7 +953,6 @@ public class AppProfiler { @GuardedBy({"mService", "mProcLock"}) boolean updateLowMemStateLSP(int numCached, int numEmpty, int numTrimming) { final long now = SystemClock.uptimeMillis(); int memFactor; if (mLowMemDetector != null && mLowMemDetector.isAvailable()) { memFactor = mLowMemDetector.getMemFactor(); Loading Loading @@ -1008,7 +1007,9 @@ public class AppProfiler { mLastNumProcesses = mService.mProcessList.getLruSizeLOSP(); boolean allChanged; int trackerMemFactor; final long now; synchronized (mService.mProcessStats.mLock) { now = SystemClock.uptimeMillis(); allChanged = mService.mProcessStats.setMemFactorLocked(memFactor, mService.mAtmInternal == null || !mService.mAtmInternal.isSleeping(), now); trackerMemFactor = mService.mProcessStats.getMemFactorLocked(); Loading Loading @@ -1044,7 +1045,7 @@ public class AppProfiler { final int curProcState = state.getCurProcState(); IApplicationThread thread; if (allChanged || state.hasProcStateChanged()) { mService.setProcessTrackerStateLOSP(app, trackerMemFactor, now); mService.setProcessTrackerStateLOSP(app, trackerMemFactor); state.setProcStateChanged(false); } trimMemoryUiHiddenIfNecessaryLSP(app); Loading Loading @@ -1113,7 +1114,7 @@ public class AppProfiler { final IApplicationThread thread; final ProcessStateRecord state = app.mState; if (allChanged || state.hasProcStateChanged()) { mService.setProcessTrackerStateLOSP(app, trackerMemFactor, now); mService.setProcessTrackerStateLOSP(app, trackerMemFactor); state.setProcStateChanged(false); } trimMemoryUiHiddenIfNecessaryLSP(app); Loading services/core/java/com/android/server/am/ConnectionRecord.java +3 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.app.IServiceConnection; import android.app.PendingIntent; import android.content.ComponentName; import android.content.Context; import android.os.SystemClock; import android.util.Slog; import android.util.proto.ProtoOutputStream; import android.util.proto.ProtoUtils; Loading Loading @@ -158,10 +159,10 @@ final class ConnectionRecord { } } public void trackProcState(int procState, int seq, long now) { public void trackProcState(int procState, int seq) { if (association != null) { synchronized (mProcStatsLock) { association.trackProcState(procState, seq, now); association.trackProcState(procState, seq, SystemClock.uptimeMillis()); } } } Loading services/core/java/com/android/server/am/ContentProviderConnection.java +5 −2 Original line number Diff line number Diff line Loading @@ -98,10 +98,13 @@ public final class ContentProviderConnection extends Binder { } } public void trackProcState(int procState, int seq, long now) { /** * Track the given proc state change. */ public void trackProcState(int procState, int seq) { if (association != null) { synchronized (mProcStatsLock) { association.trackProcState(procState, seq, now); association.trackProcState(procState, seq, SystemClock.uptimeMillis()); } } } Loading Loading
services/core/java/com/android/server/am/ActiveServices.java +16 −11 Original line number Diff line number Diff line Loading @@ -861,7 +861,7 @@ public final class ActiveServices { final ServiceState stracker = r.getTracker(); if (stracker != null) { stracker.setForeground(true, mAm.mProcessStats.getMemFactorLocked(), r.lastActivity); SystemClock.uptimeMillis()); // Use current time, not lastActivity. } } mAm.mAppOpsService.startOperation(AppOpsManager.getToken(mAm.mAppOpsService), Loading Loading @@ -1137,7 +1137,8 @@ public final class ActiveServices { synchronized (mAm.mProcessStats.mLock) { final ServiceState stracker = r.getTracker(); if (stracker != null) { stracker.setStarted(true, mAm.mProcessStats.getMemFactorLocked(), r.lastActivity); stracker.setStarted(true, mAm.mProcessStats.getMemFactorLocked(), SystemClock.uptimeMillis()); // Use current time, not lastActivity. } } r.callStart = false; Loading Loading @@ -1974,7 +1975,8 @@ public final class ActiveServices { final ServiceState stracker = r.getTracker(); if (stracker != null) { stracker.setForeground(true, mAm.mProcessStats.getMemFactorLocked(), r.lastActivity); mAm.mProcessStats.getMemFactorLocked(), SystemClock.uptimeMillis()); } } } else { Loading Loading @@ -2843,7 +2845,7 @@ public final class ActiveServices { final ServiceState stracker = s.getTracker(); if (stracker != null) { stracker.setBound(true, mAm.mProcessStats.getMemFactorLocked(), s.lastActivity); SystemClock.uptimeMillis()); } } } Loading Loading @@ -3509,14 +3511,14 @@ public final class ActiveServices { timeoutNeeded = false; } long now = SystemClock.uptimeMillis(); ProcessServiceRecord psr; if (r.executeNesting == 0) { r.executeFg = fg; synchronized (mAm.mProcessStats.mLock) { final ServiceState stracker = r.getTracker(); if (stracker != null) { stracker.setExecuting(true, mAm.mProcessStats.getMemFactorLocked(), now); stracker.setExecuting(true, mAm.mProcessStats.getMemFactorLocked(), SystemClock.uptimeMillis()); } } if (r.app != null) { Loading Loading @@ -3547,7 +3549,7 @@ public final class ActiveServices { } r.executeFg |= fg; r.executeNesting++; r.executingStart = now; r.executingStart = SystemClock.uptimeMillis(); return oomAdjusted; } Loading Loading @@ -3734,7 +3736,8 @@ public final class ActiveServices { if (oldPosInRestarting == -1) { r.createdFromFg = false; synchronized (mAm.mProcessStats.mLock) { r.makeRestarting(mAm.mProcessStats.getMemFactorLocked(), now); r.makeRestarting(mAm.mProcessStats.getMemFactorLocked(), SystemClock.uptimeMillis()); } } boolean added = false; Loading Loading @@ -4500,7 +4503,6 @@ public final class ActiveServices { } } final long now = SystemClock.uptimeMillis(); // Check to see if the service had been started as foreground, but being // brought down before actually showing a notification. That is not allowed. if (r.fgRequired) { Loading @@ -4511,7 +4513,8 @@ public final class ActiveServices { synchronized (mAm.mProcessStats.mLock) { ServiceState stracker = r.getTracker(); if (stracker != null) { stracker.setForeground(false, mAm.mProcessStats.getMemFactorLocked(), now); stracker.setForeground(false, mAm.mProcessStats.getMemFactorLocked(), SystemClock.uptimeMillis()); } } mAm.mAppOpsService.finishOperation(AppOpsManager.getToken(mAm.mAppOpsService), Loading Loading @@ -4573,7 +4576,8 @@ public final class ActiveServices { synchronized (mAm.mProcessStats.mLock) { ServiceState stracker = r.getTracker(); if (stracker != null) { stracker.setForeground(false, mAm.mProcessStats.getMemFactorLocked(), now); stracker.setForeground(false, mAm.mProcessStats.getMemFactorLocked(), SystemClock.uptimeMillis()); } } mAm.mAppOpsService.finishOperation( Loading Loading @@ -4650,6 +4654,7 @@ public final class ActiveServices { synchronized (mAm.mProcessStats.mLock) { final int memFactor = mAm.mProcessStats.getMemFactorLocked(); if (r.tracker != null) { final long now = SystemClock.uptimeMillis(); r.tracker.setStarted(false, memFactor, now); r.tracker.setBound(false, memFactor, now); if (r.executeNesting == 0) { Loading
services/core/java/com/android/server/am/ActivityManagerService.java +2 −2 Original line number Diff line number Diff line Loading @@ -14743,10 +14743,10 @@ public class ActivityManagerService extends IActivityManager.Stub } @GuardedBy(anyOf = {"this", "mProcLock"}) final void setProcessTrackerStateLOSP(ProcessRecord proc, int memFactor, long now) { final void setProcessTrackerStateLOSP(ProcessRecord proc, int memFactor) { if (proc.getThread() != null) { proc.mProfile.setProcessTrackerState( proc.mState.getReportedProcState(), memFactor, now); proc.mState.getReportedProcState(), memFactor); } }
services/core/java/com/android/server/am/AppProfiler.java +4 −3 Original line number Diff line number Diff line Loading @@ -953,7 +953,6 @@ public class AppProfiler { @GuardedBy({"mService", "mProcLock"}) boolean updateLowMemStateLSP(int numCached, int numEmpty, int numTrimming) { final long now = SystemClock.uptimeMillis(); int memFactor; if (mLowMemDetector != null && mLowMemDetector.isAvailable()) { memFactor = mLowMemDetector.getMemFactor(); Loading Loading @@ -1008,7 +1007,9 @@ public class AppProfiler { mLastNumProcesses = mService.mProcessList.getLruSizeLOSP(); boolean allChanged; int trackerMemFactor; final long now; synchronized (mService.mProcessStats.mLock) { now = SystemClock.uptimeMillis(); allChanged = mService.mProcessStats.setMemFactorLocked(memFactor, mService.mAtmInternal == null || !mService.mAtmInternal.isSleeping(), now); trackerMemFactor = mService.mProcessStats.getMemFactorLocked(); Loading Loading @@ -1044,7 +1045,7 @@ public class AppProfiler { final int curProcState = state.getCurProcState(); IApplicationThread thread; if (allChanged || state.hasProcStateChanged()) { mService.setProcessTrackerStateLOSP(app, trackerMemFactor, now); mService.setProcessTrackerStateLOSP(app, trackerMemFactor); state.setProcStateChanged(false); } trimMemoryUiHiddenIfNecessaryLSP(app); Loading Loading @@ -1113,7 +1114,7 @@ public class AppProfiler { final IApplicationThread thread; final ProcessStateRecord state = app.mState; if (allChanged || state.hasProcStateChanged()) { mService.setProcessTrackerStateLOSP(app, trackerMemFactor, now); mService.setProcessTrackerStateLOSP(app, trackerMemFactor); state.setProcStateChanged(false); } trimMemoryUiHiddenIfNecessaryLSP(app); Loading
services/core/java/com/android/server/am/ConnectionRecord.java +3 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.app.IServiceConnection; import android.app.PendingIntent; import android.content.ComponentName; import android.content.Context; import android.os.SystemClock; import android.util.Slog; import android.util.proto.ProtoOutputStream; import android.util.proto.ProtoUtils; Loading Loading @@ -158,10 +159,10 @@ final class ConnectionRecord { } } public void trackProcState(int procState, int seq, long now) { public void trackProcState(int procState, int seq) { if (association != null) { synchronized (mProcStatsLock) { association.trackProcState(procState, seq, now); association.trackProcState(procState, seq, SystemClock.uptimeMillis()); } } } Loading
services/core/java/com/android/server/am/ContentProviderConnection.java +5 −2 Original line number Diff line number Diff line Loading @@ -98,10 +98,13 @@ public final class ContentProviderConnection extends Binder { } } public void trackProcState(int procState, int seq, long now) { /** * Track the given proc state change. */ public void trackProcState(int procState, int seq) { if (association != null) { synchronized (mProcStatsLock) { association.trackProcState(procState, seq, now); association.trackProcState(procState, seq, SystemClock.uptimeMillis()); } } } Loading