1
votes

I'm making custom AOSP Marshmallow image and i would like to set default volume levels higher by default.

I found from Chinese forum that under frameworks/base/media/java/android/media/AudioSystem.java can be found

/**
* M: modify the default stream volume @{
*/
public static int[] DEFAULT_STREAM_VOLUME = new int[] {
    4,  // STREAM_VOICE_CALL
    15,  // STREAM_SYSTEM
    8,  // STREAM_RING
    8, // STREAM_MUSIC
    8,  // STREAM_ALARM
    8,  // STREAM_NOTIFICATION
    7,  // STREAM_BLUETOOTH_SCO
    15,  // STREAM_SYSTEM_ENFORCED
    11, // STREAM_DTMF
    11  // STREAM_TTS
};
/** @} */

and under frameworks/base/services/core/java/com/android/server/audio/AudioService.java is then minimum and maximum volume values.

/** Maximum volume index values for audio streams */
/// M: Modify the max stream volume @{
private 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
};

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

I have changed STREAM_MUSIC, STREAM_ALARM and STREAM_NOTIFICATION from DEFAULT_STREAM_VOLUME table from 8 to 13 but it doesn't seem to have any effect when building and making images.

Any idea what might be the problem or correct location to change default volume levels?

1

1 Answers

0
votes

Did you do a factory reset after flashing?

The default volume only applies to the first boot. Then, the volume level is persisted for the next boots.