In custom Android, how to override STREAM_RING as the default AudioService reacting to volume buttons

Google docs state that the app is not playing anything, pressing the volume keys will adjust the ringer volume. see http://developer.android.com/training/managing-audio/volume-playback.html#HardwareVolumeKeys

I'm sure it is possible to change this default behavior other than STREAM_RING (say STREAM_MUSIC) by creating a custom assembly from source so that if the user is in, say Launcher, and presses the volume button, the STREAM_MUSIC volume will change. (This is required because the device does not have a phone, so the ringer volume does not work).

I looked at the Launcher code but it doesn't show (at least not what I see) that the volume buttons are routed / consumed via the AudioManager in STREAM_RING. Also, when the VOLUME buttons change STREAM_RING in Settings, it leads me further to believe that there is something "up the chain" or "down the stack in Framework or Android Runtime applications".

Is there a "higher" process or system process running that handles sending VOLUME to AudioManager with STREAM_RING as a pipe? Or is there something in the AudioManager that can be set to handle VOLUME changes in STREAM_MUSIC (this seems unlikely from the source as it only seems to handle STREAM in the context of preferred STREAM applications.

The source I'm using is Ice Cream Sandwich 4.0.3.

+3


source to share


1 answer


The solution seems to be setting the "config_voice_capable" value to false. This value is found in frameworks / base / core / res / res / values ​​/config.xml

I used the overlay to set "config_voice_capable" to false and then built the rum.



After the device boots up, the volume controls no longer use the RINGER stream by default. I haven't been able to find any documentation on this regarding the differences between tables and phone supported devices, but the solution works.

+2


source







All Articles