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

Commit bca492d6 authored by Jaewan Kim's avatar Jaewan Kim Committed by android-build-merger
Browse files

Merge "Differentiate MediaController in a process for MediaSession" into pi-dev am: 43688e8f

am: a31254bd

Change-Id: I6b10eb78bf428cd93977d3075ae7a200b53bf92c
parents 6a94ccdb a31254bd
Loading
Loading
Loading
Loading
+19 −7
Original line number Original line Diff line number Diff line
@@ -171,7 +171,6 @@ public class Media extends BaseCommand {
            showError("Error: unknown dispatch code '" + cmd + "'");
            showError("Error: unknown dispatch code '" + cmd + "'");
            return;
            return;
        }
        }

        final long now = SystemClock.uptimeMillis();
        final long now = SystemClock.uptimeMillis();
        sendMediaKey(new KeyEvent(now, now, KeyEvent.ACTION_DOWN, keycode, 0, 0,
        sendMediaKey(new KeyEvent(now, now, KeyEvent.ACTION_DOWN, keycode, 0, 0,
                KeyCharacterMap.VIRTUAL_KEYBOARD, 0, 0, InputDevice.SOURCE_KEYBOARD));
                KeyCharacterMap.VIRTUAL_KEYBOARD, 0, 0, InputDevice.SOURCE_KEYBOARD));
@@ -189,7 +188,6 @@ public class Media extends BaseCommand {
        @Override
        @Override
        public void onSessionDestroyed() {
        public void onSessionDestroyed() {
            System.out.println("onSessionDestroyed. Enter q to quit.");
            System.out.println("onSessionDestroyed. Enter q to quit.");

        }
        }


        @Override
        @Override
@@ -246,7 +244,7 @@ public class Media extends BaseCommand {
                @Override
                @Override
                protected void onLooperPrepared() {
                protected void onLooperPrepared() {
                    try {
                    try {
                        mController.registerCallbackListener(ControllerMonitor.this);
                        mController.registerCallbackListener(PACKAGE_NAME, ControllerMonitor.this);
                    } catch (RemoteException e) {
                    } catch (RemoteException e) {
                        System.out.println("Error registering monitor callback");
                        System.out.println("Error registering monitor callback");
                    }
                    }
@@ -266,13 +264,13 @@ public class Media extends BaseCommand {
                    } else if ("q".equals(line) || "quit".equals(line)) {
                    } else if ("q".equals(line) || "quit".equals(line)) {
                        break;
                        break;
                    } else if ("play".equals(line)) {
                    } else if ("play".equals(line)) {
                        mController.play(PACKAGE_NAME);
                        dispatchKeyCode(KeyEvent.KEYCODE_MEDIA_PLAY);
                    } else if ("pause".equals(line)) {
                    } else if ("pause".equals(line)) {
                        mController.pause(PACKAGE_NAME);
                        dispatchKeyCode(KeyEvent.KEYCODE_MEDIA_PAUSE);
                    } else if ("next".equals(line)) {
                    } else if ("next".equals(line)) {
                        mController.next(PACKAGE_NAME);
                        dispatchKeyCode(KeyEvent.KEYCODE_MEDIA_NEXT);
                    } else if ("previous".equals(line)) {
                    } else if ("previous".equals(line)) {
                        mController.previous(PACKAGE_NAME);
                        dispatchKeyCode(KeyEvent.KEYCODE_MEDIA_PREVIOUS);
                    } else {
                    } else {
                        System.out.println("Invalid command: " + line);
                        System.out.println("Invalid command: " + line);
                    }
                    }
@@ -295,6 +293,20 @@ public class Media extends BaseCommand {
                }
                }
            }
            }
        }
        }

        private void dispatchKeyCode(int keyCode) {
            final long now = SystemClock.uptimeMillis();
            KeyEvent down = new KeyEvent(now, now, KeyEvent.ACTION_DOWN, keyCode, 0, 0,
                    KeyCharacterMap.VIRTUAL_KEYBOARD, 0, 0, InputDevice.SOURCE_KEYBOARD);
            KeyEvent up = new KeyEvent(now, now, KeyEvent.ACTION_UP, keyCode, 0, 0,
                    KeyCharacterMap.VIRTUAL_KEYBOARD, 0, 0, InputDevice.SOURCE_KEYBOARD);
            try {
                mController.sendMediaButton(PACKAGE_NAME, null, false, down);
                mController.sendMediaButton(PACKAGE_NAME, null, false, up);
            } catch (RemoteException e) {
                System.out.println("Failed to dispatch " + keyCode);
            }
        }
    }
    }


    private void runListSessions() {
    private void runListSessions() {
+37 −23
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@ package android.media.session;


import android.content.Intent;
import android.content.Intent;
import android.media.Rating;
import android.media.Rating;
import android.media.session.ISessionControllerCallback;
import android.net.Uri;
import android.net.Uri;
import android.os.Bundle;
import android.os.Bundle;
import android.os.ResultReceiver;
import android.os.ResultReceiver;
@@ -25,33 +26,46 @@ import android.os.ResultReceiver;
 * @hide
 * @hide
 */
 */
oneway interface ISessionCallback {
oneway interface ISessionCallback {
    void onCommand(String packageName, int pid, int uid, String command, in Bundle args,
    void onCommand(String packageName, int pid, int uid, ISessionControllerCallback caller,
            in ResultReceiver cb);
            String command, in Bundle args, in ResultReceiver cb);
    void onMediaButton(String packageName, int pid, int uid, in Intent mediaButtonIntent,
    void onMediaButton(String packageName, int pid, int uid, in Intent mediaButtonIntent,
            int sequenceNumber, in ResultReceiver cb);
            int sequenceNumber, in ResultReceiver cb);
    void onMediaButtonFromController(String packageName, int pid, int uid,
            ISessionControllerCallback caller, in Intent mediaButtonIntent);


    // These callbacks are for the TransportPerformer
    // These callbacks are for the TransportPerformer
    void onPrepare(String packageName, int pid, int uid);
    void onPrepare(String packageName, int pid, int uid, ISessionControllerCallback caller);
    void onPrepareFromMediaId(String packageName, int pid, int uid, String mediaId,
    void onPrepareFromMediaId(String packageName, int pid, int uid,
            in Bundle extras);
            ISessionControllerCallback caller, String mediaId, in Bundle extras);
    void onPrepareFromSearch(String packageName, int pid, int uid, String query, in Bundle extras);
    void onPrepareFromSearch(String packageName, int pid, int uid,
    void onPrepareFromUri(String packageName, int pid, int uid, in Uri uri, in Bundle extras);
            ISessionControllerCallback caller, String query, in Bundle extras);
    void onPlay(String packageName, int pid, int uid);
    void onPrepareFromUri(String packageName, int pid, int uid, ISessionControllerCallback caller,
    void onPlayFromMediaId(String packageName, int pid, int uid, String mediaId, in Bundle extras);
            in Uri uri, in Bundle extras);
    void onPlayFromSearch(String packageName, int pid, int uid, String query, in Bundle extras);
    void onPlay(String packageName, int pid, int uid, ISessionControllerCallback caller);
    void onPlayFromUri(String packageName, int pid, int uid, in Uri uri, in Bundle extras);
    void onPlayFromMediaId(String packageName, int pid, int uid, ISessionControllerCallback caller,
    void onSkipToTrack(String packageName, int pid, int uid, long id);
            String mediaId, in Bundle extras);
    void onPause(String packageName, int pid, int uid);
    void onPlayFromSearch(String packageName, int pid, int uid, ISessionControllerCallback caller,
    void onStop(String packageName, int pid, int uid);
            String query, in Bundle extras);
    void onNext(String packageName, int pid, int uid);
    void onPlayFromUri(String packageName, int pid, int uid, ISessionControllerCallback caller,
    void onPrevious(String packageName, int pid, int uid);
            in Uri uri, in Bundle extras);
    void onFastForward(String packageName, int pid, int uid);
    void onSkipToTrack(String packageName, int pid, int uid, ISessionControllerCallback caller,
    void onRewind(String packageName, int pid, int uid);
            long id);
    void onSeekTo(String packageName, int pid, int uid, long pos);
    void onPause(String packageName, int pid, int uid, ISessionControllerCallback caller);
    void onRate(String packageName, int pid, int uid, in Rating rating);
    void onStop(String packageName, int pid, int uid, ISessionControllerCallback caller);
    void onCustomAction(String packageName, int pid, int uid, String action, in Bundle args);
    void onNext(String packageName, int pid, int uid, ISessionControllerCallback caller);
    void onPrevious(String packageName, int pid, int uid, ISessionControllerCallback caller);
    void onFastForward(String packageName, int pid, int uid, ISessionControllerCallback caller);
    void onRewind(String packageName, int pid, int uid, ISessionControllerCallback caller);
    void onSeekTo(String packageName, int pid, int uid, ISessionControllerCallback caller,
            long pos);
    void onRate(String packageName, int pid, int uid, ISessionControllerCallback caller,
            in Rating rating);
    void onCustomAction(String packageName, int pid, int uid, ISessionControllerCallback caller,
            String action, in Bundle args);


    // These callbacks are for volume handling
    // These callbacks are for volume handling
    void onAdjustVolume(String packageName, int pid, int uid, int direction);
    void onAdjustVolume(String packageName, int pid, int uid, ISessionControllerCallback caller,
    void onSetVolumeTo(String packageName, int pid, int uid, int value);
            int direction);
    void onSetVolumeTo(String packageName, int pid, int uid,
            ISessionControllerCallback caller, int value);
}
}
+36 −25
Original line number Original line Diff line number Diff line
@@ -32,42 +32,53 @@ import android.view.KeyEvent;
import java.util.List;
import java.util.List;


/**
/**
 * Interface to a MediaSession in the system.
 * Interface to MediaSessionRecord in the system.
 * @hide
 * @hide
 */
 */
interface ISessionController {
interface ISessionController {
    void sendCommand(String packageName, String command, in Bundle args, in ResultReceiver cb);
    void sendCommand(String packageName, ISessionControllerCallback caller,
    boolean sendMediaButton(String packageName, boolean asSystemService, in KeyEvent mediaButton);
            String command, in Bundle args, in ResultReceiver cb);
    void registerCallbackListener(in ISessionControllerCallback cb);
    boolean sendMediaButton(String packageName, ISessionControllerCallback caller,
    void unregisterCallbackListener(in ISessionControllerCallback cb);
            boolean asSystemService, in KeyEvent mediaButton);
    void registerCallbackListener(String packageName, ISessionControllerCallback cb);
    void unregisterCallbackListener(ISessionControllerCallback cb);
    boolean isTransportControlEnabled();
    boolean isTransportControlEnabled();
    String getPackageName();
    String getPackageName();
    String getTag();
    String getTag();
    PendingIntent getLaunchPendingIntent();
    PendingIntent getLaunchPendingIntent();
    long getFlags();
    long getFlags();
    ParcelableVolumeInfo getVolumeAttributes();
    ParcelableVolumeInfo getVolumeAttributes();
    void adjustVolume(String packageName, boolean asSystemService, int direction, int flags);
    void adjustVolume(String packageName, ISessionControllerCallback caller,
    void setVolumeTo(String packageName, int value, int flags);
            boolean asSystemService, int direction, int flags);
    void setVolumeTo(String packageName, ISessionControllerCallback caller,
            int value, int flags);


    // These commands are for the TransportControls
    // These commands are for the TransportControls
    void prepare(String packageName);
    void prepare(String packageName, ISessionControllerCallback caller);
    void prepareFromMediaId(String packageName, String mediaId, in Bundle extras);
    void prepareFromMediaId(String packageName, ISessionControllerCallback caller,
    void prepareFromSearch(String packageName, String string, in Bundle extras);
            String mediaId, in Bundle extras);
    void prepareFromUri(String packageName, in Uri uri, in Bundle extras);
    void prepareFromSearch(String packageName, ISessionControllerCallback caller,
    void play(String packageName);
            String string, in Bundle extras);
    void playFromMediaId(String packageName, String mediaId, in Bundle extras);
    void prepareFromUri(String packageName, ISessionControllerCallback caller,
    void playFromSearch(String packageName, String string, in Bundle extras);
            in Uri uri, in Bundle extras);
    void playFromUri(String packageName, in Uri uri, in Bundle extras);
    void play(String packageName, ISessionControllerCallback caller);
    void skipToQueueItem(String packageName, long id);
    void playFromMediaId(String packageName, ISessionControllerCallback caller,
    void pause(String packageName);
            String mediaId, in Bundle extras);
    void stop(String packageName);
    void playFromSearch(String packageName, ISessionControllerCallback caller,
    void next(String packageName);
            String string, in Bundle extras);
    void previous(String packageName);
    void playFromUri(String packageName, ISessionControllerCallback caller,
    void fastForward(String packageName);
            in Uri uri, in Bundle extras);
    void rewind(String packageName);
    void skipToQueueItem(String packageName, ISessionControllerCallback caller, long id);
    void seekTo(String packageName, long pos);
    void pause(String packageName, ISessionControllerCallback caller);
    void rate(String packageName, in Rating rating);
    void stop(String packageName, ISessionControllerCallback caller);
    void sendCustomAction(String packageName, String action, in Bundle args);
    void next(String packageName, ISessionControllerCallback caller);
    void previous(String packageName, ISessionControllerCallback caller);
    void fastForward(String packageName, ISessionControllerCallback caller);
    void rewind(String packageName, ISessionControllerCallback caller);
    void seekTo(String packageName, ISessionControllerCallback caller, long pos);
    void rate(String packageName, ISessionControllerCallback caller, in Rating rating);
    void sendCustomAction(String packageName, ISessionControllerCallback caller,
            String action, in Bundle args);
    MediaMetadata getMetadata();
    MediaMetadata getMetadata();
    PlaybackState getPlaybackState();
    PlaybackState getPlaybackState();
    ParceledListSlice getQueue();
    ParceledListSlice getQueue();
+34 −32
Original line number Original line Diff line number Diff line
@@ -126,7 +126,7 @@ public final class MediaController {
     * @return true if the event was sent to the session, false otherwise.
     * @return true if the event was sent to the session, false otherwise.
     */
     */
    public boolean dispatchMediaButtonEvent(@NonNull KeyEvent keyEvent) {
    public boolean dispatchMediaButtonEvent(@NonNull KeyEvent keyEvent) {
        return dispatchMediButtonEventInternal(false, keyEvent);
        return dispatchMediaButtonEventInternal(false, keyEvent);
    }
    }


    /**
    /**
@@ -142,10 +142,10 @@ public final class MediaController {
     * @hide
     * @hide
     */
     */
    public boolean dispatchMediaButtonEventAsSystemService(@NonNull KeyEvent keyEvent) {
    public boolean dispatchMediaButtonEventAsSystemService(@NonNull KeyEvent keyEvent) {
        return dispatchMediButtonEventInternal(true, keyEvent);
        return dispatchMediaButtonEventInternal(true, keyEvent);
    }
    }


    private boolean dispatchMediButtonEventInternal(boolean asSystemService,
    private boolean dispatchMediaButtonEventInternal(boolean asSystemService,
            @NonNull KeyEvent keyEvent) {
            @NonNull KeyEvent keyEvent) {
        if (keyEvent == null) {
        if (keyEvent == null) {
            throw new IllegalArgumentException("KeyEvent may not be null");
            throw new IllegalArgumentException("KeyEvent may not be null");
@@ -154,8 +154,8 @@ public final class MediaController {
            return false;
            return false;
        }
        }
        try {
        try {
            return mSessionBinder.sendMediaButton(mContext.getPackageName(), asSystemService,
            return mSessionBinder.sendMediaButton(mContext.getPackageName(), mCbStub,
                    keyEvent);
                    asSystemService, keyEvent);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            // System is dead. =(
            // System is dead. =(
        }
        }
@@ -189,7 +189,7 @@ public final class MediaController {
                        break;
                        break;
                }
                }
                try {
                try {
                    mSessionBinder.adjustVolume(mContext.getPackageName(), true, direction,
                    mSessionBinder.adjustVolume(mContext.getPackageName(), mCbStub, true, direction,
                            AudioManager.FLAG_SHOW_UI);
                            AudioManager.FLAG_SHOW_UI);
                } catch (RemoteException e) {
                } catch (RemoteException e) {
                    Log.wtf(TAG, "Error calling adjustVolumeBy", e);
                    Log.wtf(TAG, "Error calling adjustVolumeBy", e);
@@ -200,7 +200,7 @@ public final class MediaController {
                final int flags = AudioManager.FLAG_PLAY_SOUND | AudioManager.FLAG_VIBRATE
                final int flags = AudioManager.FLAG_PLAY_SOUND | AudioManager.FLAG_VIBRATE
                        | AudioManager.FLAG_FROM_KEY;
                        | AudioManager.FLAG_FROM_KEY;
                try {
                try {
                    mSessionBinder.adjustVolume(mContext.getPackageName(), true, 0, flags);
                    mSessionBinder.adjustVolume(mContext.getPackageName(), mCbStub, true, 0, flags);
                } catch (RemoteException e) {
                } catch (RemoteException e) {
                    Log.wtf(TAG, "Error calling adjustVolumeBy", e);
                    Log.wtf(TAG, "Error calling adjustVolumeBy", e);
                }
                }
@@ -369,7 +369,7 @@ public final class MediaController {
     */
     */
    public void setVolumeTo(int value, int flags) {
    public void setVolumeTo(int value, int flags) {
        try {
        try {
            mSessionBinder.setVolumeTo(mContext.getPackageName(), value, flags);
            mSessionBinder.setVolumeTo(mContext.getPackageName(), mCbStub, value, flags);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            Log.wtf(TAG, "Error calling setVolumeTo.", e);
            Log.wtf(TAG, "Error calling setVolumeTo.", e);
        }
        }
@@ -390,7 +390,8 @@ public final class MediaController {
     */
     */
    public void adjustVolume(int direction, int flags) {
    public void adjustVolume(int direction, int flags) {
        try {
        try {
            mSessionBinder.adjustVolume(mContext.getPackageName(), false, direction, flags);
            mSessionBinder.adjustVolume(mContext.getPackageName(), mCbStub, false, direction,
                    flags);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            Log.wtf(TAG, "Error calling adjustVolumeBy.", e);
            Log.wtf(TAG, "Error calling adjustVolumeBy.", e);
        }
        }
@@ -456,7 +457,7 @@ public final class MediaController {
            throw new IllegalArgumentException("command cannot be null or empty");
            throw new IllegalArgumentException("command cannot be null or empty");
        }
        }
        try {
        try {
            mSessionBinder.sendCommand(mContext.getPackageName(), command, args, cb);
            mSessionBinder.sendCommand(mContext.getPackageName(), mCbStub, command, args, cb);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            Log.d(TAG, "Dead object in sendCommand.", e);
            Log.d(TAG, "Dead object in sendCommand.", e);
        }
        }
@@ -521,7 +522,7 @@ public final class MediaController {


        if (!mCbRegistered) {
        if (!mCbRegistered) {
            try {
            try {
                mSessionBinder.registerCallbackListener(mCbStub);
                mSessionBinder.registerCallbackListener(mContext.getPackageName(), mCbStub);
                mCbRegistered = true;
                mCbRegistered = true;
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.e(TAG, "Dead object in registerCallback", e);
                Log.e(TAG, "Dead object in registerCallback", e);
@@ -668,7 +669,7 @@ public final class MediaController {
         */
         */
        public void prepare() {
        public void prepare() {
            try {
            try {
                mSessionBinder.prepare(mContext.getPackageName());
                mSessionBinder.prepare(mContext.getPackageName(), mCbStub);
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling prepare.", e);
                Log.wtf(TAG, "Error calling prepare.", e);
            }
            }
@@ -692,7 +693,8 @@ public final class MediaController {
                        "You must specify a non-empty String for prepareFromMediaId.");
                        "You must specify a non-empty String for prepareFromMediaId.");
            }
            }
            try {
            try {
                mSessionBinder.prepareFromMediaId(mContext.getPackageName(), mediaId, extras);
                mSessionBinder.prepareFromMediaId(mContext.getPackageName(), mCbStub, mediaId,
                        extras);
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling prepare(" + mediaId + ").", e);
                Log.wtf(TAG, "Error calling prepare(" + mediaId + ").", e);
            }
            }
@@ -718,7 +720,7 @@ public final class MediaController {
                query = "";
                query = "";
            }
            }
            try {
            try {
                mSessionBinder.prepareFromSearch(mContext.getPackageName(), query, extras);
                mSessionBinder.prepareFromSearch(mContext.getPackageName(), mCbStub, query, extras);
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling prepare(" + query + ").", e);
                Log.wtf(TAG, "Error calling prepare(" + query + ").", e);
            }
            }
@@ -742,7 +744,7 @@ public final class MediaController {
                        "You must specify a non-empty Uri for prepareFromUri.");
                        "You must specify a non-empty Uri for prepareFromUri.");
            }
            }
            try {
            try {
                mSessionBinder.prepareFromUri(mContext.getPackageName(), uri, extras);
                mSessionBinder.prepareFromUri(mContext.getPackageName(), mCbStub, uri, extras);
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling prepare(" + uri + ").", e);
                Log.wtf(TAG, "Error calling prepare(" + uri + ").", e);
            }
            }
@@ -753,7 +755,7 @@ public final class MediaController {
         */
         */
        public void play() {
        public void play() {
            try {
            try {
                mSessionBinder.play(mContext.getPackageName());
                mSessionBinder.play(mContext.getPackageName(), mCbStub);
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling play.", e);
                Log.wtf(TAG, "Error calling play.", e);
            }
            }
@@ -772,7 +774,7 @@ public final class MediaController {
                        "You must specify a non-empty String for playFromMediaId.");
                        "You must specify a non-empty String for playFromMediaId.");
            }
            }
            try {
            try {
                mSessionBinder.playFromMediaId(mContext.getPackageName(), mediaId, extras);
                mSessionBinder.playFromMediaId(mContext.getPackageName(), mCbStub, mediaId, extras);
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling play(" + mediaId + ").", e);
                Log.wtf(TAG, "Error calling play(" + mediaId + ").", e);
            }
            }
@@ -794,7 +796,7 @@ public final class MediaController {
                query = "";
                query = "";
            }
            }
            try {
            try {
                mSessionBinder.playFromSearch(mContext.getPackageName(), query, extras);
                mSessionBinder.playFromSearch(mContext.getPackageName(), mCbStub, query, extras);
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling play(" + query + ").", e);
                Log.wtf(TAG, "Error calling play(" + query + ").", e);
            }
            }
@@ -813,7 +815,7 @@ public final class MediaController {
                        "You must specify a non-empty Uri for playFromUri.");
                        "You must specify a non-empty Uri for playFromUri.");
            }
            }
            try {
            try {
                mSessionBinder.playFromUri(mContext.getPackageName(), uri, extras);
                mSessionBinder.playFromUri(mContext.getPackageName(), mCbStub, uri, extras);
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling play(" + uri + ").", e);
                Log.wtf(TAG, "Error calling play(" + uri + ").", e);
            }
            }
@@ -825,7 +827,7 @@ public final class MediaController {
         */
         */
        public void skipToQueueItem(long id) {
        public void skipToQueueItem(long id) {
            try {
            try {
                mSessionBinder.skipToQueueItem(mContext.getPackageName(), id);
                mSessionBinder.skipToQueueItem(mContext.getPackageName(), mCbStub, id);
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling skipToItem(" + id + ").", e);
                Log.wtf(TAG, "Error calling skipToItem(" + id + ").", e);
            }
            }
@@ -837,7 +839,7 @@ public final class MediaController {
         */
         */
        public void pause() {
        public void pause() {
            try {
            try {
                mSessionBinder.pause(mContext.getPackageName());
                mSessionBinder.pause(mContext.getPackageName(), mCbStub);
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling pause.", e);
                Log.wtf(TAG, "Error calling pause.", e);
            }
            }
@@ -849,7 +851,7 @@ public final class MediaController {
         */
         */
        public void stop() {
        public void stop() {
            try {
            try {
                mSessionBinder.stop(mContext.getPackageName());
                mSessionBinder.stop(mContext.getPackageName(), mCbStub);
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling stop.", e);
                Log.wtf(TAG, "Error calling stop.", e);
            }
            }
@@ -862,7 +864,7 @@ public final class MediaController {
         */
         */
        public void seekTo(long pos) {
        public void seekTo(long pos) {
            try {
            try {
                mSessionBinder.seekTo(mContext.getPackageName(), pos);
                mSessionBinder.seekTo(mContext.getPackageName(), mCbStub, pos);
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling seekTo.", e);
                Log.wtf(TAG, "Error calling seekTo.", e);
            }
            }
@@ -874,7 +876,7 @@ public final class MediaController {
         */
         */
        public void fastForward() {
        public void fastForward() {
            try {
            try {
                mSessionBinder.fastForward(mContext.getPackageName());
                mSessionBinder.fastForward(mContext.getPackageName(), mCbStub);
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling fastForward.", e);
                Log.wtf(TAG, "Error calling fastForward.", e);
            }
            }
@@ -885,7 +887,7 @@ public final class MediaController {
         */
         */
        public void skipToNext() {
        public void skipToNext() {
            try {
            try {
                mSessionBinder.next(mContext.getPackageName());
                mSessionBinder.next(mContext.getPackageName(), mCbStub);
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling next.", e);
                Log.wtf(TAG, "Error calling next.", e);
            }
            }
@@ -897,7 +899,7 @@ public final class MediaController {
         */
         */
        public void rewind() {
        public void rewind() {
            try {
            try {
                mSessionBinder.rewind(mContext.getPackageName());
                mSessionBinder.rewind(mContext.getPackageName(), mCbStub);
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling rewind.", e);
                Log.wtf(TAG, "Error calling rewind.", e);
            }
            }
@@ -908,7 +910,7 @@ public final class MediaController {
         */
         */
        public void skipToPrevious() {
        public void skipToPrevious() {
            try {
            try {
                mSessionBinder.previous(mContext.getPackageName());
                mSessionBinder.previous(mContext.getPackageName(), mCbStub);
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling previous.", e);
                Log.wtf(TAG, "Error calling previous.", e);
            }
            }
@@ -923,7 +925,7 @@ public final class MediaController {
         */
         */
        public void setRating(Rating rating) {
        public void setRating(Rating rating) {
            try {
            try {
                mSessionBinder.rate(mContext.getPackageName(), rating);
                mSessionBinder.rate(mContext.getPackageName(), mCbStub, rating);
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.wtf(TAG, "Error calling rate.", e);
                Log.wtf(TAG, "Error calling rate.", e);
            }
            }
@@ -958,7 +960,7 @@ public final class MediaController {
                throw new IllegalArgumentException("CustomAction cannot be null.");
                throw new IllegalArgumentException("CustomAction cannot be null.");
            }
            }
            try {
            try {
                mSessionBinder.sendCustomAction(mContext.getPackageName(), action, args);
                mSessionBinder.sendCustomAction(mContext.getPackageName(), mCbStub, action, args);
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.d(TAG, "Dead object in sendCustomAction.", e);
                Log.d(TAG, "Dead object in sendCustomAction.", e);
            }
            }
@@ -1124,8 +1126,8 @@ public final class MediaController {
        public void onVolumeInfoChanged(ParcelableVolumeInfo pvi) {
        public void onVolumeInfoChanged(ParcelableVolumeInfo pvi) {
            MediaController controller = mController.get();
            MediaController controller = mController.get();
            if (controller != null) {
            if (controller != null) {
                PlaybackInfo info = new PlaybackInfo(pvi.volumeType, pvi.audioAttrs, pvi.controlType,
                PlaybackInfo info = new PlaybackInfo(pvi.volumeType, pvi.audioAttrs,
                        pvi.maxVolume, pvi.currentVolume);
                        pvi.controlType, pvi.maxVolume, pvi.currentVolume);
                controller.postMessage(MSG_UPDATE_VOLUME, info, null);
                controller.postMessage(MSG_UPDATE_VOLUME, info, null);
            }
            }
        }
        }
Loading