Merge "Update the FGS special use permission to normal|appop"

This commit is contained in:
Jing Ji
2022-11-30 16:50:30 +00:00
committed by Android (Google) Code Review
2 changed files with 5 additions and 3 deletions

View File

@@ -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) {

View File

@@ -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 -->