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

[GUIDE] Unlink System and Ringer volumes on Jelly Bean

$
0
0
Having updated to Jelly Bean (CM10) and finding, to my dismay, the inflexibility that Google has introduced by linking System and Ringer volumes, I decided to do something about it. Hours of searching later....yielded no results except for others with similar gripes. :confused:

To be sure, this guide is not about unlinking Ringer and Notification volumes; CM10 already has an option for that. Not too sure about other AOSP-based ROMs or OEM skinned favours of Jelly Bean. I can only report my own experiences.

WHY?
Say for instance, you want your ringtone to be suitably loud...without your keypress/keyboard feedback sound/camera shutter/Google Now bleeps and bloops being equally loud. This is my use case, at least.

HOW
Enough storytime, let's get down to business:

You need:
  • framework.jar from deodexed ROM
  • some form of archiving software to extract classes.dex from framework.jar
  • smali/baksmali tool to disassemble classes.dex
  • notepad software to make edits (I prefer Notepad++)

You also need read-write access to /system, i.e. the ability push/pull files from /system

Steps:
  1. pull /system/framework/framework.jar from your ROM
  2. extract classes.dex from framework.jar using archiving software (e.g. 7zip, winrar, windows explorer)
  3. run the baksmali tool on classes.dex (details can be found using a google search)
  4. find and open /android/media/AudioService.smali from the disassembled classes.dex
  5. search for STREAM_VOLUME_ALIAS
  6. above that line, you should see something like, "fill-array-data.... array_xxx", where xxx refers to the array that is being called
  7. search for "array_xxx", you should find a block of "0x0t 0x0t 0x0t 0x0t" etc.
  8. Notice how this is similar to the increased audio steps mod (the relevant array is nearby); this mod works just fine with it.
  9. See the code example for the line that you want to change
  10. save AudioService.smali
  11. reassemble classes.dex using smali
  12. replace classes.dex in framework.jar with your modified version
  13. push the modified framework.jar to /system/framework/ or otherwise copy & replace it there (you may have to do this in recovery or else risk forcing a reboot)
  14. set permissions (rw-r--r-- or 644)
  15. reboot / wipe dalvik cache

Search for STREAM_VOLUME_ALIAS:
Code:

    .line 240
    const/16 v0, 0xa

    new-array v0, v0, [I

    fill-array-data v0, :array_2ec

    iput-object v0, p0, Landroid/media/AudioService;->STREAM_VOLUME_ALIAS:[I

Search for array_xxx (above, it is 2ec); comments added for clarity:
Code:

    .line 240
    :array_2ec
    .array-data 0x4
        0x0t 0x0t 0x0t 0x0t                //Voice Call
      0x2t 0x0t 0x0t 0x0t                //System
        0x2t 0x0t 0x0t 0x0t                //Ringer
        0x3t 0x0t 0x0t 0x0t                //Media
        0x4t 0x0t 0x0t 0x0t                //Alarm
        0x2t 0x0t 0x0t 0x0t                //Notification
        0x6t 0x0t 0x0t 0x0t                //Bluetooth
      0x2t 0x0t 0x0t 0x0t                //System Enforced
        0x2t 0x0t 0x0t 0x0t                //DTMF
        0x3t 0x0t 0x0t 0x0t                //TTS
    .end array-data

Change the value of 0x2t for System and System Enforced to 0x1t:
Code:

    .array-data 0x4
        0x0t 0x0t 0x0t 0x0t                //Voice Call
      0x1t 0x0t 0x0t 0x0t                //System
        0x2t 0x0t 0x0t 0x0t                //Ringer
        0x3t 0x0t 0x0t 0x0t                //Media
        0x4t 0x0t 0x0t 0x0t                //Alarm
        0x2t 0x0t 0x0t 0x0t                //Notification
        0x6t 0x0t 0x0t 0x0t                //Bluetooth
        0x1t 0x0t 0x0t 0x0t                //System Enforced
        0x2t 0x0t 0x0t 0x0t                //DTMF
        0x3t 0x0t 0x0t 0x0t                //TTS
    .end array-data

Remarks
So far I've only tested this on my HTC OneXL running JellyBam-121412-nightly (CM10-based, with AOKP rom control and PA). However, since it is a framework.jar edit, it should be applicable to most Android phones. Ice Cream Sandwich phones did not have this problem (to the best of my knowledge). Please test and report if you do!

Only attempt if you've read this whole post and understand the steps. This will be done at your own risk, I am not responsible for and damages/bricking that is induced by your step through of this process or the edits themselves. I haven't experienced any issues at least.

I can post pictures of the process or a demonstration of it working if necessary, and when I have enough posts. (but I have exams currently..)
If any clarification is needed, just ask. (but again, I should be studying..)

Viewing all articles
Browse latest Browse all 3614

Trending Articles



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