欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

android7.1 修改系统默认音量

程序员文章站 2022-03-25 12:48:43
说明 系统默认的音量太大,需要将默认音量调小一点。实现 主要是修改系统、铃声、媒体、闹钟的默认音量大小。zhoujy@TP:~/data/android/sc826_cn_01_00/msm_8953_git/frameworks$ git show 58a8d5266736e328aa7abbddb8944c4c541ee2accommit 58a8d5266736e328aa7abbddb8944c4c541ee2acAuthor: zhoujinyan

说明

  系统默认的音量太大,需要将默认音量调小一点。

实现

  主要是修改系统、铃声、媒体、闹钟的默认音量大小。

zhoujy@TP:~/data/android/sc826_cn_01_00/msm_8953_git/frameworks$ git show 58a8d5266736e328aa7abbddb8944c4c541ee2ac
commit 58a8d5266736e328aa7abbddb8944c4c541ee2ac
Author: zhoujinyan <zhoujy@ibumobile.com>
Date:   Sun Jun 28 19:45:16 2020 +0800

    [frameworks]修改系统默认音量

diff --git a/frameworks/base/media/java/android/media/AudioSystem.java b/frameworks/base/media/java/android/media/AudioSystem.java
index e08c290..a930b80 100644
--- a/frameworks/base/media/java/android/media/AudioSystem.java
+++ b/frameworks/base/media/java/android/media/AudioSystem.java
@@ -770,10 +770,10 @@ public class AudioSystem
 
     public static int[] DEFAULT_STREAM_VOLUME = new int[] {
         4,  // STREAM_VOICE_CALL
-        7,  // STREAM_SYSTEM
-        5,  // STREAM_RING
-        11, // STREAM_MUSIC
-        6,  // STREAM_ALARM
+        4,  // STREAM_SYSTEM
+        3,  // STREAM_RING
+        5, // STREAM_MUSIC
+        3,  // STREAM_ALARM
         5,  // STREAM_NOTIFICATION
         7,  // STREAM_BLUETOOTH_SCO
         7,  // STREAM_SYSTEM_ENFORCED

修改电话声音最大值,进度条就可以调节多个

diff --git a/frameworks/base/services/core/java/com/android/server/audio/AudioService.java b/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
index cf7a9ea..1fdc05f 100644
--- a/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
+++ b/frameworks/base/services/core/java/com/android/server/audio/AudioService.java
@@ -282,7 +282,7 @@ public class AudioService extends IAudioService.Stub {
 
    /** Maximum volume index values for audio streams */
     private static int[] MAX_STREAM_VOLUME = new int[] {
-        5,  // STREAM_VOICE_CALL
+        8,  // STREAM_VOICE_CALL
         7,  // STREAM_SYSTEM
         7,  // STREAM_RING
         15, // STREAM_MUSIC

 

本文地址:https://blog.csdn.net/zjy764219923/article/details/109637424