Loading services/core/java/com/android/server/am/ActiveServices.java +19 −4 Original line number Diff line number Diff line Loading @@ -122,6 +122,7 @@ import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.os.Message; import android.os.PowerExemptionManager; import android.os.PowerExemptionManager.ReasonCode; import android.os.Process; import android.os.RemoteCallback; Loading Loading @@ -1850,7 +1851,6 @@ public final class ActiveServices { notification.flags |= Notification.FLAG_FOREGROUND_SERVICE; r.foregroundNoti = notification; r.foregroundServiceType = foregroundServiceType; boolean enterForeground = false; if (!r.isForeground) { final ServiceMap smap = getServiceMapLocked(r.userId); if (smap != null) { Loading @@ -1877,7 +1877,12 @@ public final class ActiveServices { } r.isForeground = true; r.mLogEntering = true; enterForeground = true; // The logging of FOREGROUND_SERVICE_STATE_CHANGED__STATE__ENTER event could // be deferred, make a copy of mAllowStartForeground and // mAllowWhileInUsePermissionInFgs. r.mAllowStartForegroundAtEntering = r.mAllowStartForeground; r.mAllowWhileInUsePermissionInFgsAtEntering = r.mAllowWhileInUsePermissionInFgs; r.mStartForegroundCount++; r.mFgsEnterTime = SystemClock.uptimeMillis(); if (!stopProcStatsOp) { Loading Loading @@ -6235,12 +6240,22 @@ public final class ActiveServices { r.packageName, mAm.mConstants.mFgsAtomSampleRate)) { return; } boolean allowWhileInUsePermissionInFgs; @PowerExemptionManager.ReasonCode int fgsStartReasonCode; if (state == FrameworkStatsLog.FOREGROUND_SERVICE_STATE_CHANGED__STATE__ENTER || state == FrameworkStatsLog.FOREGROUND_SERVICE_STATE_CHANGED__STATE__EXIT) { allowWhileInUsePermissionInFgs = r.mAllowWhileInUsePermissionInFgsAtEntering; fgsStartReasonCode = r.mAllowStartForegroundAtEntering; } else { allowWhileInUsePermissionInFgs = r.mAllowWhileInUsePermissionInFgs; fgsStartReasonCode = r.mAllowStartForeground; } FrameworkStatsLog.write(FrameworkStatsLog.FOREGROUND_SERVICE_STATE_CHANGED, r.appInfo.uid, r.shortInstanceName, state, r.mAllowWhileInUsePermissionInFgs, r.mAllowStartForeground, allowWhileInUsePermissionInFgs, fgsStartReasonCode, r.appInfo.targetSdkVersion, r.mRecentCallingUid, r.mRecentCallerApplicationInfo != null Loading services/core/java/com/android/server/am/ServiceRecord.java +7 −3 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ package com.android.server.am; import static android.app.PendingIntent.FLAG_IMMUTABLE; import static android.app.PendingIntent.FLAG_UPDATE_CURRENT; import static android.os.PowerWhitelistManager.REASON_DENIED; import static android.os.PowerExemptionManager.REASON_DENIED; import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME; Loading @@ -37,7 +37,7 @@ import android.net.Uri; import android.os.Binder; import android.os.Build; import android.os.IBinder; import android.os.PowerWhitelistManager; import android.os.PowerExemptionManager; import android.os.SystemClock; import android.os.UserHandle; import android.provider.Settings; Loading Loading @@ -153,6 +153,8 @@ final class ServiceRecord extends Binder implements ComponentName.WithComponentN // allow while-in-use permissions in foreground service or not. // while-in-use permissions in FGS started from background might be restricted. boolean mAllowWhileInUsePermissionInFgs; // A copy of mAllowWhileInUsePermissionInFgs's value when the service is entering FGS state. boolean mAllowWhileInUsePermissionInFgsAtEntering; // the most recent package that start/bind this service. String mRecentCallingPackage; Loading @@ -172,7 +174,9 @@ final class ServiceRecord extends Binder implements ComponentName.WithComponentN // allow the service becomes foreground service? Service started from background may not be // allowed to become a foreground service. @PowerWhitelistManager.ReasonCode int mAllowStartForeground = REASON_DENIED; @PowerExemptionManager.ReasonCode int mAllowStartForeground = REASON_DENIED; // A copy of mAllowStartForeground's value when the service is entering FGS state. @PowerExemptionManager.ReasonCode int mAllowStartForegroundAtEntering = REASON_DENIED; // Debug info why mAllowStartForeground is allowed or denied. String mInfoAllowStartForeground; // Debug info if mAllowStartForeground is allowed because of a temp-allowlist. Loading Loading
services/core/java/com/android/server/am/ActiveServices.java +19 −4 Original line number Diff line number Diff line Loading @@ -122,6 +122,7 @@ import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.os.Message; import android.os.PowerExemptionManager; import android.os.PowerExemptionManager.ReasonCode; import android.os.Process; import android.os.RemoteCallback; Loading Loading @@ -1850,7 +1851,6 @@ public final class ActiveServices { notification.flags |= Notification.FLAG_FOREGROUND_SERVICE; r.foregroundNoti = notification; r.foregroundServiceType = foregroundServiceType; boolean enterForeground = false; if (!r.isForeground) { final ServiceMap smap = getServiceMapLocked(r.userId); if (smap != null) { Loading @@ -1877,7 +1877,12 @@ public final class ActiveServices { } r.isForeground = true; r.mLogEntering = true; enterForeground = true; // The logging of FOREGROUND_SERVICE_STATE_CHANGED__STATE__ENTER event could // be deferred, make a copy of mAllowStartForeground and // mAllowWhileInUsePermissionInFgs. r.mAllowStartForegroundAtEntering = r.mAllowStartForeground; r.mAllowWhileInUsePermissionInFgsAtEntering = r.mAllowWhileInUsePermissionInFgs; r.mStartForegroundCount++; r.mFgsEnterTime = SystemClock.uptimeMillis(); if (!stopProcStatsOp) { Loading Loading @@ -6235,12 +6240,22 @@ public final class ActiveServices { r.packageName, mAm.mConstants.mFgsAtomSampleRate)) { return; } boolean allowWhileInUsePermissionInFgs; @PowerExemptionManager.ReasonCode int fgsStartReasonCode; if (state == FrameworkStatsLog.FOREGROUND_SERVICE_STATE_CHANGED__STATE__ENTER || state == FrameworkStatsLog.FOREGROUND_SERVICE_STATE_CHANGED__STATE__EXIT) { allowWhileInUsePermissionInFgs = r.mAllowWhileInUsePermissionInFgsAtEntering; fgsStartReasonCode = r.mAllowStartForegroundAtEntering; } else { allowWhileInUsePermissionInFgs = r.mAllowWhileInUsePermissionInFgs; fgsStartReasonCode = r.mAllowStartForeground; } FrameworkStatsLog.write(FrameworkStatsLog.FOREGROUND_SERVICE_STATE_CHANGED, r.appInfo.uid, r.shortInstanceName, state, r.mAllowWhileInUsePermissionInFgs, r.mAllowStartForeground, allowWhileInUsePermissionInFgs, fgsStartReasonCode, r.appInfo.targetSdkVersion, r.mRecentCallingUid, r.mRecentCallerApplicationInfo != null Loading
services/core/java/com/android/server/am/ServiceRecord.java +7 −3 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ package com.android.server.am; import static android.app.PendingIntent.FLAG_IMMUTABLE; import static android.app.PendingIntent.FLAG_UPDATE_CURRENT; import static android.os.PowerWhitelistManager.REASON_DENIED; import static android.os.PowerExemptionManager.REASON_DENIED; import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME; Loading @@ -37,7 +37,7 @@ import android.net.Uri; import android.os.Binder; import android.os.Build; import android.os.IBinder; import android.os.PowerWhitelistManager; import android.os.PowerExemptionManager; import android.os.SystemClock; import android.os.UserHandle; import android.provider.Settings; Loading Loading @@ -153,6 +153,8 @@ final class ServiceRecord extends Binder implements ComponentName.WithComponentN // allow while-in-use permissions in foreground service or not. // while-in-use permissions in FGS started from background might be restricted. boolean mAllowWhileInUsePermissionInFgs; // A copy of mAllowWhileInUsePermissionInFgs's value when the service is entering FGS state. boolean mAllowWhileInUsePermissionInFgsAtEntering; // the most recent package that start/bind this service. String mRecentCallingPackage; Loading @@ -172,7 +174,9 @@ final class ServiceRecord extends Binder implements ComponentName.WithComponentN // allow the service becomes foreground service? Service started from background may not be // allowed to become a foreground service. @PowerWhitelistManager.ReasonCode int mAllowStartForeground = REASON_DENIED; @PowerExemptionManager.ReasonCode int mAllowStartForeground = REASON_DENIED; // A copy of mAllowStartForeground's value when the service is entering FGS state. @PowerExemptionManager.ReasonCode int mAllowStartForegroundAtEntering = REASON_DENIED; // Debug info why mAllowStartForeground is allowed or denied. String mInfoAllowStartForeground; // Debug info if mAllowStartForeground is allowed because of a temp-allowlist. Loading