Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09f6e614 authored by RoboErik's avatar RoboErik Committed by Android (Google) Code Review
Browse files

Merge "Fix crash in legacy apps that register without a looper" into lmp-dev

parents 2b3b706e 78c64cdb
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -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);
                    }
+5 −2
Original line number Diff line number Diff line
@@ -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);
            }
        }