1 /*
2  * Copyright (C) 2014 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package android.media;
17 
18 import android.util.IntArray;
19 
20 import com.android.server.LocalServices;
21 
22 /**
23  * Class for system services to access extra AudioManager functionality. The
24  * AudioService is responsible for registering an implementation with
25  * {@link LocalServices}.
26  *
27  * @hide
28  */
29 public abstract class AudioManagerInternal {
30 
setRingerModeDelegate(RingerModeDelegate delegate)31     public abstract void setRingerModeDelegate(RingerModeDelegate delegate);
32 
getRingerModeInternal()33     public abstract int getRingerModeInternal();
34 
setRingerModeInternal(int ringerMode, String caller)35     public abstract void setRingerModeInternal(int ringerMode, String caller);
36 
silenceRingerModeInternal(String caller)37     public abstract void silenceRingerModeInternal(String caller);
38 
updateRingerModeAffectedStreamsInternal()39     public abstract void updateRingerModeAffectedStreamsInternal();
40 
setAccessibilityServiceUids(IntArray uids)41     public abstract void setAccessibilityServiceUids(IntArray uids);
42 
43     /**
44      * Add the UID for a new assistant service
45      *
46      * @param uid UID of the newly available assistants
47      */
addAssistantServiceUid(int uid)48     public abstract void addAssistantServiceUid(int uid);
49 
50     /**
51      * Remove the UID for an existing assistant service
52      *
53      * @param uid UID of the currently available assistant
54      */
removeAssistantServiceUid(int uid)55     public abstract void removeAssistantServiceUid(int uid);
56 
57     /**
58      * Set the currently active assistant service UIDs
59      * @param activeUids active UIDs of the assistant service
60      */
setActiveAssistantServicesUids(IntArray activeUids)61     public abstract void setActiveAssistantServicesUids(IntArray activeUids);
62 
63     /**
64      * Called by {@link com.android.server.inputmethod.InputMethodManagerService} to notify the UID
65      * of the currently used {@link android.inputmethodservice.InputMethodService}.
66      *
67      * <p>The caller is expected to take care of any performance implications, e.g. by using a
68      * background thread to call this method.</p>
69      *
70      * @param uid UID of the currently used {@link android.inputmethodservice.InputMethodService}.
71      *            {@link android.os.Process#INVALID_UID} if no IME is active.
72      */
setInputMethodServiceUid(int uid)73     public abstract void setInputMethodServiceUid(int uid);
74 
75     public interface RingerModeDelegate {
76         /** Called when external ringer mode is evaluated, returns the new internal ringer mode */
onSetRingerModeExternal(int ringerModeOld, int ringerModeNew, String caller, int ringerModeInternal, VolumePolicy policy)77         int onSetRingerModeExternal(int ringerModeOld, int ringerModeNew, String caller,
78                 int ringerModeInternal, VolumePolicy policy);
79 
80         /** Called when internal ringer mode is evaluated, returns the new external ringer mode */
onSetRingerModeInternal(int ringerModeOld, int ringerModeNew, String caller, int ringerModeExternal, VolumePolicy policy)81         int onSetRingerModeInternal(int ringerModeOld, int ringerModeNew, String caller,
82                 int ringerModeExternal, VolumePolicy policy);
83 
canVolumeDownEnterSilent()84         boolean canVolumeDownEnterSilent();
85 
getRingerModeAffectedStreams(int streams)86         int getRingerModeAffectedStreams(int streams);
87     }
88 }
89