From 23f0b1842a6f577e1ba72276861796023c8146dd Mon Sep 17 00:00:00 2001 From: Hui Yu Date: Thu, 16 Jul 2020 10:43:40 -0700 Subject: [PATCH] Add logcat message for background started FGS. Bug: 161392994 Test: reboot device and observe adb logcat Change-Id: I29a1d916c1f1c203ae06c5a94fe95592b3b7e968 --- .../java/com/android/server/am/ActiveServices.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java index 56953708e3833..3f867f656c245 100644 --- a/services/core/java/com/android/server/am/ActiveServices.java +++ b/services/core/java/com/android/server/am/ActiveServices.java @@ -18,7 +18,6 @@ package com.android.server.am; import static android.Manifest.permission.START_ACTIVITIES_FROM_BACKGROUND; import static android.content.pm.PackageManager.PERMISSION_GRANTED; -import static android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION; import static android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_MANIFEST; import static android.os.Process.NFC_UID; import static android.os.Process.ROOT_UID; @@ -1361,13 +1360,12 @@ public final class ActiveServices { + String.format("0x%08X", manifestType) + " in service element of manifest file"); } - if ((foregroundServiceType & FOREGROUND_SERVICE_TYPE_LOCATION) != 0 - && !r.mAllowWhileInUsePermissionInFgs) { - // If the foreground service is not started from TOP process, do not allow it to - // have location capability, this prevents BG started FGS to have while-in-use - // location permission. + // If the foreground service is not started from TOP process, do not allow it to + // have while-in-use location/camera/microphone access. + if (!r.mAllowWhileInUsePermissionInFgs) { Slog.w(TAG, - "BG started FGS can not have location capability: service " + "Foreground service started from background can not have " + + "location/camera/microphone access: service " + r.shortInstanceName); } }