Missing options in K30 5G xiaomi.eu build (but existing in stock fw) - dual band WiFi and 5G switch


peter232

Members
Aug 19, 2016
14
15
Dual band WLAN speed boost
It is available and it is working on stock firmware. I found the reason why it is not available on xiaomi.eu build.
/product/priv-app/Settings/Settings.apk, com.android.settings.wifi.linkturbo.LinkTurboClient.isLinkTurboSupported:

Java:
    private static boolean isGlobalShowMultiNetwork() {
        String str = Build.MODEL;
        return str.contains("Mi 10") || str.contains("Redmi K20 Pro");
    }

    public static boolean isLinkTurboSupported() {
        return (!miui.os.Build.IS_INTERNATIONAL_BUILD || isGlobalShowMultiNetwork()) && SystemProperties.getInt("ro.vendor.net.enable_sla", 0) == 1;
    }

So, in my opinion method `isGlobalShowMultiNetwork` should be patched and "Redmi K30 5G" should be added.



Missing 5G switch in `SIM cards & mobile networks`
I'm not sure if it is really important, because it is still available in network mode selector.
But it exists on stock firmware.
/system/priv-app/TeleService/TeleService.apk, com.android.phone.MiuiPhoneUtils.showFiveGSwitch:

Java:
    public static boolean shouldEnableFiveGCapability() {
        return "andromeda".equals(miui.os.Build.DEVICE) || isMtk5gDevice() || SystemProperties.getInt("ro.vendor.radio.5g", 0) > 0;
    }

    public static int getFiveGSwitchType() {
        return Build.IS_INTERNATIONAL_BUILD ? 2 : 3;
    }

    public static boolean showFiveGSwitch() {
        return shouldEnableFiveGCapability() && (getFiveGSwitchType() & 1) == 1 && FiveGManager.is5GSwitchCarrierAvailable() && !FiveGManager.is5GSwitchClosedByCloud();
    }

    public static boolean showFiveGNetworkMode() {
        return shouldEnableFiveGCapability() && (getFiveGSwitchType() & 2) == 2 && FiveGManager.is5GSwitchCarrierAvailable() && !FiveGManager.is5GSwitchClosedByCloud();
    }

`shouldEnableFiveGCapability` is true because ro.vendor.radio.5g = 1
`getFiveGSwitchType` return 2 because IS_INTERNATIONAL_BUILD, 2&1 = 0, so `showFiveGSwitch` return false
`showFiveGNetworkMode` return true in both builds because 2&2 = 2 and 3&2 = 2. It is used in network mode selector.

I did not find `getFiveGSwitchType` is used anywhere in other places, so in my opinion it could be just removed (and both calls to it in conditions).
 
No problem, "Dual band WLAN speed boost" and "Use mobile data to boost speed" features have been enabled for all supported devices.
Only devices with slaservice.apk (com.qti.slaservice) and the "ro.vendor.net.enable_dual_wifi" and/or "ro.vendor.net.enable_sla" props (respectively) set to 1 are supported.
Currently supported devices for both features: Redmi K30 5G, Redmi K30 Pro, Mi 10, Mi 10 Pro.
Currently supported devices* for "Use mobile data to boost speed" only: Redmi K20 Pro/Mi 9T Pro.
* Mi 9 and Mi 9 Pro 5G were also supported up to 20.3.9 and 20.3.5, respectively, but support was removed in newer releases for some reason.

Also forced getFiveGSwitchType to return 3 without the IS_INTERNATIONAL_BUILD check. All 5G devices should be supported.

These changes will be applied to the next release.
 
Because the dual 4g is missing only one SIM is active until manually switched, so if SIM 1 is using data, SIM 2 will show signal bars only, enabling SIM 2 for data will only show signal bars with no 4g/LTE in SIM 1.
Using Redmi k30 pro zoom.
 
No problem, "Dual band WLAN speed boost" and "Use mobile data to boost speed" features have been enabled for all supported devices.
Only devices with slaservice.apk (com.qti.slaservice) and the "ro.vendor.net.enable_dual_wifi" and/or "ro.vendor.net.enable_sla" props (respectively) set to 1 are supported.
Currently supported devices for both features: Redmi K30 5G, Redmi K30 Pro, Mi 10, Mi 10 Pro.
Currently supported devices* for "Use mobile data to boost speed" only: Redmi K20 Pro/Mi 9T Pro.
* Mi 9 and Mi 9 Pro 5G were also supported up to 20.3.9 and 20.3.5, respectively, but support was removed in newer releases for some reason.

Also forced getFiveGSwitchType to return 3 without the IS_INTERNATIONAL_BUILD check. All 5G devices should be supported.

These changes will be applied to the next release.
Is this available on current 20.4.30 release?
 
In stable builds again
Java:
    public static int getFiveGSwitchType() {
        return Build.IS_INTERNATIONAL_BUILD ? 2 : 3;
    }
 
Also 5G is not available in preferred networks.
I did not investigate why.
Just patched both showFiveGSwitch and showFiveGNetworkMode to always return true.
Works fine.

5G was launched in Bulgaria, but only 1800 and 2100 are used (as I understand they are bands 1 and 3). 3600 will be used later (as I understand it is band 78).
Only band 78 is supported by K30 5G. So I can not test 5G for now. I was hoping on band 78, for example only it is used in Romania.
 
Also 5G is not available in preferred networks.
I did not investigate why.
Just patched both showFiveGSwitch and showFiveGNetworkMode to always return true.
Works fine.

5G was launched in Bulgaria, but only 1800 and 2100 are used (as I understand they are bands 1 and 3). 3600 will be used later (as I understand it is band 78).
Only band 78 is supported by K30 5G. So I can not test 5G for now. I was hoping on band 78, for example only it is used in Romania.


could you please tell us how do you patch these commands?
 
i am not really into java scripting but what should i do with these ?

public static boolean shouldDisable5GByDefault() {
return false;
}

public static boolean shouldDisable5GSwitchByDefault() {
return false;

public static boolean showFiveGNetworkMode() {
return isFiveGCapable() && (getFiveGSwitchType() & 2) == 2 && FiveGManager.is5GSwitchCarrierAvailable() && !FiveGManager.is5GSwitchClosedByCloud();
}

public static boolean showFiveGSwitch() {
return isFiveGCapable() && (getFiveGSwitchType() & 1) == 1 && FiveGManager.is5GSwitchCarrierAvailable() && !FiveGManager.is5GSwitchClosedByCloud();
}
 
what should i do
You can read Java code to understand the algorithm and decide what you want to change.
But changes should be done in Smali code.
You can use apktool to disassemble apk (use "-r" option to decode only code).
Then you can make changes in Smali. Example of patched methods always returning true:
Code:
.method public static showFiveGNetworkMode()Z
    .locals 2

    const/4 v0, 0x1

    return v0
.end method

.method public static showFiveGSwitch()Z
    .locals 2

    const/4 v0, 0x1

    return v0
.end method
And then you can build new apk with apktool.
Then you should create Magisk module to replace the apk because system partition is not writable.
(BTW I think in xiaomi.eu firmware it is writable, but Magisk is cleaner way in any case)

It is impossible to describe everything in details, a whole book is required.
 
Latest update from Xiaomi.eu Stable Redmi k30 5G (12.0.6) still dont have this 5G switch in the Preferred Network Type. I think it's really risky for me to do it myself since I got literally 0 knowledge about coding and I might f**k something up. Hope they will include this in the next patch.
 
  • Like
Reactions: Biggio
now i am

on xiaomi.eu_multi_HMK30Pro_20.12.10_v12-11 (its build from China Rom)...

and i have working 5G on SIM 1 and 4G on SIM 2 (no 5G contract on SIM 2).

greets
 
I'm under weekly build (20.12.10) which is latest one. I have neither 5G switch nor WiFi + mobile data speed boost in settings.
Do Xiaomi.eu has plan to enable both in next weekly build?
 
Last edited:
  • Like
Reactions: lucastmendoncaf