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