[LG V20 Themes, Apps, and Mods] Zacharee1:
So I've always been annoyed with how the HiFi volume only has 15 steps. For me, 5 is too low and 10 is too loud (cheap earbuds). With the release of the V30, I've learned that it has 75 steps for the HiFi volume, which prompted me to modify our system to get 75 steps as well.

Well, I didn't do that exactly, but I think this is better. I didn't manage to get the 75 steps on just the HiFi volume: I changed every slider, and it's customizable. By default, it's 1 step on the HiFi slider. This is about 1/2 of a step on the ringer volume I think. But if you don't like that, you can change what it uses.

The property is

volume_step_size

in Settings.Global.

You can set that using ADB. For instance, if you want to go back to the default step size for HiFi mode, you could use

adb shell settings put global volume_step_size 10

The default step size if 5, but for whatever reason, the system uses double the number you want. It's some weird scaling thing I think.

Attached is the modified services.jar. It goes in /system/framework/ with 0644 permissions.

Enjoy!

Do it Manually

This guide assumes you know how to decompile and recompile APKs/JARs or DEX files. I'm just going to tell you what code you need to edit to add this mod yourself.

- Decompile your services.jar. If you're on an odexed system, you'll either have to deodex the JAR or edit the DEX. That's beyond the scope of this though.

- Find these two files:

- /com/android/server/audio/AudioService.smali
- /com/android/server/audio/AudioService$VolumeStreamState.smali

- In AudioService, you need to add two new methods.

.method static synthetic -get49(Lcom/android/server/audio/AudioService;)Z
.locals 1

iget-boolean v0, p0, Lcom/android/server/audio/AudioService;->mHifiDacMode:Z

return v0
.end method

You'll want to make sure that -get49 isn't already used as a method name. My latest method was -get48, so the one I added I renamed to -get49.

.method private getCustomVolumeStepValue()I
.locals 3

const-string/jumbo v0, "volume_step_size"
const v1, 0x2
iget-object v2, p0, Lcom/android/server/audio/AudioService;->mContext:Landroid/content/Context;

invoke-virtual {v2}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v2

invoke-static {v2, v0, v1}, Landroid/provider/Settings$Global;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
move-result v2

return v2
.end method

This is the method that grabs the current volume step set in Settings.Global. If there's no value found, it will use "2" by default.

- Now, go into AudioService$VolumeStreamState and find this method: "rescaleDeltaIndex(IIII)I." Comment the entire method out and paste this instead:

.method private rescaleDeltaIndex(IIII)I
.locals 3
.param p1, "deltaIndex" # I
.param p2, "flags" # I
.param p3, "streamType" # I
.param p4, "device" # I

.prologue
.line 4948
invoke-static {}, Lcom/android/server/audio/AudioService;->-get26()Z

move-result v2

if-eqz v2, :cond_4

const/high16 v2, 0x20000

and-int/2addr v2, p2

if-nez v2, :cond_4

const/4 v2, 0x3

if-ne p3, v2, :cond_4

.line 4950
iget-object v2, p0, Lcom/android/server/audio/AudioService$VolumeStreamState;->this$0:Lcom/android/server/audio/AudioService;

invoke-static {v2}, Lcom/android/server/audio/AudioService;->-get49(Lcom/android/server/audio/AudioService;)Z

move-result v2

if-eqz v2, :cond_0

and-int/lit16 v2, p2, 0x1000

if-nez v2, :cond_1

.line 4951
:cond_0
invoke-static {}, Lcom/android/server/audio/AudioService;->-get0()I

move-result v2

mul-int/2addr p1, v2

.line 4953
:cond_1
const/4 v1, 0x0

.line 4954
.local v1, "rescaledeltaIndex":I
invoke-virtual {p0, p4}, Lcom/android/server/audio/AudioService$VolumeStreamState;->getIndex(I)I

move-result v0

.line 4955
.local v0, "currentIndex":I
rem-int v2, v0, p1

if-eqz v2, :cond_3

.line 4956
if-gtz p1, :cond_2

.line 4957
rem-int v2, v0, p1

neg-int v1, v2

.line 4964
:goto_0
return v1

.line 4959
:cond_2
rem-int v2, v0, p1

sub-int v1, p1, v2

goto :goto_0

.line 4962
:cond_3
move v1, p1

goto :goto_0

.line 4966
.end local v0 # "currentIndex":I
.end local v1 # "rescaledeltaIndex":I
:cond_4
return p1
.end method

-get49 is the method you pasted earlier.

-get0 is the method that returns HIFI_MEDIA_VOLUME_OFFSET. Just make sure your -get0 is the same one as mine.

- Now, you need to actually get the custom method you pasted to be called. Find "adjustStreamVolume(IIILjava/lang/String;Ljava/lang/String;I)V" in AudioService and find the call to "rescaleIndex(III)I" inside it.

My call looks like this:

invoke-direct {v0, v6, v1, v13}, Lcom/android/server/audio/AudioService;->rescaleIndex(III)I

Change whatever you have to look like this:

invoke-direct {v0}, Lcom/android/server/audio/AudioService;->getCustomVolumeStepValue()I

- Rebuild and install!