90HZ option in frequency display options


alecuba16

Members
Nov 25, 2016
9
13
Please, add the 90hz option to the display frequency options.

Currently, there are only two options: 60hz and 120hz, but It would be nice to have the option of 90hz, to save some battery.
 
Actually, the custom ROM devs, are able to change the settings apk where this option is present and also to perform the translations. So it makes sense to ask to the people that mods the original xiaomi cn rom, like xiaomi eu.
 
Nope.. Ask Xiaomi to do that..
I don't see why is not possible to include in xiaomi eu roms, if you are able to compile custom roms...

I edited by myself to the first of xiaomi eu 12.x the MiSettings.apk to enable the 90hz by using apktool and decompiling the apk.

The option is present at the path smali->com->xiaomi->misetting->display->RefreshRate , you should replace the condition ( :cond_2) on line 137, with cond_1, then the option 90hz is visible. In my case, to replace the misettings.apk, I had to use the magisk with the overlay option to load the modified apk with a custom install.sh function.


As far as I know as a developer, It should be easy for the xiaomi eu devs to include such modification if the result of smali is the same across the different versions, just with a diff is easy to know that.
 
I don't see why is not possible to include in xiaomi eu roms, if you are able to compile custom roms...

I edited by myself to the first of xiaomi eu 12.x the MiSettings.apk to enable the 90hz by using apktool and decompiling the apk.

The option is present at the path smali->com->xiaomi->misetting->display->RefreshRate , you should replace the condition ( :cond_2) on line 137, with cond_1, then the option 90hz is visible. In my case, to replace the misettings.apk, I had to use the magisk with the overlay option to load the modified apk with a custom install.sh function.


As far as I know as a developer, It should be easy for the xiaomi eu devs to include such modification if the result of smali is the same across the different versions, just with a diff is easy to know that.
Patching is not the problem. There has to be a reason why it's not there officially, and unless you have an answer to why that is, we rather not mess with user's hardware. Since you're quite competent yourself, you can mod the ROM on your own device as much as you want.
 
Patching is not the problem. There has to be a reason why it's not there officially, and unless you have an answer to why that is, we rather not mess with user's hardware. Since you're quite competent yourself, you can mod the ROM on your own device as much as you want.
What is the reason? I don't see the problem if exposing that option on Xiaomi EU ROMs.

The point is that I have to do the process that I have described above every time that a ROM is released. Also, there are different users changing that option via terminal and setedit app.

It would be nice to have the option for the phones that supports 120hz. As lower fps means lower GPU load and then battery saving.

But I get It, Xiaomi EU modders are not interested into mod those features.

Thanks for replying anyway.
 
What is the reason? I don't see the problem if exposing that option on Xiaomi EU ROMs.

The point is that I have to do the process that I have described above every time that a ROM is released. Also, there are different users changing that option via terminal and setedit app.

It would be nice to have the option for the phones that supports 120hz. As lower fps means lower GPU load and then battery saving.

But I get It, Xiaomi EU modders are not interesting into mod those features.
Which file in RefreshRate dir are you talking about?
 
Which file in RefreshRate dir are you talking about?
The fastest way is to manipulate the a.smali to put 90hz instead of 60hz in cond_2.

The cool way is to enable the option via manipulating the RefreshRateActivity.smali, which in the latest xiaomi Eu version (I haven't tested into my device) is to manipulate the method b()V at the line 54 from:

Code:
.method private b()V
    .locals 4

    const-string v0, "fpsList"

    invoke-static {v0}, Lb/c/a/b/a/b;->b(Ljava/lang/String;)[I

    move-result-object v0

    if-eqz v0, :cond_1

    array-length v1, v0

    if-gtz v1, :cond_0

    goto :goto_1

    :cond_0
    invoke-static {v0}, Ljava/util/Arrays;->sort([I)V

    array-length v1, v0

    new-array v1, v1, [I

    iput-object v1, p0, Lcom/xiaomi/misettings/display/RefreshRate/RefreshRateActivity;->d:[I

    const/4 v1, 0x0

    :goto_0
    array-length v2, v0

    if-ge v1, v2, :cond_1

    iget-object v2, p0, Lcom/xiaomi/misettings/display/RefreshRate/RefreshRateActivity;->d:[I

    array-length v3, v0

    sub-int/2addr v3, v1

    add-int/lit8 v3, v3, -0x1

    aget v3, v0, v3

    aput v3, v2, v1

    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    :cond_1
    :goto_1
    return-void
.end method

to:

Code:
.method private b()V
    .locals 4

    const-string v0, "fpsList"

    invoke-static {v0}, Lb/c/a/b/a/b;->b(Ljava/lang/String;)[I

    move-result-object v0
  
    if-eqz v0, :cond_1

    array-length v1, v0
  
    # Force enable 90hz  
    const-string v2, "90"
    # Current index+1
    add-int/lit8 v1, v1, 0x1
    # put value v2 inside array v0 at index v1+1
    aput-object v2, v0, v1
    #Recalculate arraylength
    array-length v1, v0
  
    if-gtz v1, :cond_0

    goto :goto_1

    :cond_0
    invoke-static {v0}, Ljava/util/Arrays;->sort([I)V

    array-length v1, v0

    new-array v1, v1, [I

    iput-object v1, p0, Lcom/xiaomi/misettings/display/RefreshRate/RefreshRateActivity;->d:[I

    const/4 v1, 0x0

    :goto_0
    array-length v2, v0

    if-ge v1, v2, :cond_1

    iget-object v2, p0, Lcom/xiaomi/misettings/display/RefreshRate/RefreshRateActivity;->d:[I

    array-length v3, v0

    sub-int/2addr v3, v1

    add-int/lit8 v3, v3, -0x1

    aget v3, v0, v3

    aput v3, v2, v1

    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    :cond_1
    :goto_1
    return-void
.end method
 
Last edited:
What is the reason? I don't see the problem if exposing that option on Xiaomi EU ROMs.

The point is that I have to do the process that I have described above every time that a ROM is released. Also, there are different users changing that option via terminal and setedit app.

It would be nice to have the option for the phones that supports 120hz. As lower fps means lower GPU load and then battery saving.

But I get It, Xiaomi EU modders are not interested into mod those features.

Thanks for replying anyway.
Main point is that if something goes wrong, you will break just your device.. If we add it to our ROMs, thousands of users will be affected.. So for their safety, we are not interested in HW mods.. It's Xiaomi's responsibility..
 
  • Like
Reactions: JiaiJ
The fastest way is to manipulate the a.smali to put 90hz instead of 60hz in cond_2.
Which is silly, because all you do here is change the title/summary, nothing else.

The cool way is to enable the option via manipulating the RefreshRateActivity.smali, which in the latest xiaomi Eu version (I haven't tested into my device) is to manipulate the method b()V at the line 54 from:

Code:
.method private b()V
    .locals 4

    const-string v0, "fpsList"

    invoke-static {v0}, Lb/c/a/b/a/b;->b(Ljava/lang/String;)[I

    move-result-object v0

    if-eqz v0, :cond_1

    array-length v1, v0

    if-gtz v1, :cond_0

    goto :goto_1

    :cond_0
    invoke-static {v0}, Ljava/util/Arrays;->sort([I)V

    array-length v1, v0

    new-array v1, v1, [I

    iput-object v1, p0, Lcom/xiaomi/misettings/display/RefreshRate/RefreshRateActivity;->d:[I

    const/4 v1, 0x0

    :goto_0
    array-length v2, v0

    if-ge v1, v2, :cond_1

    iget-object v2, p0, Lcom/xiaomi/misettings/display/RefreshRate/RefreshRateActivity;->d:[I

    array-length v3, v0

    sub-int/2addr v3, v1

    add-int/lit8 v3, v3, -0x1

    aget v3, v0, v3

    aput v3, v2, v1

    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    :cond_1
    :goto_1
    return-void
.end method

to:

Code:
.method private b()V
    .locals 4

    const-string v0, "fpsList"

    invoke-static {v0}, Lb/c/a/b/a/b;->b(Ljava/lang/String;)[I

    move-result-object v0
 
    if-eqz v0, :cond_1

    array-length v1, v0
 
    # Force enable 90hz 
    const-string v2, "90"
    # Current index+1
    add-int/lit8 v1, v1, 0x1
    # put value v2 inside array v0 at index v1+1
    aput-object v2, v0, v1
    #Recalculate arraylength
    array-length v1, v0
 
    if-gtz v1, :cond_0

    goto :goto_1

    :cond_0
    invoke-static {v0}, Ljava/util/Arrays;->sort([I)V

    array-length v1, v0

    new-array v1, v1, [I

    iput-object v1, p0, Lcom/xiaomi/misettings/display/RefreshRate/RefreshRateActivity;->d:[I

    const/4 v1, 0x0

    :goto_0
    array-length v2, v0

    if-ge v1, v2, :cond_1

    iget-object v2, p0, Lcom/xiaomi/misettings/display/RefreshRate/RefreshRateActivity;->d:[I

    array-length v3, v0

    sub-int/2addr v3, v1

    add-int/lit8 v3, v3, -0x1

    aget v3, v0, v3

    aput v3, v2, v1

    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    :cond_1
    :goto_1
    return-void
.end method
Which is even more absurd.
This:
Code:
    array-length v1, v0
  
    # Force enable 90hz  
    const-string v2, "90"
    # Current index+1
    add-int/lit8 v1, v1, 0x1
    # put value v2 inside array v0 at index v1+1
    aput-object v2, v0, v1
Translates in Java to:
Code:
array[array.length + 1] = "90";
Which basically results in IndexOutOfBoundsException because: 0 <= index < array.length
Didn't you say you were a developer? It's basic knowledge that each array has a fixed length.

Why don't you just find where the "fpsList" array is defined and add the "90" item there?
Hint: No decompilation is needed to edit it.
 
Which is silly, because all you do here is change the title/summary, nothing else.


Which is even more absurd.
This:
Code:
    array-length v1, v0

    # Force enable 90hz
    const-string v2, "90"
    # Current index+1
    add-int/lit8 v1, v1, 0x1
    # put value v2 inside array v0 at index v1+1
    aput-object v2, v0, v1
Translates in Java to:
Code:
array[array.length + 1] = "90";
Which basically results in IndexOutOfBoundsException because: 0 <= index < array.length
Didn't you say you were a developer? It's basic knowledge that each array has a fixed length.

Why don't you just find where the "fpsList" array is defined and add the "90" item there?
Hint: No decompilation is needed to edit it.

About the first point, it isn't just the text draw on the activity, it is also the value stored in the settings table...This is the method that I'm currently using and checking the "user_refresh_rate" it changes to 90 instead 60 as it did before the change, I have checked it with setedit...

About the OOB, just enlarge the array one position:

new-array v3, v1, [Ljava/lang/String;.
 
About the first point, it isn't just the text draw on the activity, it is also the value stored in the settings table...This is the method that I'm currently using and checking the "user_refresh_rate" it changes to 90 instead 60 as it did before the change, I have checked it with setedit...

About the OOB, just enlarge the array one position:

new-array v3, v1, [Ljava/lang/String;.
Or just find where the array is at and change it, the array is barebones and in plain sight on vendor partition, not hard to find :D

In any case, just curious, set 90 FPS and then go to Developer options and toggle on "Show refresh rate", what do you see on the screen?
 
Or just find where the array is at and change it, the array is barebones and in plain sight on vendor partition, not hard to find :D

In any case, just curious, set 90 FPS and then go to Developer options and toggle on "Show refresh rate", what do you see on the screen?

It is 90 , but by doing the mod, it's not dynamic between 60 and 120 as it does by selecting 120hz on the display menu. I'm trying to find out if there is some value to set the max and min in dynamic mode.

Ok, I will look for the FpsList if it is defined in some XML or plain config, but I suspect that this value is inside some lib (so) or inside the boot.img.

I will continue working in the small code to provide a tested recompiled version of the misettings with that change into the possible values of FPS.The first modification that I have indicated is the one that I'm using right now, it sets on the 60hz selector the 90hz value. And as you see it works.


photo5805298348595458973.jpg