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.support.v4.media.session; 17 18 import android.app.PendingIntent; 19 import android.content.Intent; 20 import android.support.v4.media.MediaDescriptionCompat; 21 import android.support.v4.media.MediaMetadataCompat; 22 import android.support.v4.media.RatingCompat; 23 import android.support.v4.media.session.IMediaControllerCallback; 24 import android.support.v4.media.session.ParcelableVolumeInfo; 25 import android.support.v4.media.session.PlaybackStateCompat; 26 import android.support.v4.media.session.MediaSessionCompat; 27 import android.os.Bundle; 28 import android.view.KeyEvent; 29 30 import java.util.List; 31 32 /** 33 * Interface to a MediaSessionCompat. This is only used on pre-Lollipop systems. 34 * @hide 35 */ 36 interface IMediaSession { 37 // Next ID: 48 sendCommand(String command, in Bundle args, in MediaSessionCompat.ResultReceiverWrapper cb)38 void sendCommand(String command, in Bundle args, in MediaSessionCompat.ResultReceiverWrapper cb) = 0; 39 boolean sendMediaButton(in KeyEvent mediaButton) = 1; 40 void registerCallbackListener(in IMediaControllerCallback cb) = 2; 41 void unregisterCallbackListener(in IMediaControllerCallback cb) = 3; isTransportControlEnabled()42 boolean isTransportControlEnabled() = 4; getPackageName()43 String getPackageName() = 5; getTag()44 String getTag() = 6; getLaunchPendingIntent()45 PendingIntent getLaunchPendingIntent() = 7; getFlags()46 long getFlags() = 8; getVolumeAttributes()47 ParcelableVolumeInfo getVolumeAttributes() = 9; adjustVolume(int direction, int flags, String packageName)48 void adjustVolume(int direction, int flags, String packageName) = 10; setVolumeTo(int value, int flags, String packageName)49 void setVolumeTo(int value, int flags, String packageName) = 11; getMetadata()50 MediaMetadataCompat getMetadata() = 26; getPlaybackState()51 PlaybackStateCompat getPlaybackState() = 27; getQueue()52 List<MediaSessionCompat.QueueItem> getQueue() = 28; getQueueTitle()53 CharSequence getQueueTitle() = 29; getExtras()54 Bundle getExtras() = 30; getRatingType()55 int getRatingType() = 31; isCaptioningEnabled()56 boolean isCaptioningEnabled() = 44; getRepeatMode()57 int getRepeatMode() = 36; isShuffleModeEnabledDeprecated()58 boolean isShuffleModeEnabledDeprecated() = 37; getShuffleMode()59 int getShuffleMode() = 46; 60 void addQueueItem(in MediaDescriptionCompat description) = 40; addQueueItemAt(in MediaDescriptionCompat description, int index)61 void addQueueItemAt(in MediaDescriptionCompat description, int index) = 41; 62 void removeQueueItem(in MediaDescriptionCompat description) = 42; removeQueueItemAt(int index)63 void removeQueueItemAt(int index) = 43; 64 65 // These commands are for the TransportControls prepare()66 void prepare() = 32; prepareFromMediaId(String uri, in Bundle extras)67 void prepareFromMediaId(String uri, in Bundle extras) = 33; prepareFromSearch(String string, in Bundle extras)68 void prepareFromSearch(String string, in Bundle extras) = 34; prepareFromUri(in Uri uri, in Bundle extras)69 void prepareFromUri(in Uri uri, in Bundle extras) = 35; play()70 void play() = 12; playFromMediaId(String uri, in Bundle extras)71 void playFromMediaId(String uri, in Bundle extras) = 13; playFromSearch(String string, in Bundle extras)72 void playFromSearch(String string, in Bundle extras) = 14; playFromUri(in Uri uri, in Bundle extras)73 void playFromUri(in Uri uri, in Bundle extras) = 15; skipToQueueItem(long id)74 void skipToQueueItem(long id) = 16; pause()75 void pause() = 17; stop()76 void stop() = 18; next()77 void next() = 19; previous()78 void previous() = 20; fastForward()79 void fastForward() = 21; rewind()80 void rewind() = 22; seekTo(long pos)81 void seekTo(long pos) = 23; 82 void rate(in RatingCompat rating) = 24; setCaptioningEnabled(boolean enabled)83 void setCaptioningEnabled(boolean enabled) = 45; setRepeatMode(int repeatMode)84 void setRepeatMode(int repeatMode) = 38; setShuffleModeEnabledDeprecated(boolean shuffleMode)85 void setShuffleModeEnabledDeprecated(boolean shuffleMode) = 39; setShuffleMode(int shuffleMode)86 void setShuffleMode(int shuffleMode) = 47; sendCustomAction(String action, in Bundle args)87 void sendCustomAction(String action, in Bundle args) = 25; 88 } 89