MIUI8, edit framework-res.apk and fix Roaming Indicator

MIUI doesn’t know all operators around the world, like bob, which is a brand of A1 Telekom Austria and uses their Network. Bob has the MNC 11 (Mobile Network Code) and  A1 has 1. MIUI does recognize that the MNC of the bob SIM Card is not the same as the network operator and thinks that it is Roaming and displays a R in the Status Bar.

To fix this, we need to tell MIUI that a MCC232MNC1 network for a MCC232MNC11 SIM card is in fact not roaming. These settings are in /system/framework-res.apk. Of course you need root for that and i will not explain how to pull/push system files from/to a android device, i will just explain how to edit the framework-res.apk.

You need 4 files from your device:
/system/framework/framework-res.apk
/system/framework/framework-ext-res/framework-ext-res.apk
/system/app/miui/miui.apk
/system/app/miuisystem/miuisystem.apk
And you need to install apktool.

First we install all 4 apks in apktool:

apktool if ./framework-res.apk
apktool if ./framework-ext-res.apk
apktool if ./miui.apk
apktool if ./ miuisystem.apk

Now we extract/decompile the framework-res.apk

apktool d ./framework-res.apk

It will create a directory ./framework-res where all files from the apk got extracted. Now we can edit the resource file.

We will add a new directory ./framework-res/res/values-mcc232-mnc11 and create a new file ./framework-res/res/values-mcc232-mnc11/arrays.xml which contains:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="config_operatorConsideredNonRoaming">
<item>23201</item>
<item>23209</item>
<item>23212</item>
</string-array>
</resources>

When we made all changes we need, we can repack/compile it again:

apktool b ./framework-res -o framework-res-new.apk

APKs are signed, so we can’t just use the new framework-res-new.apk, we need to replace resources.arsc of the ./framework-res.apk with the new one from framework-res-new.apk . APKs are basically just zip-files, so we can use zip/unzip utils for that. We will remove resources.arsc and ./framework-res-new.apk after that, because we don’t need it anymore.

unzip framework-res-new.apk resources.arsc
zip framework-res.apk "resources.arsc"
rm resources.arsc
rm framework-res-new.apk

Now replace the framework-res.apk from your device with our changed one. If you do this with adb, be sure to move it over the other one, with the correct permissions, DO NOT delete the framework-res.apk before doing that! Your device will crash instantly and be unbootable.

For example: The new framework-res.apk is in /sdcard/Download and you are in an adb shell on your device.

su
mount -o rw,remount /system
mv /sdcard/Download/framework-res.apk /system/framework/framework2.apk
chmod 644 /system/framework/framework2.apk
mv /system/framework/framework2.apk /system/framework/framework-res.apk

Now restart your device and the R for Roaming should be gone.

Hinterlasse einen Kommentar