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 adjustSuggestedStreamVolumeForUid(int streamType, int direction, int flags, String callingPackage, int uid, int pid)31 public abstract void adjustSuggestedStreamVolumeForUid(int streamType, int direction, 32 int flags, String callingPackage, int uid, int pid); 33 adjustStreamVolumeForUid(int streamType, int direction, int flags, String callingPackage, int uid, int pid)34 public abstract void adjustStreamVolumeForUid(int streamType, int direction, int flags, 35 String callingPackage, int uid, int pid); 36 setStreamVolumeForUid(int streamType, int direction, int flags, String callingPackage, int uid, int pid)37 public abstract void setStreamVolumeForUid(int streamType, int direction, int flags, 38 String callingPackage, int uid, int pid); 39 setRingerModeDelegate(RingerModeDelegate delegate)40 public abstract void setRingerModeDelegate(RingerModeDelegate delegate); 41 getRingerModeInternal()42 public abstract int getRingerModeInternal(); 43 setRingerModeInternal(int ringerMode, String caller)44 public abstract void setRingerModeInternal(int ringerMode, String caller); 45 silenceRingerModeInternal(String caller)46 public abstract void silenceRingerModeInternal(String caller); 47 updateRingerModeAffectedStreamsInternal()48 public abstract void updateRingerModeAffectedStreamsInternal(); 49 setAccessibilityServiceUids(IntArray uids)50 public abstract void setAccessibilityServiceUids(IntArray uids); 51 52 /** 53 * Called by {@link com.android.server.inputmethod.InputMethodManagerService} to notify the UID 54 * of the currently used {@link android.inputmethodservice.InputMethodService}. 55 * 56 * <p>The caller is expected to take care of any performance implications, e.g. by using a 57 * background thread to call this method.</p> 58 * 59 * @param uid UID of the currently used {@link android.inputmethodservice.InputMethodService}. 60 * {@link android.os.Process#INVALID_UID} if no IME is active. 61 */ setInputMethodServiceUid(int uid)62 public abstract void setInputMethodServiceUid(int uid); 63 64 public interface RingerModeDelegate { 65 /** Called when external ringer mode is evaluated, returns the new internal ringer mode */ onSetRingerModeExternal(int ringerModeOld, int ringerModeNew, String caller, int ringerModeInternal, VolumePolicy policy)66 int onSetRingerModeExternal(int ringerModeOld, int ringerModeNew, String caller, 67 int ringerModeInternal, VolumePolicy policy); 68 69 /** Called when internal ringer mode is evaluated, returns the new external ringer mode */ onSetRingerModeInternal(int ringerModeOld, int ringerModeNew, String caller, int ringerModeExternal, VolumePolicy policy)70 int onSetRingerModeInternal(int ringerModeOld, int ringerModeNew, String caller, 71 int ringerModeExternal, VolumePolicy policy); 72 canVolumeDownEnterSilent()73 boolean canVolumeDownEnterSilent(); 74 getRingerModeAffectedStreams(int streams)75 int getRingerModeAffectedStreams(int streams); 76 } 77 } 78