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.media.session;
17
18import android.app.PendingIntent;
19import android.content.Intent;
20import android.content.pm.ParceledListSlice;
21import android.media.MediaMetadata;
22import android.media.Rating;
23import android.media.session.ISessionControllerCallback;
24import android.media.session.MediaSession;
25import android.media.session.ParcelableVolumeInfo;
26import android.media.session.PlaybackState;
27import android.net.Uri;
28import android.os.Bundle;
29import android.os.ResultReceiver;
30import android.view.KeyEvent;
31
32import java.util.List;
33
34/**
35 * Interface to a MediaSession in the system.
36 * @hide
37 */
38interface ISessionController {
39    void sendCommand(String command, in Bundle args, in ResultReceiver cb);
40    boolean sendMediaButton(in KeyEvent mediaButton);
41    void registerCallbackListener(in ISessionControllerCallback cb);
42    void unregisterCallbackListener(in ISessionControllerCallback cb);
43    boolean isTransportControlEnabled();
44    String getPackageName();
45    String getTag();
46    PendingIntent getLaunchPendingIntent();
47    long getFlags();
48    ParcelableVolumeInfo getVolumeAttributes();
49    void adjustVolume(int direction, int flags, String packageName);
50    void setVolumeTo(int value, int flags, String packageName);
51
52    // These commands are for the TransportControls
53    void prepare();
54    void prepareFromMediaId(String mediaId, in Bundle extras);
55    void prepareFromSearch(String string, in Bundle extras);
56    void prepareFromUri(in Uri uri, in Bundle extras);
57    void play();
58    void playFromMediaId(String mediaId, in Bundle extras);
59    void playFromSearch(String string, in Bundle extras);
60    void playFromUri(in Uri uri, in Bundle extras);
61    void skipToQueueItem(long id);
62    void pause();
63    void stop();
64    void next();
65    void previous();
66    void fastForward();
67    void rewind();
68    void seekTo(long pos);
69    void rate(in Rating rating);
70    void sendCustomAction(String action, in Bundle args);
71    MediaMetadata getMetadata();
72    PlaybackState getPlaybackState();
73    ParceledListSlice getQueue();
74    CharSequence getQueueTitle();
75    Bundle getExtras();
76    int getRatingType();
77}
78