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.MediaController; 25 import android.media.session.MediaSession; 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 MediaSessionRecord in the system. 36 * @hide 37 */ 38 interface ISessionController { sendCommand(String packageName, String command, in Bundle args, in ResultReceiver cb)39 void sendCommand(String packageName, String command, in Bundle args, in ResultReceiver cb); sendMediaButton(String packageName, in KeyEvent mediaButton)40 boolean sendMediaButton(String packageName, in KeyEvent mediaButton); registerCallback(String packageName, in ISessionControllerCallback cb)41 void registerCallback(String packageName, in ISessionControllerCallback cb); unregisterCallback(in ISessionControllerCallback cb)42 void unregisterCallback(in ISessionControllerCallback cb); getPackageName()43 String getPackageName(); getTag()44 String getTag(); getSessionInfo()45 Bundle getSessionInfo(); getLaunchPendingIntent()46 PendingIntent getLaunchPendingIntent(); getFlags()47 long getFlags(); getVolumeAttributes()48 MediaController.PlaybackInfo getVolumeAttributes(); adjustVolume(String packageName, String opPackageName, int direction, int flags)49 void adjustVolume(String packageName, String opPackageName, int direction, int flags); setVolumeTo(String packageName, String opPackageName, int value, int flags)50 void setVolumeTo(String packageName, String opPackageName, int value, int flags); 51 52 // These commands are for the TransportControls prepare(String packageName)53 void prepare(String packageName); prepareFromMediaId(String packageName, String mediaId, in Bundle extras)54 void prepareFromMediaId(String packageName, String mediaId, in Bundle extras); prepareFromSearch(String packageName, String string, in Bundle extras)55 void prepareFromSearch(String packageName, String string, in Bundle extras); prepareFromUri(String packageName, in Uri uri, in Bundle extras)56 void prepareFromUri(String packageName, in Uri uri, in Bundle extras); play(String packageName)57 void play(String packageName); playFromMediaId(String packageName, String mediaId, in Bundle extras)58 void playFromMediaId(String packageName, String mediaId, in Bundle extras); playFromSearch(String packageName, String string, in Bundle extras)59 void playFromSearch(String packageName, String string, in Bundle extras); playFromUri(String packageName, in Uri uri, in Bundle extras)60 void playFromUri(String packageName, in Uri uri, in Bundle extras); skipToQueueItem(String packageName, long id)61 void skipToQueueItem(String packageName, long id); pause(String packageName)62 void pause(String packageName); stop(String packageName)63 void stop(String packageName); next(String packageName)64 void next(String packageName); previous(String packageName)65 void previous(String packageName); fastForward(String packageName)66 void fastForward(String packageName); rewind(String packageName)67 void rewind(String packageName); seekTo(String packageName, long pos)68 void seekTo(String packageName, long pos); rate(String packageName, in Rating rating)69 void rate(String packageName, in Rating rating); setPlaybackSpeed(String packageName, float speed)70 void setPlaybackSpeed(String packageName, float speed); sendCustomAction(String packageName, String action, in Bundle args)71 void sendCustomAction(String packageName, String action, in Bundle args); getMetadata()72 MediaMetadata getMetadata(); getPlaybackState()73 PlaybackState getPlaybackState(); getQueue()74 ParceledListSlice getQueue(); getQueueTitle()75 CharSequence getQueueTitle(); getExtras()76 Bundle getExtras(); getRatingType()77 int getRatingType(); 78 } 79