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 * @param owningUid UID of the actual assistant app, if {@code uid} is a isolated proc 48 */ addAssistantServiceUid(int uid, int owningUid)49 public abstract void addAssistantServiceUid(int uid, int owningUid); 50 51 /** 52 * Remove the UID for an existing assistant service 53 * 54 * @param uid UID of the currently available assistant 55 */ removeAssistantServiceUid(int uid)56 public abstract void removeAssistantServiceUid(int uid); 57 58 /** 59 * Set the currently active assistant service UIDs 60 * @param activeUids active UIDs of the assistant service 61 */ setActiveAssistantServicesUids(IntArray activeUids)62 public abstract void setActiveAssistantServicesUids(IntArray activeUids); 63 64 /** 65 * Called by {@link com.android.server.inputmethod.InputMethodManagerService} to notify the UID 66 * of the currently used {@link android.inputmethodservice.InputMethodService}. 67 * 68 * <p>The caller is expected to take care of any performance implications, e.g. by using a 69 * background thread to call this method.</p> 70 * 71 * @param uid UID of the currently used {@link android.inputmethodservice.InputMethodService}. 72 * {@link android.os.Process#INVALID_UID} if no IME is active. 73 */ setInputMethodServiceUid(int uid)74 public abstract void setInputMethodServiceUid(int uid); 75 76 public interface RingerModeDelegate { 77 /** Called when external ringer mode is evaluated, returns the new internal ringer mode */ onSetRingerModeExternal(int ringerModeOld, int ringerModeNew, String caller, int ringerModeInternal, VolumePolicy policy)78 int onSetRingerModeExternal(int ringerModeOld, int ringerModeNew, String caller, 79 int ringerModeInternal, VolumePolicy policy); 80 81 /** Called when internal ringer mode is evaluated, returns the new external ringer mode */ onSetRingerModeInternal(int ringerModeOld, int ringerModeNew, String caller, int ringerModeExternal, VolumePolicy policy)82 int onSetRingerModeInternal(int ringerModeOld, int ringerModeNew, String caller, 83 int ringerModeExternal, VolumePolicy policy); 84 canVolumeDownEnterSilent()85 boolean canVolumeDownEnterSilent(); 86 getRingerModeAffectedStreams(int streams)87 int getRingerModeAffectedStreams(int streams); 88 } 89 } 90