[GUIDE | TUT | HACK] Remove Android 4.2.x safe volume message

Search This thread

elesbb

Senior Member
Jun 20, 2010
7,883
5,324
Hey XDA community! :)

I received the Android 4.2.1 update for my Asus Transformer TF300T tablet and after using it for awhile i noticed when headphones are plugged into the device, and you increase the volume past (10 for my tablet) you will get a message saying that it is unsafe to use headphones at high volumes. Well I'm sorry. If people really need that message because they do not have the common sense to figure it out, well i have no comment.

zarepudu.jpg



So since this message is awfully annoying, i decided to go forth and remove it.

After hours of Google not helping, only finding other people on Nexus 7 devices and the like, seriously annoyed with it as i was. I knew i had to write this guide.

So here we go! :)

Firstly, there are two methods i discovered to remove this. First method, and prolly the easiest for people, is to:

1. Grab your framework-res.apk file from /system/framework/framework-res.apk using either adb or root explorer on your device
2. Using APKTool decompile framework-res.apk
3. Once decompiled directory.
4. Navigate to the file framework-res.apk/res/values/integers.xml YOU MUST USE NOTEPAD++ DO NOT USE MS NOTEPAD (Linux users need not worry)
5. Find the following "<integer name="config_safe_media_volume_index">10</integer>"
6. Change the "10" to a "20"
7. Save the changes to the xml file
8. Recompile the framework-res.apk with APKTool
9. Using adb or a flashable zip, put the framework-res.apk back to your device by:

adb remount

adb push <path to newly compiled apk> /system/framework/framework-res.apk

adb shell chmod 644 /system/framework/framework-res.apk

10. Reboot device and test :)






The second method is a little more tricky as it deals with smali code. Some people have no idea what smali code is but for those who do, this is the mod i personally use.

1. Grab your framework.jar file from /system/framework/framework.jar directory
2. Using either apktool, or baksmali, decompile framework.jar
3. Once decompiled, find the file framework.jar/smali/android/media/AudioService$AudioHandler.smali
4. YOU MUST USE NOTEPAD++ AGAIN! (Linux users again need not worry :) )
5. Once opened, find the following.

Code:
:pswitch_data_0
    .packed-switch 0x0
        :pswitch_0
        :pswitch_2
        :pswitch_3
        :pswitch_5
        :pswitch_6
        :pswitch_7
        :pswitch_9
        :pswitch_a
        :pswitch_8
        :pswitch_b
        :pswitch_c
        :pswitch_f
        :pswitch_d
        :pswitch_e
        :pswitch_1
        :pswitch_4
        :pswitch_12
        :pswitch_13
        :pswitch_14
        :pswitch_15
        :pswitch_b
        :pswitch_10
        :pswitch_11
        :pswitch_16
        :pswitch_17
        :pswitch_18
        :pswitch_19
        :pswitch_19
    .end packed-switch


6. at the bottom, you will see
Code:
:pswitch_19
(hoping this is the same for all devices) and comment out
Code:
:pswitch_19
(i have two i dont know why, if you also have two, comment both out)

Should look like this:

Code:
:pswitch_data_0
    .packed-switch 0x0
        :pswitch_0
        :pswitch_2
        :pswitch_3
        :pswitch_5
        :pswitch_6
        :pswitch_7
        :pswitch_9
        :pswitch_a
        :pswitch_8
        :pswitch_b
        :pswitch_c
        :pswitch_f
        :pswitch_d
        :pswitch_e
        :pswitch_1
        :pswitch_4
        :pswitch_12
        :pswitch_13
        :pswitch_14
        :pswitch_15
        :pswitch_b
        :pswitch_10
        :pswitch_11
        :pswitch_16
        :pswitch_17
        :pswitch_18
     #   :pswitch_19
     #   :pswitch_19
    .end packed-switch

7. Once edited, save the file.
8. Using APKTool or smali, recompile framework.jar
9. Using adb or a flashable zip, push the file back to your device

adb remount

adb push <path to newly compiled framework.jar file> /system/framework/framework.jar

adb shell chmod 644 /system/framework/framework.

adb reboot recovery

10. Once in recovery, wipe dalvik cache and cache.

11. Reboot and test :)






I have a zip attached for those who wish to use a zip.

Just OPEN the zip using 7zip, you will see two folders (META-INF, system) open system folder, open framework folder, and place your newly compiled file in there. Put the zip to your device, and flash in recovery.


ROM devs, feel free to use this! Just give credit :) Thanks

Guys dont hesitate to hit that thanks button! Can even donate to me as well :) Thanks everyone!
 

Attachments

  • ZipFlasher.zip
    216.9 KB · Views: 549
Last edited:

hello_world.c

Senior Member
Jun 3, 2011
194
52
First method doesn't work

With the modified framework-res.apk per your instructions, the device hangs at the "X" animation. I push the original, everything works again.

This is how the process looks like:

>apktool d -f framework-res.apk tmp
I: Loading resource table...
I: Loaded.
I: Decoding AndroidManifest.xml with resources...
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Done.
I: Copying assets and libs...

Editing the xml file, extremely carefully with a hex editor, only changing the original value 7 to 20, then:

>apktool b tmp/ framework-res.apk
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
I: Building apk file...

When it didn't boot I compared the original and rebuilt apk, I noticed that the META-INF directory was missing, so I copied it over, into the .apk. Still no luck, device hangs at boot.

Nexus 4 with 4.2.2 stock, rooted, CWM.
 

elesbb

Senior Member
Jun 20, 2010
7,883
5,324
With the modified framework-res.apk per your instructions, the device hangs at the "X" animation. I push the original, everything works again.

This is how the process looks like:

>apktool d -f framework-res.apk tmp
I: Loading resource table...
I: Loaded.
I: Decoding AndroidManifest.xml with resources...
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Done.
I: Copying assets and libs...

Editing the xml file, extremely carefully with a hex editor, only changing the original value 7 to 20, then:

>apktool b tmp/ framework-res.apk
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
I: Building apk file...

When it didn't boot I compared the original and rebuilt apk, I noticed that the META-INF directory was missing, so I copied it over, into the .apk. Still no luck, device hangs at boot.

Nexus 4 with 4.2.2 stock, rooted, CWM.

I have this problem time to time. Its prolly a compressed resources.arsc file. Do this.

Take newly compiled apk.
Open with 7zip.
Copy the resources.arsc to desktop.
Open ORIGINAL (make a copy so you still have original) delete the resources.arsc file.
Go to your desktop.
Copy resources.arsc file to the ORIGINAL.

Then push to device. Should work.

Sent from my ASUS Transformer Pad TF300T using Tapatalk 2
 
  • Like
Reactions: hello_world.c

dwitherell

Retired Forum Moderator
May 2, 2011
4,061
9,253
Howdy - nice work on this :)

Any way you could share the smali code of what pswitch_19 points to? Might be handy for people trying to figure out what exactly it is that should be removed if things don't appear quite the same here so they comment out the appropriate switch. Thanks!
 

elesbb

Senior Member
Jun 20, 2010
7,883
5,324
Howdy - nice work on this :)

Any way you could share the smali code of what pswitch_19 points to? Might be handy for people trying to figure out what exactly it is that should be removed if things don't appear quite the same here so they comment out the appropriate switch. Thanks!

pswitch_19 points to the method that stops the volume from increasing as well as displaying that message. Its an $access1234523 number so its prolly different in each jar file. If people have issues i will be able to help them :)

They just need to post here :)
 

dwitherell

Retired Forum Moderator
May 2, 2011
4,061
9,253
pswitch_19 points to the method that stops the volume from increasing as well as displaying that message. Its an $access1234523 number so its prolly different in each jar file. If people have issues i will be able to help them :)

They just need to post here :)

Gotcha - and no worries. Depending on what is used to decompile sometimes those access$### calls have a commented out bit right above them telling you what that static access function is doing/what is being called - but you are right people should just post if they need help. Thanks again for this :)
 

elesbb

Senior Member
Jun 20, 2010
7,883
5,324
didnt work for me on my S4 with android 4.2.2

that is such a broad statement. if you want help youre gonna have to provide more info like which method you tried, is the ROM deodexed or odexed. etc etc

Sent from my ASUS Transformer Pad TF300T using Tapatalk 2
 

cabloomi

Senior Member
Feb 25, 2012
220
544
Iraq
---------- Post added at 12:51 PM ---------- Previous post was at 12:49 PM ----------

[/COLOR]
that is such a broad statement. if you want help youre gonna have to provide more info like which method you tried, is the ROM deodexed or odexed. etc etc

Sent from my ASUS Transformer Pad TF300T using Tapatalk 2

oh. so sorry. wasn't expecting a reply, im running deodexed and my files came up just like you said. i also had 2 ":pswitch_19" and i put the # as you did
compile with no problem. replaced the the classes.dex files to the original one. so what now..
i still get that annoying message. do you think it in the android policy jar. becouse it can unlock the phone to show the notification
@elesbb
 
Last edited:

elesbb

Senior Member
Jun 20, 2010
7,883
5,324
---------- Post added at 12:51 PM ---------- Previous post was at 12:49 PM ----------

[/COLOR]

oh. so sorry. wasn't expecting a reply, im running deodexed and my files came up just like you said. i also had 2 ":pswitch_19" and i put the # as you did
compile with no problem. replaced the the classes.dex files to the original one. so what now..
i still get that annoying message. do you think it in the android policy jar. becouse it can unlock the phone to show the notification
@elesbb

can you post the framework.jar please? And i always try to reply to my threads :)

Sent from my ASUS Transformer Pad TF300T using Tapatalk 2
 

svetievboris

Member
Oct 17, 2012
36
5
Hi Elesbb,
Thanks for this guide. Could you please tell me if flashing your .zip file would work on a stock unrooted ZTE grand x in?
If I have to root my phone first than that will be a little more work for me prior to even attempting your tutorials.

Thanks either way.

Sent from my Grand X In using Tapatalk 2
 

elesbb

Senior Member
Jun 20, 2010
7,883
5,324
Hi Elesbb,
Thanks for this guide. Could you please tell me if flashing your .zip file would work on a stock unrooted ZTE grand x in?
If I have to root my phone first than that will be a little more work for me prior to even attempting your tutorials.

Thanks either way.

Sent from my Grand X In using Tapatalk 2

The zip in the OP has nothing in it. I posted it so after people follow my guide, they are able to download that zip, place their new file inside it, then flash.

But yes you have to be rooted. Or at least a custom recovery. Any Stock Recovery will reject the zip.

Sent from my ASUS Transformer Pad TF300T using Tapatalk 2
 

svetievboris

Member
Oct 17, 2012
36
5
The zip in the OP has nothing in it. I posted it so after people follow my guide, they are able to download that zip, place their new file inside it, then flash.

But yes you have to be rooted. Or at least a custom recovery. Any Stock Recovery will reject the zip.

Sent from my ASUS Transformer Pad TF300T using Tapatalk 2

Thanks for the clarification, I wouldn't have known the zip was empty. I'm still noobish when it comes to Android.

Sent from my Grand X In using Tapatalk 2
 

elesbb

Senior Member
Jun 20, 2010
7,883
5,324
Didn't seem to work on my i9500

I'm also having issues turning my volume all the way up now, is there a way to reverse this flash?

Youre supposed to make a backup before you do anything. And it is working for whatever phone that guy had. I'd have to see your framework.jar file.

Sent from my ASUS Transformer Pad TF300T using Tapatalk 2
 

Top Liked Posts

  • There are no posts matching your filters.
  • 25
    Hey XDA community! :)

    I received the Android 4.2.1 update for my Asus Transformer TF300T tablet and after using it for awhile i noticed when headphones are plugged into the device, and you increase the volume past (10 for my tablet) you will get a message saying that it is unsafe to use headphones at high volumes. Well I'm sorry. If people really need that message because they do not have the common sense to figure it out, well i have no comment.

    zarepudu.jpg



    So since this message is awfully annoying, i decided to go forth and remove it.

    After hours of Google not helping, only finding other people on Nexus 7 devices and the like, seriously annoyed with it as i was. I knew i had to write this guide.

    So here we go! :)

    Firstly, there are two methods i discovered to remove this. First method, and prolly the easiest for people, is to:

    1. Grab your framework-res.apk file from /system/framework/framework-res.apk using either adb or root explorer on your device
    2. Using APKTool decompile framework-res.apk
    3. Once decompiled directory.
    4. Navigate to the file framework-res.apk/res/values/integers.xml YOU MUST USE NOTEPAD++ DO NOT USE MS NOTEPAD (Linux users need not worry)
    5. Find the following "<integer name="config_safe_media_volume_index">10</integer>"
    6. Change the "10" to a "20"
    7. Save the changes to the xml file
    8. Recompile the framework-res.apk with APKTool
    9. Using adb or a flashable zip, put the framework-res.apk back to your device by:

    adb remount

    adb push <path to newly compiled apk> /system/framework/framework-res.apk

    adb shell chmod 644 /system/framework/framework-res.apk

    10. Reboot device and test :)






    The second method is a little more tricky as it deals with smali code. Some people have no idea what smali code is but for those who do, this is the mod i personally use.

    1. Grab your framework.jar file from /system/framework/framework.jar directory
    2. Using either apktool, or baksmali, decompile framework.jar
    3. Once decompiled, find the file framework.jar/smali/android/media/AudioService$AudioHandler.smali
    4. YOU MUST USE NOTEPAD++ AGAIN! (Linux users again need not worry :) )
    5. Once opened, find the following.

    Code:
    :pswitch_data_0
        .packed-switch 0x0
            :pswitch_0
            :pswitch_2
            :pswitch_3
            :pswitch_5
            :pswitch_6
            :pswitch_7
            :pswitch_9
            :pswitch_a
            :pswitch_8
            :pswitch_b
            :pswitch_c
            :pswitch_f
            :pswitch_d
            :pswitch_e
            :pswitch_1
            :pswitch_4
            :pswitch_12
            :pswitch_13
            :pswitch_14
            :pswitch_15
            :pswitch_b
            :pswitch_10
            :pswitch_11
            :pswitch_16
            :pswitch_17
            :pswitch_18
            :pswitch_19
            :pswitch_19
        .end packed-switch


    6. at the bottom, you will see
    Code:
    :pswitch_19
    (hoping this is the same for all devices) and comment out
    Code:
    :pswitch_19
    (i have two i dont know why, if you also have two, comment both out)

    Should look like this:

    Code:
    :pswitch_data_0
        .packed-switch 0x0
            :pswitch_0
            :pswitch_2
            :pswitch_3
            :pswitch_5
            :pswitch_6
            :pswitch_7
            :pswitch_9
            :pswitch_a
            :pswitch_8
            :pswitch_b
            :pswitch_c
            :pswitch_f
            :pswitch_d
            :pswitch_e
            :pswitch_1
            :pswitch_4
            :pswitch_12
            :pswitch_13
            :pswitch_14
            :pswitch_15
            :pswitch_b
            :pswitch_10
            :pswitch_11
            :pswitch_16
            :pswitch_17
            :pswitch_18
         #   :pswitch_19
         #   :pswitch_19
        .end packed-switch

    7. Once edited, save the file.
    8. Using APKTool or smali, recompile framework.jar
    9. Using adb or a flashable zip, push the file back to your device

    adb remount

    adb push <path to newly compiled framework.jar file> /system/framework/framework.jar

    adb shell chmod 644 /system/framework/framework.

    adb reboot recovery

    10. Once in recovery, wipe dalvik cache and cache.

    11. Reboot and test :)






    I have a zip attached for those who wish to use a zip.

    Just OPEN the zip using 7zip, you will see two folders (META-INF, system) open system folder, open framework folder, and place your newly compiled file in there. Put the zip to your device, and flash in recovery.


    ROM devs, feel free to use this! Just give credit :) Thanks

    Guys dont hesitate to hit that thanks button! Can even donate to me as well :) Thanks everyone!
    3
    @elesbb

    Just wanted to share some feedback on this. This is what I found on the Sprint GS4. It may or may not be the same on other devices. When I made the smali changes you pointed out it worked but it removed the physical vibration when you set the phone to vibrate. Normally the phone would vibrate when selecting vibrate mode from quick settings or when turning the ringer volume all the way down to let you know it's in vibrate mode. After this mod it didn't vibrate when making the choice but still vibrated on calls and stuff. So here is what I did to resolve it and still get rid of the warning. Instead of commenting out the section that you suggested as below.

    Code:
    :pswitch_data_0
        .packed-switch 0x0
            :pswitch_0
            :pswitch_2
            :pswitch_3
            :pswitch_5
            :pswitch_6
            :pswitch_7
            :pswitch_9
            :pswitch_a
            :pswitch_8
            :pswitch_b
            :pswitch_c
            :pswitch_f
            :pswitch_d
            :pswitch_e
            :pswitch_1
            :pswitch_4
            :pswitch_12
            :pswitch_13
            :pswitch_14
            :pswitch_15
            :pswitch_b
            :pswitch_10
            :pswitch_11
            :pswitch_16
            :pswitch_17
            :pswitch_18
         #   :pswitch_19
         #   :pswitch_19
        .end packed-switch

    go to the pswitch_19 section. Look for something like the below code. This was taken from the S4.
    Code:
    Change From
    2123	:goto_3a5
    2124 	#calls: Landroid/media/AudioService;->onConfigureSafeVolume(Z)V
    2125 	invoke-static {v2, v1}, Landroid/media/AudioService;->access$8100(Landroid/media/AudioService;Z)V

    Code:
    Change To
    2123	:goto_3a5
    2124 	#calls: Landroid/media/AudioService;->onConfigureSafeVolume(Z)V
    2125 	#invoke-static {v2, v1}, Landroid/media/AudioService;->access$8100(Landroid/media/AudioService;Z)V

    Hope that helps someone out there. And thanks again for the work. I really appreciate it because I hated that warning. :good:
    2
    ok here it is
    http://d-h.st/Cbp
    this is unedited just so you can do your magic from scratch @elesbb

    Test this please? I dont have the S4 so i cannot try it.

    Its flashable so just flash in recovery.
    1
    With the modified framework-res.apk per your instructions, the device hangs at the "X" animation. I push the original, everything works again.

    This is how the process looks like:

    >apktool d -f framework-res.apk tmp
    I: Loading resource table...
    I: Loaded.
    I: Decoding AndroidManifest.xml with resources...
    I: Regular manifest package...
    I: Decoding file-resources...
    I: Decoding values */* XMLs...
    I: Done.
    I: Copying assets and libs...

    Editing the xml file, extremely carefully with a hex editor, only changing the original value 7 to 20, then:

    >apktool b tmp/ framework-res.apk
    W: Could not find sources
    I: Checking whether resources has changed...
    I: Building resources...
    I: Building apk file...

    When it didn't boot I compared the original and rebuilt apk, I noticed that the META-INF directory was missing, so I copied it over, into the .apk. Still no luck, device hangs at boot.

    Nexus 4 with 4.2.2 stock, rooted, CWM.

    I have this problem time to time. Its prolly a compressed resources.arsc file. Do this.

    Take newly compiled apk.
    Open with 7zip.
    Copy the resources.arsc to desktop.
    Open ORIGINAL (make a copy so you still have original) delete the resources.arsc file.
    Go to your desktop.
    Copy resources.arsc file to the ORIGINAL.

    Then push to device. Should work.

    Sent from my ASUS Transformer Pad TF300T using Tapatalk 2
    1
    Success:good:

    Problems was an old version of 7-Zip that didn't let me open the jar file to drag and drop the classes.dex file. Delete old 7-Zip and installed newest version and all is working.:good:

    Thanks for your help and patients.

    Woo! Glad you got it solved! :D