How to add volume steps and volume buttons on NavBar?


#1

Regular 16 steps volume adjustment is not enough for smooth adjustment. In Android 4.4 I did 60 steps on /frameworks/base/media/java/android/media/AudioService.java file for smooth adjustment of the encoder. But android 6 and 7 does not has this file (AudioService.java). It has file AudioSystem.java only and in it set to the default volume.

public static int[] DEFAULT_STREAM_VOLUME = new int[] {
4, // STREAM_VOICE_CALL
7, // STREAM_SYSTEM
5, // STREAM_RING
11, // STREAM_MUSIC
6, // STREAM_ALARM
5, // STREAM_NOTIFICATION
7, // STREAM_BLUETOOTH_SCO
7, // STREAM_SYSTEM_ENFORCED
11, // STREAM_DTMF
11 // STREAM_TTS
};

How to add volume steps on android Nougat?


#2

You can try to modify the file frameworks/base/services/core/java/com/android/server/audio/AudioService.java

diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/j
index 836670a..6a2e3e0 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
   /** Maximum volume index values for audio streams */
    private static int[] MAX_STREAM_VOLUME = new int[] {
        5,  // STREAM_VOICE_CALL
        7,  // STREAM_SYSTEM
        7,  // STREAM_RING
-       15, // STREAM_MUSIC
+       60, // STREAM_MUSIC
        7,  // STREAM_ALARM
        7,  // STREAM_NOTIFICATION
        15, // STREAM_BLUETOOTH_SCO
        7,  // STREAM_SYSTEM_ENFORCED
        15, // STREAM_DTMF
        15  // STREAM_TTS
    };




#3

I don’t see it :smile: Thank you!


#4

Please tell, How to add volume buttons on NavBar?

Thank you!


#5

You can refer to Volume_button_patch
It is only for reference, can’t apply this patch directly.
Have a try. Thanks
Notice: Need to add ro.khadas.systembar.voiceicon=true into file build.prop