1 /* Copyright (C) 2014 The Android Open Source Project
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *      http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 package android.media.session;
17 
18 import android.app.PendingIntent;
19 import android.content.Intent;
20 import android.content.pm.ParceledListSlice;
21 import android.media.MediaMetadata;
22 import android.media.Rating;
23 import android.media.session.ISessionControllerCallback;
24 import android.media.session.MediaSession;
25 import android.media.session.ParcelableVolumeInfo;
26 import android.media.session.PlaybackState;
27 import android.net.Uri;
28 import android.os.Bundle;
29 import android.os.ResultReceiver;
30 import android.view.KeyEvent;
31 
32 import java.util.List;
33 
34 /**
35  * Interface to a MediaSession in the system.
36  * @hide
37  */
38 interface ISessionController {
sendCommand(String command, in Bundle args, in ResultReceiver cb)39     void sendCommand(String command, in Bundle args, in ResultReceiver cb);
sendMediaButton(in KeyEvent mediaButton)40     boolean sendMediaButton(in KeyEvent mediaButton);
registerCallbackListener(in ISessionControllerCallback cb)41     void registerCallbackListener(in ISessionControllerCallback cb);
unregisterCallbackListener(in ISessionControllerCallback cb)42     void unregisterCallbackListener(in ISessionControllerCallback cb);
isTransportControlEnabled()43     boolean isTransportControlEnabled();
getPackageName()44     String getPackageName();
getTag()45     String getTag();
getLaunchPendingIntent()46     PendingIntent getLaunchPendingIntent();
getFlags()47     long getFlags();
getVolumeAttributes()48     ParcelableVolumeInfo getVolumeAttributes();
adjustVolume(int direction, int flags, String packageName)49     void adjustVolume(int direction, int flags, String packageName);
setVolumeTo(int value, int flags, String packageName)50     void setVolumeTo(int value, int flags, String packageName);
51 
52     // These commands are for the TransportControls
play()53     void play();
playFromMediaId(String mediaId, in Bundle extras)54     void playFromMediaId(String mediaId, in Bundle extras);
playFromSearch(String string, in Bundle extras)55     void playFromSearch(String string, in Bundle extras);
playFromUri(in Uri uri, in Bundle extras)56     void playFromUri(in Uri uri, in Bundle extras);
skipToQueueItem(long id)57     void skipToQueueItem(long id);
pause()58     void pause();
stop()59     void stop();
next()60     void next();
previous()61     void previous();
fastForward()62     void fastForward();
rewind()63     void rewind();
seekTo(long pos)64     void seekTo(long pos);
rate(in Rating rating)65     void rate(in Rating rating);
sendCustomAction(String action, in Bundle args)66     void sendCustomAction(String action, in Bundle args);
getMetadata()67     MediaMetadata getMetadata();
getPlaybackState()68     PlaybackState getPlaybackState();
getQueue()69     ParceledListSlice getQueue();
getQueueTitle()70     CharSequence getQueueTitle();
getExtras()71     Bundle getExtras();
getRatingType()72     int getRatingType();
73 }
74