diff options
author | Jaewan Kim <jaewan@google.com> | 2016-09-19 21:19:55 +0900 |
---|---|---|
committer | gitbuildkicker <android-build@google.com> | 2016-10-12 17:24:40 -0700 |
commit | ad58c1c2840d0855ca83a8b32a149e388609e8c5 (patch) | |
tree | cbcd3458ffd43b93588366d34825d0c6bbe8516c | |
parent | d206d52db47ecf869023dc04b7f8eba19a83cc0e (diff) | |
download | base-ad58c1c2840d0855ca83a8b32a149e388609e8c5.tar.gz |
DO NOT MERGE Check caller for sending media key to global priority session
Prevent sending media key events from the non-system app to the global
priority session through the MediaSessionManager.dispatchMediaKeyEvent().
Note that any app can use the API indirectly with
the public API AudioManager.dispatchMediaKeyEvent().
Bug: 29833954
Tested: Installed malicious apps and confirmed that they don't work.
Tested: Run CtsTelecomTestCases and CtsMediaTestCases
Change-Id: I2a9e78196ba7455324e485f098f095d03b47ee15
(cherry picked from commit 09c3df004bad9343092e377a7e74e11f9635734a)
-rw-r--r-- | services/core/java/com/android/server/media/MediaSessionService.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/media/MediaSessionService.java b/services/core/java/com/android/server/media/MediaSessionService.java index 777eee81473a..2c53af3a54bb 100644 --- a/services/core/java/com/android/server/media/MediaSessionService.java +++ b/services/core/java/com/android/server/media/MediaSessionService.java @@ -765,6 +765,13 @@ public class MediaSessionService extends SystemService implements Monitor { + "setup is in progress."); return; } + if (isGlobalPriorityActive() && uid != Process.SYSTEM_UID) { + // Prevent dispatching key event through reflection while the global priority + // session is active. + Slog.i(TAG, "Only the system can dispatch media key event " + + "to the global priority session."); + return; + } synchronized (mLock) { // If we don't have a media button receiver to fall back on |