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.ComponentName;
19 import android.media.IRemoteVolumeController;
20 import android.media.ISessionTokensListener;
21 import android.media.session.IActiveSessionsListener;
22 import android.media.session.ICallback;
23 import android.media.session.IOnMediaKeyListener;
24 import android.media.session.IOnVolumeKeyLongPressListener;
25 import android.media.session.ISession;
26 import android.media.session.ISessionCallback;
27 import android.os.Bundle;
28 import android.view.KeyEvent;
29 
30 /**
31  * Interface to the MediaSessionManagerService
32  * @hide
33  */
34 interface ISessionManager {
createSession(String packageName, in ISessionCallback cb, String tag, int userId)35     ISession createSession(String packageName, in ISessionCallback cb, String tag, int userId);
getSessions(in ComponentName compName, int userId)36     List<IBinder> getSessions(in ComponentName compName, int userId);
dispatchMediaKeyEvent(String packageName, boolean asSystemService, in KeyEvent keyEvent, boolean needWakeLock)37     void dispatchMediaKeyEvent(String packageName, boolean asSystemService, in KeyEvent keyEvent,
38             boolean needWakeLock);
dispatchVolumeKeyEvent(String packageName, boolean asSystemService, in KeyEvent keyEvent, int stream, boolean musicOnly)39     void dispatchVolumeKeyEvent(String packageName, boolean asSystemService, in KeyEvent keyEvent,
40             int stream, boolean musicOnly);
dispatchAdjustVolume(String packageName, int suggestedStream, int delta, int flags)41     void dispatchAdjustVolume(String packageName, int suggestedStream, int delta, int flags);
addSessionsListener(in IActiveSessionsListener listener, in ComponentName compName, int userId)42     void addSessionsListener(in IActiveSessionsListener listener, in ComponentName compName,
43             int userId);
removeSessionsListener(in IActiveSessionsListener listener)44     void removeSessionsListener(in IActiveSessionsListener listener);
45 
46     // This is for the system volume UI only
setRemoteVolumeController(in IRemoteVolumeController rvc)47     void setRemoteVolumeController(in IRemoteVolumeController rvc);
48 
49     // For PhoneWindowManager to precheck media keys
isGlobalPriorityActive()50     boolean isGlobalPriorityActive();
51 
setCallback(in ICallback callback)52     void setCallback(in ICallback callback);
setOnVolumeKeyLongPressListener(in IOnVolumeKeyLongPressListener listener)53     void setOnVolumeKeyLongPressListener(in IOnVolumeKeyLongPressListener listener);
setOnMediaKeyListener(in IOnMediaKeyListener listener)54     void setOnMediaKeyListener(in IOnMediaKeyListener listener);
55 
56     // MediaSession2
isTrusted(String controllerPackageName, int controllerPid, int controllerUid)57     boolean isTrusted(String controllerPackageName, int controllerPid, int controllerUid);
createSession2(in Bundle sessionToken)58     boolean createSession2(in Bundle sessionToken);
destroySession2(in Bundle sessionToken)59     void destroySession2(in Bundle sessionToken);
getSessionTokens(boolean activeSessionOnly, boolean sessionServiceOnly, String packageName)60     List<Bundle> getSessionTokens(boolean activeSessionOnly, boolean sessionServiceOnly,
61             String packageName);
62 
addSessionTokensListener(in ISessionTokensListener listener, int userId, String packageName)63     void addSessionTokensListener(in ISessionTokensListener listener, int userId,
64             String packageName);
removeSessionTokensListener(in ISessionTokensListener listener, String packageName)65     void removeSessionTokensListener(in ISessionTokensListener listener, String packageName);
66 }
67