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

Commit 61eaa6a1 authored by Sherry Huang's avatar Sherry Huang Committed by Android (Google) Code Review
Browse files

Merge "TIS: Include ALWAYS_BOUND_TV_INPUT permission" into main

parents bdfdd485 d826a2de
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -5593,6 +5593,15 @@
    <permission android:name="android.permission.BIND_TV_INPUT"
        android:protectionLevel="signature|privileged" />

    <!-- This permission is required among systems services to always keep the
         binding with TvInputManagerService.
         <p>This should only be used by the OEM TvInputService.
         <p>Protection level: signature|privileged|vendorPrivileged
         @hide
    -->
    <permission android:name="android.permission.ALWAYS_BOUND_TV_INPUT"
        android:protectionLevel="signature|privileged|vendorPrivileged" />

    <!-- Must be required by a {@link android.media.tv.interactive.TvInteractiveAppService}
         to ensure that only the system can bind to it.
         <p>Protection level: signature|privileged
+7 −1
Original line number Diff line number Diff line
@@ -341,10 +341,16 @@ public final class TvInputManagerService extends SystemService {
        }, UserHandle.ALL, intentFilter, null, null);
    }

    private static boolean hasAlwaysBoundPermission(PackageManager pm, ComponentName component) {
        return pm.checkPermission(android.Manifest.permission.ALWAYS_BOUND_TV_INPUT,
                component.getPackageName()) == PackageManager.PERMISSION_GRANTED;
    }

    private static boolean hasHardwarePermission(PackageManager pm, ComponentName component) {
        return pm.checkPermission(android.Manifest.permission.TV_INPUT_HARDWARE,
                component.getPackageName()) == PackageManager.PERMISSION_GRANTED;
    }

    @GuardedBy("mLock")
    private void buildTvInputListLocked(int userId, String[] updatedPackages) {
        UserState userState = getOrCreateUserStateLocked(userId);
@@ -3526,7 +3532,7 @@ public final class TvInputManagerService extends SystemService {
                continue;
            }
            ComponentName component = new ComponentName(si.packageName, si.name);
            if (hasHardwarePermission(pm, component)) {
            if (!hasAlwaysBoundPermission(pm, component) && hasHardwarePermission(pm, component)) {
                updateServiceConnectionLocked(component, userId);
            }
        }