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