summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoboErik <epastern@google.com>2014-08-15 18:10:48 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-08-15 04:58:06 +0000
commit09f6e61489c49cf45b3aa1947d4acb3a9e375d0f (patch)
tree33b84b0438b49447b3e9d8b7a683699b271fd2b0
parent2b3b706e146f9d7773c9c2c99d969b48d89d237e (diff)
parent78c64cdbd82a4d8feb7faf43109b86ab87252dd1 (diff)
downloadframeworks_base-09f6e61489c49cf45b3aa1947d4acb3a9e375d0f.zip
frameworks_base-09f6e61489c49cf45b3aa1947d4acb3a9e375d0f.tar.gz
frameworks_base-09f6e61489c49cf45b3aa1947d4acb3a9e375d0f.tar.bz2
Merge "Fix crash in legacy apps that register without a looper" into lmp-dev
-rw-r--r--cmds/media/src/com/android/commands/media/Media.java10
-rw-r--r--media/java/android/media/session/MediaSessionLegacyHelper.java7
2 files changed, 14 insertions, 3 deletions
diff --git a/cmds/media/src/com/android/commands/media/Media.java b/cmds/media/src/com/android/commands/media/Media.java
index b13b009..b37f896 100644
--- a/cmds/media/src/com/android/commands/media/Media.java
+++ b/cmds/media/src/com/android/commands/media/Media.java
@@ -225,7 +225,7 @@ public class Media extends BaseCommand {
void printUsageMessage() {
try {
System.out.println("V2Monitoring session " + mController.getTag()
- + "... available commands:");
+ + "... available commands: play, pause, next, previous");
} catch (RemoteException e) {
System.out.println("Error trying to monitor session!");
}
@@ -257,6 +257,14 @@ public class Media extends BaseCommand {
addNewline = false;
} else if ("q".equals(line) || "quit".equals(line)) {
break;
+ } else if ("play".equals(line)) {
+ mController.play();
+ } else if ("pause".equals(line)) {
+ mController.pause();
+ } else if ("next".equals(line)) {
+ mController.next();
+ } else if ("previous".equals(line)) {
+ mController.previous();
} else {
System.out.println("Invalid command: " + line);
}
diff --git a/media/java/android/media/session/MediaSessionLegacyHelper.java b/media/java/android/media/session/MediaSessionLegacyHelper.java
index a182982..aa196a9 100644
--- a/media/java/android/media/session/MediaSessionLegacyHelper.java
+++ b/media/java/android/media/session/MediaSessionLegacyHelper.java
@@ -290,7 +290,6 @@ public class MediaSessionLegacyHelper {
if (DEBUG) {
Log.d(TAG, "addMediaButtonListener already added " + pi);
}
- return;
}
holder.mMediaButtonListener = new MediaButtonListener(pi, context);
// TODO determine if handling transport performer commands should also
@@ -468,7 +467,11 @@ public class MediaSessionLegacyHelper {
mSessions.remove(mPi);
} else if (mCb == null) {
mCb = new SessionCallback();
- mSession.setCallback(mCb);
+ Handler handler = null;
+ if (Looper.myLooper() == null) {
+ handler = new Handler(Looper.getMainLooper());
+ }
+ mSession.setCallback(mCb, handler);
}
}