diff options
author | Xin Li <delphij@google.com> | 2024-01-29 10:22:40 -0800 |
---|---|---|
committer | Xin Li <delphij@google.com> | 2024-01-29 10:22:40 -0800 |
commit | ff181b22fdd275a48034c6bfbe463db7f3de395c (patch) | |
tree | 032cc86b4d7944fa5588d715a47d43880cf823e0 | |
parent | 5ff773ef8dba035e43c2168bf6d8adf639d952f1 (diff) | |
parent | f32abc8235b020e8ec17fdc478ae4e45351cf7bf (diff) | |
download | Media-temp_319669529.tar.gz |
Merge Android 24Q1 Release (ab/11220357)temp_319669529
Bug: 319669529
Merged-In: I43f68b92fd292c3df688085b0880ad5f04a77bf7
Change-Id: Icc105c242b594c0522ebcd5865c231c3169d35f5
6 files changed, 45 insertions, 9 deletions
diff --git a/apex/framework/api/lint-baseline.txt b/apex/framework/api/lint-baseline.txt new file mode 100644 index 0000000..bf401d9 --- /dev/null +++ b/apex/framework/api/lint-baseline.txt @@ -0,0 +1,7 @@ +// Baseline format: 1.0 +RequiresPermission: android.media.MediaSession2Service#onUpdateNotification(android.media.MediaSession2): + Method 'onUpdateNotification' documentation mentions permissions without declaring @RequiresPermission + + +Todo: android.media.ApplicationMediaCapabilities.Builder: + Documentation mentions 'TODO' diff --git a/apex/framework/api/module-lib-lint-baseline.txt b/apex/framework/api/module-lib-lint-baseline.txt new file mode 100644 index 0000000..bf966c5 --- /dev/null +++ b/apex/framework/api/module-lib-lint-baseline.txt @@ -0,0 +1,13 @@ +// Baseline format: 1.0 +RequiresPermission: android.media.MediaCommunicationManager#registerSessionCallback(java.util.concurrent.Executor, android.media.MediaCommunicationManager.SessionCallback): + Method 'registerSessionCallback' documentation mentions permissions already declared by @RequiresPermission +RequiresPermission: android.media.MediaSession2Service#onUpdateNotification(android.media.MediaSession2): + Method 'onUpdateNotification' documentation mentions permissions without declaring @RequiresPermission +RequiresPermission: android.media.MediaTranscodingManager.TranscodingSession#addClientUid(int): + Method 'addClientUid' documentation mentions permissions without declaring @RequiresPermission + + +Todo: android.media.ApplicationMediaCapabilities.Builder: + Documentation mentions 'TODO' +Todo: android.media.MediaParceledListSlice: + Documentation mentions 'TODO' diff --git a/apex/framework/api/system-lint-baseline.txt b/apex/framework/api/system-lint-baseline.txt new file mode 100644 index 0000000..967ba60 --- /dev/null +++ b/apex/framework/api/system-lint-baseline.txt @@ -0,0 +1,9 @@ +// Baseline format: 1.0 +RequiresPermission: android.media.MediaSession2Service#onUpdateNotification(android.media.MediaSession2): + Method 'onUpdateNotification' documentation mentions permissions without declaring @RequiresPermission +RequiresPermission: android.media.MediaTranscodingManager.TranscodingSession#addClientUid(int): + Method 'addClientUid' documentation mentions permissions without declaring @RequiresPermission + + +Todo: android.media.ApplicationMediaCapabilities.Builder: + Documentation mentions 'TODO' diff --git a/apex/framework/java/android/media/MediaCommunicationManager.java b/apex/framework/java/android/media/MediaCommunicationManager.java index d6442d4..886b4a0 100644 --- a/apex/framework/java/android/media/MediaCommunicationManager.java +++ b/apex/framework/java/android/media/MediaCommunicationManager.java @@ -36,8 +36,6 @@ import android.view.KeyEvent; import androidx.annotation.RequiresApi; -import androidx.annotation.RequiresApi; - import com.android.internal.annotations.GuardedBy; import com.android.modules.annotation.MinSdk; import com.android.modules.utils.build.SdkLevel; @@ -191,7 +189,7 @@ public class MediaCommunicationManager { getService().registerCallback(callbackStub, mContext.getPackageName()); mCallbackStub = callbackStub; } catch (RemoteException ex) { - Log.e(TAG, "Failed to register callback.", ex); + ex.rethrowFromSystemServer(); } } } diff --git a/apex/framework/java/android/media/MediaFeature.java b/apex/framework/java/android/media/MediaFeature.java index 8d1b159..47f6ed0 100644 --- a/apex/framework/java/android/media/MediaFeature.java +++ b/apex/framework/java/android/media/MediaFeature.java @@ -30,8 +30,8 @@ import java.lang.annotation.RetentionPolicy; @MinSdk(Build.VERSION_CODES.S) public final class MediaFeature { /** - * Defines tye type of HDR(high dynamic range) video. - */ + * Defines the type of HDR (high dynamic range) video. + */ public static final class HdrType { private HdrType() { } diff --git a/apex/service/java/com/android/server/media/MediaCommunicationService.java b/apex/service/java/com/android/server/media/MediaCommunicationService.java index 3ebb40b..62d2a6a 100644 --- a/apex/service/java/com/android/server/media/MediaCommunicationService.java +++ b/apex/service/java/com/android/server/media/MediaCommunicationService.java @@ -16,11 +16,13 @@ package com.android.server.media; import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL; +import static android.Manifest.permission.MEDIA_CONTENT_CONTROL; import static android.os.UserHandle.ALL; import static android.os.UserHandle.getUserHandleForUid; import android.annotation.NonNull; import android.annotation.Nullable; +import android.annotation.RequiresPermission; import android.app.ActivityManager; import android.app.NotificationManager; import android.content.Context; @@ -418,16 +420,23 @@ public class MediaCommunicationService extends SystemService { } @Override - public void registerCallback(IMediaCommunicationServiceCallback callback, - String packageName) throws RemoteException { + @RequiresPermission(MEDIA_CONTENT_CONTROL) + public void registerCallback(@NonNull IMediaCommunicationServiceCallback callback, + @NonNull String packageName) throws RemoteException { Objects.requireNonNull(callback, "callback should not be null"); Objects.requireNonNull(packageName, "packageName should not be null"); + final int uid = Binder.getCallingUid(); + final int pid = Binder.getCallingPid(); + if (!hasMediaControlPermission(pid, uid)){ + throw new SecurityException("MEDIA_CONTENT_CONTROL permission is required to" + + " register MediaCommunicationServiceCallback"); + } + synchronized (mLock) { if (findCallbackRecordLocked(callback) == null) { - CallbackRecord record = new CallbackRecord(callback, packageName, - Binder.getCallingUid(), Binder.getCallingPid()); + uid, pid); mCallbackRecords.add(record); try { callback.asBinder().linkToDeath(record, 0); |