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

Commit 0adfa709 authored by Zimuzo Ezeozue's avatar Zimuzo Ezeozue Committed by Android (Google) Code Review
Browse files

Merge "Restrict capture_[secure_]video_output permission to signature only"

parents 37e43a88 e91f5019
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -150,6 +150,7 @@ package android {
    field public static final java.lang.String REGISTER_CALL_PROVIDER = "android.permission.REGISTER_CALL_PROVIDER";
    field public static final java.lang.String REGISTER_CONNECTION_MANAGER = "android.permission.REGISTER_CONNECTION_MANAGER";
    field public static final java.lang.String REGISTER_SIM_SUBSCRIPTION = "android.permission.REGISTER_SIM_SUBSCRIPTION";
    field public static final java.lang.String REMOTE_DISPLAY_PROVIDER = "android.permission.REMOTE_DISPLAY_PROVIDER";
    field public static final java.lang.String REMOVE_DRM_CERTIFICATES = "android.permission.REMOVE_DRM_CERTIFICATES";
    field public static final java.lang.String REMOVE_TASKS = "android.permission.REMOVE_TASKS";
    field public static final java.lang.String RESET_PASSWORD = "android.permission.RESET_PASSWORD";
+8 −2
Original line number Diff line number Diff line
@@ -3521,19 +3521,25 @@
    <permission android:name="android.permission.MODIFY_DEFAULT_AUDIO_EFFECTS"
        android:protectionLevel="signature|privileged" />

    <!-- @SystemApi Allows an application to provide remote displays.
         <p>Not for use by third-party applications.</p>
         @hide -->
    <permission android:name="android.permission.REMOTE_DISPLAY_PROVIDER"
        android:protectionLevel="signature|privileged" />

    <!-- Allows an application to capture video output.
         <p>Not for use by third-party applications.</p>
          @hide
          @removed -->
    <permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT"
        android:protectionLevel="signature|privileged" />
        android:protectionLevel="signature" />

    <!-- Allows an application to capture secure video output.
         <p>Not for use by third-party applications.</p>
          @hide
          @removed -->
    <permission android:name="android.permission.CAPTURE_SECURE_VIDEO_OUTPUT"
        android:protectionLevel="signature|privileged" />
        android:protectionLevel="signature" />

    <!-- Allows an application to know what content is playing and control its playback.
         <p>Not for use by third-party applications due to privacy of media consumption</p>  -->
+6 −17
Original line number Diff line number Diff line
@@ -159,12 +159,13 @@ public final class RemoteDisplayProviderWatcher {
                    + serviceInfo.packageName + "/" + serviceInfo.name);
            return false;
        }
        if (!hasCaptureVideoPermission(serviceInfo.packageName)) {
            // If the service does not have permission to capture video then it
            // isn't going to be terribly useful as a remote display, is it?
            // Kind of makes you wonder what it's doing there in the first place.
        if (mPackageManager.checkPermission(Manifest.permission.REMOTE_DISPLAY_PROVIDER,
                        serviceInfo.packageName) != PackageManager.PERMISSION_GRANTED) {
            // If the service does not have this permission then the system will not bind to it.
            // This is to prevent non privileged apps declaring themselves as remote display
            // providers just to be bound to by the system and keep their process alive.
            Slog.w(TAG, "Ignoring remote display provider service because it does not "
                    + "have the CAPTURE_VIDEO_OUTPUT or CAPTURE_SECURE_VIDEO_OUTPUT "
                    + "have the REMOTE_DISPLAY_PROVIDER "
                    + "permission: " + serviceInfo.packageName + "/" + serviceInfo.name);
            return false;
        }
@@ -172,18 +173,6 @@ public final class RemoteDisplayProviderWatcher {
        return true;
    }

    private boolean hasCaptureVideoPermission(String packageName) {
        if (mPackageManager.checkPermission(Manifest.permission.CAPTURE_VIDEO_OUTPUT,
                packageName) == PackageManager.PERMISSION_GRANTED) {
            return true;
        }
        if (mPackageManager.checkPermission(Manifest.permission.CAPTURE_SECURE_VIDEO_OUTPUT,
                packageName) == PackageManager.PERMISSION_GRANTED) {
            return true;
        }
        return false;
    }

    private int findProvider(String packageName, String className) {
        int count = mProviders.size();
        for (int i = 0; i < count; i++) {