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