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

Commit 73c10ee5 authored by Joseph Murphy's avatar Joseph Murphy Committed by Android (Google) Code Review
Browse files

Merge "Revert "Limit permission MANAGE_MEDIA_PROJECTION to the SystemUI..."" into main

parents 5831e0f8 fbf540f4
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -203,7 +203,6 @@ package android {
    field public static final String MANAGE_HOTWORD_DETECTION = "android.permission.MANAGE_HOTWORD_DETECTION";
    field public static final String MANAGE_IPSEC_TUNNELS = "android.permission.MANAGE_IPSEC_TUNNELS";
    field public static final String MANAGE_LOW_POWER_STANDBY = "android.permission.MANAGE_LOW_POWER_STANDBY";
    field @FlaggedApi("com.android.media.flags.limit_manage_media_projection") public static final String MANAGE_MEDIA_PROJECTION = "android.permission.MANAGE_MEDIA_PROJECTION";
    field public static final String MANAGE_MUSIC_RECOGNITION = "android.permission.MANAGE_MUSIC_RECOGNITION";
    field public static final String MANAGE_NOTIFICATION_LISTENERS = "android.permission.MANAGE_NOTIFICATION_LISTENERS";
    field public static final String MANAGE_ONE_TIME_PERMISSION_SESSIONS = "android.permission.MANAGE_ONE_TIME_PERMISSION_SESSIONS";
+2 −5
Original line number Diff line number Diff line
@@ -6902,13 +6902,10 @@
    <permission android:name="android.permission.ACCESS_DRM_CERTIFICATES"
        android:protectionLevel="signature|privileged" />

    <!-- Allows an application to manage media projection sessions, by showing the permission dialog
         to the user and creating a new token for each capture session.
         @FlaggedApi("com.android.media.flags.limit_manage_media_projection")
         @SystemApi Only granted to apps holding role SYSTEM_UI.
    <!-- Api Allows an application to manage media projection sessions.
         @hide This is not a third-party API (intended for system apps). -->
    <permission android:name="android.permission.MANAGE_MEDIA_PROJECTION"
        android:protectionLevel="internal|role" />
        android:protectionLevel="signature" />

    <!-- @SystemApi Allows an application to read install sessions
         @hide This is not a third-party API (intended for system apps). -->
+2 −31
Original line number Diff line number Diff line
@@ -550,8 +550,8 @@ public final class MediaProjectionManagerService extends SystemService
                    break;
                case RECORD_CONTENT_TASK:
                    IBinder taskWindowContainerToken =
                            mProjectionGrant.getLaunchCookieInternal() == null ? null
                                    : mProjectionGrant.getLaunchCookieInternal().binder;
                            mProjectionGrant.getLaunchCookie() == null ? null
                                    : mProjectionGrant.getLaunchCookie().binder;
                    setReviewedConsentSessionLocked(
                            ContentRecordingSession.createTaskSession(taskWindowContainerToken));
                    break;
@@ -603,17 +603,6 @@ public final class MediaProjectionManagerService extends SystemService
        return projection;
    }

    /**
     * Test API mirroring the types in the aidl interface for access outside the projection
     * package.
     */
    @VisibleForTesting
    public IMediaProjection createProjectionInternal(int processUid, String packageName, int type,
            boolean isPermanentGrant) {
        return createProjectionInternal(processUid, packageName, type, isPermanentGrant,
                Binder.getCallingUserHandle());
    }

    // TODO(b/261563516): Remove internal method and test aidl directly, here and elsewhere.
    @VisibleForTesting
    MediaProjection getProjectionInternal(int uid, String packageName) {
@@ -1203,10 +1192,6 @@ public final class MediaProjectionManagerService extends SystemService
        @Override // Binder call
        public void setLaunchCookie(LaunchCookie launchCookie) {
            setLaunchCookie_enforcePermission();
            setLaunchCookieInternal(launchCookie);
        }

        @VisibleForTesting void setLaunchCookieInternal(LaunchCookie launchCookie) {
            mLaunchCookie = launchCookie;
        }

@@ -1214,10 +1199,6 @@ public final class MediaProjectionManagerService extends SystemService
        @Override // Binder call
        public LaunchCookie getLaunchCookie() {
            getLaunchCookie_enforcePermission();
            return getLaunchCookieInternal();
        }

        @VisibleForTesting LaunchCookie getLaunchCookieInternal() {
            return mLaunchCookie;
        }

@@ -1225,11 +1206,6 @@ public final class MediaProjectionManagerService extends SystemService
        @Override
        public boolean isValid() {
            isValid_enforcePermission();
            return isValidInternal();
        }

        @VisibleForTesting
        boolean isValidInternal() {
            synchronized (mLock) {
                final long curMs = mClock.uptimeMillis();
                final boolean hasTimedOut = curMs - mCreateTimeMs > mTimeoutMs;
@@ -1260,11 +1236,6 @@ public final class MediaProjectionManagerService extends SystemService
        @Override
        public void notifyVirtualDisplayCreated(int displayId) {
            notifyVirtualDisplayCreated_enforcePermission();
            notifyVirtualDisplayCreatedInternal(displayId);
        }

        @VisibleForTesting
        void notifyVirtualDisplayCreatedInternal(int displayId) {
            synchronized (mLock) {
                mVirtualDisplayId = displayId;

+0 −8
Original line number Diff line number Diff line
@@ -6783,14 +6783,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        return mSandboxDisplayApis;
    }

    /**
     * For testing only; inject a ContentRecorder instance.
     */
    @VisibleForTesting
    void setContentRecorder(ContentRecorder contentRecorder) {
        mContentRecorder = contentRecorder;
    }

    private ContentRecorder getContentRecorder() {
        if (mContentRecorder == null) {
            mContentRecorder = new ContentRecorder(this);
+0 −2
Original line number Diff line number Diff line
@@ -32,8 +32,6 @@ android_test {
        "androidx.test.runner",
        "truth",
        "Harrier",
        "frameworks-base-testutils",
        "services.core",
    ],
    platform_apis: true,
    certificate: "platform",
Loading