account arrowhead-down arrowhead-up mobile-menu search sm-bold-x x-skinny-rounded x-skinny arrowhead-right social-facebook social-googleplus social-instagram social-linkedin social-pinterest social-qzone social-renren social-tencent social-twitter social-vkontakt social-weibo social-youku social-youtube

Please help us improve our website

Take our customer survey to evaluate your visit.

It should only take a few minutes to answer five quick questions. Just click the Launch survey button at the end of your visit to begin.

cancel
Showing results for 
Search instead for 
Did you mean: 
Welcome to the Open Devices community!

This is where we discuss open source and development related questions on our Open Devices initiative.

increase number of volume steps

Highlighted
Inhabitant
Message 1 of 1
1,417 Views
Message 1 of 1

increase number of volume steps

tags: increase number of volume steps; add volume steps; more volume change steps; finer volume change

 

For those interested, to increase number of volume change steps you can modify a bit the following files:

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

    search for the following section of the code and change numbers to whatever you like (I changed everything to 30 which is fine enough for me)

 

    private 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
    };  

 

 

you should probably change the following as well, as this takes care of communication with apps & widgets, I think (I'm not sure, it's only what I understood from short googling)

frameworks/base/media/java/android/media/RemoteControlClient.java

    where you need to look for a variable DEFAULT_PLAYBACK_VOLUME and change it to the same number as to what you set the line

        15, // STREAM_MUSIC

so this:

    // hard-coded to the same number of steps as AudioService.MAX_STREAM_VOLUME[STREAM_MUSIC]
    public final static int DEFAULT_PLAYBACK_VOLUME = 15;

 would become this in my case:

 

    // hard-coded to the same number of steps as AudioService.MAX_STREAM_VOLUME[STREAM_MUSIC]
    public final static int DEFAULT_PLAYBACK_VOLUME = 30;

 

There may be some compatibility issues from what I understood, but having alarm quite enough to wake up only me and not people in the other room as well is much more important tp me Winking Face