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 prepare()53 void prepare(); prepareFromMediaId(String mediaId, in Bundle extras)54 void prepareFromMediaId(String mediaId, in Bundle extras); prepareFromSearch(String string, in Bundle extras)55 void prepareFromSearch(String string, in Bundle extras); prepareFromUri(in Uri uri, in Bundle extras)56 void prepareFromUri(in Uri uri, in Bundle extras); play()57 void play(); playFromMediaId(String mediaId, in Bundle extras)58 void playFromMediaId(String mediaId, in Bundle extras); playFromSearch(String string, in Bundle extras)59 void playFromSearch(String string, in Bundle extras); playFromUri(in Uri uri, in Bundle extras)60 void playFromUri(in Uri uri, in Bundle extras); skipToQueueItem(long id)61 void skipToQueueItem(long id); pause()62 void pause(); stop()63 void stop(); next()64 void next(); previous()65 void previous(); fastForward()66 void fastForward(); rewind()67 void rewind(); seekTo(long pos)68 void seekTo(long pos); rate(in Rating rating)69 void rate(in Rating rating); sendCustomAction(String action, in Bundle args)70 void sendCustomAction(String action, in Bundle args); getMetadata()71 MediaMetadata getMetadata(); getPlaybackState()72 PlaybackState getPlaybackState(); getQueue()73 ParceledListSlice getQueue(); getQueueTitle()74 CharSequence getQueueTitle(); getExtras()75 Bundle getExtras(); getRatingType()76 int getRatingType(); 77 } 78