Loading services/core/java/com/android/server/am/ActiveServices.java +15 −5 Original line number Diff line number Diff line Loading @@ -88,6 +88,7 @@ import static com.android.internal.messages.nano.SystemMessageProto.SystemMessag import static com.android.internal.util.FrameworkStatsLog.FOREGROUND_SERVICE_STATE_CHANGED__STATE__DENIED; import static com.android.internal.util.FrameworkStatsLog.FOREGROUND_SERVICE_STATE_CHANGED__STATE__ENTER; import static com.android.internal.util.FrameworkStatsLog.FOREGROUND_SERVICE_STATE_CHANGED__STATE__EXIT; import static com.android.internal.util.FrameworkStatsLog.FOREGROUND_SERVICE_STATE_CHANGED__STATE__TIMED_OUT; import static com.android.internal.util.FrameworkStatsLog.SERVICE_REQUEST_EVENT_REPORTED; import static com.android.internal.util.FrameworkStatsLog.SERVICE_REQUEST_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_NORMAL; import static com.android.internal.util.FrameworkStatsLog.SERVICE_REQUEST_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_STOPPED; Loading Loading @@ -3240,6 +3241,12 @@ public final class ActiveServices { return; } Slog.e(TAG_SERVICE, "Short FGS timed out: " + sr); final long now = SystemClock.uptimeMillis(); logFGSStateChangeLocked(sr, FOREGROUND_SERVICE_STATE_CHANGED__STATE__TIMED_OUT, now > sr.mFgsEnterTime ? (int) (now - sr.mFgsEnterTime) : 0, FGS_STOP_REASON_UNKNOWN, FGS_TYPE_POLICY_CHECK_UNKNOWN); try { sr.app.getThread().scheduleTimeoutService(sr, sr.getShortFgsInfo().getStartId()); } catch (RemoteException e) { Loading Loading @@ -7897,7 +7904,8 @@ public final class ActiveServices { boolean allowWhileInUsePermissionInFgs; @PowerExemptionManager.ReasonCode int fgsStartReasonCode; if (state == FOREGROUND_SERVICE_STATE_CHANGED__STATE__ENTER || state == FOREGROUND_SERVICE_STATE_CHANGED__STATE__EXIT) { || state == FOREGROUND_SERVICE_STATE_CHANGED__STATE__EXIT || state == FOREGROUND_SERVICE_STATE_CHANGED__STATE__TIMED_OUT) { allowWhileInUsePermissionInFgs = r.mAllowWhileInUsePermissionInFgsAtEntering; fgsStartReasonCode = r.mAllowStartForegroundAtEntering; } else { Loading Loading @@ -7931,9 +7939,9 @@ public final class ActiveServices { r.mFgsDelegation != null ? r.mFgsDelegation.mOptions.mClientUid : INVALID_UID, r.mFgsDelegation != null ? r.mFgsDelegation.mOptions.mDelegationService : ForegroundServiceDelegationOptions.DELEGATION_SERVICE_DEFAULT, 0, null, null); 0 /* api_sate */, null /* api_type */, null /* api_timestamp */); int event = 0; if (state == FOREGROUND_SERVICE_STATE_CHANGED__STATE__ENTER) { Loading @@ -7942,6 +7950,8 @@ public final class ActiveServices { event = EventLogTags.AM_FOREGROUND_SERVICE_STOP; } else if (state == FOREGROUND_SERVICE_STATE_CHANGED__STATE__DENIED) { event = EventLogTags.AM_FOREGROUND_SERVICE_DENIED; } else if (state == FOREGROUND_SERVICE_STATE_CHANGED__STATE__TIMED_OUT) { event = EventLogTags.AM_FOREGROUND_SERVICE_TIMED_OUT; }else { // Unknown event. return; Loading services/core/java/com/android/server/am/EventLogTags.logtags +2 −1 Original line number Diff line number Diff line Loading @@ -121,10 +121,11 @@ option java_package com.android.server.am # Similarly, tags below are used by UserManagerService 30091 um_user_visibility_changed (userId|1|5),(visible|1) # Foreground service start/stop events. # Foreground service start/stop/denied/timed_out events. 30100 am_foreground_service_start (User|1|5),(Component Name|3),(allowWhileInUse|1),(startReasonCode|3),(targetSdk|1|1),(callerTargetSdk|1|1),(notificationWasDeferred|1),(notificationShown|1),(durationMs|1|3),(startForegroundCount|1|1),(stopReason|3),(fgsType|1) 30101 am_foreground_service_denied (User|1|5),(Component Name|3),(allowWhileInUse|1),(startReasonCode|3),(targetSdk|1|1),(callerTargetSdk|1|1),(notificationWasDeferred|1),(notificationShown|1),(durationMs|1|3),(startForegroundCount|1|1),(stopReason|3),(fgsType|1) 30102 am_foreground_service_stop (User|1|5),(Component Name|3),(allowWhileInUse|1),(startReasonCode|3),(targetSdk|1|1),(callerTargetSdk|1|1),(notificationWasDeferred|1),(notificationShown|1),(durationMs|1|3),(startForegroundCount|1|1),(stopReason|3),(fgsType|1) 30103 am_foreground_service_timed_out (User|1|5),(Component Name|3),(allowWhileInUse|1),(startReasonCode|3),(targetSdk|1|1),(callerTargetSdk|1|1),(notificationWasDeferred|1),(notificationShown|1),(durationMs|1|3),(startForegroundCount|1|1),(stopReason|3),(fgsType|1) # Intent Sender redirect for UserHandle.USER_CURRENT 30110 am_intent_sender_redirect_user (userId|1|5) Loading
services/core/java/com/android/server/am/ActiveServices.java +15 −5 Original line number Diff line number Diff line Loading @@ -88,6 +88,7 @@ import static com.android.internal.messages.nano.SystemMessageProto.SystemMessag import static com.android.internal.util.FrameworkStatsLog.FOREGROUND_SERVICE_STATE_CHANGED__STATE__DENIED; import static com.android.internal.util.FrameworkStatsLog.FOREGROUND_SERVICE_STATE_CHANGED__STATE__ENTER; import static com.android.internal.util.FrameworkStatsLog.FOREGROUND_SERVICE_STATE_CHANGED__STATE__EXIT; import static com.android.internal.util.FrameworkStatsLog.FOREGROUND_SERVICE_STATE_CHANGED__STATE__TIMED_OUT; import static com.android.internal.util.FrameworkStatsLog.SERVICE_REQUEST_EVENT_REPORTED; import static com.android.internal.util.FrameworkStatsLog.SERVICE_REQUEST_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_NORMAL; import static com.android.internal.util.FrameworkStatsLog.SERVICE_REQUEST_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_STOPPED; Loading Loading @@ -3240,6 +3241,12 @@ public final class ActiveServices { return; } Slog.e(TAG_SERVICE, "Short FGS timed out: " + sr); final long now = SystemClock.uptimeMillis(); logFGSStateChangeLocked(sr, FOREGROUND_SERVICE_STATE_CHANGED__STATE__TIMED_OUT, now > sr.mFgsEnterTime ? (int) (now - sr.mFgsEnterTime) : 0, FGS_STOP_REASON_UNKNOWN, FGS_TYPE_POLICY_CHECK_UNKNOWN); try { sr.app.getThread().scheduleTimeoutService(sr, sr.getShortFgsInfo().getStartId()); } catch (RemoteException e) { Loading Loading @@ -7897,7 +7904,8 @@ public final class ActiveServices { boolean allowWhileInUsePermissionInFgs; @PowerExemptionManager.ReasonCode int fgsStartReasonCode; if (state == FOREGROUND_SERVICE_STATE_CHANGED__STATE__ENTER || state == FOREGROUND_SERVICE_STATE_CHANGED__STATE__EXIT) { || state == FOREGROUND_SERVICE_STATE_CHANGED__STATE__EXIT || state == FOREGROUND_SERVICE_STATE_CHANGED__STATE__TIMED_OUT) { allowWhileInUsePermissionInFgs = r.mAllowWhileInUsePermissionInFgsAtEntering; fgsStartReasonCode = r.mAllowStartForegroundAtEntering; } else { Loading Loading @@ -7931,9 +7939,9 @@ public final class ActiveServices { r.mFgsDelegation != null ? r.mFgsDelegation.mOptions.mClientUid : INVALID_UID, r.mFgsDelegation != null ? r.mFgsDelegation.mOptions.mDelegationService : ForegroundServiceDelegationOptions.DELEGATION_SERVICE_DEFAULT, 0, null, null); 0 /* api_sate */, null /* api_type */, null /* api_timestamp */); int event = 0; if (state == FOREGROUND_SERVICE_STATE_CHANGED__STATE__ENTER) { Loading @@ -7942,6 +7950,8 @@ public final class ActiveServices { event = EventLogTags.AM_FOREGROUND_SERVICE_STOP; } else if (state == FOREGROUND_SERVICE_STATE_CHANGED__STATE__DENIED) { event = EventLogTags.AM_FOREGROUND_SERVICE_DENIED; } else if (state == FOREGROUND_SERVICE_STATE_CHANGED__STATE__TIMED_OUT) { event = EventLogTags.AM_FOREGROUND_SERVICE_TIMED_OUT; }else { // Unknown event. return; Loading
services/core/java/com/android/server/am/EventLogTags.logtags +2 −1 Original line number Diff line number Diff line Loading @@ -121,10 +121,11 @@ option java_package com.android.server.am # Similarly, tags below are used by UserManagerService 30091 um_user_visibility_changed (userId|1|5),(visible|1) # Foreground service start/stop events. # Foreground service start/stop/denied/timed_out events. 30100 am_foreground_service_start (User|1|5),(Component Name|3),(allowWhileInUse|1),(startReasonCode|3),(targetSdk|1|1),(callerTargetSdk|1|1),(notificationWasDeferred|1),(notificationShown|1),(durationMs|1|3),(startForegroundCount|1|1),(stopReason|3),(fgsType|1) 30101 am_foreground_service_denied (User|1|5),(Component Name|3),(allowWhileInUse|1),(startReasonCode|3),(targetSdk|1|1),(callerTargetSdk|1|1),(notificationWasDeferred|1),(notificationShown|1),(durationMs|1|3),(startForegroundCount|1|1),(stopReason|3),(fgsType|1) 30102 am_foreground_service_stop (User|1|5),(Component Name|3),(allowWhileInUse|1),(startReasonCode|3),(targetSdk|1|1),(callerTargetSdk|1|1),(notificationWasDeferred|1),(notificationShown|1),(durationMs|1|3),(startForegroundCount|1|1),(stopReason|3),(fgsType|1) 30103 am_foreground_service_timed_out (User|1|5),(Component Name|3),(allowWhileInUse|1),(startReasonCode|3),(targetSdk|1|1),(callerTargetSdk|1|1),(notificationWasDeferred|1),(notificationShown|1),(durationMs|1|3),(startForegroundCount|1|1),(stopReason|3),(fgsType|1) # Intent Sender redirect for UserHandle.USER_CURRENT 30110 am_intent_sender_redirect_user (userId|1|5)