Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ccd59411 authored by Jing Ji's avatar Jing Ji
Browse files

Update the FGS special use permission to normal|appop

So it'll get granted by default on install.

Bug: 254662522
Bug: 246792057
Test: atest CtsAppFgsTestCases
Change-Id: I8e496115655a44f480cccd1bfa41b11da60fadd1
parent 813816a4
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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) {
+2 −2
Original line number Diff line number Diff line
@@ -6286,12 +6286,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 -->