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