diff options
author | RoboErik <epastern@google.com> | 2014-05-19 09:25:25 -0700 |
---|---|---|
committer | RoboErik <epastern@google.com> | 2014-05-20 14:57:46 -0700 |
commit | 418c10ca9df1505509afeffd558cd92fc97bc635 (patch) | |
tree | 6055e734f0029497467308fb02d55acc49ced3d9 /media | |
parent | 48dfae92d24de47672d01612f66102c7b435b16f (diff) | |
download | frameworks_base-418c10ca9df1505509afeffd558cd92fc97bc635.zip frameworks_base-418c10ca9df1505509afeffd558cd92fc97bc635.tar.gz frameworks_base-418c10ca9df1505509afeffd558cd92fc97bc635.tar.bz2 |
Add 5s timeout to wakelock
Also filed a b/15110168 to anr the app if it doesn't finish with the
button event in 5s.
Change-Id: I23906b4c7f17d3d3a29eef92b523d8653c87017e
Diffstat (limited to 'media')
3 files changed, 12 insertions, 14 deletions
diff --git a/media/java/android/media/session/ISessionCallback.aidl b/media/java/android/media/session/ISessionCallback.aidl index 7b0412e..103c3f1 100644 --- a/media/java/android/media/session/ISessionCallback.aidl +++ b/media/java/android/media/session/ISessionCallback.aidl @@ -28,7 +28,7 @@ import android.os.ResultReceiver; */ oneway interface ISessionCallback { void onCommand(String command, in Bundle extras, in ResultReceiver cb); - void onMediaButton(in Intent mediaButtonIntent, in ResultReceiver cb); + void onMediaButton(in Intent mediaButtonIntent, int sequenceNumber, in ResultReceiver cb); void onRequestRouteChange(in RouteInfo route); void onRouteConnected(in RouteInfo route, in RouteOptions options); void onRouteDisconnected(in RouteInfo route, int reason); diff --git a/media/java/android/media/session/MediaSession.java b/media/java/android/media/session/MediaSession.java index 5b9adaa..6a62dc2 100644 --- a/media/java/android/media/session/MediaSession.java +++ b/media/java/android/media/session/MediaSession.java @@ -119,13 +119,6 @@ public final class MediaSession { */ public static final int DISCONNECT_REASON_SESSION_DESTROYED = 5; - /** - * Status code indicating the call was handled. - * - * @hide - */ - public static final int RESULT_SUCCESS = 0; - private static final int MSG_MEDIA_BUTTON = 1; private static final int MSG_COMMAND = 2; private static final int MSG_ROUTE_CHANGE = 3; @@ -563,14 +556,17 @@ public final class MediaSession { } @Override - public void onMediaButton(Intent mediaButtonIntent, ResultReceiver cb) + public void onMediaButton(Intent mediaButtonIntent, int sequenceNumber, ResultReceiver cb) throws RemoteException { MediaSession session = mMediaSession.get(); - if (session != null) { - session.postMediaButton(mediaButtonIntent); - } - if (cb != null) { - cb.send(RESULT_SUCCESS, null); + try { + if (session != null) { + session.postMediaButton(mediaButtonIntent); + } + } finally { + if (cb != null) { + cb.send(sequenceNumber, null); + } } } diff --git a/media/java/android/media/session/MediaSessionLegacyHelper.java b/media/java/android/media/session/MediaSessionLegacyHelper.java index 2e02a66..249b9c4 100644 --- a/media/java/android/media/session/MediaSessionLegacyHelper.java +++ b/media/java/android/media/session/MediaSessionLegacyHelper.java @@ -137,6 +137,8 @@ public class MediaSessionLegacyHelper { return; } holder.mMediaButtonListener = new MediaButtonListener(pi, context); + // TODO determine if handling transport performer commands should also + // set this flag holder.mFlags |= MediaSession.FLAG_HANDLES_MEDIA_BUTTONS; holder.mSession.setFlags(holder.mFlags); holder.mSession.getTransportPerformer().addListener(holder.mMediaButtonListener, mHandler); |