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.MediaMetadataCompat; 21 import android.support.v4.media.RatingCompat; 22 import android.support.v4.media.session.IMediaControllerCallback; 23 import android.support.v4.media.session.ParcelableVolumeInfo; 24 import android.support.v4.media.session.PlaybackStateCompat; 25 import android.support.v4.media.session.MediaSessionCompat; 26 import android.os.Bundle; 27 import android.view.KeyEvent; 28 29 import java.util.List; 30 31 /** 32 * Interface to a MediaSessionCompat. This is only used on pre-Lollipop systems. 33 * @hide 34 */ 35 interface IMediaSession { sendCommand(String command, in Bundle args, in MediaSessionCompat.ResultReceiverWrapper cb)36 void sendCommand(String command, in Bundle args, in MediaSessionCompat.ResultReceiverWrapper cb); sendMediaButton(in KeyEvent mediaButton)37 boolean sendMediaButton(in KeyEvent mediaButton); registerCallbackListener(in IMediaControllerCallback cb)38 void registerCallbackListener(in IMediaControllerCallback cb); unregisterCallbackListener(in IMediaControllerCallback cb)39 void unregisterCallbackListener(in IMediaControllerCallback cb); isTransportControlEnabled()40 boolean isTransportControlEnabled(); getPackageName()41 String getPackageName(); getTag()42 String getTag(); getLaunchPendingIntent()43 PendingIntent getLaunchPendingIntent(); getFlags()44 long getFlags(); getVolumeAttributes()45 ParcelableVolumeInfo getVolumeAttributes(); adjustVolume(int direction, int flags, String packageName)46 void adjustVolume(int direction, int flags, String packageName); setVolumeTo(int value, int flags, String packageName)47 void setVolumeTo(int value, int flags, String packageName); 48 49 // These commands are for the TransportControls play()50 void play(); playFromMediaId(String uri, in Bundle extras)51 void playFromMediaId(String uri, in Bundle extras); playFromSearch(String string, in Bundle extras)52 void playFromSearch(String string, in Bundle extras); playFromUri(in Uri uri, in Bundle extras)53 void playFromUri(in Uri uri, in Bundle extras); skipToQueueItem(long id)54 void skipToQueueItem(long id); pause()55 void pause(); stop()56 void stop(); next()57 void next(); previous()58 void previous(); fastForward()59 void fastForward(); rewind()60 void rewind(); seekTo(long pos)61 void seekTo(long pos); rate(in RatingCompat rating)62 void rate(in RatingCompat rating); sendCustomAction(String action, in Bundle args)63 void sendCustomAction(String action, in Bundle args); getMetadata()64 MediaMetadataCompat getMetadata(); getPlaybackState()65 PlaybackStateCompat getPlaybackState(); getQueue()66 List<MediaSessionCompat.QueueItem> getQueue(); getQueueTitle()67 CharSequence getQueueTitle(); getExtras()68 Bundle getExtras(); getRatingType()69 int getRatingType(); prepare()70 void prepare(); prepareFromMediaId(String uri, in Bundle extras)71 void prepareFromMediaId(String uri, in Bundle extras); prepareFromSearch(String string, in Bundle extras)72 void prepareFromSearch(String string, in Bundle extras); prepareFromUri(in Uri uri, in Bundle extras)73 void prepareFromUri(in Uri uri, in Bundle extras); 74 } 75