Don't throw ANR if service is not running.

Change-Id: I92a29451cdaa562a322891cef75fa81c7bc82dfc
Fixes: 338670878
Test: atest CtsFgsTimeoutTestCases
diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java
index ec0d897..ce80ea7 100644
--- a/services/core/java/com/android/server/am/ActiveServices.java
+++ b/services/core/java/com/android/server/am/ActiveServices.java
@@ -3930,7 +3930,9 @@
 
             Slog.e(TAG_SERVICE, "FGS ANR'ed: " + sr);
             traceInstant("FGS ANR: ", sr);
-            mAm.appNotResponding(sr.app, tr);
+            if (sr.app != null) {
+                mAm.appNotResponding(sr.app, tr);
+            }
 
             // TODO: Can we close the ANR dialog here, if it's still shown? Currently, the ANR
             // dialog really doesn't remember the "cause" (especially if there have been multiple