Loading media/java/android/media/AudioManager.java +17 −0 Original line number Original line Diff line number Diff line Loading @@ -38,6 +38,7 @@ import android.os.Looper; import android.os.Message; import android.os.Message; import android.os.Process; import android.os.Process; import android.os.RemoteException; import android.os.RemoteException; import android.os.SystemProperties; import android.os.SystemClock; import android.os.SystemClock; import android.os.ServiceManager; import android.os.ServiceManager; import android.provider.Settings; import android.provider.Settings; Loading @@ -63,6 +64,16 @@ public class AudioManager { private static String TAG = "AudioManager"; private static String TAG = "AudioManager"; private static final AudioPortEventHandler sAudioPortEventHandler = new AudioPortEventHandler(); private static final AudioPortEventHandler sAudioPortEventHandler = new AudioPortEventHandler(); /** * System properties for whether the default microphone and speaker paths support * near-ultrasound frequencies (range of 18 - 21 kHz). */ private static final String SYSTEM_PROPERTY_MIC_NEAR_ULTRASOUND = "persist.audio.mic.near_ultrasound"; private static final String SYSTEM_PROPERTY_SPEAKER_NEAR_ULTRASOUND = "persist.audio.speaker.near_ultrasound"; private static final String DEFAULT_RESULT_FALSE_STRING = "false"; /** /** * Broadcast intent, a hint for applications that audio is about to become * Broadcast intent, a hint for applications that audio is about to become * 'noisy' due to a change in audio outputs. For example, this intent may * 'noisy' due to a change in audio outputs. For example, this intent may Loading Loading @@ -3175,6 +3186,12 @@ public class AudioManager { } else if (PROPERTY_OUTPUT_FRAMES_PER_BUFFER.equals(key)) { } else if (PROPERTY_OUTPUT_FRAMES_PER_BUFFER.equals(key)) { int outputFramesPerBuffer = AudioSystem.getPrimaryOutputFrameCount(); int outputFramesPerBuffer = AudioSystem.getPrimaryOutputFrameCount(); return outputFramesPerBuffer > 0 ? Integer.toString(outputFramesPerBuffer) : null; return outputFramesPerBuffer > 0 ? Integer.toString(outputFramesPerBuffer) : null; } else if (PROPERTY_SUPPORT_MIC_NEAR_ULTRASOUND.equals(key)) { return SystemProperties.get(SYSTEM_PROPERTY_MIC_NEAR_ULTRASOUND, DEFAULT_RESULT_FALSE_STRING); } else if (PROPERTY_SUPPORT_SPEAKER_NEAR_ULTRASOUND.equals(key)) { return SystemProperties.get(SYSTEM_PROPERTY_SPEAKER_NEAR_ULTRASOUND, DEFAULT_RESULT_FALSE_STRING); } else { } else { // null or unknown key // null or unknown key return null; return null; Loading Loading
media/java/android/media/AudioManager.java +17 −0 Original line number Original line Diff line number Diff line Loading @@ -38,6 +38,7 @@ import android.os.Looper; import android.os.Message; import android.os.Message; import android.os.Process; import android.os.Process; import android.os.RemoteException; import android.os.RemoteException; import android.os.SystemProperties; import android.os.SystemClock; import android.os.SystemClock; import android.os.ServiceManager; import android.os.ServiceManager; import android.provider.Settings; import android.provider.Settings; Loading @@ -63,6 +64,16 @@ public class AudioManager { private static String TAG = "AudioManager"; private static String TAG = "AudioManager"; private static final AudioPortEventHandler sAudioPortEventHandler = new AudioPortEventHandler(); private static final AudioPortEventHandler sAudioPortEventHandler = new AudioPortEventHandler(); /** * System properties for whether the default microphone and speaker paths support * near-ultrasound frequencies (range of 18 - 21 kHz). */ private static final String SYSTEM_PROPERTY_MIC_NEAR_ULTRASOUND = "persist.audio.mic.near_ultrasound"; private static final String SYSTEM_PROPERTY_SPEAKER_NEAR_ULTRASOUND = "persist.audio.speaker.near_ultrasound"; private static final String DEFAULT_RESULT_FALSE_STRING = "false"; /** /** * Broadcast intent, a hint for applications that audio is about to become * Broadcast intent, a hint for applications that audio is about to become * 'noisy' due to a change in audio outputs. For example, this intent may * 'noisy' due to a change in audio outputs. For example, this intent may Loading Loading @@ -3175,6 +3186,12 @@ public class AudioManager { } else if (PROPERTY_OUTPUT_FRAMES_PER_BUFFER.equals(key)) { } else if (PROPERTY_OUTPUT_FRAMES_PER_BUFFER.equals(key)) { int outputFramesPerBuffer = AudioSystem.getPrimaryOutputFrameCount(); int outputFramesPerBuffer = AudioSystem.getPrimaryOutputFrameCount(); return outputFramesPerBuffer > 0 ? Integer.toString(outputFramesPerBuffer) : null; return outputFramesPerBuffer > 0 ? Integer.toString(outputFramesPerBuffer) : null; } else if (PROPERTY_SUPPORT_MIC_NEAR_ULTRASOUND.equals(key)) { return SystemProperties.get(SYSTEM_PROPERTY_MIC_NEAR_ULTRASOUND, DEFAULT_RESULT_FALSE_STRING); } else if (PROPERTY_SUPPORT_SPEAKER_NEAR_ULTRASOUND.equals(key)) { return SystemProperties.get(SYSTEM_PROPERTY_SPEAKER_NEAR_ULTRASOUND, DEFAULT_RESULT_FALSE_STRING); } else { } else { // null or unknown key // null or unknown key return null; return null; Loading