Increase the Number of Volume Steps in Android

By | January 9, 2012

This tutorial will show you how to increase the number of steps of volume control in Android.  The default number of steps (for music/media volume) is 15, which is fine for most people.  However, I have a pair of headphones which are very loud even at the lowest volume setting, so I changed it to 30 steps.

Warnings

  • You will need ROOT on your device. We are modifying android system files, so there is a chance you will break your OS.  It would be a good idea to make a nandroid backup first. This is not for the computer-illiterate or faint of heart. Read through the whole tutorial first to make sure you want to do this before starting.
  • This may not work well on all devices. On my HTC Thunderbolt, certain numbers of steps seemed to cause the volume to bounce up and down every step.

Required Hardware

  • A rooted android device. I have tested this on a Toshiba Thrive (Android 3.2.1) and an HTC Thunderbolt (Android 2.3.4)
  • A computer running Windows. You could certainly use Mac or Linux, but this tutorial is written for Windows users.

Required Windows Software

Process

Install Prerequisites

Install JDK, 7-Zip, and Notepad++

Setup ADB (Android Debug Bridge)

Unzip Android SDK.  Add the folder that adb is in to the windows PATH. This will allow you to run adb from any folder.

In Windows 7, search the start menu for environmental variables:

You can also right click on My Computer -> Advanced System Settings -> Advanced Tab -> Environmental Variables

Edit the PATH variable.  There should be several folder paths already. Go to the end of the text field, type ; (semicolon) followed by the path to adb.  For example, I unzipped Android SDK to F:\Downloads\android-sdk-windows, so my path to adb is F:\Downloads\android-sdk-windows\platform-tools.

Test adb: Open a command prompt (Win+R and type cmd), then type adb version and hit Enter. A response like below should be shown.

Install USB Drivers

Enable USB Debugging on your device:

Press Home, Menu > Settings > Applications > Development. Ensure USB debugging is checked.

Plug in your device via USB.

In the command prompt, type adb devices. You should see a device listed (with serial number).

If you see a device, continue to the next step. If not, you will have to install drivers, by following the steps here.

Get framework.jar

Download and unzip Smali/Baksmali Manager (link above).

Open a command prompt in the folder where you unzipped smali/baksmali. Hold shift and right click on the folder, then click Open command window here.

Type adb pull /system/framework/framework.jar.  This will copy the framework.jar file to the smali/baksmali folder.

Extract (baksmali) and edit framework.jar

Open the smali/baksmali folder and run baksmali Manager.bat

Type 4 (select file), then 2 (framework.jar).

Type 1 to baksmali the framework.jar.  This decompresses it to files and folders. Leave this window open.

In the smali/baksmali folder, open framework\android\media\AudioService.smali

Search for 0xft 0x0t 0x0t 0x0t

You should find a table that looks like the one below, with 10 or 11 lines.

The first entry in each line is the number of steps. Line 4 is music/media, and is currently 0xf, which is hexadecimal for 15

Let’s say I want to change this to 45.  Open up Windows calculator, and Witch to View -> Programmer mode. Type in 45 then hit hex, which converts 45 to hexadecimal.  The result is 2d.  You can do this for any number.

Change the value in the table to your desired value (for example 0x2dt. You can also modify the steps for the other parameters, such as bluetooth or ringers. Save AudioService.smali.

 

Repack framework.jar

In the baksmali Manager.bat window, press 2 to smali (this will create a new classes.dex file).

If you accidently closed the window, you will have to open it again and hit 4 and 2 to reselect the file.

Open framework.jar with 7-Zip. Drag classes.dex into the archive in 7-Zip

Replace framework.jar on device

Method 1:

Go back to the window that had adb open in the smali/baksmali folder. Type adb remount and hit enter. Then type adb push framework.jar /system/framework/framework.jar  This will copy framework.jar over your old framework.jar

Run adb shell

Run cd /system/framework

Run chmod 644 framework.jar

I also ran ls -l to ensure framework.jar has copied and the permissions are correct.

Restart the device. Type adb reboot

 

Method 2 (if method 1 did not work):

Go back to the window that had adb open in the smali/baksmali folder. Type adb push framework.jar /sdcard/framework.jar  This will copy framework.jar to the root of your SD card (or maybe internal storage) on the device.

Get a file browser that can access the whole filesystem, such as ES File Explorer or Root Browser. Go into options and make sure mount filesystem as writable (or similar) is enabled.

Browse to the /sdcard (this is also /mnt/sdcard). Copy framework.jar, navigate to /system/framework, and paste it, overwriting the old framework.jar

Go to properties and change permissions like is shown below

Restart the device.

Test

Play some music and rack through the volume to make sure it works right.

 

 

Sources

 


1 Comment

Leave Your Comment

Your email will not be published or shared.

Connect with Facebook

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>