Quantcast
Channel: xda-developers - Android Software and Hacking General [Developers Only]
Viewing all articles
Browse latest Browse all 3614

[Q] Question to devs: any clue how to adjust volume steps in 5.x?

$
0
0
Ok, I thought I'd at least try out CM12 for a bit, though I may not stay until it goes more stable with monthlies and such. Anyway, one thing that immediately is bothering me is I can no longer fix the crappy volume controls. It was always a bit of a messy hack (at least without Xposed Modules) but the framework has changed significantly it seems. Basically the old trick with 4.x was to "Baksmali" the framework.jar, open the AudioService.smali file in ./framework/android/media/, search for 0xft (the default values for most of the volumes which luckily nothing else uses or searching would be a lot harder) and then replace the pre-defined numbers of steps with new ones (my own personal preference being 14,14,14,64,7,7,14,7,f,f but not everyone would like that 64 in particular. It needed to be a heck of a lot more than the default f though!) After that one simply used "Smali" to repack the modified data, put the classes.dex in the framework.jar and put it back in the system. (Which, sadly, counts as an "upgrade" forcing it to reoptimize everything -- I usually tried to do this in advance during flashing.) This is an ugly hack, but no one will fix Android to let users use better volume controls, so it's this or disable ART and use Xposed modules (which basically just do this on the fly anyway. Still a messy hack IMO.)

Anyway, with 5.0 there is no longer even a ./framework/android/media/ at all. No AudioService.smali anywhere. I'm guessing the number of volume steps has shifted to some other portion of the system? If it helps, as far as searching goes, here are the default values from at least as far back as CM7 up to CM11:
Code:

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

So it would look something like this in Smali form:
Code:

        0x5t 0x0t 0x0t 0x0t
        0x7t 0x0t 0x0t 0x0t
        0x7t 0x0t 0x0t 0x0t
        0xft 0x0t 0x0t 0x0t
        0x7t 0x0t 0x0t 0x0t
        0x7t 0x0t 0x0t 0x0t
        0xft 0x0t 0x0t 0x0t
        0x7t 0x0t 0x0t 0x0t
        0xft 0x0t 0x0t 0x0t
        0xft 0x0t 0x0t 0x0t

I'm no developer myself I will admit, so I'm hoping these values have simply shifted to a new location. If it's going to require more fundamental modifications I think I'm basically going to have to give up hope on fixing the volume anymore with 5.x.

Viewing all articles
Browse latest Browse all 3614

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>