diff options
author | Jaewan Kim <jaewan@google.com> | 2016-09-19 21:19:55 +0900 |
---|---|---|
committer | gitbuildkicker <android-build@google.com> | 2016-09-27 15:58:52 -0700 |
commit | 4c95059c31584cbd5651183a4605301563cf2e8e (patch) | |
tree | 99a359c5d2533628d3c7ba7abed68187a88c81b8 /services/core | |
parent | 4f0dec2e62ee47dec1e29a6c97e13af2c86a33e9 (diff) | |
download | frameworks_base-4c95059c31584cbd5651183a4605301563cf2e8e.zip frameworks_base-4c95059c31584cbd5651183a4605301563cf2e8e.tar.gz frameworks_base-4c95059c31584cbd5651183a4605301563cf2e8e.tar.bz2 |
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 c282c4f106bea5c5375fdb6062ffd4fdcf8563a7)
Diffstat (limited to 'services/core')
-rw-r--r-- | services/core/java/com/android/server/media/MediaSessionService.java | 8 |
1 files changed, 8 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 7028fa6..22f9f72 100644 --- a/services/core/java/com/android/server/media/MediaSessionService.java +++ b/services/core/java/com/android/server/media/MediaSessionService.java @@ -47,6 +47,7 @@ import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.os.PowerManager; +import android.os.Process; import android.os.RemoteException; import android.os.ResultReceiver; import android.os.ServiceManager; @@ -760,6 +761,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 |