其他分享
首页 > 其他分享> > android调节系统音量之设置默认音量、最大音量和最小音量

android调节系统音量之设置默认音量、最大音量和最小音量

作者:互联网

android调节系统音量之设置默认音量、最大音量和最小音量

有时候我们想改变系统的默认音量等音量属性,这时可以修改以下对应内容实现:

位置  frameworks/base/media/java/android/media/AudioSystem.java

/** @hide */
    public static int[] DEFAULT_STREAM_VOLUME = new int[] {
        4,  // STREAM_VOICE_CALL
        7,  // STREAM_SYSTEM
        5,  // STREAM_RING
        5, // STREAM_MUSIC
        6,  // STREAM_ALARM
        5,  // STREAM_NOTIFICATION
        7,  // STREAM_BLUETOOTH_SCO
        7,  // STREAM_SYSTEM_ENFORCED
        5, // STREAM_DTMF
        5, // STREAM_TTS
        5, // STREAM_ACCESSIBILITY
        5, // STREAM_ASSISTANT
    };
位置 frameworks/base/services/core/java/com/android/server/audio/AudioService.java

/** Maximum volume index values for audio streams */
    protected static int[] MAX_STREAM_VOLUME = new int[] {
        5,  // STREAM_VOICE_CALL
        7,  // STREAM_SYSTEM
        7,  // STREAM_RING
        15, // STREAM_MUSIC
        7,  // STREAM_ALARM
        7,  // STREAM_NOTIFICATION
        15, // STREAM_BLUETOOTH_SCO
        7,  // STREAM_SYSTEM_ENFORCED
        15, // STREAM_DTMF
        15, // STREAM_TTS
        15, // STREAM_ACCESSIBILITY
        15  // STREAM_ASSISTANT
    };
位置 frameworks/base/services/core/java/com/android/server/audio/AudioService.java

/** Minimum volume index values for audio streams */
    protected static int[] MIN_STREAM_VOLUME = new int[] {
        1,  // STREAM_VOICE_CALL
        0,  // STREAM_SYSTEM
        0,  // STREAM_RING
        0,  // STREAM_MUSIC
        1,  // STREAM_ALARM
        0,  // STREAM_NOTIFICATION
        0,  // STREAM_BLUETOOTH_SCO
        0,  // STREAM_SYSTEM_ENFORCED
        0,  // STREAM_DTMF
        0,  // STREAM_TTS
        1,  // STREAM_ACCESSIBILITY
        0   // STREAM_ASSISTANT
    };

参考:https://blog.csdn.net/chaojiangluo/article/details/80023154?spm=1001.2014.3001.5501

标签:java,STREAM,int,SYSTEM,默认,音量,15,android
来源: https://blog.csdn.net/jppipai/article/details/121162963