android 所有音量默认最大

AndroidQ:

ProjectOption.ini

sys.audio.config.volume_voice = 15
sys.audio.config.volume_system = 15
sys.audio.config.volume_ring = 15
sys.audio.config.volume_music = 15
sys.audio.config.volume_alarm = 15
sys.audio.config.volume_notification = 15

AndroidR:

AndroidS:

AndroidT:

/frameworks/base/services/core/java/com/android/server/audio/AudioService.java

    protected static int[] MAX_STREAM_VOLUME = new int[] {
        7, // STREAM_VOICE_CALL
        15,  // STREAM_SYSTEM
        15,  // STREAM_RING
        15, // STREAM_MUSIC
        15,  // STREAM_ALARM
        15,  // STREAM_NOTIFICATION
        15, // STREAM_BLUETOOTH_SCO
        15,  // STREAM_SYSTEM_ENFORCED
        15, // STREAM_DTMF
        15, // STREAM_TTS
        15, // STREAM_ACCESSIBILITY
        15  // STREAM_ASSISTANT
    };

    /** 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
    };

 int maxCallVolume = SystemProperties.getInt("ro.config.vc_call_vol_steps", -1);
        if (maxCallVolume != -1) {
            MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL] = maxCallVolume;
        }

        int defaultCallVolume = SystemProperties.getInt("ro.config.vc_call_vol_default", -1);
        if (defaultCallVolume != -1 &&
                defaultCallVolume <= MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL] &&
                defaultCallVolume >= MIN_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]) {
            AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL] = defaultCallVolume;
        } else {
            AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL] = 7;
                   // (MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL] * 3) / 4;
        }

        int maxMusicVolume = SystemProperties.getInt("ro.config.media_vol_steps", -1);
        if (maxMusicVolume != -1) {
            MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] = maxMusicVolume;
        }

        int defaultMusicVolume = SystemProperties.getInt("ro.config.media_vol_default", -1);
        if (defaultMusicVolume != -1 &&
                defaultMusicVolume <= MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] &&
                defaultMusicVolume >= MIN_STREAM_VOLUME[AudioSystem.STREAM_MUSIC]) {
            AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] = defaultMusicVolume;
        } else {
            if (isPlatformTelevision()) {
                AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] =
                        MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] / 4;
            } else {
                AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] = 15;
                       // MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] / 3;
            }
        }

        int maxAlarmVolume = SystemProperties.getInt("ro.config.alarm_vol_steps", -1);
        if (maxAlarmVolume != -1) {
            MAX_STREAM_VOLUME[AudioSystem.STREAM_ALARM] = maxAlarmVolume;
        }

        int defaultAlarmVolume = SystemProperties.getInt("ro.config.alarm_vol_default", -1);
        if (defaultAlarmVolume != -1 &&
                defaultAlarmVolume <= MAX_STREAM_VOLUME[AudioSystem.STREAM_ALARM]) {
            AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_ALARM] = defaultAlarmVolume;
        } else {
            // Default is 6 out of 7 (default maximum), so scale accordingly.
            AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_ALARM] = 15;
                       // 6 * MAX_STREAM_VOLUME[AudioSystem.STREAM_ALARM] / 7;
        }

        int maxSystemVolume = SystemProperties.getInt("ro.config.system_vol_steps", -1);
        if (maxSystemVolume != -1) {
            MAX_STREAM_VOLUME[AudioSystem.STREAM_SYSTEM] = maxSystemVolume;
        }

        int defaultSystemVolume = SystemProperties.getInt("ro.config.system_vol_default", -1);
        if (defaultSystemVolume != -1 &&
                defaultSystemVolume <= MAX_STREAM_VOLUME[AudioSystem.STREAM_SYSTEM]) {
            AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_SYSTEM] = defaultSystemVolume;
        } else {
            // Default is to use maximum.
            AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_SYSTEM] = 15;
                        //MAX_STREAM_VOLUME[AudioSystem.STREAM_SYSTEM];
        }

        createAudioSystemThread();

        AudioSystem.setErrorCallback(mAudioSystemCallback);

        updateAudioHalPids();
 

相关推荐

  1. android 所有音量默认

    2024-04-03 11:24:06       36 阅读
  2. Android 11.0 所有音量默认音量

    2024-04-03 11:24:06       52 阅读
  3. Android 设置音量默认

    2024-04-03 11:24:06       59 阅读
  4. Android动态设置系统音量

    2024-04-03 11:24:06       29 阅读
  5. Android Audio实战——音量默认值修改(一)

    2024-04-03 11:24:06       29 阅读
  6. Android 10 Android音量调节

    2024-04-03 11:24:06       47 阅读
  7. Android 单一音量控制

    2024-04-03 11:24:06       35 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-03 11:24:06       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-03 11:24:06       106 阅读
  3. 在Django里面运行非项目文件

    2024-04-03 11:24:06       87 阅读
  4. Python语言-面向对象

    2024-04-03 11:24:06       96 阅读

热门阅读

  1. 小程序页面滚动?

    2024-04-03 11:24:06       31 阅读
  2. Flink总结

    2024-04-03 11:24:06       41 阅读
  3. 【m122】webrtc的比较

    2024-04-03 11:24:06       35 阅读
  4. IDEA 宝贝插件

    2024-04-03 11:24:06       38 阅读
  5. IntelliJ IDEA - 快捷键 Win & Mac 对照表

    2024-04-03 11:24:06       37 阅读
  6. openshift和k8s的差别

    2024-04-03 11:24:06       34 阅读
  7. RuoYi单体版Table行内编辑

    2024-04-03 11:24:06       32 阅读
  8. 研究应用推广开源项目——提高软件技术的途径

    2024-04-03 11:24:06       37 阅读