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.content.Intent;
19 import android.media.Rating;
20 import android.media.session.ISessionControllerCallback;
21 import android.net.Uri;
22 import android.os.Bundle;
23 import android.os.ResultReceiver;
24 
25 /**
26  * @hide
27  */
28 oneway interface ISessionCallback {
onCommand(String packageName, int pid, int uid, ISessionControllerCallback caller, String command, in Bundle args, in ResultReceiver cb)29     void onCommand(String packageName, int pid, int uid, ISessionControllerCallback caller,
30             String command, in Bundle args, in ResultReceiver cb);
onMediaButton(String packageName, int pid, int uid, in Intent mediaButtonIntent, int sequenceNumber, in ResultReceiver cb)31     void onMediaButton(String packageName, int pid, int uid, in Intent mediaButtonIntent,
32             int sequenceNumber, in ResultReceiver cb);
onMediaButtonFromController(String packageName, int pid, int uid, ISessionControllerCallback caller, in Intent mediaButtonIntent)33     void onMediaButtonFromController(String packageName, int pid, int uid,
34             ISessionControllerCallback caller, in Intent mediaButtonIntent);
35 
36     // These callbacks are for the TransportControls
onPrepare(String packageName, int pid, int uid, ISessionControllerCallback caller)37     void onPrepare(String packageName, int pid, int uid, ISessionControllerCallback caller);
onPrepareFromMediaId(String packageName, int pid, int uid, ISessionControllerCallback caller, String mediaId, in Bundle extras)38     void onPrepareFromMediaId(String packageName, int pid, int uid,
39             ISessionControllerCallback caller, String mediaId, in Bundle extras);
onPrepareFromSearch(String packageName, int pid, int uid, ISessionControllerCallback caller, String query, in Bundle extras)40     void onPrepareFromSearch(String packageName, int pid, int uid,
41             ISessionControllerCallback caller, String query, in Bundle extras);
onPrepareFromUri(String packageName, int pid, int uid, ISessionControllerCallback caller, in Uri uri, in Bundle extras)42     void onPrepareFromUri(String packageName, int pid, int uid,
43             ISessionControllerCallback caller, in Uri uri, in Bundle extras);
onPlay(String packageName, int pid, int uid, ISessionControllerCallback caller)44     void onPlay(String packageName, int pid, int uid, ISessionControllerCallback caller);
onPlayFromMediaId(String packageName, int pid, int uid, ISessionControllerCallback caller, String mediaId, in Bundle extras)45     void onPlayFromMediaId(String packageName, int pid, int uid,
46             ISessionControllerCallback caller, String mediaId, in Bundle extras);
onPlayFromSearch(String packageName, int pid, int uid, ISessionControllerCallback caller, String query, in Bundle extras)47     void onPlayFromSearch(String packageName, int pid, int uid,
48             ISessionControllerCallback caller, String query, in Bundle extras);
onPlayFromUri(String packageName, int pid, int uid, ISessionControllerCallback caller, in Uri uri, in Bundle extras)49     void onPlayFromUri(String packageName, int pid, int uid, ISessionControllerCallback caller,
50             in Uri uri, in Bundle extras);
onSkipToTrack(String packageName, int pid, int uid, ISessionControllerCallback caller, long id)51     void onSkipToTrack(String packageName, int pid, int uid, ISessionControllerCallback caller,
52             long id);
onPause(String packageName, int pid, int uid, ISessionControllerCallback caller)53     void onPause(String packageName, int pid, int uid, ISessionControllerCallback caller);
onStop(String packageName, int pid, int uid, ISessionControllerCallback caller)54     void onStop(String packageName, int pid, int uid, ISessionControllerCallback caller);
onNext(String packageName, int pid, int uid, ISessionControllerCallback caller)55     void onNext(String packageName, int pid, int uid, ISessionControllerCallback caller);
onPrevious(String packageName, int pid, int uid, ISessionControllerCallback caller)56     void onPrevious(String packageName, int pid, int uid, ISessionControllerCallback caller);
onFastForward(String packageName, int pid, int uid, ISessionControllerCallback caller)57     void onFastForward(String packageName, int pid, int uid, ISessionControllerCallback caller);
onRewind(String packageName, int pid, int uid, ISessionControllerCallback caller)58     void onRewind(String packageName, int pid, int uid, ISessionControllerCallback caller);
onSeekTo(String packageName, int pid, int uid, ISessionControllerCallback caller, long pos)59     void onSeekTo(String packageName, int pid, int uid, ISessionControllerCallback caller,
60             long pos);
onRate(String packageName, int pid, int uid, ISessionControllerCallback caller, in Rating rating)61     void onRate(String packageName, int pid, int uid, ISessionControllerCallback caller,
62             in Rating rating);
onSetPlaybackSpeed(String packageName, int pid, int uid, ISessionControllerCallback caller, float speed)63     void onSetPlaybackSpeed(String packageName, int pid, int uid,
64             ISessionControllerCallback caller, float speed);
onCustomAction(String packageName, int pid, int uid, ISessionControllerCallback caller, String action, in Bundle args)65     void onCustomAction(String packageName, int pid, int uid, ISessionControllerCallback caller,
66             String action, in Bundle args);
67 
68     // These callbacks are for volume handling
onAdjustVolume(String packageName, int pid, int uid, ISessionControllerCallback caller, int direction)69     void onAdjustVolume(String packageName, int pid, int uid, ISessionControllerCallback caller,
70             int direction);
onSetVolumeTo(String packageName, int pid, int uid, ISessionControllerCallback caller, int value)71     void onSetVolumeTo(String packageName, int pid, int uid,
72             ISessionControllerCallback caller, int value);
73 }
74