summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/app/ForegroundServiceTypePolicy.java4
-rw-r--r--core/res/AndroidManifest.xml4
2 files changed, 5 insertions, 3 deletions
diff --git a/core/java/android/app/ForegroundServiceTypePolicy.java b/core/java/android/app/ForegroundServiceTypePolicy.java
index 9bf8550df6d0..63fdc2e1b686 100644
--- a/core/java/android/app/ForegroundServiceTypePolicy.java
+++ b/core/java/android/app/ForegroundServiceTypePolicy.java
@@ -48,6 +48,7 @@ import android.compat.annotation.Disabled;
import android.compat.annotation.EnabledAfter;
import android.compat.annotation.Overridable;
import android.content.Context;
+import android.content.PermissionChecker;
import android.content.pm.PackageManager;
import android.content.pm.ServiceInfo;
import android.content.pm.ServiceInfo.ForegroundServiceType;
@@ -879,7 +880,8 @@ public abstract class ForegroundServiceTypePolicy {
int checkPermission(@NonNull Context context, @NonNull String name, int callerUid,
int callerPid, String packageName, boolean allowWhileInUse) {
// Simple case, check if it's already granted.
- if (context.checkPermission(name, callerPid, callerUid) == PERMISSION_GRANTED) {
+ if (PermissionChecker.checkPermissionForPreflight(context, name,
+ callerPid, callerUid, packageName) == PERMISSION_GRANTED) {
return PERMISSION_GRANTED;
}
if (allowWhileInUse) {
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 5816488e1098..ad8f7fb2d425 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -6287,12 +6287,12 @@
<!-- Allows a regular application to use {@link android.app.Service#startForeground
Service.startForeground} with the type "specialUse".
- <p>Protection level: signature|appop|instant
+ <p>Protection level: normal|appop|instant
-->
<permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE"
android:description="@string/permdesc_foregroundServiceSpecialUse"
android:label="@string/permlab_foregroundServiceSpecialUse"
- android:protectionLevel="signature|appop|instant" />
+ android:protectionLevel="normal|appop|instant" />
<!-- @SystemApi Allows to access all app shortcuts.
@hide -->