Move FGS while-in-use log message.

To after setFgsRestrictionLocked() which could set
mAllowWhileInUsePermissionInFgs again.

Bug: 189172428
Test: atest cts/tests/app/src/android/app/cts/ActivityManagerFgsBgStartTest.java
Change-Id: Ia8b54065ecb8d4d0f3bd4c302791207ea71fa80f
This commit is contained in:
Hui Yu
2021-05-24 22:27:56 -07:00
parent 72104bdf67
commit 30b599f744

View File

@@ -1706,14 +1706,6 @@ public final class ActiveServices {
+ String.format("0x%08X", manifestType)
+ " in service element of manifest file");
}
// 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,
"Foreground service started from background can not have "
+ "location/camera/microphone access: service "
+ r.shortInstanceName);
}
}
boolean alreadyStartedOp = false;
@@ -1802,6 +1794,14 @@ public final class ActiveServices {
r.appInfo.uid, r.intent.getIntent(), r, r.userId,false);
}
}
// 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,
"Foreground service started from background can not have "
+ "location/camera/microphone access: service "
+ r.shortInstanceName);
}
logFgsBackgroundStart(r);
if (r.mAllowStartForeground == REASON_DENIED && isBgFgsRestrictionEnabled(r)) {
final String msg = "Service.startForeground() not allowed due to "