Merge "Fix NPE in onFgsTimeout()." into main
diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java
index 96228b2..a6b7809 100644
--- a/services/core/java/com/android/server/am/ActiveServices.java
+++ b/services/core/java/com/android/server/am/ActiveServices.java
@@ -3856,7 +3856,7 @@
void onFgsTimeout(ServiceRecord sr) {
synchronized (mAm) {
final int fgsType = getTimeLimitedFgsType(sr.foregroundServiceType);
- if (fgsType == ServiceInfo.FOREGROUND_SERVICE_TYPE_NONE) {
+ if (fgsType == ServiceInfo.FOREGROUND_SERVICE_TYPE_NONE || sr.app == null) {
mFGSAnrTimer.discard(sr);
return;
}