Skip to content

Commit

Permalink
DO NOT MERGE Check caller for sending media key to global priority se…
Browse files Browse the repository at this point in the history
…ssion

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().

CYNGNOS-3303
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 6a1567c)
  • Loading branch information
jaewan-github authored and Jessica Wagantall committed Nov 16, 2016
1 parent 3a32715 commit 0a77aa4
Showing 1 changed file with 8 additions and 0 deletions.
Expand Up @@ -48,6 +48,7 @@
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;
Expand Down Expand Up @@ -728,6 +729,13 @@ public void dispatchMediaKeyEvent(KeyEvent keyEvent, boolean needWakeLock) {
+ "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
Expand Down

0 comments on commit 0a77aa4

Please sign in to comment.