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 41 /** 42 * Notify the UID of the currently active {@link android.service.voice.HotwordDetectionService}. 43 * 44 * <p>The caller is expected to take care of any performance implications, e.g. by using a 45 * background thread to call this method.</p> 46 * 47 * @param uid UID of the currently active service or {@link android.os.Process#INVALID_UID} if 48 * none. 49 */ setHotwordDetectionServiceUid(int uid)50 public abstract void setHotwordDetectionServiceUid(int uid); 51 setAccessibilityServiceUids(IntArray uids)52 public abstract void setAccessibilityServiceUids(IntArray uids); 53 54 /** 55 * Called by {@link com.android.server.inputmethod.InputMethodManagerService} to notify the UID 56 * of the currently used {@link android.inputmethodservice.InputMethodService}. 57 * 58 * <p>The caller is expected to take care of any performance implications, e.g. by using a 59 * background thread to call this method.</p> 60 * 61 * @param uid UID of the currently used {@link android.inputmethodservice.InputMethodService}. 62 * {@link android.os.Process#INVALID_UID} if no IME is active. 63 */ setInputMethodServiceUid(int uid)64 public abstract void setInputMethodServiceUid(int uid); 65 66 public interface RingerModeDelegate { 67 /** Called when external ringer mode is evaluated, returns the new internal ringer mode */ onSetRingerModeExternal(int ringerModeOld, int ringerModeNew, String caller, int ringerModeInternal, VolumePolicy policy)68 int onSetRingerModeExternal(int ringerModeOld, int ringerModeNew, String caller, 69 int ringerModeInternal, VolumePolicy policy); 70 71 /** Called when internal ringer mode is evaluated, returns the new external ringer mode */ onSetRingerModeInternal(int ringerModeOld, int ringerModeNew, String caller, int ringerModeExternal, VolumePolicy policy)72 int onSetRingerModeInternal(int ringerModeOld, int ringerModeNew, String caller, 73 int ringerModeExternal, VolumePolicy policy); 74 canVolumeDownEnterSilent()75 boolean canVolumeDownEnterSilent(); 76 getRingerModeAffectedStreams(int streams)77 int getRingerModeAffectedStreams(int streams); 78 } 79 } 80