Loading services/core/java/com/android/server/am/ActiveServices.java +3 −3 Original line number Diff line number Diff line Loading @@ -2501,12 +2501,12 @@ public final class ActiveServices { FGS_STOP_REASON_STOP_FOREGROUND, FGS_TYPE_POLICY_CHECK_UNKNOWN); // foregroundServiceType is used in logFGSStateChangeLocked(), so we can't clear it // earlier. r.foregroundServiceType = 0; synchronized (mFGSLogger) { mFGSLogger.logForegroundServiceStop(r.appInfo.uid, r); } // foregroundServiceType is used in logFGSStateChangeLocked(), so we can't clear it // earlier. r.foregroundServiceType = 0; r.mFgsNotificationWasDeferred = false; signalForegroundServiceObserversLocked(r); resetFgsRestrictionLocked(r); Loading services/core/java/com/android/server/am/ForegroundServiceTypeLoggerModule.java +22 −13 Original line number Diff line number Diff line Loading @@ -141,6 +141,10 @@ public class ForegroundServiceTypeLoggerModule { // grab the appropriate types final IntArray apiTypes = convertFgsTypeToApiTypes(record.foregroundServiceType); if (apiTypes.size() == 0) { Slog.w(TAG, "Foreground service start for UID: " + uid + " does not have any types"); } // now we need to iterate through the types // and insert the new record as needed final IntArray apiTypesFound = new IntArray(); Loading Loading @@ -201,6 +205,9 @@ public class ForegroundServiceTypeLoggerModule { // and also clean up the start calls stack by UID final IntArray apiTypes = convertFgsTypeToApiTypes(record.foregroundServiceType); final UidState uidState = mUids.get(uid); if (apiTypes.size() == 0) { Slog.w(TAG, "FGS stop call for: " + uid + " has no types!"); } if (uidState == null) { Slog.w(TAG, "FGS stop call being logged with no start call for UID for UID " + uid Loading Loading @@ -460,17 +467,18 @@ public class ForegroundServiceTypeLoggerModule { public void logFgsApiEvent(ServiceRecord r, int fgsState, @FgsApiState int apiState, @ForegroundServiceApiType int apiType, long timestamp) { long apiDurationBeforeFgsStart = r.createRealTime - timestamp; long apiDurationAfterFgsEnd = timestamp - r.mFgsExitTime; long apiDurationBeforeFgsStart = 0; long apiDurationAfterFgsEnd = 0; UidState uidState = mUids.get(r.appInfo.uid); if (uidState != null) { if (uidState == null) { return; } if (uidState.mFirstFgsTimeStamp.contains(apiType)) { apiDurationBeforeFgsStart = uidState.mFirstFgsTimeStamp.get(apiType) - timestamp; } if (uidState.mLastFgsTimeStamp.contains(apiType)) { apiDurationAfterFgsEnd = timestamp - uidState.mLastFgsTimeStamp.get(apiType); } } final int[] apiTypes = new int[1]; apiTypes[0] = apiType; final long[] timeStamps = new long[1]; Loading Loading @@ -525,11 +533,12 @@ public class ForegroundServiceTypeLoggerModule { @ForegroundServiceApiType int apiType, long timestamp) { long apiDurationAfterFgsEnd = 0; UidState uidState = mUids.get(uid); if (uidState != null) { if (uidState == null) { return; } if (uidState.mLastFgsTimeStamp.contains(apiType)) { apiDurationAfterFgsEnd = timestamp - uidState.mLastFgsTimeStamp.get(apiType); } } final int[] apiTypes = new int[1]; apiTypes[0] = apiType; final long[] timeStamps = new long[1]; Loading Loading
services/core/java/com/android/server/am/ActiveServices.java +3 −3 Original line number Diff line number Diff line Loading @@ -2501,12 +2501,12 @@ public final class ActiveServices { FGS_STOP_REASON_STOP_FOREGROUND, FGS_TYPE_POLICY_CHECK_UNKNOWN); // foregroundServiceType is used in logFGSStateChangeLocked(), so we can't clear it // earlier. r.foregroundServiceType = 0; synchronized (mFGSLogger) { mFGSLogger.logForegroundServiceStop(r.appInfo.uid, r); } // foregroundServiceType is used in logFGSStateChangeLocked(), so we can't clear it // earlier. r.foregroundServiceType = 0; r.mFgsNotificationWasDeferred = false; signalForegroundServiceObserversLocked(r); resetFgsRestrictionLocked(r); Loading
services/core/java/com/android/server/am/ForegroundServiceTypeLoggerModule.java +22 −13 Original line number Diff line number Diff line Loading @@ -141,6 +141,10 @@ public class ForegroundServiceTypeLoggerModule { // grab the appropriate types final IntArray apiTypes = convertFgsTypeToApiTypes(record.foregroundServiceType); if (apiTypes.size() == 0) { Slog.w(TAG, "Foreground service start for UID: " + uid + " does not have any types"); } // now we need to iterate through the types // and insert the new record as needed final IntArray apiTypesFound = new IntArray(); Loading Loading @@ -201,6 +205,9 @@ public class ForegroundServiceTypeLoggerModule { // and also clean up the start calls stack by UID final IntArray apiTypes = convertFgsTypeToApiTypes(record.foregroundServiceType); final UidState uidState = mUids.get(uid); if (apiTypes.size() == 0) { Slog.w(TAG, "FGS stop call for: " + uid + " has no types!"); } if (uidState == null) { Slog.w(TAG, "FGS stop call being logged with no start call for UID for UID " + uid Loading Loading @@ -460,17 +467,18 @@ public class ForegroundServiceTypeLoggerModule { public void logFgsApiEvent(ServiceRecord r, int fgsState, @FgsApiState int apiState, @ForegroundServiceApiType int apiType, long timestamp) { long apiDurationBeforeFgsStart = r.createRealTime - timestamp; long apiDurationAfterFgsEnd = timestamp - r.mFgsExitTime; long apiDurationBeforeFgsStart = 0; long apiDurationAfterFgsEnd = 0; UidState uidState = mUids.get(r.appInfo.uid); if (uidState != null) { if (uidState == null) { return; } if (uidState.mFirstFgsTimeStamp.contains(apiType)) { apiDurationBeforeFgsStart = uidState.mFirstFgsTimeStamp.get(apiType) - timestamp; } if (uidState.mLastFgsTimeStamp.contains(apiType)) { apiDurationAfterFgsEnd = timestamp - uidState.mLastFgsTimeStamp.get(apiType); } } final int[] apiTypes = new int[1]; apiTypes[0] = apiType; final long[] timeStamps = new long[1]; Loading Loading @@ -525,11 +533,12 @@ public class ForegroundServiceTypeLoggerModule { @ForegroundServiceApiType int apiType, long timestamp) { long apiDurationAfterFgsEnd = 0; UidState uidState = mUids.get(uid); if (uidState != null) { if (uidState == null) { return; } if (uidState.mLastFgsTimeStamp.contains(apiType)) { apiDurationAfterFgsEnd = timestamp - uidState.mLastFgsTimeStamp.get(apiType); } } final int[] apiTypes = new int[1]; apiTypes[0] = apiType; final long[] timeStamps = new long[1]; Loading