Guide to Advanced Leo/MIUI Customization: System & Boot Images, APK Patching + Extras - Xiaomi Mi Note Pro

Guide to Advanced Leo/MIUI Customization: System & Boot Images, APK Patching + Extras
Just got myself this device and have been playing with it since. As a result, I have accumulated a set of patches and optimizations I'd now like to share. As it's going to be quite a few of them, I'll split the stuff into a couple of posts.
For the benefit of future readers, I think it'd be better to have everything I am about to post in one place, and for this reason I'm starting a new thread, although some of those topics might have already been addressed in other places on this and other forums.
Most of the stuff below can easily be adopted to other Xiaomi/MIUI devices, or even the products of other manufacturers. Please feel free to do so, as well as to share any comments and further optimizations you made. All feedback is appreciated, especially if things can be made better as a result of it.
If at any point you find yourself missing any of the common tools, the archive attached to this post includes: apktool2, aapt[-miui], adb, diff & patch, signapk[w], [un]zip and zipalign.
Table of Contents​
The Initial Steps: Preparing the Device & Choosing the ROM
Starting with a Clean Slate
Flashing TWRP Recovery
Choosing the ROM Base
Modifying the Data Partition Image
Removable Files
Modifiable Files & Configuration
Modifying the System Partition Image (Except Configuration)
Removable Files
Removable Apps
Removing Google Apps
Removing Other Garbage
Modifiable Files
Modifying the System Partition Image: Configuration Files
Configuration
/system/build.prop
/system/etc/gps.conf
/system/etc/init.qcom.post_boot.sh
/system/etc/install_app_filter.xml
/system/etc/mcd_default.conf
/system/etc/spn.conf
/system/etc/system_fonts.xml
Modifying the Boot Image
Purpose
Changes
Securing the ADB
Disabling the CD-ROM Emulation
Flashing
Patching and Recompiling the Application Packages
Purpose
Reference
Changes
Mi Talk SIM Card Activation Nag
Mi Voice Ad in Contacts
Data Roaming Lost Connection Notification
Modifying the Theme Settings
Gadgets & Translations
MIUI-Themed App Icons
MIUI Default Wallpapers
Per-Application Theming
Automating the Modifications
The Edify Script
The Update ZIP Archive
The Patch Builder Script
The Complete Patch
Automated Installation of Google Apps
Purpose
Choosing the Google Apps Distribution
Scripting the Google Apps Installation
Flashing
Summary
Bonus: Qualcomm NVRAM Settings & 2G/3G/4G LTE Band Config
Choosing Bands to Enable
Enabling the Extra Bands
Understanding the Values
 

The Initial Steps: Preparing the Device & Choosing the ROM
Starting with a Clean Slate
Download the latest Chinese Development ROM along with the userdata partition by clicking this direct download link. If the link does not work, go to this page and search for "小米Note 顶配 最新 开发版". Unpack, edit the file flash_all.bat to remove the fastboot reboot line at the end. Put device in fastboot mode, check that it is connected with fastboot devices and execute flash_all.bat.
This will completely wipe everything on your device, bringing it to a factory-like state (but with the latest developer version flashed). Later, if you make some extensive changes to the filesystem and want to roll back, this should do the trick.
Flashing TWRP Recovery
Attached to this post is the version I made for myself. It is TWRP 2.8.6.0 based on GanFan and Happy MIUI's Chinese version of June 13, 2015, an improvement upon the English version GanFan released earlier (May 27, 2015), which was the one posted before on XDA. The newer version was only posted in the Chinese forums. All credit for the underlying TWRP build is due to GanFan and Happy MIUI.
I have removed any customizations from the filesystem, bringing it back to stock TWRP, using TWRP for LG G3 Europe (d855) as a base, as it has the same screen resolution. I have then merged the TWRP Materialised Play theme directly into the image, along with the official "Light-Light Blue" splash screen (curtain). TWRP is version 2.8.6.0 but the integrated theme is 2.8.7.x, as it fixes some bugs and appears to work just fine.
To install: unzip first, fastboot erase recovery, then fastboot flash recovery <filename>. You can then do fastboot reboot while holding the Volume Up button to get into the recovery.
Changelog
2015-12-31: Updated to set the ro.product.device property to "leo" so that Edify scripts that check for compatibility will now work.
Outstanding Issues
Sometimes the screen might be difficult to unlock because the swipes need to be very precise for them to register. I recommend to disable the screen timeout in the TWRP settings once in the recovery mode.
Wiping all partitions by formatting them appears to be introducing some problem, probably due to fstab discrepancies. Consider changing the relevant setting to use rm -rf for wiping if you plan to use this function.
Choosing the ROM Base
There are a lot of MIUI releases, of which the notable include:
The Official China Developer ROM (click the second green button under the headline "开发版" to download). This is always the first version to get the new features. It also includes a lot of China-specific apps you might want to get rid of while not having any translations besides that of the few Asian countries where Xiaomi products are sold officially. Lastly, it is not de-odexed.
Xiaomi.eu's Unofficial International MIUI is de-odexed and includes translations to Western languages, along with minimal GApps and some configuration changes most of which are fine but some you might want to revert (more on this later).
MIUI Pro is an alternative quality de-odexed ROM to check out, being Russian-based it does not however include Western translations. It is closer to the stock ROM in some areas, while deviating more from it in some others.
I went through the most recent releases of each of the three ROMs comparing their differences before I made up my mind which one to choose as a base. Starting with the original MIUI and de-odexing it, perhaps also adding your own translations in the process, might be a lot of fun but it'll also take you some time, and will be mostly redoing the work that has already been done elsewhere, so for now I settled upon using Xiaomi.eu's release. I went through all the changes they're doing to the stock version and find most of them reasonable, while starting off their version saves me some work.
If you are inclined to start with the stock version, there's a certain tool called jBART (released by the author of MIUI Pro) that provides a GUI to do all this, making it much easier than it used to be (the tools used by Xiaomi.eu are not publicly available).
Having downloaded the ROM of your choice, you can now start making the changes as described below. It's a good idea to keep a record of all the changes you make against the original image so that you can re-create them in future versions or roll back if necessary. It'd be even better if after making the changes you go back to the clean slate and then re-apply them from your records, to make sure that nothing else was accidentally changed.
 

Modifying the Data Partition Image
Removable Files
The following directories can be removed recursively:
/data/evt-test/
/data/media/MIUI/
/data/miui/app/
/data/miui/cust/
/data/miui/gallery/
/data/miui/mms/
/data/miui/videoplugins/
/data/miui/yellowpage/
/data/qmi-framework-tests/
As well as the following files:
/data/miui/app/vanward_applist
/data/miui/cdrom_install.iso
/data/miui/cust_variant
Xiaomi.eu's version already removes most of the clutter here, so if you're using the stock ROM the above list will not be enough: you'll want to remove more files (which unfortunately change with every version of the stock ROM).
Modifiable Files & Configuration
Further, there are some potentially interesting files in /data/miui/ that you might want to create or edit:
/data/miui/resolves_miui.conf
In this file, Xiaomi has hard-coded the IP addresses of their servers; as I don't see any reason to bypass the regular resolver configuration in such a way, I bumped up the version number and emptied the file:
Code:
# /data/miui/resolves_miui.conf
# Hardcoded data for the DNS resolver
# version 999
# Syntax:
# <fqdn> <ip_address> <"v4"|"v6">
# No more than 4 addresses per FQDN.
# If more than one address specified, all of them must be of the same type ("v4" or "v6")
# Version number must be increased whenever the file is modified
/data/miui/cust_variant
Suppose that in this file you put:
Code:
cn
Then, you can have:
/data/miui/cust/cn/cust.prop
Some build.prop settings that can be customized at the time of first boot:
Code:
persist.sys.timezone=UTC
#ro.carrier.name=
ro.com.android.mobiledata=true
ro.miui.region=IN
ro.miui.mcc=9404
# 9404 in 9454 hk 9460 cn 9502 my
# 9510 id 9515 ph 9525 sg 9466 tw
ro.miui.mnc=9999
ro.miui.cust_variant=cn
#ro.miui.cta=1
ro.product.locale.language=en
ro.product.locale.region=US
The list of all keys that can be customized, which you can edit it too, is in the file /system/etc/cust/cust_prop_white_keys_list.
The two files contain a list of pre-installed crapware, so they can be emptied (unless you already deleted them following the instructions above):
/data/miui/cust/cn/ota_customized_applist
/data/miui/cust/cn/ota_recommended_applist
If you really want to pre-install some apps, put them in:
/data/miui/app/noncustomized/<AppName>/<AppName>.apk
/data/miui/cust/cn/wpa_supplicant_customization.conf
The above file used to work at some point in the past (with another device I have), offering a way to preset the Wi-Fi profiles. Unfortunately, it doesn't work now. The example below is just in case that the functionality starts working again some time in the future, but for now don't bother:
Code:
network={
ssid="<Wi-Fi ESSID Name>"
key_mgmt=WPA-PSK
psk="<PlainTextPassword>"
proto=RSN
group=CCMP TKIP
pairwise=CCMP TKIP
priority=1
}

Modifying the System Partition Image (Except Configuration)
Removable Files
Removable Apps
The following apps (directories) can be recursively removed:
/system/app/AnalyticsCore/
/system/app/BaiduNetworkLocation/
/system/app/BugReport/
/system/app/matcli/
/system/app/Metok/
/system/app/MiLinkService/
/system/app/NVItem/
/system/app/PicoTts/
/system/app/SecurityAdd/
/system/app/TrafficControl/
/system/app/VirtualSim/
/system/app/XiaomiVip/
/system/app/XMPass/
If you are using the stock version, you can also get rid of these (in Xiaomi.eu's version, these are already removed):
/system/app/BasicDreams/
/system/app/Galaxy4/
/system/app/GameCenter/
/system/app/GooglePinyinIME/
/system/app/HoloSpiralWallpaper/
/system/app/LiveWallpapers/
/system/app/MiuiSuperMarket/
/system/app/NoiseField/
/system/app/PaymentService/
/system/app/PhaseBeam/
/system/app/PhotoTable/
/system/app/SystemAdSolution/
/system/app/VisualizationWallpapers/
/system/app/VirtualSim/
/system/app/VoiceAssist/
/system/priv-app/MiGameCenterSDKService/
Contrary to some information posted elsewhere, do not remove /system/app/NetworkAssistant2/ or you will get a force-close going through some mobile network settings. Also, while /system/app/Whetstone/ can possibly be removed, removing its libraries in /system/lib/ and /system/lib64/ will cause problems.
Removing Google Apps
Xiaomi.eu already includes a minimal installation of Google Apps but I am flashing a larger Open GApps package later so that the 500+ MiB free space on the /system partition can be put to good use. To avoid any conflicts between the two versions, it's a good idea to get rid of all the pre-loaded Google files first:
/system/etc/permissions/com.google.android.dialer.support.xml
/system/etc/permissions/com.google.android.media.effects.xml
/system/etc/permissions/com.google.widevine.software.drm.xml
/system/etc/preferred-apps/google.xml
/system/etc/preferred-apps/
/system/etc/sysconfig/google.xml
/system/etc/sysconfig/google_build.xml
/system/etc/sysconfig/
/system/framework/com.google.android.dialer.support.jar
/system/framework/com.google.android.media.effects.jar
/system/framework/com.google.widevine.software.drm.jar
And the apps themselves (recursively):
/system/app/CloudPrint2/
/system/app/GoogleCalendarSyncAdapter/
/system/app/GoogleContactsSyncAdapter/
/system/priv-app/GoogleBackupTransport/
/system/priv-app/GoogleFeedback/
/system/priv-app/GoogleLoginService/
/system/priv-app/GoogleOneTimeInitializer/
/system/priv-app/GooglePartnerSetup/
/system/priv-app/GoogleServicesFramework/
/system/priv-app/Phonesky/
/system/priv-app/PrebuiltGmsCore/
Note that I am not deleting /system/etc/permissions/com.google.android.maps.xml and /system/framework/com.google.android.maps.jar as for some reason those files are present in the stock ROM too. I am also keeping the WebView (Chromium) component. The above list can be used with MIUI Pro as well but you also need to remove the camera library that is not part of Xiaomi.eu's distribution.
Removing Other Garbage
MIUI includes the CD-ROM emulation "feature," which we'll be getting completely rid of shortly:
/system/etc/fake_cdrom_install.iso
The following font files are only included with Xiaomi.eu for obscure reasons and are probably obsolete:
/system/fonts/AndroidEmoji.ttf
/system/fonts/DroidNaskh-Regular-SystemUI.ttf
/system/fonts/NotoSansHebrewUI-Bold.ttf
/system/fonts/NotoSansHebrewUI-Regular.ttf
With regard to the latter two files, only some scripts have an UI variant in the Noto Sans font, and Hebrew is not even one of them. These two font files are the same as their corresponding non-UI variants. For some reason, Xiaomi.eu also forgot to include Burmese fonts, which are part of the stock ROMs.
These files seem to serve no purpose either:
/system/bin/qmi-framework-tests/
/system/media/audio/create_symlink_for_audio-timestamp
Modifiable Files
Here are some items that can be updated on the System partition, except the configuration files, which will be discussed separately later:
/system/app/<AppName>/<AppName>.apk
/system/priv-app/<AppName>/<AppName>.apk
If you want to add any extra system apps.
/system/fonts/
The fonts used in MIUI are generally based on outdated versions, and some of the fonts Xiaomi.eu uses are even older, apparently. The versions I am posting as an attachment are the latest at the time I was collecting them, which is roughly the time of this post. Alternatively, potentially newer versions can be downloaded from the following sources: Roboto, Noto (use unhinted, alternative link), Carrois Gothic, Coming Soon, Cutive Mono, Dancing Script, Naver fonts and others.
Note that Xiaomi.eu replaces the default MIUI fonts with Roboto, which is a good idea, as it solves some problems. The collection I posted in the attachment does the same.
/system/media/audio/alarms/
/system/media/audio/notifications/
/system/media/audio/ringtones/
If you want to add some extra audio files, this is the place (use the Ogg Vorbis format). Of course, you can just as well put them on the User Data partition.
/system/media/lockscreen/
/system/media/wallpaper/
Ditto, graphics files in the JPG format.
/system/media/theme/
This is a very interesting place to have a closer look, so I'll write about it in more detail later, with the exception of briefly mentioning the following:
/system/media/theme/miui_mod_icons/
The customized, MIUI-themed icons for all applications are stored here. The stock ROM barely includes any icons, while the collection shipped with MIUI Pro is much larger than that of Xiaomi.eu, so you may want to combine the two in your device's ROM (even more interestingly, many icons for popular apps overlap, and you will have two completely different versions to choose from for each of them).
/system/usr/icu/icudt53l.dat
The International Components for Unicode data. A newer version is available included in the attachment, or download it directly from source (making sure it's in the same format). It appears that the data downloaded directly from ICU does not include some charsets, pending further investigation please do not use this version. It should be safe to use the Google Source version but since newer Android releases switched to a different ICU format, the last version available there is not necessarily better than the one provided by Xiaomi.
/system/usr/share/zoneinfo/tzdata
The timezone data included with the latest MIUI is version 2015a, while the newest (as of now) is 2015g, as several countries made adjustments to their timezones last year. If you want to be up to date, download the newest version from the attachment or get it from the source.
 

Modifying the System Partition Image: Configuration Files
The configuration files discussed below, along with unified diffs against the original files, are included as attachments to this post. Note that they were made against the version 5.12.31 of China Developer ROM, so some of the changes might eventually get outdated. For this reason, I suggest you always apply the patches against the newest config files, and not reuse the old patched ones.
Configuration
/system/build.prop
Even if you're using Xiaomi.eu's ROM as your base, I suggest to start with the stock version of this file, as it's less cluttered, and just make the following edits:
ro.product.locale.language=en
ro.product.locale.region=US
Switch the default language to English.
ro.com.android.dateformat=yyyy-MM-dd
Change the date format to ISO standard.
persist.sys.mitalk.enable=false
Mi Talk is an online service I have no need for. Do you?
Further, we make the following additions:
drm.service.enabled=true
ro.com.google.gmsversion=5.1_r1
This is used for Google Apps.
persist.adb.notify=0
Disable the persistent notification when the device is in USB Debugging mode.
ro.adb.secure=1
Only allow ADB connections from hosts with pre-approved fingerprints. Important for security: otherwise, anything connected to your phone through USB will be able to get superuser access (and yes, that includes even something that might look just like an ordinary charger).
ro.product.mod_device=leo_mam_global
Adding the _global suffix sets the IS_INTERNATIONAL_VERSION flag inside some of the APKs, which is what you usually want, unless you are located in China (but then, removing some of the items listed above apparently breaks the China version, you'd need to investigate this on your own). Further, in Xiaomi.eu's version this has been modified to _mam_global inside the Settings app, so without this suffix you will experience force-closes when trying to open Additional settings (with other ROMs, you can probably just use _global as the suffix).
ro.setupwizard.mode=OPTIONAL
This setting would skip the setup wizard on first boot but then it stopped working at some point. I keep it here just in case someone searches for it or it starts working again but for now, don't bother.
You can also set the properties below to distinguish your build. It serves only cosmetic purpose but shows up in the Settings and is available to user-space apps:
ro.build.display.id=LMY47V-Custom
ro.build.date=Fri Jan 1 00:00:00 UTC 2016
ro.build.date.utc=1451606400
/system/etc/gps.conf
Again, I suggest starting with the stock version, and then making the following changes:
XTRA_SERVER_1=http://xtrapath1.izatcloud.net/xtra2.bin
XTRA_SERVER_2=http://xtrapath2.izatcloud.net/xtra2.bin
XTRA_SERVER_3=http://xtrapath3.izatcloud.net/xtra2.bin
Without it, you can see an occasional complaint in the logs that XTRA servers are not set, so perhaps this has the potential to improve fix time.
NTP_SERVER=pool.ntp.org
One is enough. And with the NTP.org pool you will get a server topologically very close to you. It already works very well just by analyzing your IP address. There is no need to constrain it to something like myvillage.mycountry.continent.ntp.org, especially on a mobile device, which is, by definition, mobile (unless you never travel outside your village). Seriously, too many people get this completely wrong. There is no benefit to be gained from setting it to anything else.
SUPL_HOST=supl.google.com
SUPL_PORT=7276
Even if it's unset in gps.conf, it might be set at runtime by an app. However, the above settings are correct, and there is no harm in setting to those values (other than Google knowing your location).
A_GLONASS_POS_PROTOCOL_SELECT = 0x7
Now this is something I was unable to find any documentation for so I might be completely wrong but according to the comments in the file, it should enable all the "assisted" GLONASS modes. I figured even if it does not, again there is no harm in trying, as it would not affect the other GPS options anyway. If anyone can shed more light on this, comments are welcome.
/system/etc/init.qcom.post_boot.sh
Only if you're using Xiaomi.eu's version, revert this file to the stock version to remove the additions they made at the end of this file.
/system/etc/install_app_filter.xml
Only if you're using the stock version, you can get rid of all the crap inside, as it doesn't serve any purpose but it's probably still parsed at every boot. Xiaomi.eu already has this file emptied. Make the contents look like this:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<app_list>
<add_apps>
</add_apps>
<ignore_apps>
</ignore_apps>
</app_list>
/system/etc/mcd_default.conf
Add your browser to the list of browser apps, so that it can be allowed to consume more resources (as browsers typically do). The entries for Chrome and Sleipnir, my favorite browser, look like this:
Code:
{"uid": "*", "name": "com.android.chrome*" },
{"uid": "*", "name": "jp.co.fenrir.android.sleipnir*" },
Other than that, I also remove here the privileged entry for com.miui.whetstone. Since Whetstone cannot be removed completely, I decided to leave the APKs for it for the moment as well. If anyone has any comments on Whetstone, please feel free to share.
/system/etc/spn-conf.xml
This file has the names of known mobile networks. (You might also be interested in /system/etc/apns-conf.xml, which has the APN settings.) You can edit the name of your network here, and it will be displayed by the phone accordingly. The version supplied with the stock ROM seems outdated but Xiaomi.eu's version appears to be even more out of date, so I replace it with the stock version. Unfortunately, I don't have a good source for an up-to-date version of this file: Google's Android source code only includes a couple of entries, and not the worldwide list. CyanogenMod's version also doesn't seem very good. If you know a good source for the spn-conf.xml updates, please share.
/system/etc/system_fonts.xml
Xiaomi.eu has replaced the MIUI font entries here with Roboto but this is redundant because they also replaced the MIUI font files so that the MIUI font is in fact the Roboto font anyway. Besides, the font configuration is spread around several other files (/system/etc/fallback_fonts.xml, /system/etc/fonts.xml), so making such change in one place only seems to make even less sense. Revert to stock.
 

Modifying the Boot Image
Attached to this post is a diff that includes all of the discussed changes, along with the modified files (except the file where you are supposed to put your own ADB key).
Purpose
Simply put, the boot image consists of the kernel and a small filesystem image that is mounted as the root (/) filesystem. There are some files of interest there but since this filesystem becomes read-only once booted, the only way to make any changes to it is to unpack it, modify, and repack before flashing. There are essentially three reasons to do this:
To enable ADB fingerprint check (disabling the insecure ADB), and to add our ADB key to the database.
To remove the fake CD-ROM emulation.
While we are at it, for cosmetic reasons we also change the default timezone from Asia/Shanghai.
There are numerous ways to unpack and repack boot images but if you're on Windows, the most straightforward method is to do it with the Android Image Kitchen.
Changes
Securing the ADB
/bin/adb_keys
Paste your public ADB key into this file. On Windows, you can find your ADB key in %USERPROFILE%\.android\adbkey.pub.
/default.prop
To enable the secure ADB, we edit the following line:
ro.adb.secure=1
Then, to change the timezone:
persist.sys.timezone=UTC
Disabling the CD-ROM Emulation
The remainder of the changes deals with getting rid of the emulated CD drive:
/init.qcom.usb.cdrom.rc
Delete this file completely.
/init.qcom.usb.rc
Remove the lines that say:
import init.qcom.usb.cdrom.rc
write /sys/class/android_usb/android0/f_mass_storage/lun/ro 1 (2x)
trigger set_cdrom_install_file (2x)
/init.qcom.usb.sh
Remove the following section:
Code:
#
# Add support for exposing lun0 as cdrom in mass-storage
#
cdromname="/system/etc/cdrom_install.iso"
case "$target" in
"msm8226" | "msm8610" | "msm8916")
case $soc_hwplatform in
"QRD")
echo "mounting usbcdrom lun"
echo $cdromname > /sys/class/android_usb/android0/f_mass_storage/rom/file
chmod 0444 /sys/class/android_usb/android0/f_mass_storage/rom/file
;;
esac
;;
esac
/init.rc
Remove the line that says:
write /sys/class/android_usb/android0/f_mass_storage/lun/file /system/etc/fake_cdrom_install.iso
Better yet, just use the attached diff for all of the above. I am also including an image obtained by applying the diff against the original stock image (version 5.12.31) although it's better if you do the patching yourself.
Flashing
Put your device into fastboot mode, and execute: fastboot erase boot, fastboot flash boot boot-patched.img, fastboot reboot. Note: do not mistake this for fastboot bootloader, which is a completely different partition and one you wouldn't want to overwrite.
Another way to flash the boot image will be discussed in the section related to automating the patches.

Patching and Recompiling the Application Packages
Attached to this post are diffs for each of the APKs, along with their recompiled patched versions. The recompiled versions are based on Xiaomi.eu's ROM version 5.12.31.
Purpose
Nearly everything can be customized by modifying the code inside the APK. Resources can also be changed to translate or modify text or images displayed in a particular place. This is a last resort for stuff that cannot be adjusted through the Settings interface or by editing the configuration files. As of now, with Leo/MIUI I do it for three reasons:
Remove the Mi Talk notification asking me to "activate" my SIM card, without confirming my phone number and sending the text message to Xiaomi.
Remove the Mi Voice (built-in VOIP) group from the Contacts
Remove the notification saying that I have "lost connectivity because I left my home network", which was nearly always on because I put a foreign SIM card in the second slot, even though the first card is selected for data. This last diff might also be useful to non-MIUI users.
Reference
What follows is a quick summary how to do the modifications described below. I will not be explaining everything in detail but it should be enough to get you started.
APK Tool Wrapper
apktool2.bat
Code:
@echo off
setlocal
set PATH=%CD%;%PATH%;
java -jar \path\to\apktool-2.x.x.jar %1 %2 %3 %4 %5 %6 %7 %8 %9
Initial Framework Installation
apktool2 if -t miui system/framework/framework-res.apk
apktool2 if -t miui system/framework/framework-ext-res/framework-ext-res.apk
apktool2 if -t miui system/app/miui/miui.apk
apktool2 if -t miui system/app/miuisystem/miuisystem.apk
This only needs to be done once, the first time you are modifying any MIUI APK.
Decompiling with APK Tool
apktool2 d -b -o <AppName> -r -t miui <AppName>.apk
Decompiling with -b skips the generation of comments such as line numbers, which should make the diffs easier to apply even against future versions. Also, since in the situations below I'm only modifying the code, the -r flag skips decompiling the resources.
Applying a Diff Patch
patch --binary --no-backup-if-mismatch -E -i <DiffFileName>.diff -p0
Generating a Diff Patch
To generate your own patches, the syntax is:
diff -uN <FileName>.orig <FileName> > <FileName>.diff
For a single file.
diff -urN <DirName>.orig <DirName> > <DirName>.diff
For a recursive patch comparing directories.
Before making any changes, copy the original file or directory to <FileName>.orig or <DirName>.orig
Recompiling with APK Tool
apktool2 b -a aapt-miui.exe -c -o <AppName>.apk.unaligned <AppName>
The special version of AAPT for MIUI is available from Xiaomi with the drivers package, although based on my experience, the regular AAPT works just as well. Using the -c flag just copies over the old signature, so we don't need to sign the app again, note however that this will not work if you make any changes to AndroidManifest.xml.
zipalign -f 4 <AppName>.unaligned.apk <AppName>.apk
Aligns the APK file.
Changes
Mi Talk SIM Card Activation Nag
/system/app/XiaomiServiceFramework/XiaomiServiceFramework.apk
The following patch removes the Mi Talk notification asking to "activate" the SIM card. Normally to get rid of this message you'd need to send a text message to Xiaomi every time you change the SIM card. The patch doesn't interfere with the Mi Talk functionality so if you decide to register for it later, it will still be possible. This just removes the notification nag.
The patch:
Code:
diff -urN XiaomiServiceFramework.orig/smali/com/xiaomi/activate/ActivateProgressController.smali XiaomiServiceFramework/smali/com/xiaomi/activate/ActivateProgressController.smali
--- XiaomiServiceFramework.orig/smali/com/xiaomi/activate/ActivateProgressController.smali Sat Jan 02 19:25:42 2016
+++ XiaomiServiceFramework/smali/com/xiaomi/activate/ActivateProgressController.smali Sat Jan 02 20:03:19 2016
@@ -168,20 +168,6 @@
.locals 2
.param p1 # Landroid/content/Context;
- const-string v1, "notification"
-
- invoke-virtual {p1, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
-
- move-result-object v0
-
- check-cast v0, Landroid/app/NotificationManager;
-
- const/4 v1, 0x5
-
- invoke-virtual {v0, v1}, Landroid/app/NotificationManager;->cancel(I)V
-
- invoke-static {}, Lcom/xiaomi/activate/ActivatePopupActivity;->dismiss()V
-
return-void
.end method
@@ -858,64 +844,6 @@
.method private notifyUnactivatedSimCards(Landroid/content/Context;)V
.locals 7
.param p1 # Landroid/content/Context;
-
- const/4 v6, 0x1
-
- const-string v3, "notification"
-
- invoke-virtual {p1, v3}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
-
- move-result-object v1
-
- check-cast v1, Landroid/app/NotificationManager;
-
- new-instance v0, Landroid/app/Notification$Builder;
-
- invoke-direct {v0, p1}, Landroid/app/Notification$Builder;-><init>(Landroid/content/Context;)V
-
- const v3, 0x7f07002c
-
- invoke-virtual {p1, v3}, Landroid/content/Context;->getString(I)Ljava/lang/String;
-
- move-result-object v3
-
- invoke-virtual {v0, v3}, Landroid/app/Notification$Builder;->setContentTitle(Ljava/lang/CharSequence;)Landroid/app/Notification$Builder;
-
- invoke-static {}, Lcom/xiaomi/activate/ActivateExternal;->getSysInteface()Lcom/xiaomi/activate/SysInterface;
-
- move-result-object v3
-
- invoke-interface {v3}, Lcom/xiaomi/activate/SysInterface;->getAppIconRes()I
-
- move-result v3
-
- invoke-virtual {v0, v3}, Landroid/app/Notification$Builder;->setSmallIcon(I)Landroid/app/Notification$Builder;
-
- invoke-virtual {v0, v6}, Landroid/app/Notification$Builder;->setAutoCancel(Z)Landroid/app/Notification$Builder;
-
- invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
-
- move-result-wide v4
-
- invoke-virtual {v0, v4, v5}, Landroid/app/Notification$Builder;->setWhen(J)Landroid/app/Notification$Builder;
-
- const/4 v3, -0x1
-
- const/4 v4, 0x0
-
- invoke-static {p1, v3, v6, v4}, Lcom/xiaomi/activate/ActivateProgressController;->getActivatePopupPendingIntent(Landroid/content/Context;IILjava/lang/String;)Landroid/app/PendingIntent;
-
- move-result-object v2
-
- invoke-virtual {v0, v2}, Landroid/app/Notification$Builder;->setContentIntent(Landroid/app/PendingIntent;)Landroid/app/Notification$Builder;
-
- const/4 v3, 0x5
-
- invoke-virtual {v0}, Landroid/app/Notification$Builder;->build()Landroid/app/Notification;
-
- move-result-object v4
-
- invoke-virtual {v1, v3, v4}, Landroid/app/NotificationManager;->notify(ILandroid/app/Notification;)V
invoke-direct {p0}, Lcom/xiaomi/activate/ActivateProgressController;->setNotifiedEverFlagTrue()V
Apply with:
adb pull /system/app/XiaomiServiceFramework/XiaomiServiceFramework.apk
apktool2 d -b -o XiaomiServiceFramework -r -t miui XiaomiServiceFramework.apk
patch --binary --no-backup-if-mismatch -E -i system_app_XiaomiServiceFramework.diff -p0
apktool2 b -a aapt-miui.exe -c -o XiaomiServiceFramework.apk.unaligned XiaomiServiceFramework
zipalign -f 4 XiaomiServiceFramework.apk.unaligned XiaomiServiceFramework.apk
adb root
adb shell mount -o remount,rw /system
adb push XiaomiServiceFramework.apk /system/app/XiaomiServiceFramework/
Mi Voice Ad in Contacts
/system/priv-app/Contacts/Contacts.apk
MIUI Contacts now include a "Mi Voice" entry, which is essentially just an ad encouraging you to sign up for Xiaomi's proprietary VoIP service. The contact cannot be deleted or hidden from within the Settings, at least without activating it first, which involves sending a text message (again). This patch will get rid of it. It does not impact any of the other functionality of Mi Voice, so if you decide to register with it later, it should still work. Just do it from the Settings menu instead.
The patch:
Code:
diff -urN Contacts.orig/smali/com/android/contacts/list/ProfileAndContactsLoader.smali Contacts/smali/com/android/contacts/list/ProfileAndContactsLoader.smali
--- Contacts.orig/smali/com/android/contacts/list/ProfileAndContactsLoader.smali Tue Jan 05 17:53:40 2016
+++ Contacts/smali/com/android/contacts/list/ProfileAndContactsLoader.smali Tue Jan 05 17:57:12 2016
@@ -190,19 +190,6 @@
invoke-virtual {v8, v9}, Landroid/database/MatrixCursor;->addRow([Ljava/lang/Object;)V
:cond_3
- iget-boolean v0, p0, Lcom/android/contacts/list/ProfileAndContactsLoader;->mLoadVoipGroup:Z
-
- if-eqz v0, :cond_4
-
- const-string v0, "lookup_voip_group"
-
- const v1, 0x7f0c03ff
-
- invoke-direct {p0, v0, v1}, Lcom/android/contacts/list/ProfileAndContactsLoader;->loadGroupItem(Ljava/lang/String;I)[Ljava/lang/Object;
-
- move-result-object v9
-
- invoke-virtual {v8, v9}, Landroid/database/MatrixCursor;->addRow([Ljava/lang/Object;)V
:cond_4
iget-boolean v0, p0, Lcom/android/contacts/list/ProfileAndContactsLoader;->mLoadFollowedYellowPage:Z
Apply with:
adb pull /system/priv-app/Contacts/Contacts.apk
apktool2 d -b -o Contacts -r -t miui Contacts.apk
patch --binary --no-backup-if-mismatch -E -i system_priv-app_Contacts.diff -p0
apktool2 b -a aapt-miui.exe -c -o Contacts.apk.unaligned Contacts
zipalign -f 4 Contacts.apk.unaligned Contacts.apk
adb root
adb shell mount -o remount,rw /system
adb push Contacts.apk /system/priv-app/Contacts/
Data Roaming Lost Connection Notification
/system/priv-app/TeleService/TeleService.apk
This patch will remove the notification saying that "You have lost data connectivity because you left your home network". This is not a MIUI-specific message but I believe this notification being active all the time is due to a some glitch in the way MIUI handles the two SIM cards: in my setup, I have a local and a foreign SIM card inserted in my phone, however it is the former one that is selected for mobile data, and the data connection is working just fine, so by all means this notification should not pop up in such circumstances.
Anyway, as this message is annoying and useless in stock Android too, this diff might also be useful to non-MIUI users: feel free to adapt it to your needs of course.
The patch:
Code:
diff -urN TeleService.orig/smali/com/android/phone/NotificationMgr.smali TeleService/smali/com/android/phone/NotificationMgr.smali
--- TeleService.orig/smali/com/android/phone/NotificationMgr.smali Mon Jan 04 00:42:16 2016
+++ TeleService/smali/com/android/phone/NotificationMgr.smali Mon Jan 04 00:51:47 2016
@@ -637,27 +637,6 @@
# virtual methods
-.method hideDataDisconnectedRoaming()V
- .locals 2
-
- sget-boolean v0, Lcom/android/phone/NotificationMgr;->DBG:Z
-
- if-eqz v0, :cond_0
-
- const-string v0, "hideDataDisconnectedRoaming()..."
-
- invoke-direct {p0, v0}, Lcom/android/phone/NotificationMgr;->log(Ljava/lang/String;)V
-
- :cond_0
- iget-object v0, p0, Lcom/android/phone/NotificationMgr;->mNotificationManager:Landroid/app/NotificationManager;
-
- const/4 v1, 0x5
-
- invoke-virtual {v0, v1}, Landroid/app/NotificationManager;->cancel(I)V
-
- return-void
-.end method
-
.method public postTransientNotification(ILjava/lang/CharSequence;)V
.locals 2
.param p1 # I
@@ -686,167 +665,6 @@
invoke-virtual {v0}, Landroid/widget/Toast;->show()V
- return-void
-.end method
-
-.method showDataDisconnectedRoaming()V
- .locals 13
-
- const/4 v10, 0x0
-
- const/4 v12, 0x0
-
- sget-boolean v9, Lcom/android/phone/NotificationMgr;->DBG:Z
-
- if-eqz v9, :cond_0
-
- const-string v9, "showDataDisconnectedRoaming()..."
-
- invoke-direct {p0, v9}, Lcom/android/phone/NotificationMgr;->log(Ljava/lang/String;)V
-
- :cond_0
- new-instance v4, Landroid/content/Intent;
-
- iget-object v9, p0, Lcom/android/phone/NotificationMgr;->mContext:Landroid/content/Context;
-
- const-class v11, Lcom/android/phone/settings/MobileNetworkSettings;
-
- invoke-direct {v4, v9, v11}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V
-
- iget-object v9, p0, Lcom/android/phone/NotificationMgr;->mContext:Landroid/content/Context;
-
- invoke-static {v9, v12, v4, v12}, Landroid/app/PendingIntent;->getActivity(Landroid/content/Context;ILandroid/content/Intent;I)Landroid/app/PendingIntent;
-
- move-result-object v1
-
- iget-object v9, p0, Lcom/android/phone/NotificationMgr;->mContext:Landroid/content/Context;
-
- const v11, 0x7f090221
-
- invoke-virtual {v9, v11}, Landroid/content/Context;->getText(I)Ljava/lang/CharSequence;
-
- move-result-object v2
-
- new-instance v9, Landroid/app/Notification$Builder;
-
- iget-object v11, p0, Lcom/android/phone/NotificationMgr;->mContext:Landroid/content/Context;
-
- invoke-direct {v9, v11}, Landroid/app/Notification$Builder;-><init>(Landroid/content/Context;)V
-
- const v11, 0x108008a
-
- invoke-virtual {v9, v11}, Landroid/app/Notification$Builder;->setSmallIcon(I)Landroid/app/Notification$Builder;
-
- move-result-object v9
-
- iget-object v11, p0, Lcom/android/phone/NotificationMgr;->mContext:Landroid/content/Context;
-
- const v12, 0x7f09021e
-
- invoke-virtual {v11, v12}, Landroid/content/Context;->getText(I)Ljava/lang/CharSequence;
-
- move-result-object v11
-
- invoke-virtual {v9, v11}, Landroid/app/Notification$Builder;->setContentTitle(Ljava/lang/CharSequence;)Landroid/app/Notification$Builder;
-
- move-result-object v9
-
- iget-object v11, p0, Lcom/android/phone/NotificationMgr;->mContext:Landroid/content/Context;
-
- invoke-virtual {v11}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
-
- move-result-object v11
-
- const v12, 0x7f070027
-
- invoke-virtual {v11, v12}, Landroid/content/res/Resources;->getColor(I)I
-
- move-result v11
-
- invoke-virtual {v9, v11}, Landroid/app/Notification$Builder;->setColor(I)Landroid/app/Notification$Builder;
-
- move-result-object v9
-
- invoke-virtual {v9, v2}, Landroid/app/Notification$Builder;->setContentText(Ljava/lang/CharSequence;)Landroid/app/Notification$Builder;
-
- move-result-object v0
-
- iget-object v9, p0, Lcom/android/phone/NotificationMgr;->mUserManager:Landroid/os/UserManager;
-
- const/4 v11, 0x1
-
- invoke-virtual {v9, v11}, Landroid/os/UserManager;->getUsers(Z)Ljava/util/List;
-
- move-result-object v8
-
- const/4 v3, 0x0
-
- :goto_0
- invoke-interface {v8}, Ljava/util/List;->size()I
-
- move-result v9
-
- if-ge v3, v9, :cond_3
-
- invoke-interface {v8, v3}, Ljava/util/List;->get(I)Ljava/lang/Object;
-
- move-result-object v6
-
- check-cast v6, Landroid/content/pm/UserInfo;
-
- invoke-virtual {v6}, Landroid/content/pm/UserInfo;->isManagedProfile()Z
-
- move-result v9
-
- if-eqz v9, :cond_1
-
- :goto_1
- add-int/lit8 v3, v3, 0x1
-
- goto :goto_0
-
- :cond_1
- invoke-virtual {v6}, Landroid/content/pm/UserInfo;->getUserHandle()Landroid/os/UserHandle;
-
- move-result-object v7
-
- invoke-virtual {v7}, Landroid/os/UserHandle;->isOwner()Z
-
- move-result v9
-
- if-eqz v9, :cond_2
-
- move-object v9, v1
-
- :goto_2
- invoke-virtual {v0, v9}, Landroid/app/Notification$Builder;->setContentIntent(Landroid/app/PendingIntent;)Landroid/app/Notification$Builder;
-
- new-instance v9, Landroid/app/Notification$BigTextStyle;
-
- invoke-direct {v9, v0}, Landroid/app/Notification$BigTextStyle;-><init>(Landroid/app/Notification$Builder;)V
-
- invoke-virtual {v9, v2}, Landroid/app/Notification$BigTextStyle;->bigText(Ljava/lang/CharSequence;)Landroid/app/Notification$BigTextStyle;
-
- move-result-object v9
-
- invoke-virtual {v9}, Landroid/app/Notification$BigTextStyle;->build()Landroid/app/Notification;
-
- move-result-object v5
-
- iget-object v9, p0, Lcom/android/phone/NotificationMgr;->mNotificationManager:Landroid/app/NotificationManager;
-
- const/4 v11, 0x5
-
- invoke-virtual {v9, v10, v11, v5, v7}, Landroid/app/NotificationManager;->notifyAsUser(Ljava/lang/String;ILandroid/app/Notification;Landroid/os/UserHandle;)V
-
- goto :goto_1
-
- :cond_2
- move-object v9, v10
-
- goto :goto_2
-
- :cond_3
return-void
.end method
diff -urN TeleService.orig/smali/com/android/phone/PhoneGlobals$1.smali TeleService/smali/com/android/phone/PhoneGlobals$1.smali
--- TeleService.orig/smali/com/android/phone/PhoneGlobals$1.smali Mon Jan 04 00:42:16 2016
+++ TeleService/smali/com/android/phone/PhoneGlobals$1.smali Mon Jan 04 00:51:37 2016
@@ -112,20 +112,10 @@
goto :goto_0
:sswitch_3
- iget-object v4, p0, Lcom/android/phone/PhoneGlobals$1;->this$0:Lcom/android/phone/PhoneGlobals;
- iget-object v4, v4, Lcom/android/phone/PhoneGlobals;->notificationMgr:Lcom/android/phone/NotificationMgr;
-
- invoke-virtual {v4}, Lcom/android/phone/NotificationMgr;->showDataDisconnectedRoaming()V
-
goto :goto_0
:sswitch_4
- iget-object v4, p0, Lcom/android/phone/PhoneGlobals$1;->this$0:Lcom/android/phone/PhoneGlobals;
-
- iget-object v4, v4, Lcom/android/phone/PhoneGlobals;->notificationMgr:Lcom/android/phone/NotificationMgr;
-
- invoke-virtual {v4}, Lcom/android/phone/NotificationMgr;->hideDataDisconnectedRoaming()V
goto :goto_0
Apply with:
adb pull /system/priv-app/TeleService/TeleService.apk
apktool2 d -b -o TeleService -r -t miui TeleService.apk
patch --binary --no-backup-if-mismatch -E -i system_priv-app_TeleService.diff -p0
apktool2 b -a aapt-miui.exe -c -o TeleService.apk.unaligned TeleService
zipalign -f 4 TeleService.apk.unaligned TeleService.apk
adb root
adb shell mount -o remount,rw /system
adb push TeleService.apk /system/priv-app/TeleService/

Modifying the Theme Settings
MIUI allows a lot of theme customization. Fortunately, this part is relatively well-documented elsewhere, and I'm not writing this to repeat something that is already well-known but rather to contribute something new. Thus, unlike the other sections, here I will just briefly go through some of the possibilities.
Note that the *.mrc and *.mtz files, as well as most of the files with no extension, are in fact ZIP archives that can be unpacked and repacked again. The *.mrm files are directly editable text files. If you make some edits to a gadget, you might need to update its size and change the hash value in the corresponding .mrm file. The latter is just the MD5 sum of the file.
Themes are part of the System partition image, which was already discussed above; its only split into a separate section for the sake of organization.
Gadgets & Translations
/system/media/theme/.data/meta/
/system/media/theme/default/gadgets/
/system/media/theme/default/keyguardmusicview
/system/media/theme/default/powermenu
These files are responsible for the gadget layout as well as some of the translations. The layout seems to change relatively often with the stock China Developer ROM, which however does not include translations to Western languages. On the other hand, Xiaomi.eu's rom, while including the translations, seems to be based on an outdated layout in some places. Further, MIUI Pro includes some gadgets not available in any of the two, most likely coming from an earlier stock version.
The version posted as an attachment below, which I prepared for my own use, is a hybrid made in the following way:
Start with the China Developer ROM.
Port the translations from Xiaomi.eu, while keeping the stock translations for the other (Asian) languages as well, which Xiaomi.eu seems to delete.
Port some of the Xiaomi.eu's changes, where it makes sense to do so (the China version is supposed to show the Air Quality Index but this only works within China, and is reported as 0 for international locations, so it's been hidden).
Port some of the enhancements from MIUI Pro (two additional Music widgets and some modifications of default icons for Google services).
The result is yours to download and modify further.
MIUI-Themed App Icons
/system/media/theme/miui_mod_icons/<AppPackageName>.png
Icons put in this directory will replace the default app icons. The format is 192x192 px PNG-24. To find out the app package name, run:
adb shell pm list packages
The stock ROM includes just a couple of themed icons. Xiaomi.eu and MIUI Pro both have a considerable collection, although the latter is about three times larger than the former. I have merged the icons from all the three sources and they are available for download below, along with a dozen or so icons I designed myself for some niché apps I use.
The selection is somehow arbitrary, as the icons overlap for about 100 apps between Xiaomi.eu and MIUI Pro, so if you don't like the choice I made, download each of the ROMs and go through the icons yourself, choosing the ones according to your preference.
Note that after you change the icons, you need to re-apply the default theme (using the Themes app). It is not necessary to reboot your device.
MIUI Default Wallpapers
/system/media/theme/lock_wallpaper
If you want to change the default lockscreen and desktop wallpapers, notice that they are set to the following files:
/system/media/lockscreen/lockscreen_000.jpg
/system/media/wallpaper/wallpaper_000.jpg
Alternatively, you can change these paths in:
/system/media/theme/.data/meta/lockscreen/default.mrm
/system/media/theme/.data/meta/wallpaper/default.mrm
Per-Application Theming
/system/media/theme/<AppPackageName>
This is a really great feature of MIUI that gives endless possibilities of adjusting the appearance of an application. The file (no extension) is in fact a ZIP archive whose structure mimics that of the corresponding APK, and any files present in this archive (such as resources) will replace those placed inside the original APK. Also, the special file called theme_values.xml can be used to replace any strings inside.
One most straightforward way to employ the above is to rename an application. Generally, the application names are hard-coded inside the APK under the constant app_name. Thus, the theme_values.xml inside the <AppPackageName> could look like that:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<MIUI_Theme_Values>
<string name="app_name">New Name</string>
</MIUI_Theme_Values>
For some APKs, the variable that stores the name might be different, in which case you can take a look inside with APK Tool, using the method described in the previous post. To conclude with an example, the attached file changes the names of "SIM Toolkit" and "SIM Toolkit2" into "SIM1 Toolkit" and "SIM2 Toolkit" respectively. In this case, the relevant theme_values.xml are:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<MIUI_Theme_Values>
<string name="app_name">SIM1 Toolkit</string>
<string name="app_name2">SIM2 Toolkit</string>
<string name="app_name3">SIM3 Toolkit</string>
</MIUI_Theme_Values>
 

Automating the Modifications
Doing all the modifications as described above might soon get tedious. What if there was a way to automate them? Well, there actually is. With the help of an Edify ("Update") script, the whole process becomes much faster.
The Edify Script
Code:
# Xiaomi Note Pro (Leo) Customization Script
# Aqq123 @ XDA, http://forum.xda-developers.com/showthread.php?t=3286972
# MIUI7 5.12.31, Xiaomi.eu Image
### Edify Scripting Reference ###
# abort("msg");
# delete("/path");
# delete_recursive("/path");
# format("fstype", "parttype", "/dev");
# getprop("sys.prop.name");
# get_device_compatible("device_name");
# mount("fstype", "parttype", "/dev", "/mntpt", "mntopts");
# package_extract_dir("dir_in_zip", "/dst_dir");
# package_extract_file("/src", "/dst");
# run_program("/path", "--param1", "--param2", "--param3");
# set_metadata("/path", "uid", uid, "gid", gid, "mode", 0644,
# "capabilities", 0, "selabel", "u:object_r:system_file:s0");
# set_metadata_recursive("/path", "uid", uid, "gid", gid, "dmode", 0755, "fmode", 0644,
# "capabilities", 0, "selabel", "u:object_r:system_file:s0");
# symlink(dst, src[, src2, ...]);
# ui_print("msg");
# umount("/mntpt");
######
# Compatibility Check
ui_print("Checking compatibility...");
get_device_compatible("leo") == "OK" || abort("The update is not intended for this device.");
set_progress(0.000000);
show_progress(1.34, 100);
# Mount Filesystems
ui_print("Mounting filesystems...");
mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/system", "/system", "barrier=1,commit=1,data=ordered,errors=panic,max_batch_time=0,nodelalloc");
# || abort("System: Failed to mount partition!");
#mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/cache", "/cache", "");
# || abort("Cache: Failed to mount partition!");
mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/userdata", "/data", "");
# || abort("Data: Failed to mount partition!");
# Note: Do not use "|| abort(...)" with TWRP as partitions are already mounted.
########
# BOOT #
########
# Extract
ui_print("Boot: Extracting items...");
package_extract_file("boot-patched.img", "/dev/block/bootdevice/by-name/boot") || abort("Boot: Extraction failed!");
##########
# SYSTEM #
##########
# Delete
ui_print("System: Deleting items...");
# Apps
delete_recursive("/system/app/AnalyticsCore/");
delete_recursive("/system/app/BaiduNetworkLocation/");
delete_recursive("/system/app/BugReport/");
delete_recursive("/system/app/matcli/");
delete_recursive("/system/app/Metok/");
delete_recursive("/system/app/MiLinkService/");
delete_recursive("/system/app/NVItem/");
delete_recursive("/system/app/PicoTts/");
delete_recursive("/system/app/SecurityAdd/");
delete_recursive("/system/app/TrafficControl/");
delete_recursive("/system/app/VirtualSim/");
delete_recursive("/system/app/XiaomiVip/");
delete_recursive("/system/app/XMPass/");
# Apps Already Removed in Xiaomi.eu
#delete_recursive("/system/app/BasicDreams/");
#delete_recursive("/system/app/Galaxy4/");
#delete_recursive("/system/app/GameCenter/");
#delete_recursive("/system/app/GooglePinyinIME/");
#delete_recursive("/system/app/HoloSpiralWallpaper/");
#delete_recursive("/system/app/LiveWallpapers/");
#delete_recursive("/system/app/MiuiSuperMarket/");
#delete_recursive("/system/app/NoiseField/");
#delete_recursive("/system/app/PaymentService/");
#delete_recursive("/system/app/PhaseBeam/");
#delete_recursive("/system/app/PhotoTable/");
#delete_recursive("/system/app/SystemAdSolution/");
#delete_recursive("/system/app/VisualizationWallpapers/");
#delete_recursive("/system/app/VirtualSim/");
#delete_recursive("/system/app/VoiceAssist/");
#delete_recursive("/system/priv-app/MiGameCenterSDKService/");
# Other Garbage
delete_recursive("/system/bin/qmi-framework-tests/");
delete("/system/etc/fake_cdrom_install.iso");
delete("/system/media/audio/create_symlink_for_audio-timestamp");
# Google Apps
delete("/system/etc/permissions/com.google.android.dialer.support.xml");
#delete("/system/etc/permissions/com.google.android.maps.xml"); # Careful! Also present in stock
delete("/system/etc/permissions/com.google.android.media.effects.xml");
delete("/system/etc/permissions/com.google.widevine.software.drm.xml");
delete("/system/etc/preferred-apps/google.xml");
delete("/system/etc/preferred-apps/");
delete("/system/etc/sysconfig/google.xml");
delete("/system/etc/sysconfig/google_build.xml");
delete("/system/etc/sysconfig/");
delete("/system/framework/com.google.android.dialer.support.jar");
#delete("/system/framework/com.google.android.maps.jar"); # Careful! Also present in stock
delete("/system/framework/com.google.android.media.effects.jar");
delete("/system/framework/com.google.widevine.software.drm.jar");
delete_recursive("/system/app/CloudPrint2/");
delete_recursive("/system/app/GoogleCalendarSyncAdapter/");
delete_recursive("/system/app/GoogleContactsSyncAdapter/");
delete_recursive("/system/priv-app/GoogleBackupTransport/");
delete_recursive("/system/priv-app/GoogleFeedback/");
delete_recursive("/system/priv-app/GoogleLoginService/");
delete_recursive("/system/priv-app/GoogleOneTimeInitializer/");
delete_recursive("/system/priv-app/GooglePartnerSetup/");
delete_recursive("/system/priv-app/GoogleServicesFramework/");
delete_recursive("/system/priv-app/Phonesky/");
delete_recursive("/system/priv-app/PrebuiltGmsCore/");
# Fonts
delete("/system/fonts/AndroidEmoji.ttf");
delete("/system/fonts/DroidNaskh-Regular-SystemUI.ttf");
delete("/system/fonts/NotoSansHebrewUI-Bold.ttf"); # Just a copy, there is UI variant for Hebrew
delete("/system/fonts/NotoSansHebrewUI-Regular.ttf"); # Just a copy, there is no UI variant for Hebrew
# Default Audio Resources (Only Remove If Replacing Your Own)
#delete_recursive("/system/media/audio/alarms/");
#delete_recursive("/system/media/audio/notifications/");
#delete_recursive("/system/media/audio/ringtones/");
# Default Visual Resources (Only Remove If Replacing Your Own)
#delete_recursive("/system/media/lockscreen/");
delete_recursive("/system/media/theme/miui_mod_icons/");
#delete_recursive("/system/media/wallpaper/");
# Extract
ui_print("System: Extracting items...");
package_extract_dir("system", "/system") || abort("System: Extraction failed!");
# Set Metadata
ui_print("System: Setting permissions...");
set_metadata_recursive("/system/app/",
"uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644,
"capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata("/system/build.prop", "uid", 0, "gid", 0, "mode", 0644,
"capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata("/system/etc/gps.conf", "uid", 0, "gid", 0, "mode", 0644,
"capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata("/system/etc/init.qcom.post_boot.sh", "uid", 0, "gid", 0, "mode", 0644,
"capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata("/system/etc/mcd_default.conf", "uid", 0, "gid", 0, "mode", 0644,
"capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata("/system/etc/spn-conf.xml", "uid", 0, "gid", 0, "mode", 0644,
"capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata("/system/etc/system_fonts.xml", "uid", 0, "gid", 0, "mode", 0644,
"capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata_recursive("/system/fonts/",
"uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644,
"capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata_recursive("/system/media/",
"uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644,
"capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata_recursive("/system/priv-app/",
"uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644,
"capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata_recursive("/system/usr/",
"uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644,
"capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
########
# DATA #
########
# Delete
ui_print("Data: Deleting items...");
delete_recursive("/data/evt-test/");
delete_recursive("/data/media/MIUI/");
delete_recursive("/data/miui/app/");
delete_recursive("/data/miui/cust/");
delete_recursive("/data/miui/gallery/");
delete_recursive("/data/miui/mms/");
delete_recursive("/data/miui/videoplugins/");
delete_recursive("/data/miui/yellowpage/");
delete_recursive("/data/qmi-framework-tests/");
# Already Removed in Xiaomi.eu
#delete("/data/miui/app/vanward_applist");
#delete("/data/miui/cdrom_install.iso");
#delete("/data/miui/cust_variant");
# MIUI Update Binary
ui_print("Data: Executing MIUI Update Binary...");
package_extract_file("META-INF/com/miui/miui_update", "/cache/miui_update");
set_metadata("/cache/miui_update", "uid", 0, "gid", 0, "mode", 0555, "capabilities", 0x0);
run_program("/cache/miui_update");
delete("/cache/miui_update");
# Extract
ui_print("Data: Extracting items...");
package_extract_dir("data", "/data") || abort("Data: Extraction failed!");
# Set Metadata
ui_print("Data: Setting permissions...");
set_metadata_recursive("/data/miui", "uid", 1000, "gid", 1000, "dmode", 0755, "fmode", 0644,
"capabilities", 0x0);
#########
# CACHE #
#########
# Wipe Cache
#ui_print("Wiping cache...");
#delete_recursive("/cache/");
# Wipe Dalvik Cache
ui_print("Wiping Dalvik cache...");
delete_recursive("/data/dalvik-cache/");
# Unmount
ui_print("Unmounting filesystems...");
unmount("/system");
#unmount("/cache");
unmount("/data");
# Finish
set_progress(1.000000);
ui_print("Finished.");
When reusing the above script, please retain the attribution notice:
Code:
Aqq123 @ XDA, http://forum.xda-developers.com/showthread.php?t=3286972
Thank you!
The Update ZIP Archive
Next, we'll create a collection of all the changed files we want installed on top of the original installation. The collection will have the following structure:
./data/
Everything in here will be unpacked into the /data partition.
./system/
Everything in here will be unpacked into the /system partition.
./boot-patched.img
The modified boot image that will be flashed into the boot partition.
./META-INF/com/android/metadata
./META-INF/com/android/otacert
Essentially redundant files that I'm keeping out of sentiment.
./META-INF/com/google/android/update-binary
./META-INF/com/miui/miui_update
Helper binaries that are taken from the latest version of the China Developer ROM installer.
./META-INF/com/google/android/updater-script
This is where we put the above Edify script. Note that the script is "updater", whereas the binary is "update."
All the stuff needs to be collected together and packed as one ZIP archive, which then becomes a flashable ZIP from inside the TWRP recovery or with adb sideload aqq123patch.zip, immediately after flashing the full MIUI image.
The Patch Builder Script
To automate things further, here is a simple batch script called build_patch.bat that rebuilds the patch file:
Code:
@echo off
if exist aqq123patch_leo*.zip del /f /q aqq123patch_leo*.zip
zip -r aqq123patch_leo.zip . -x *.bat *.zip
rem To generate a signed version, using signapk and your own key
rem change the above name to aqq123patch_leo_unsigned.zip
rem and uncomment the following two lines:
rem call signapkw aqq123patch_leo_unsigned.zip aqq123patch_leo.zip
rem del /f /q aqq123patch_leo_unsigned.zip
The script, also included in the attached archive, allows you to generate a signed archive as well, which is what I do, however you would need to have the signapkw.bat wrapper set up with your own key. For example:
Code:
@echo off
set PATH_SAVE=%PATH%
set PATH=%CD%;%PATH%;
java -jar "signapk.jar" -w "signapk.x509.pem" "signapk.pk8" %1 %2 %3 %4 %5 %6 %7 %8 %9
set PATH=%PATH_SAVE%
set PATH_SAVE=
The Complete Patch
For your convenience, all the stuff is attached to this post as a single archive. Note however that due to the 20 MiB attachment size constraint, I needed to leave out a couple of larger files, which you need to manually download from the attachments to previous posts and put into the appropriate directories. These are:
boot-patched.img
The modified boot partition image.
system/app/XiaomiServiceFramework/XiaomiServiceFramework.apk
system/priv-app/Contacts/Contacts.apk
system/priv-app/TeleService/TeleService.apk
The patched APKs.
system/fonts/*
system/usr/icu/icudt53l.dat
system/usr/share/zoneinfo/tzdata
Updated fonts, Unicode database and timezone data.
system/media/theme/miui_mod_icons/*
The merged collection of MIUI-themed app icons from MIUI Pro, Xiaomi.eu and the stock MIUI along with some obscure icons I designed on my own.
You are of course free to leave out any files you don't want included or put some more of your own. For example, I also install my own set of ringtones and wallpapers while removing the default ones this way. Note the following though:
If you don't want to flash the boot-patched.img, you need to edit the Edify script above (which I encourage you to do anyway).
If you put anything into other directories than the ones that are mentioned throughout this guide, you might need to adjust the metadata (ownership, permissions and SELinux labels).
If making the above changes, you might also want tocopy the ./file_contexts from the stock installer ZIP. I am not including it here, as with the way I use this script, it's not necessary (although you will see a warning about it in TWRP, just ignore it).

Automated Installation of Google Apps
Purpose
Xiaomi.eu's ROM already includes a minimal distribution of Google Apps. It's very good decision to only include the basic stuff so that the users can then decide what to install, which is simple enough with the Play Store.
This setup works perfectly for most users, so what I'm doing here is by no means necessary. It however allows you to use some of the remaining space on your /system partition that would otherwise be left empty. It also lets you have a more fine-grained control over what's installed. Finally, if as your base you chose another ROM that does not include Google Apps, you probably want to figure out a way to install them and what follows is likely the best one.
Choosing the Google Apps Distribution
Open GApps is arguably the best distribution of Google Apps. It comes in several different sizes. I suggest going with the largest Super version and then automatically trimming what is installed with an automated install script. Download the relevant version here.
You could just flash the downloaded ZIP although the installation will most likely fail due to lack of space. Also, no-one really needs to have all the Google Apps.
Scripting the Google Apps Installation
Open GApps setup can be customized with an answer file. I encourage you to read the full documentation but just to get you started, create a file gapps-config-leo.txt and use the following content (also attached) as a template:
Code:
# gapps-config-leo.txt
# Aqq123 @ XDA, http://forum.xda-developers.com/showthread.php?t=3286972
#forceclean # Allow Camera installation on upgrade
#forcedpi480 # Set DPI to 160, 240, 320, 480, 560, 640
NoDebug # Disable the generation of open_gapps_debug_logs.tar.gz
#Override # Allow removing all keyboards, launchers and SMS apps
#Test # Only simulate and generate open_gapps_log.txt
# Version to be installed
SuperGApps
#StockGApps
#FullGApps
#MiniGApps
#MicroGApps
#NanoGApps
#PicoGApps
# Whether to exclude or include listed apps
Exclude
#Include
# Google App List
AndroidForWork # Super
AndroidPay # Super
#Books # Super/Stock/Full
CalendarGoogle # Super/Stock/Full/Mini/Micro
#CalSync # Super/Stock/Full/Mini/Micro/Nano/Pico
CalculatorGoogle# Super/Stock/Full/Mini
CameraGoogle # Super/Stock
Chrome # Super/Stock/Full
ClockGoogle # Super/Stock/Full/Mini (Desk Clock)
CloudPrint # Super/Stock/Full
ContactsGoogle # Super/Stock
DialerGoogle # Super/Stock [Apparently already excluded]
DMAgent # Super (Google Apps Device Policy)
Docs # Super/Stock/Full
#Drive # Super/Stock/Full
Ears # Super/Stock/Full (Sound Search)
#Earth # Super
#ExchangeGoogle # Super/Stock/Full/Mini/Micro
FaceDetect # Super/Stock/Full/Mini/Micro/Nano
FaceUnlock # Super/Stock/Full/Mini/Micro/Nano
Fitness # Super/Stock/Full
GCS # Super [Removes ProjectFi]
#Gmail # Super/Stock/Full/Mini/Micro
GoogleNow # Super/Stock/Full/Mini/Micro [Removed by Search]
GooglePlus # Super/Stock/Full/Mini
#GoogleTTS # Super/Stock/Full/Mini/Micro
Hangouts # Super/Stock/Full/Mini
Indic # Super
Japanese # Super
Keep # Super/Stock/Full
#KeyboardGoogle # Super/Stock
Korean # Super
#Maps # Super/Stock/Full/Mini
Messenger # Super/Stock [Not installable on tablets]
Movies # Super/Stock/Full
Music # Super/Stock/Full
NewsStand # Super/Stock/Full
#NewsWidget # Super/Stock/Full
#Photos # Super/Stock/Full/Mini
Pinyin # Super
PlayGames # Super/Stock/Full
ProjectFi # Super [Removed by GCS]
Sheets # Super/Stock/Full
Slides # Super/Stock/Full
Search # Super/Stock/Full/Mini/Micro/Nano [Removes GoogleNow]
#Speech # Super/Stock/Full/Mini/Micro/Nano [Required for "OK Google"]
#Street # Super
TagGoogle # Super/Stock/Full/Mini <No hardware support for NFC>
Talkback # Super/Stock/Full
#Translate # Translate
#WebviewGoogle # Super/Stock [Already present in MIUI, Old version possibly broken]
YouTube # Super/Stock/Full/Mini
Zhuyin # Super
# Stock/AOSP App List
# Generally Not Applicable to MIUI
#BasicDreams
+Browser
#CalendarStock
#CameraStock
#ClockStock
#CMAccount
#CMAudioFX
#CMEleven # (CM Music)
#CMFileManager
#CMUpdater
#CMSetupWizard
#CMWallpapers
#DashClock
+Email
#ExchangeStock
#FMRadio
+Gallery
#Galaxy
#HoloSpiral
KeyboardStock
+Launcher
#LiveWallpapers
#LockClock
+MMS
#NoiseField
#Phasebeam
#PhotoPhase
#PhotoTable
PicoTTS
#SimToolKit
#Studio
#SykoPath
#TagStock
#Terminal
#Themes
#VisualizationWallpapers
#WhisperPush
# Universal App Removal
#(DocumentsUi)
#(DownloadProviderUi)
#(DownloadsUi)
This file (written by me, please retain the attribution notice when sharing) includes an example setup but also lists all the possible options and is extensively commented, so hopefully it'll make for a good start.
Flashing
Once you're ready, put the text file in the same directory as the Open GApps package you are about to flash (say, the root of your User Data partition available through MTP) and install the Open GApps ZIP file through the recovery.
A note about installing GApps: while the patch described in the previous can be installed over the original MIUI system before booting it for the first time (this is in fact the preferred way, as it avoids potential interference with the newly created files on the data partition), before installing Google Apps boot the system at least once. If you install the Google Apps in one go, the Google Setup Wizard will run instead of the MIUI one, with potential side effects difficult to predict (there is obviously some way around this but I didn't investigate it further).
Summary
This summarizes the complete installation procedure spanning all the posts:
Start by wiping everything and flashing the latest factory image:
tar xzvf *_images_*.tgz --strip=1
flash_all (remove fastboot reboot before executing)
Flash TWRP recovery:
fastboot erase recovery
fastboot flash recovery twrp-2.8.6.0-leo-ganfan-20150613-en-custom-materialised-play-light_lightblue-theme-v287x.img
fastboot reboot (hold the Volume Up button to get into the recovery)
In the recovery, open the ADB Sideload mode and:
adb sideload xiaomi.eu_multi_*.zip
adb sideload aqq123patch.zip
adb reboot
Once the device has finished booting, reboot into recovery. Copy open_gapps-arm64-5.1-super-*.zip and your gapps-config-leo.txt over MTP and install from recovery. Reboot when prompted.
And your customized MIUI is ready to use. Congratulations!
 

Bonus: Qualcomm NVRAM Settings & 2G/3G/4G LTE Band Config
A lot has been written about this topic but the relevant bits are scattered and there is a lot of misunderstanding. My goal here is to provide a summary of all the relevant information as it relates to this device. As in the place where I am at the moment there are no networks operating on any of the extra bands I attempted to enable, I can't confirm if I managed to do so. Still, there is probably no harm in trying, as long as you know what you're doing, and how to undo any changes.
Choosing Bands to Enable
Before we start, it's best to figure out what exactly we're trying to do, in terms of the desired result.
Factory-Enabled Bands
First of all, these are the bands that are already supported. It's important to start from this because there are people claiming they "unlocked" some of them. Well, they didn't, really; they were already enabled. This situation is aggravated by the lack of any way to list all the operational bands on the phone (if you know of a way to do so, please share!).
The information below comes from Xiaomi's website but I expanded it to include other common designations for bands, along with the frequencies and a general indication of the world region they are used in:
4G
FDD-LTE
1 (2100 MHz; Europe & Asia Misc)
3 (1800 MHz; Europe & Asia)
7 (2600 MHz; Europe & Asia)
TDD-LTE
38 (2600 MHz; Europe Misc)
39 (1900 MHz; China)
40 (2300 MHz; China, Asia Misc)
41 (2500 MHz; China)
3G
TD-SCDMA
34 / A (2010-2025 MHz; China)
39 / F (1880-1920 MHz; China)
WCDMA
1 / I (2100 MHz; Europe & Asia)
2 / II (1900 MHz; US: AT&T, T-Mobile)
5 / V (850 MHz; US: AT&T)
8 / VIII (900 MHz; Europe & Asia)
CDMA2000
BC0 (800 MHz)
BC1 (1900 MHz)
2G
GSM/CDMA1X
2 (1900 MHz; Americas)
3 (1800 MHz; Europe & Asia)
5 (850 MHz; Americas)
8 (900 MHz; Europe & Asia)
BC0 (800 MHz)
BC1 (1900 MHz)
The above list is for Xiaomi Note Pro 2015022 (All-Network) version. Some versions do not support CDMA1X and CDMA2000.
Irrelevant Bands
On the other hand, for a multitude of reasons, the following LTE bands enjoy very limited use or are not used at all or even allocated, so enabling them would not really change anything for anyone (this is somewhat arbitrary, people located in Japan might disagree to some extent): 6, 9-11, 13-16, 18, 19, 21-27, 29-37, 42-44
Potentially Interesting Bands
The above investigation leaves us with a list of bands that would be potentially interesting to enable. Classifying them by the region:
Europe: 4G FDD LTE Band 20 (800 MHz)
Asia: 4G FDD LTE Bands 5 (850 MHz, also US regional), 8 (900 MHz) and 28 (700 MHz)
America:
3G UMTS Band 4 (1700 MHz, T-Mobile)
4G FDD LTE Bands 2 (1900 MHz), 4 (1700 MHz), 12 (700 MHz, T-Mobile), 17 (700 MHz, AT&T)
Wikipedia has more information on: LTE bands, LTE network list, LTE network list in Europe, UMTS bands, UMTS network list.
Enabling the Extra Bands
Now that we know what we're trying to enable, here's how.
Qualcomm Diagnostics Setup
Connect the phone to computer with USB cable.
On Windows 8.1, boot the computer into the Disable Driver Signature Enforcement mode.
On the phone keypad type *#*#717717#*#* to enable the diagnostics mode.
Open the Device Manager (Win+X, M).
Locate the device with Vendor ID: 05C6 and Product ID: 9025, where the instance path contains MI_00 (USB\VID_05C6&PID_9025&MI_00\...) and force the installation of the Qualcomm HS-USB Diagnostics 9025 driver onto it.
Both the driver version 2.0.8.1 from some Sony phone, which can be found in many places on the Internet, and the driver version 2.1.0.5 included with the official Xiaomi drivers seem to work for me. If you have problems installing the driver, you can also try editing the *.inf files and changing "NTia64" and "NTamd64" to "NTia64.6.3" and "NTamd64.6.3" respectively. You then also need to delete the accompanying *.cat files as their signatures will no longer match.
To edit the NVRAM settings I used the following Qualcomm software versions:
Qualcomm Product Support Tools (QPST) 2.7.411
Qualcomm Extensible Diagnostic Monitor (QXDM) 3.12.714
Other versions will probably work just as fine. Open QPST Configuration first. Make sure there is an active phone there, and leave it running. Then, open QXDM as well and in Options → Communications check the box next to the matching device and choose the matching COM port from the pull-down list below. Click OK and choose the NV Browser view. To paraphrase MIUI, you're ready to rock!
NVRAM Values
These are the changes I have made to enable all the "potentially interesting" bands listed above:
Code:
ID Desc Original Value Modified Value
01877 rf_bc_config 562950035735431 562950069289863
00441 band_pref 0xFFFF 0xFFFF (Same)
00946 band_pref_16_31 0xBFFF 0xBFFF (Same)
02954 band_pref_32_63 131072 131072 (Same)
06828 lte_bc_config 2061584302149 2061719111903
If you want to know why the above numbers are what they are, read on. Otherwise, feel free to try the above settings.
Understanding the Values
Generally these numbers are just a series of binary flags. You can think of them as a large congregation of on/off switches, next to one another, each corresponding to a particular, specific band. Thus, to see what's going on and make our changes, we convert them to the binary representation. After we're done, we convert them back to the form that is acceptable as input by QXDM (which is decimal again, for the particular registers we're modifying).
2G & 3G Configuration
The 2G and 3G configuration is determined by four values. First, take the three band_pref* values:
Code:
band_pref [= band_pref_0_15] (16-bit):
0xFFFF 1111111111111111
band_pref_16_31 (16-bit):
0xBFFF 1011111111111111
band_pref_32_63 (32-bit):
000131072 00000000000000100000000000000000
The three are juxtaposed to form a 64-bit quad-word (the split is probably to maintain some compatibility with legacy architectures, there is no logical reason for this). Then, the result of bitwise conjunction of rf_bc_config (configured bands), also a 64-bit quad-word, and the three juxtaposed band_pref* values (preferred bands) determine which bands are available.
Code:
rf_bc_config (64-bit):
0000562950035735431 0000000000000010000000000000000000000100111010000000001110000111
0000562950069289863 0000000000000010000000000000000000000110111010000000001110000111
0000000000000010000000000000000010111111111111111111111111111111
band_pref_32_63 band_pref_16_31 band_pref_0_15
The difference between the two values is apparently that rf_bc_config are the pre-configured bands, whereas the band_pref values can be modified at run-time, for example through the *#*#INFO#*#* (or *#*#4636#*#*) menu.
For our purposes, we notice that we need a band to be both "configured" and "preferred" to be available, which means the corresponding bit should be a 1 in each of the above values.
The meaning of the particular bits is as such (note that they are counted from right to left, that is bit 0 is the rightmost bit):
Code:
Def Chngd
Bit Cf Pr Cf Pr Description
#00 1 1 . . CDMA Band Class 0: A-System US Cellular (800MHz)
#01 1 1 . . CDMA Band Class 0: B-System
#02 1 1 . . CDMA Band Class 1: All Blocks US PCS (1800-2000 MHz)
#03 0 1 . . CDMA Band Class 2: Placeholder TACS Band (872-960 MHz)
#04 0 1 . . CDMA Band Class 3: A-System Japan Cellular JTACS Band (832-925 MHz)
#05 0 1 . . CDMA Band Class 4: All Blocks Korean PCS Band (1750-1870 MHz)
#06 0 1 . . CDMA Band Class 5: All Blocks NMT Band (450 MHz)
#07 1 1 . . GSM DCS 1800 Band Europe (1800 MHz)
#08 1 1 . . GSM Extended (E-GSM) Band, Includes RF Band 9 GSM (900 MHz)
#09 1 1 . . GSM Primary (P-GSM) Band Europe (900 MHz)
#10 0 1 . . CDMA Band Class 6 IMT-2000 (2000 MHz)
#11 0 1 . . CDMA Band Class 7 (Upper 700 MHz)
#12 0 1 . . CDMA Band Class 8 (1800 MHz)
#13 0 1 . . CDMA Band Class 9 (900 MHz)
#14 0 1 . . CDMA Band Class 10 (Secondary 800 MHz)
#15 0 1 . . CDMA Band Class 11 European PAMR (400 MHz)
#16 0 1 . . <Unused> GSM 450 Rural Parts
#17 0 1 . . <Unused> GSM 480
#18 0 1 . . <Unused> GSM 750
#19 1 1 . . GSM Band US (850 MHz)
#20 0 1 . . RGSM GSM Railways, Includes RF Bands 8 & 9 (900 MHz)
#21 1 1 . . GSM PCS 1900 Band US (1900 MHz)
#22 1 1 . . WCDMA Band I - Europe, Asia (Japan), New Zealand (2100 MHz)
#23 1 1 . . WCDMA Band II - PCS North America (1900 MHz)
#24 0 1 . . WCDMA Band III - DCS Europe, Asia (1800 MHz)
#25 0 1 1 . WCDMA Band IV - US T-Mobile (AWS) (1700 MHz)
#26 1 1 . . WCDMA Band V - North America, Australia, New Zealand, Philippines (850 MHz)
#27 0 1 . . WCDMA Band VI - Japan (800 MHz)
#28 0 1 . . CDMA Band Class 12 PAMR (800 MHz)
#29 0 1 . . CDMA Band Class 14 US PCS (1900 MHz)
#30 0 0 . . <Reserved>
#31 0 1 . . CDMA Band Class 15 Advanced Wireless Services (AWS)
#32 0 0 . . <Reserved> WLAN US (2400 MHz)
#33 0 0 . . <Reserved> WLAN ETSI (2400 MHz)
#34 0 0 . . <Reserved> WLAN FR (2400 MHz)
#35 0 0 . . <Reserved> WLAN ES (2400 MHz)
#36 0 0 . . <Reserved> WLAN JP (2400 MHz)
#37 0 0 . . <Reserved> WLAN US (5000 MHz)
#38 0 0 . . <Reserved> WLAN EU (5000 MHz)
#39 0 0 . . <Reserved> WLAN FR (5000 MHz)
#40 0 0 . . <Reserved> WLAN ES (5000 MHz)
#41 0 0 . . <Reserved> WLAN JP (5000 MHz)
#42 0 0 . . <Reserved>
#43 0 0 . . <Reserved>
#44 0 0 . . <Reserved>
#45 0 0 . . <Reserved>
#46 0 0 . . <Reserved>
#47 0 0 . . <Reserved>
#48 0 0 . . WCDMA Band VII - Europe (2600 MHz)
#49 1 1 . . WCDMA Band VIII - Europe, Asia, Australia, New Zealand (900 MHz)
#50 0 0 . . WDCMA Band IX - Japan (1700 MHz)
#51 0 0 . . AWS+ Band X US (1700 MHz)
#52 0 0 . . 1500 Band XI Japan (1500 MHz)
#53 0 0 . . 700ac Band XII USA
#54 0 0 . . 700 C Band XIII USA
#55 0 0 . . 700PS Band XIV USA
#56 0 0 . . CDMA Band Class 16 US (2500 MHz)
#57 0 0 . . <Reserved>
#58 0 0 . . <Reserved>
#59 0 0 . . <Reserved>
#60 0 0 . . WCDMA Japan (800 MHz)
#61 0 0 . . <Reserved>
#62 0 0 . . <Reserved>
#63 0 0 . . <Reserved>
Some of the bands listed above are purely theoretical, as they have never been used. From the above breakdown, it's quite obvious that to enable WCDMA Band IV, which is what I'm after here, it's enough to toggle just one bit, and the band_pref* values do not need to be modified at all.
4G LTE Configuration
The LTE configuration settings are much simpler, controlled by just a single variable, lte_bc_config. The variable is a quad-word (64-bit) again but only the first 44 bits appear to be relevant. Each bit corresponds to a single LTE band, starting with the rightmost bit being responsible for band 1. Overall:
Code:
lte_bc_config (64-bit, of which 44 bits relevant): Bands Active:
2061584302149 00011110000000000000000000000000000001000101 1.3...7. 38-41
2061719111903 00011110000000001000000010010000100011011111 12345.78 12 17 20 28 38-41
2061584892127 00011110000000000000000010010000000011011111 12345.78 17 20 38-41
You can then see that the modified value enables LTE bands 2, 4, 5, 8, 12, 17, 20, 28 in addition to the ones that were already enabled. (Whether it works is another story, as I said I'm unable to verify it at the moment.)
The third line is what is necessary to enable LTE bands 2, 4, 5, 8, 17, 20, while not trying to enable bands 12 and 28, which are unlikely to work due to the lack of hardware support.

Hello
Is it possible to modify prop to set camera jpg quality to 100%? I saw that on a mi3 or mi4.

EMJI79 said:
Is it possible to modify prop to set camera jpg quality to 100%. I saw that on a mi3 or mi4.
Click to expand...
Click to collapse
Hi,
I don't know anything about it but please feel free to share your results in this thread.

Updates 1 & 2 to the Guide
Update 1 to Post #7
Patching and Recompiling the Application Packages
Remove Find Device Activation Nag
/system/app/CloudService/CloudService.apk
This patch removes the notification to activate Find Device with Mi Cloud showing up all the time (as long as you are logged in with your Mi Account, most likely). Otherwise, there is no way to switch it off through the Settings.
The patch:
Code:
diff -urN CloudService.orig/smali/com/miui/cloudservice/finddevice/FindDeviceGuideService.smali CloudService/smali/com/miui/cloudservice/finddevice/FindDeviceGuideService.smali
--- CloudService.orig/smali/com/miui/cloudservice/finddevice/FindDeviceGuideService.smali Thu Jan 07 22:20:30 2016
+++ CloudService/smali/com/miui/cloudservice/finddevice/FindDeviceGuideService.smali Thu Jan 07 22:41:09 2016
@@ -134,62 +134,6 @@
.method private a(Landroid/content/Context;Landroid/graphics/Bitmap;Ljava/lang/String;Ljava/lang/String;Landroid/app/PendingIntent;)V
.locals 5
- const/4 v4, 0x1
-
- new-instance v0, Landroid/app/Notification$Builder;
-
- invoke-direct {v0, p1}, Landroid/app/Notification$Builder;-><init>(Landroid/content/Context;)V
-
- invoke-virtual {v0, p5}, Landroid/app/Notification$Builder;->setContentIntent(Landroid/app/PendingIntent;)Landroid/app/Notification$Builder;
-
- const/4 v1, -0x1
-
- invoke-virtual {v0, v1}, Landroid/app/Notification$Builder;->setSmallIcon(I)Landroid/app/Notification$Builder;
-
- invoke-virtual {v0, p2}, Landroid/app/Notification$Builder;->setLargeIcon(Landroid/graphics/Bitmap;)Landroid/app/Notification$Builder;
-
- invoke-virtual {v0, p4}, Landroid/app/Notification$Builder;->setContentText(Ljava/lang/CharSequence;)Landroid/app/Notification$Builder;
-
- invoke-virtual {v0, p3}, Landroid/app/Notification$Builder;->setContentTitle(Ljava/lang/CharSequence;)Landroid/app/Notification$Builder;
-
- invoke-virtual {v0, v4}, Landroid/app/Notification$Builder;->setAutoCancel(Z)Landroid/app/Notification$Builder;
-
- const-wide/16 v2, 0x0
-
- invoke-virtual {v0, v2, v3}, Landroid/app/Notification$Builder;->setWhen(J)Landroid/app/Notification$Builder;
-
- invoke-virtual {v0}, Landroid/app/Notification$Builder;->build()Landroid/app/Notification;
-
- move-result-object v1
-
- iget v0, v1, Landroid/app/Notification;->defaults:I
-
- or-int/lit8 v0, v0, -0x1
-
- iput v0, v1, Landroid/app/Notification;->defaults:I
-
- new-instance v0, Landroid/app/MiuiNotification;
-
- invoke-direct {v0}, Landroid/app/MiuiNotification;-><init>()V
-
- invoke-virtual {v0, v4}, Landroid/app/MiuiNotification;->setCustomizedIcon(Z)Landroid/app/MiuiNotification;
-
- iput-object v0, v1, Landroid/app/Notification;->extraNotification:Landroid/app/MiuiNotification;
-
- const-string v0, "notification"
-
- invoke-virtual {p1, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
-
- move-result-object v0
-
- check-cast v0, Landroid/app/NotificationManager;
-
- const-string v2, "micloud_find_device_guide"
-
- const/16 v3, 0x6e
-
- invoke-virtual {v0, v2, v3, v1}, Landroid/app/NotificationManager;->notify(Ljava/lang/String;ILandroid/app/Notification;)V
-
return-void
.end method
Apply with:
adb pull /system/app/CloudService/CloudService.apk
apktool2 d -b -o CloudService -r -t miui CloudService.apk
patch --binary --no-backup-if-mismatch -E -i system_app_CloudService.diff -p0
apktool2 b -a aapt-miui.exe -c -o CloudService.apk.raw CloudService
zipalign -f 4 CloudService.apk.raw CloudService.apk
adb root
adb shell mount -o remount,rw /system
adb push CloudService.apk /system/app/CloudService/
Remove Update Availability Notification
/system/app/Updater/Updater.apk
The Updater app, which apparently cannot be uninstalled (at least not without clearing the /data partition) checks for OTA updates and once it finds an update available, it will permanently display a notification asking to download it. The following patch disables all notifications from the Updater app.
The patch:
Code:
diff -urN Updater.orig/smali/com/android/updater/a/j.smali Updater/smali/com/android/updater/a/j.smali
--- Updater.orig/smali/com/android/updater/a/j.smali Wed Jan 13 06:44:02 2016
+++ Updater/smali/com/android/updater/a/j.smali Wed Jan 13 06:53:16 2016
@@ -2051,8 +2051,6 @@
move-result-object v1
- invoke-virtual {v0, p2, v1}, Landroid/app/NotificationManager;->notify(ILandroid/app/Notification;)V
-
return-void
.end method
@@ -2151,8 +2149,6 @@
invoke-virtual {v4, v5}, Landroid/app/MiuiNotification;->setEnableFloat(Z)Landroid/app/MiuiNotification;
- invoke-virtual {v2, p2, v3}, Landroid/app/NotificationManager;->notify(ILandroid/app/Notification;)V
-
return-void
.end method
@@ -2330,7 +2326,6 @@
invoke-virtual {v4, v5}, Landroid/app/MiuiNotification;->setMessageCount(I)V
:cond_0
- invoke-virtual {v2, p2, v3}, Landroid/app/NotificationManager;->notify(ILandroid/app/Notification;)V
return-void
Apply with:
adb pull /system/app/Updater/Updater.apk
apktool2 d -b -o Updater -r -t miui Updater.apk
patch --binary --no-backup-if-mismatch -E -i system_app_Updater.diff -p0
apktool2 b -a aapt-miui.exe -c -o Updater.apk.raw Updater
zipalign -f 4 Updater.apk.raw Updater.apk
adb root
adb shell mount -o remount,rw /system
adb push Updater.apk /system/app/Updater/
Update 2 to Post #11
Bonus: Qualcomm NVRAM Settings & 2G/3G/4G LTE Band Config
RF Hardware Capability Analysis
While I still can't confirm whether the method described above unlocked any of the bands for me, if we knew what RF hardware is inside the device, this could tell us which bands can potentially be unlocked, and which are not supported by the hardware. Unfortunately, none of the teardowns I could find, including Leiphone/iGao7.com, Xiujj.cn (video) or 91 Chai (video) reaches far enough to show the power amplifier chip. However, the information posted here says that the amplifier used is Avago ACPM-7620, while a Xiaomi Note teardown shows that the chip used there was Avago ACPM-7600. The specifications for those chips tell us that the following bands are supported:
ACPM-7600: 4G LTE & 3G (UMTS) Bands 1, 2, 3, 4, 5, 8, 25, 26
ACPM-7620: As above, and additionally LTE Bands 17 and 20
Comparing this to the list of "interesting" bands I posted above, it would seem that bands 12 and 28 (both 700 MHz) are most likely not supported by the hardware, so making them work is probably out of the question, while the other bands could theoretically be enabled, subject to modem firmware (17 and 20 on the condition that the amplifier used is indeed ACPM-7620).
If anyone sees (or does) a teardown deep enough to clarify what the power amplifier chip is, please share this information. Thank you.
 

Any more results from testing?
Hi really great article. Saved me actually as while I was messing about with various options managed to completely c*ck up my 2g settings.
Looking through the article re LTE 4g bands makes sense. However I have put the below into effect on my Note Pro
2061584892127 00011110000000000000000010010000000011011111 12345.78 17 20 38-41[/code]
But am still unable to get band 20 800Mhz working. I would be interested to know if you ever got further to the testing phase and find out if you had any joy with any other bands?
All the Best
Aqq123 said:
A lot has been written about this topic but the relevant bits are scattered and there is a lot of misunderstanding. My goal here is to provide a summary of all the relevant information as it relates to this device. As in the place where I am at the moment there are no networks operating on any of the extra bands I attempted to enable, I can't confirm if I managed to do so. Still, there is probably no harm in trying, as long as you know what you're doing, and how to undo any changes.
Choosing Bands to Enable
Before we start, it's best to figure out what exactly we're trying to do, in terms of the desired result.
Factory-Enabled Bands
First of all, these are the bands that are already supported. It's important to start from this because there are people claiming they "unlocked" some of them. Well, they didn't, really; they were already enabled. This situation is aggravated by the lack of any way to list all the operational bands on the phone (if you know of a way to do so, please share!).
The information below comes from Xiaomi's website but I expanded it to include other common designations for bands, along with the frequencies and a general indication of the world region they are used in:
4G
FDD-LTE
1 (2100 MHz; Europe & Asia Misc)
3 (1800 MHz; Europe & Asia)
7 (2600 MHz; Europe & Asia)
TDD-LTE
38 (2600 MHz; Europe Misc)
39 (1900 MHz; China)
40 (2300 MHz; China, Asia Misc)
41 (2500 MHz; China)
3G
TD-SCDMA
34 / A (2010-2025 MHz; China)
39 / F (1880-1920 MHz; China)
WCDMA
1 / I (2100 MHz; Europe & Asia)
2 / II (1900 MHz; US: AT&T, T-Mobile)
5 / V (850 MHz; US: AT&T)
8 / VIII (900 MHz; Europe & Asia)
CDMA2000
BC0 (800 MHz)
BC1 (1900 MHz)
2G
GSM/CDMA1X
2 (1900 MHz; Americas)
3 (1800 MHz; Europe & Asia)
5 (850 MHz; Americas)
8 (900 MHz; Europe & Asia)
BC0 (800 MHz)
BC1 (1900 MHz)
The above list is for Xiaomi Note Pro 2015022 (All-Network) version. Some versions do not support CDMA1X and CDMA2000.
Irrelevant Bands
On the other hand, for a multitude of reasons, the following LTE bands enjoy very limited use or are not used at all or even allocated, so enabling them would not really change anything for anyone (this is somewhat arbitrary, people located in Japan might disagree to some extent): 6, 9-11, 13-16, 18, 19, 21-27, 29-37, 42-44
Potentially Interesting Bands
The above investigation leaves us with a list of bands that would be potentially interesting to enable. Classifying them by the region:
Europe: 4G FDD LTE Band 20 (800 MHz)
Asia: 4G FDD LTE Bands 5 (850 MHz, also US regional), 8 (900 MHz) and 28 (700 MHz)
America:
3G UMTS Band 4 (1700 MHz, T-Mobile)
4G FDD LTE Bands 2 (1900 MHz), 4 (1700 MHz), 12 (700 MHz, T-Mobile), 17 (700 MHz, AT&T)
Wikipedia has more information on: LTE bands, LTE network list, LTE network list in Europe, UMTS bands, UMTS network list.
Enabling the Extra Bands
Now that we know what we're trying to enable, here's how.
Qualcomm Diagnostics Setup
Connect the phone to computer with USB cable.
On Windows 8.1, boot the computer into the Disable Driver Signature Enforcement mode.
On the phone keypad type *#*#717717#*#* to enable the diagnostics mode.
Open the Device Manager (Win+X, M).
Locate the device with Vendor ID: 05C6 and Product ID: 9025, where the instance path contains MI_00 (USB\VID_05C6&PID_9025&MI_00\...) and force the installation of the Qualcomm HS-USB Diagnostics 9025 driver onto it.
Both the driver version 2.0.8.1 from some Sony phone, which can be found in many places on the Internet, and the driver version 2.1.0.5 included with the official Xiaomi drivers seem to work for me. If you have problems installing the driver, you can also try editing the *.inf files and changing "NTia64" and "NTamd64" to "NTia64.6.3" and "NTamd64.6.3" respectively. You then also need to delete the accompanying *.cat files as their signatures will no longer match.
To edit the NVRAM settings I used the following Qualcomm software versions:
Qualcomm Product Support Tools (QPST) 2.7.411
Qualcomm Extensible Diagnostic Monitor (QXDM) 3.12.714
Other versions will probably work just as fine. Open QPST Configuration first. Make sure there is an active phone there, and leave it running. Then, open QXDM as well and in Options → Communications check the box next to the matching device and choose the matching COM port from the pull-down list below. Click OK and choose the NV Browser view. To paraphrase MIUI, you're ready to rock!
NVRAM Values
These are the changes I have made to enable all the "potentially interesting" bands listed above:
Code:
ID Desc Original Value Modified Value
01877 rf_bc_config 562950035735431 562950069289863
00441 band_pref 0xFFFF 0xFFFF (Same)
00946 band_pref_16_31 0xBFFF 0xBFFF (Same)
02954 band_pref_32_63 131072 131072 (Same)
06828 lte_bc_config 2061584302149 2061719111903
If you want to know why the above numbers are what they are, read on. Otherwise, feel free to try the above settings.
Understanding the Values
Generally these numbers are just a series of binary flags. You can think of them as a large congregation of on/off switches, next to one another, each corresponding to a particular, specific band. Thus, to see what's going on and make our changes, we convert them to the binary representation. After we're done, we convert them back to the form that is acceptable as input by QXDM (which is decimal again, for the particular registers we're modifying).
2G & 3G Configuration
The 2G and 3G configuration is determined by four values. First, take the three band_pref* values:
Code:
band_pref [= band_pref_0_15] (16-bit):
0xFFFF 1111111111111111
band_pref_16_31 (16-bit):
0xBFFF 1011111111111111
band_pref_32_63 (32-bit):
000131072 00000000000000100000000000000000
The three are juxtaposed to form a 64-bit quad-word (the split is probably to maintain some compatibility with legacy architectures, there is no logical reason for this). Then, the result of bitwise conjunction of rf_bc_config (configured bands), also a 64-bit quad-word, and the three juxtaposed band_pref* values (preferred bands) determine which bands are available.
Code:
rf_bc_config (64-bit):
0000562950035735431 0000000000000010000000000000000000000100111010000000001110000111
0000562950069289863 0000000000000010000000000000000000000110111010000000001110000111
0000000000000010000000000000000010111111111111111111111111111111
band_pref_32_63 band_pref_16_31 band_pref_0_15
The difference between the two values is apparently that rf_bc_config are the pre-configured bands, whereas the band_pref values can be modified at run-time, for example through the *#*#INFO#*#* (or *#*#4636#*#*) menu.
For our purposes, we notice that we need a band to be both "configured" and "preferred" to be available, which means the corresponding bit should be a 1 in each of the above values.
The meaning of the particular bits is as such (note that they are counted from right to left, that is bit 0 is the rightmost bit):
Code:
Def Chngd
Bit Cf Pr Cf Pr Description
#00 1 1 . . CDMA Band Class 0: A-System US Cellular (800MHz)
#01 1 1 . . CDMA Band Class 0: B-System
#02 1 1 . . CDMA Band Class 1: All Blocks US PCS (1800-2000 MHz)
#03 0 1 . . CDMA Band Class 2: Placeholder TACS Band (872-960 MHz)
#04 0 1 . . CDMA Band Class 3: A-System Japan Cellular JTACS Band (832-925 MHz)
#05 0 1 . . CDMA Band Class 4: All Blocks Korean PCS Band (1750-1870 MHz)
#06 0 1 . . CDMA Band Class 5: All Blocks NMT Band (450 MHz)
#07 1 1 . . GSM DCS 1800 Band Europe (1800 MHz)
#08 1 1 . . GSM Extended (E-GSM) Band, Includes RF Band 9 GSM (900 MHz)
#09 1 1 . . GSM Primary (P-GSM) Band Europe (900 MHz)
#10 0 1 . . CDMA Band Class 6 IMT-2000 (2000 MHz)
#11 0 1 . . CDMA Band Class 7 (Upper 700 MHz)
#12 0 1 . . CDMA Band Class 8 (1800 MHz)
#13 0 1 . . CDMA Band Class 9 (900 MHz)
#14 0 1 . . CDMA Band Class 10 (Secondary 800 MHz)
#15 0 1 . . CDMA Band Class 11 European PAMR (400 MHz)
#16 0 1 . . <Unused> GSM 450 Rural Parts
#17 0 1 . . <Unused> GSM 480
#18 0 1 . . <Unused> GSM 750
#19 1 1 . . GSM Band US (850 MHz)
#20 0 1 . . RGSM GSM Railways, Includes RF Bands 8 & 9 (900 MHz)
#21 1 1 . . GSM PCS 1900 Band US (1900 MHz)
#22 1 1 . . WCDMA Band I - Europe, Asia (Japan), New Zealand (2100 MHz)
#23 1 1 . . WCDMA Band II - PCS North America (1900 MHz)
#24 0 1 . . WCDMA Band III - DCS Europe, Asia (1800 MHz)
#25 0 1 1 . WCDMA Band IV - US T-Mobile (AWS) (1700 MHz)
#26 1 1 . . WCDMA Band V - North America, Australia, New Zealand, Philippines (850 MHz)
#27 0 1 . . WCDMA Band VI - Japan (800 MHz)
#28 0 1 . . CDMA Band Class 12 PAMR (800 MHz)
#29 0 1 . . CDMA Band Class 14 US PCS (1900 MHz)
#30 0 0 . . <Reserved>
#31 0 1 . . CDMA Band Class 15 Advanced Wireless Services (AWS)
#32 0 0 . . <Reserved> WLAN US (2400 MHz)
#33 0 0 . . <Reserved> WLAN ETSI (2400 MHz)
#34 0 0 . . <Reserved> WLAN FR (2400 MHz)
#35 0 0 . . <Reserved> WLAN ES (2400 MHz)
#36 0 0 . . <Reserved> WLAN JP (2400 MHz)
#37 0 0 . . <Reserved> WLAN US (5000 MHz)
#38 0 0 . . <Reserved> WLAN EU (5000 MHz)
#39 0 0 . . <Reserved> WLAN FR (5000 MHz)
#40 0 0 . . <Reserved> WLAN ES (5000 MHz)
#41 0 0 . . <Reserved> WLAN JP (5000 MHz)
#42 0 0 . . <Reserved>
#43 0 0 . . <Reserved>
#44 0 0 . . <Reserved>
#45 0 0 . . <Reserved>
#46 0 0 . . <Reserved>
#47 0 0 . . <Reserved>
#48 0 0 . . WCDMA Band VII - Europe (2600 MHz)
#49 1 1 . . WCDMA Band VIII - Europe, Asia, Australia, New Zealand (900 MHz)
#50 0 0 . . WDCMA Band IX - Japan (1700 MHz)
#51 0 0 . . AWS+ Band X US (1700 MHz)
#52 0 0 . . 1500 Band XI Japan (1500 MHz)
#53 0 0 . . 700ac Band XII USA
#54 0 0 . . 700 C Band XIII USA
#55 0 0 . . 700PS Band XIV USA
#56 0 0 . . CDMA Band Class 16 US (2500 MHz)
#57 0 0 . . <Reserved>
#58 0 0 . . <Reserved>
#59 0 0 . . <Reserved>
#60 0 0 . . WCDMA Japan (800 MHz)
#61 0 0 . . <Reserved>
#62 0 0 . . <Reserved>
#63 0 0 . . <Reserved>
Some of the bands listed above are purely theoretical, as they have never been used. From the above breakdown, it's quite obvious that to enable WCDMA Band IV, which is what I'm after here, it's enough to toggle just one bit, and the band_pref* values do not need to be modified at all.
4G LTE Configuration
The LTE configuration settings are much simpler, controlled by just a single variable, lte_bc_config. The variable is a quad-word (64-bit) again but only the first 44 bits appear to be relevant. Each bit corresponds to a single LTE band, starting with the rightmost bit being responsible for band 1. Overall:
Code:
lte_bc_config (64-bit, of which 44 bits relevant): Bands Active:
2061584302149 00011110000000000000000000000000000001000101 1.3...7. 38-41
2061719111903 00011110000000001000000010010000100011011111 12345.78 12 17 20 28 38-41
2061584892127 00011110000000000000000010010000000011011111 12345.78 17 20 38-41
You can then see that the modified value enables LTE bands 2, 4, 5, 8, 12, 17, 20, 28 in addition to the ones that were already enabled. (Whether it works is another story, as I said I'm unable to verify it at the moment.)
The third line is what is necessary to enable LTE bands 2, 4, 5, 8, 17, 20, while not trying to enable bands 12 and 28, which are unlikely to work due to the lack of hardware support.
Click to expand...
Click to collapse

Aqq123 said:
...
NVRAM Values
These are the changes I have made to enable all the "potentially interesting" bands listed above:
Code:
ID Desc Original Value Modified Value
01877 rf_bc_config 562950035735431 562950069289863
00441 band_pref 0xFFFF 0xFFFF (Same)
00946 band_pref_16_31 0xBFFF 0xBFFF (Same)
02954 band_pref_32_63 131072 131072 (Same)
06828 lte_bc_config 2061584302149 2061719111903
If you want to know why the above numbers are what they are, read on. Otherwise, feel free to try the above settings.
Understanding the Values
Generally these numbers are just a series of binary flags. You can think of them as a large congregation of on/off switches, next to one another, each corresponding to a particular, specific band. Thus, to see what's going on and make our changes, we convert them to the binary representation. After we're done, we convert them back to the form that is acceptable as input by QXDM (which is decimal again, for the particular registers we're modifying).
2G & 3G Configuration
The 2G and 3G configuration is determined by four values. First, take the three band_pref* values:
Code:
band_pref [= band_pref_0_15] (16-bit):
0xFFFF 1111111111111111
band_pref_16_31 (16-bit):
0xBFFF 1011111111111111
band_pref_32_63 (32-bit):
000131072 00000000000000100000000000000000
The three are juxtaposed to form a 64-bit quad-word (the split is probably to maintain some compatibility with legacy architectures, there is no logical reason for this). Then, the result of bitwise conjunction of rf_bc_config (configured bands), also a 64-bit quad-word, and the three juxtaposed band_pref* values (preferred bands) determine which bands are available.
Code:
rf_bc_config (64-bit):
0000562950035735431 0000000000000010000000000000000000000100111010000000001110000111
0000562950069289863 0000000000000010000000000000000000000110111010000000001110000111
0000000000000010000000000000000010111111111111111111111111111111
band_pref_32_63 band_pref_16_31 band_pref_0_15
The difference between the two values is apparently that rf_bc_config are the pre-configured bands, whereas the band_pref values can be modified at run-time, for example through the *#*#INFO#*#* (or *#*#4636#*#*) menu.
...
.
Click to expand...
Click to collapse
Thank you very much. I just got a Xiaomi Mi 5 did a stupid move. I set the band_pref to "USA" or 0x0 from *#*#4636#*#*. And so disabled my first sim card slot. Yeah, that was stupid.
But after only spending one whole day searching the internet for Qualcomm drivers, I got it fixed. Thanks to your topic.
You are great, thank you very much.

TheUltrametricSpace said:
Thank you very much. I just got a Xiaomi Mi 5 did a stupid move. I set the band_pref to "USA" or 0x0 from *#*#4636#*#*. And so disabled my first sim card slot. Yeah, that was stupid.
But after only spending one whole day searching the internet for Qualcomm drivers, I got it fixed. Thanks to your topic.
You are great, thank you very much.
Click to expand...
Click to collapse
So did you get the Band20 working on the Mi5?

CodeX86 said:
So did you get the Band20 working on the Mi5?
Click to expand...
Click to collapse
No, NVRAM values alone do not unlock additional LTE frequencies.

TheUltrametricSpace said:
No, NVRAM values alone do not unlock additional LTE frequencies.
Click to expand...
Click to collapse
I'm aware that the hardware needs to support it. I just thought to have read that the Mi5 would be capable of doing so. That's why I asked.
Sent from my HUAWEI RIO-L01 using XDA-Developers mobile app

CodeX86 said:
I'm aware that the hardware needs to support it. I just thought to have read that the Mi5 would be capable of doing so. That's why I asked.
Sent from my HUAWEI RIO-L01 using XDA-Developers mobile app
Click to expand...
Click to collapse
We wrote it down in other topics, the hardware is capable. It's only about the configuration of the hardware.
But that's the big issue here; if the configuration of stuff like the PMA has to be modified; assuming we get access to it and somehow manage it; then an RF engineer has to do it, a random person isn't good enough for this task.
Manipulation at this level without testing and a lot of knowledge will bring big time negative side-effects; trial and error won't help. (But that's the absolute worst-case scenario.)
Maybe it's somewhere in the kernel, dunno.
Yet we can surely say that NVRAM values alone are not enough and the hardware is able to support additional bands at least in theory! (talking about the mi5, the note pro is outdated.)

Related

Checksum problem

Code:
220025072 56 inetd.conf 71 330
502905796 360 updater 703 418
#Checksum 416 774 748
I know that field A and B are CRC and Block for inetd.conf and updater, but I just can't figure out how to get the value for C and D.
I also know that record 3, Checksum, is the total of B,C and D.
Anyone that has the free time to see if they can figure it out are welcome.
Net....

1% Battery Development (Calling devs/programmers/coders)

So I have found a few japanese/chinese sites that explain how to edit services.jar for phones like the atrix and milestone to get 1% battery increments. Considering my noob status it may require other things to be modified (kernal? which we cant) but my attempts fail and have to keep flashing back to stock. Hopefully someone out there can explain or work on this if possible. Here is a translation of one of the sites I found:
Tutorial] yourself to achieve 1% of the power to modify services.jar display
Posts by wzhizhou editor at 2011-9-23 08:25
The first mobile phone needs root, tutorial please refer to the respective mobile forums, if even this did not do that, you still do hands-on.
Now divided into two types, first is the only root of your machine, and did not brush off others deodex the Brush Pack, which is original to the official system, it is looked down
Official only for the root system and require the system deodex. Purpose is to talk about services.jar for deodex. This is necessary, or 1% of the electricity could not handle.
Note that the following actions may cause the phone not start, so please exercise caution ahead of the backup, in addition to the problem scold me, I'm just sharing my experience, responsible for any of your operations, only you own your own responsibility. I ATT machine, brush the 2.3.4, then brush the Hong Kong version of fastboot boot, system, webtop, and then root. The following operations are successful in my phone, and the starting point is two-wipe after.
Need to use the system deodex xUltimate, this software Niua Soso can easily download.
Unzip the downloaded xUltimate speak to the root directory of the folder, open the phone's debug mode (you do not know? Sweat - you still do not dry)
Run main.exe, there are interface
First select option 2 after a wait for completion of Option 3 will last a long time in this operation, according to some online tutorials, the steps to delete a file, but I have not met, the search is completed, please continue to choose their own 4 point xUltimate Then after use about xUltimate directory "done_frame" and "done_app" gave the copy to the SD card's root directory; in this process has been connected to the computer and the phone open debug mode, then switch the usb storage mode, to adjusted to none. Still keep the phone and pc connection, and debugging mode turned on. Bring up the command line, win7 and the best vista as administrator open a command line then need to use adb tool at your own search using the command line, cd into the directory where the adb tool, and then proceed as follows
> Adb shell
> Su (light before running the command phone into the desktop, run the command will appear so you root authorization information, consent, if you have run, then there will not be prompted. To obtain root privileges , the prompt will be> changed #, please pay attention to distinguish)
# Stop
# Mount-o rw, remount-t ext3 / dev/block/mmcblk1p21 / system
# Cp / sdcard / done_app / * / system / app /
# Cp / sdcard / done_frame / * / system / framework /
# Rm / system / app / *. odex
# Rm / system / framework / *. odex
# Mount-o ro, remount-t ext3 / dev/block/mmcblk1p21 / system
# Reboot
Copy code
Your phone has deodex, you will feel a lot of speed to be cool, and edit documents such as services.jar also facilitate a lot of time. (In the penultimate line of input devices may be prompted to after a busy kind of information, all right, and enter reboot reboot directly on the line. A long time the first reboot is normal.) After deodex on your cell phone after the show with a 1% charge of the basic conditions, followed by the services.jar changes. Next you need to download smali-1.2.8.jar, baksmali-1.2.8.jar, the dex file assembly and disassembly, note the machine you need to install jdk find xUltimate directory done_frame folder, copy services.jar just download the two files to the folder where, note the directory name if you do not have Chinese system installed winrar, winrar need to be configured as follows
Click the first option, then click the Compression creates a default configuration stored in the compression of a conversion, then make sure you can use winrar to open services.jar, will find a classes.dex file, which is what we want to modify the Dongdong
Extract the files to this directory services.jar to open a command line, run the following command java-jar baksmali-1.2.8.jar classes.dex-oclasses will find a directory of extra classes directory first instead of closing the command line, one will also be used in classes \ com \ android \ server directory has a BatteryService.smali file, we will modify it first to find. field private mBatteryLevel: I
Note: The following code is not my work, is a Japanese cow broke in the blog
# Instance fields
. Field private mAcOnline: Z
. Field private mBatteryHealth: I
. Field private mBatteryLevel: I
Copy code
Then add a line below
. Field private mBatteryLevel1Step: I
Copy code
Then search iget v3, p0, Lcom / android / server / BatteryService; -> mBatteryLevel: I will be the original
iget v3, p0, Lcom / android / server / BatteryService; -> mBatteryLevel: I
invoke-virtual {v1, v2, v3}, Landroid / content / Intent; -> putExtra (Ljava / lang / String; I) Landroid / content / Intent;
Copy code
Replaced
iget v3, p0, Lcom / android / server / BatteryService; -> mBatteryLevel: I
invoke-direct {p0}, Lcom / android / server / BatteryService; -> getBatteryLevel1Step () V
iget v3, p0, Lcom / android / server / BatteryService; -> mBatteryLevel1Step: I
invoke-virtual {v1, v2, v3}, Landroid / content / Intent; -> putExtra (Ljava / lang / String; I) Landroid / content / Intent;
Copy code
Then to the end of the file add the following section
. Method private getBatteryLevel1Step () V
. Locals 8
. Prologue
. Line 30
const / 4 v4, 0x0
. Line 32
. Local v4, reader: Ljava / io / FileReader;
: Try_start_0
new-instance v5, Ljava / io / FileReader;
const-string v6, "/ sys / class / power_supply / battery / charge_counter"
invoke-direct {v5, v6}, Ljava / io / FileReader; -> <init> (Ljava / lang / String V
: Try_end_0
. Catch Ljava / io / IOException; {: try_start_0 ..: try_end_0}: catch_1
. End local v4 # reader: Ljava / io / FileReader;
. Local v5, reader: Ljava / io / FileReader;
move-object v4, v5
. Line 35
. End local v5 # reader: Ljava / io / FileReader;
. Restart local v4 # reader: Ljava / io / FileReader;
: Goto_0
const/16 v6, 0x14
: Try_start_1
new-array v1, v6, [C
. Line 36
. Local v1, buf: [C
invoke-virtual {v4, v1}, Ljava / io / FileReader; -> read ([C) I
move-result v3
. Line 37
. Local v3, read: I
invoke-virtual {v4}, Ljava / io / FileReader; -> close () V
. Line 38
new-instance v0, Ljava / lang / String;
const / 4 v6, 0x0
invoke-direct {v0, v1, v6, v3}, Ljava / lang / String; -> <init> ([CII) V
. Line 39
. Local v0, batteryLevelsysfs: Ljava / lang / String;
const-string v6, "\ n"
const-string v7, ""
invoke-virtual {v0, v6, v7}, Ljava / lang / String; -> replace (Ljava / lang / CharSequence; Ljava / lang / CharSequence Ljava / lang / String;
move-result-object v0
. Line 40
invoke-static {v0}, Ljava / lang / Integer; -> parseInt (Ljava / lang / String I
move-result v2
. Line 41
. Local v2, mBatteryLevel1Step: I
const/16 v6, 0x64
if-lt v2, v6,: cond_0
. Line 42
const/16 v2, 0x64
. Line 45
: Cond_0
# Sget-object v6, Ljava / lang / System; -> out: Ljava / io / PrintStream;
# Invoke-virtual {v6, v2}, Ljava / io / PrintStream; -> println (I) V
iput v2, p0, Lcom / android / server / BatteryService; -> mBatteryLevel1Step: I
: Try_end_1
. Catch Ljava / lang / Exception; {: try_start_1 ..: try_end_1}: catch_0
. Line 52
. End local v0 # batteryLevelsysfs: Ljava / lang / String;
. End local v1 # buf: [C
. End local v2 # mBatteryLevel1Step: I
. End local v3 # read: I
: Goto_1
return-void
. Line 48
: Catch_0
move-exception v6
goto: goto_1
. Line 33
: Catch_1
move-exception v6
goto: goto_0
. End method
Copy code
Then just save the open command line to the next steps
java-Xmx512M-jar smali-1.2.8.jar classes-o new-classes.dex
Copy code
Then it will appear in the directory of a new-classes.dex file, rename it to classes.dex use winrar to open services.jar, speaking directly in the directory classes.dex in drag to winrar
Replace the original classes.dex, and then copy the modified services.jar adb tool to open the directory where the command line, cd command into the directory where to run the following command adb
> Adb push services.jar / sdcard /
> Adb shell
> Su
# Mount-o rw, remount-t ext3 / dev/block/mmcblk1p21 / system
# Cp / sdcard / services.jar / system / framework /
# Chmod 644 / system / framework / services.jar
# Reboot
Copy code
This time there will be some time after restart black screen, it does not matter, slowly waiting, if all goes well, this time into the system settings, battery management, battery light will show the remaining 1% of the change, no longer is 10%.
Ill take a look into this later today. Not promseing anything since I haven't worked on a motor device b4
Sent from my DROID BIONIC using Tapatalk
Got this working, will post the files soon.
Really! Glad I posted this info
Haha didnt really use this info, but it gave me an idea to ask my buddy who did it for the droid x2, and since it is practically the same phone, the copy and paste worked Enjoy guys. Thank Nitro.
TheMuffStuff said:
Haha didnt really use this info, but it gave me an idea to ask my buddy who did it for the droid x2, and since it is practically the same phone, the copy and paste worked Enjoy guys. Thank Nitro.
Click to expand...
Click to collapse
No problem man! I made a thread on here as well for the mod.

[Q] [HELP][MOD] Lockscreen shortcuts

Hi to all
I'm trying to enable the lockscreen shortcuts in my rom 4.3 with German csc (DBT).
following this guide:
1- Decompile SecSettings.apk and go to smali/com/android/settings/lockscreenshortcut/LockScreenShortcutSettings.smali
2- Open this file with notpad++ and change the following line:
Code:
# direct methods
.method static constructor <clinit>()V
.locals 2
.prologue
const/4 v1, 0x0
.line 79
const/4 v0, 0x4
sput v0, Lcom/android/settings/lockscreenshortcut/LockScreenShortcutSettings;->MAX_SHORTCUT_ICON:I
to:
Code:
# direct methods
.method static constructor <clinit>()V
.locals 2
.prologue
const/4 v1, 0x0
.line 79
const/4 v0, 0x3
sput v0, Lcom/android/settings/lockscreenshortcut/LockScreenShortcutSettings;->MAX_SHORTCUT_ICON:I
3- Save changes
4- (The following step is provided by tkari4; thanks man) For some region this feature is disabled like Germany ; So navigate to smali/com/android/settings folder and open LockscreenMenuSettings.smali and search for "ro.csc.country_code" and change the following (red to blue):
Code:
if-nez v4, :cond_5
const-string v4, "Germany"
const-string v7, "ro.csc.country_code"
invoke-static {v7}, Landroid/os/SystemProperties;->get(Ljava/lang/StringLjava/lang/String;
to:
Code:
if-nez v4, :cond_5
const-string v4, "none"
const-string v7, "ro.csc.country_code"
invoke-static {v7}, Landroid/os/SystemProperties;->get(Ljava/lang/StringLjava/lang/String;
3- Save file and recompile and push to your phone.
When I delete "German", sortcuts appear in settings. I enable them but as soon as I turn off the screen, they are disabled and do not appear in the lockscreen.
I tried to change the values ​​of const/4 v0, 0x4 as the guide ... I tried x0, x1, x2, x3, x4, x5 but none of them worked.
Someone can tell me what to change to enable the lockscreen shortcuts?
Did you end up finding out a solution?
I had a look at this at one stage myself, however my CSC is from Australia and not Germany (but it does exactly the same thing)
I managed to get as far as you, so it would show the prompt on the settings screen etc, and then it would turn off once you lock and unlock the screen.
Is it possible that another file needs to be changed? I know android.policy.jar has lockscreen related stuff in it. I remember looking there as well but couldn't find anything.

[INFO] Nexus 5 booting kernel 4.11

Hi,
i just wanted to give some information on my latest attempts to boot kernel 4.11 on the Nexus 5.
This is just for fun or at least a proof of concept to boot mainline kernel.
Have a look at bootup text file attached to this post.
You may first see my other post here:
https://forum.xda-developers.com/showpost.php?p=72681973&postcount=13
As i already stated this "project" is of no real practical use, other then learning about latest kernel and getting used to DTS files.
Many parts are missing and booting into Android would be a very dusty and rocky road... it is more that this will never happen!
Anyway i decided to switch to kernel 4.11, as there'd been some improvements on some SoC internals (e.g. USB).
So i took this kernel:
https://git.linaro.org/landing-team...shot/kernel-release/db820c/qcomlt-4.11.tar.gz
After some first tests i decided to check out more options in the kernel config file to get little nearer to the 3.4 kernel config we all know.
You'll find the config file below.
In order to do some testing easily i decided to use TWRP recovery as an initrd here.
To make it more handy i simply added a service to get a console shell.
In other words, there's busybox and some other tools to examine the system.
The image uses the serial debug console as the user interface.
To interact with the system you'll need an earjack debug adapter.
See the image (debug_3.5mm.jpg) for some information... or search the web.
To boot the image, unzip hammerhead-4.11.zip go into bootloader mode and use fastboot:
fastboot boot hammerhead-4.11.img
EDIT: Updated the attachments, as there'd been some progress (see post #7).
EDIT2: YAU (Yet Another Update)
Have fun!
scholbert
Nice job!
Some time ago I tried to build from scratch 3.10 kernel, you can find the code here.
From the log look like that the internal memory is missing, maybe due incomplete device tree entry. The related documentation should be this.
Hi 95A31!
95A31 said:
Nice job!
Some time ago I tried to build from scratch 3.10 kernel, you can find the code here.
From the log look like that the internal memory is missing, maybe due incomplete device tree entry. The related documentation should be this.
Click to expand...
Click to collapse
Thanks for your reply. Any hints and ideas are higly appreciated
Basically the sdhc entries look o.k. to me.
I already compared many parts of the DT entries in kernel 4.11 with the ones in kernel 3.4 as well (and yes they slightly changed their style).
There might be some issues with DT in general here, but i suspect some basic stuff is missing to initiate the power supply (PM8841 & PM8941) correctly.
Maybe i'll dig a little deeper... maybe not :angel:
Anyway, leave some comments here if you like!
Cheers,
scholbert
scholbert said:
...
There might be some issues with DT in general here, but i suspect some basic stuff is missing to initiate the power supply (PM8841 & PM8941) correctly.
....
Click to expand...
Click to collapse
What make you think this?
Gonna test it on my phone.
95A31 said:
What make you think this?
Click to expand...
Click to collapse
See those snippets from bootlog of kernel 3.4:
Code:
...
[ 0.143223] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.144749] socinfo_print: v8, id=126, ver=2.2, raw_id=1968, raw_ver=7, hw_plat=150, hw_plat_ver=65536
[ 0.144755] accessory_chip=0, hw_plat_subtype=0, pmic_model=65537, pmic_die_revision=196609
[ 0.158993] gpiochip_add: registered GPIOs 0 to 145 on device: msmgpio
[ 0.175335] msm_watchdog f9017000.qcom,wdt: MSM Watchdog Initialized
[ 0.194446] 8841_s1: 675 <--> 1050 mV at 0 mV normal idle
[ 0.194895] 8841_s1_ao: 675 <--> 1050 mV at 0 mV normal idle
[ 0.195357] 8841_s1_so: 675 <--> 1050 mV at 675 mV normal idle
[ 0.195859] 8841_s2: 500 <--> 1050 mV at 0 mV normal idle
[ 0.196322] 8841_s2_corner: 0 <--> 0 mV at 0 mV normal idle
[ 0.196785] 8841_s2_corner_ao: 0 <--> 0 mV at 0 mV normal idle
[ 0.197235] 8841_s2_floor_corner: 0 <--> 0 mV at 0 mV normal idle
[ 0.197723] 8841_s3: 1050 mV normal idle
[ 0.198201] 8841_s4: 815 <--> 900 mV at 0 mV normal idle
[ 0.198675] 8841_s4_corner: 0 <--> 0 mV at 0 mV normal idle
[ 0.199145] 8841_s4_floor_corner: 0 <--> 0 mV at 0 mV normal idle
[ 0.199630] 8941_s1: 1300 mV normal idle
[ 0.200131] 8941_s2: 2150 mV normal idle
[ 0.200614] 8941_s3: 1800 mV normal idle
[ 0.201146] 8941_l1: 1225 mV normal idle
[ 0.201627] 8941_l2: 1200 mV normal idle
[ 0.202120] 8941_l3: 1225 mV normal idle
[ 0.202608] 8941_l4: 1225 mV normal idle
[ 0.203117] 8941_l5: 1800 mV normal idle
[ 0.203599] 8941_l6: 1800 mV normal idle
[ 0.204088] 8941_l7: 1800 mV normal idle
[ 0.204588] 8941_l8: 1800 mV normal idle
[ 0.205066] 8941_l9: 1800 <--> 2950 mV at 2950 mV normal idle
[ 0.205554] 8941_l10: 1800 <--> 2950 mV at 2950 mV normal idle
[ 0.206025] 8941_l11: 1300 mV normal idle
[ 0.206520] 8941_l12: 1800 mV normal idle
[ 0.206982] 8941_l12_ao: 1800 mV normal idle
[ 0.207462] 8941_l13: 1800 <--> 2950 mV at 2950 mV normal idle
[ 0.207961] 8941_l14: 1800 mV normal idle
[ 0.208434] 8941_l15: 2050 mV normal idle
[ 0.208930] 8941_l16: 2700 mV normal idle
[ 0.209418] 8941_l17: 3000 mV normal idle
[ 0.209909] 8941_l18: 2850 mV normal idle
[ 0.210405] 8941_l19: 3000 <--> 3300 mV at 3300 mV normal idle
[ 0.210917] 8941_l20: 2950 mV normal idle
[ 0.211414] 8941_l21: 2950 mV normal idle
[ 0.211907] 8941_l22: 3000 <--> 3300 mV at 3100 mV normal idle
[ 0.212411] 8941_l23: 3000 mV normal idle
[ 0.212898] 8941_l24: 3075 mV normal idle
[ 0.213387] 8941_lvs1:
[ 0.213821] 8941_lvs2:
[ 0.214265] 8941_lvs3:
...
...and these messages from kernel 4.11:
Code:
...
[ 0.213352] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.215005] cpuidle: using governor menu
[ 0.215647] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[ 0.215657] hw-breakpoint: maximum watchpoint size is 8 bytes.
[ 0.216665] irq: no irq domain found for /smp2p-adsp/slave-kernel !
[ 0.232062] irq: no irq domain found for /soc/[email protected] !
[ 0.251356] AXI: msm_bus_fabric_init_driver(): msm_bus_fabric_init_driver
[ 0.251635] reg-fixed-voltage vreg-boost: could not find pctldev for node /soc/[email protected]/[email protected]/[email protected]/boost-bypass, deferring probe
...
Regards,
scholbert
Hey,
short update... found something to get the messages from PMIC :victory:
There was a missing option in my configuration. We need CONFIG_RPMSG_QCOM_SMD to be set.
Unfortunately still no sign from the eMMC ...
EDIT: grrrrr... still some issues here.
If RPM shared memory driver gets activated, this seems to change some setup in clock unit of the chip, which as a result disables RTC or destroys something else.
So in the end i'm not sure if shared memory driver should be used here
Anyway will play around with all this in the next weeks... but remember it's summer... so it may all take it's time!
EDIT2: yeeeessssss.. some issues solved!
I forgot that i made a change in dtsi which seemed to block the interrupt to smbi... in the end reverted it, applied new configuration, and there it is.
We got eMMC now :highfive:
See new attached files and have anice weekend!
EDIT3: Moved the attachments to the first post!
BTW, there's a guy at the fairphone forum who does similar experiments with the FP2 (MSM8974 based as well):
https://forum.fairphone.com/t/kernel-hackers-upstream-kernel-for-fp2-openos/28628
Here's his github repo:
https://github.com/z3ntu/linux
Regards,
scholbert
scholbert said:
Hey,
short update... found something to get the messages from PMIC :victory:
There was a missing option in my configuration. We need CONFIG_RPMSG_QCOM_SMD to be set.
Unfortunately still no sign from the eMMC ...
[...]
Click to expand...
Click to collapse
Good job!
Look like system can not access to memory:
Code:
[ 1.800624] init: /init.rc: 66: invalid command 'load_system_props'
Code:
[ 1.995481] init: /init.recovery.hammerhead.rc: 17: invalid command '/sbin/ln'
Maybe the change msm_sdcc.1 -> f9824900.sdhci had broke something. Before the kernel messages I have this part in my logs:
Code:
[7040] use_signed_kernel=0, is_unlocked=1, is_tampered=1.
[7040] Loading boot image (9416704): start
[7380] Loading boot image (9416704): done
[7380] Found Appeneded Flattened Device tree
[7380] DTB: platform id 126, board id 150, soc rev 20002, board rev 11
[7390] get_display_kcal = 0, 0, 0, x
[7390]
Booting Linux
[7440] vibe
[7540] splash: boot
[7580] splash: unlocked
[7620] cmdline: console=ttyHSL0,115200,n8 androidboot.hardware=hammerhead user_debug=31 msm_watchdog_v2.enable=1 mdss_mdp.panel=dsi androidboot.bootdevice=msm_sdcc.1 uart_console=enable gpt=enable lge.kcal=0|0|0|x lge.rev=rev_11 androidboot.laf androidboot.emmc=[7640] Updating device tree: start
[7650] Updating device tree: done
[7660] booting linux @ 0x8000, ramdisk @ 0x2900000 (1115413), tags/device tree @ 0x2700000
[7660] Turn off MIPI_CMD_PANEL.
[7660] Continuous splash enabled, keeping panel alive.
Uncompressing Linux... done, booting the kernel.
Can be the value of androidboot.bootdevice related with this problem?
Here a Linaro guy is working on Nexus 7 (APQ8064 based unfortunately).
EDIT:
Moreover fstab.hammerhead use msm_sdcc.1 and this is wrong for sure.
Hi 95A31,
thanks for your comments and information about the Nexus 7 project.
The errors you find in the logs are related to the TWRP initrd and setup stuff.
Please refer to these messages i grabbed some time ago from the standard TWRP image:
Code:
...
[ 5.341167] init: /init.rc: 66: invalid command 'load_system_props'
[ 5.346559] init: could not import file '/init.recovery.logd.rc' from '/init.rc'
[ 5.353919] init: /init.recovery.hammerhead.rc: 17: invalid command 'ln'
[ 5.362647] healthd: wakealarm_init: timerfd_create failed
[ 5.863315] android_usb: already disabled
[ 6.134887] init: Unable to open persistent property directory /data/property errno: 2
[ 6.141831] init: Unable to open persistent property directory /data/property errno: 2
...
As you see it's barely the same stuff printed out (independent of the kernel you use).
You may modify the initrd as you like to
The partitions can be mounted and accessed from serial console with this kernel now:
Code:
~ # mount -t ext4 /dev/block/mmcblk0p28 /data
[ 237.878280] EXT4-fs (mmcblk0p28): mounted filesystem with ordered data mode. Opts: (null)
~ # df
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 968568 28 968540 0% /dev
tmpfs 968568 288 968280 0% /tmp
/dev/block/mmcblk0p28
27971732 10849488 17105860 39% /data
~ # cd data
/data # ls
adb backup data media security
anr bootchart drm mediadrm ss
app bugreports fdAlbum misc su
app-asec cam_socket1 local nfc system
app-lib cam_socket2 lost+found property tombstones
app-private dalvik-cache maru resource-cache user
/data #
Please check out the expermimental image and try yourself.
Be careful what you do at anytime though, because your dealing with your phones file system from within an experimental ramdisk.
So please do not brick your phone, while playing around :angel:
BTW... speaking of memory is more common for RAM, while storage may be used for eMMC and mass storage devices.
Of course a lot of tweaks and fixes are needed as this is all very experimental, so anyway thanks for your hint.
EDIT: ... and yes as for the numbering and naming this has to be corrected somewhere in time.
The eMMC is detected as device mmc0 (controller sdhci1) for now, because WLAN SDIO (using controller sdhci2) is not implemented yet.
Same for the fstab file.
Someone may try to rename some entries and see what happens, but as far as many parts are missing, there's no need for this right now.
Regards,
scholbert
scholbert said:
[...]
The errors you find in the logs are related to the TWRP initrd and setup stuff.
[...]
Click to expand...
Click to collapse
You are more skilled than me about this topic
scholbert said:
[...]
Someone may try to rename some entries and see what happens, but as far as many parts are missing, there's no need for this right now.
[...]
Click to expand...
Click to collapse
Which should be the next thing to fix?
I attached the list of commits commited by LG in aosp kernel
95A31 said:
You are more skilled than me about this topic
Click to expand...
Click to collapse
Thanks for the flowers
95A31 said:
Which should be the next thing to fix?
Click to expand...
Click to collapse
I would like to get a working usb connection and use adb to communicate with the phone.
This would possibly increase the amount of interested people to check out a console based system on their phone and do some experiments.
I guess there are only a few people who got this earjack adapter or something.
At least the Nexus 5 is an interesting piece of embedded hardware to play with, even if the display got crashed.
95A31 said:
I attached the list of commits commited by LG in aosp kernel
Click to expand...
Click to collapse
Nice! Thanks for the list.
As this refers to AOSP kernel 3.4 it gives a good overview of the patches fixes and changes of course.
For mainline kernel 4.11 this is list would look very different though.
I still concentrate on fine tuning of the kernel configuration, as there are still many things to discover.
To get some Nexus 5 specific device drivers integrated would be nice as well (e.g. check BQ24190/2 code and implement it to DT).
Anyway... always remember this is a just for fun thing.
Could be some educational project if your like, but without all the binary blobs adopted to kernel 4.11 there will never be a working Android.
EDIT:
As for the educational purpose (my very own )
We can sample some interrupts from the PM8941 subsystem very well:
Code:
~ # cat /proc/interrupts
CPU0
18: 8925 GIC-0 20 Level arch_timer
20: 0 GIC-0 39 Level arch_mem_timer
22: 0 GIC-0 194 Edge adsp
23: 0 GIC-0 190 Edge smp2p
24: 0 GIC-0 59 Edge smp2p
25: 0 GIC-0 175 Edge smp2p
26: 1181 GIC-0 139 Level msm_serial0
27: 80 GIC-0 155 Edge mmc0
28: 0 GIC-0 170 Edge f9824900.sdhci
176: 0 GIC-0 127 Level i2c_qup
178: 0 GIC-0 271 Level bam_dma
179: 0 GIC-0 166 Edge msm_otg
186: 0 pmic_arb 6357309 Edge pm8xxx_rtc_alarm
187: 2 pmic_arb 524325 Edge pm8941_pwrkey
188: 0 pmic_arb 1050408 Edge chg-done
189: 0 pmic_arb 1049896 Edge chg-fast
190: 0 pmic_arb 1049640 Edge chg-trkl
191: 0 pmic_arb 1179946 Edge bat-temp-ok
192: 0 pmic_arb 1179690 Edge bat-present
193: 0 pmic_arb 1245739 Edge chg-gone
194: 4 pmic_arb 1245483 Edge usb-valid
195: 0 pmic_arb 1311020 Edge dc-valid
197: 2 pmic_arb 12648535 Edge volume_up
198: 2 pmic_arb 12714072 Edge volume_down
243: 0 GIC-0 188 Edge adsp
244: 0 GIC-0 57 Edge modem
245: 47 GIC-0 200 Edge rpm
246: 0 GIC-0 58 Edge smsm
247: 0 GIC-0 189 Edge smsm
248: 0 GIC-0 176 Edge smsm
249: 0 smp2p 0 Edge adsp
250: 0 smp2p 1 Edge adsp
251: 0 smp2p 2 Edge adsp
252: 0 smp2p 3 Edge adsp
IPI0: 0 CPU wakeup interrupts
IPI1: 0 Timer broadcast interrupts
IPI2: 652 Rescheduling interrupts
IPI3: 5 Function call interrupts
IPI4: 0 CPU stop interrupts
IPI5: 0 IRQ work interrupts
IPI6: 0 completion interrupts
Err: 0
To be more precisely:
volume_up, volume_down, pwrkey and usb-valid are detected and working.
Unfortunately no reaction from the host and no kernel message, when micro usb cable is attached or detached...
Whatever...
Regards,
scholbert
scholbert said:
[..]
I would like to get a working usb connection and use adb to communicate with the phone.
This would possibly increase the amount of interested people to check out a console based system on their phone and do some experiments.
I guess there are only a few people who got this earjack adapter or something.
At least the Nexus 5 is an interesting piece of embedded hardware to play with, even if the display got crashed.
[...]
Click to expand...
Click to collapse
Nice, I hope to have time to seriously play with it and maybe make something work.
scholbert said:
[...]
Anyway... always remember this is a just for fun thing.
Could be some educational project if your like, but without all the binary blobs adopted to kernel 4.11 there will never be a working Android.
[...]
Click to expand...
Click to collapse
I know, I know, sometime I follow my enthusiasm . Yes, blobs are a big problem for a working Android and when I think about how address it, and how much time it will require I die inside
Wow!!!
Hey there,
i just wondered how time goes by
I'm still using my hammerhead for daily use and from time to time i'm searching the web how things are evolving.
This is the coolest project i've seen for a while:
https://github.com/flto/linux/wiki/hammerhead-upstream
Need to do some research who's behind it
Have a nice day!
scholbert

[guide][root] Tweaks Redmi 4x stock ROM

Hello xda world,
EDIT 24 may 2018: using Luis kernel now on RR 5.8.4. Best I have tried so far!!
Link: http://luis-builds.de/downloads/lineageos/rr/Xiaomi_Redmi_4X_(santoni)/
EDIT 10-feb-2018: battery drain due to *alarm* and *launcher* system wakelocks solved with firmware V32.
Grab it here and flash with TWRP: https://forum.xda-developers.com/xiaomi-redmi-4x/how-to/firmwares-t3682965
Here I hope to collect some tweaks and mods that work in rooted Redmi 4x stock rom. (8.2.10.0 Global)
EDIT: since I use Resurrection Remix now I also added some RR tweaks
Since I just own the device it will be work in progress for a while. I search the forums for solutions for problems I encounter.
My Redmi 4x is OEM unlocked via Xiaomi, has twrp and Magisk root. (you need root for tweaks)
For OEM unlock you need account and register at miui.com, ask for unlock, wait 30+ hours and then use the miui unlock tool that checks if you are granted bij Xiaomi for unlock.
Some Redmi 4x facts:
- Xiaomi Redmi 4x has codename Santoni
- The Soc is Qualcomm 435 (msm8940 socid 313, msm8937 for the firmware), 4 cpu cores perf and 4 cpu cores power
- The gpu is Adreno 505
- main camera is Samsung S5K3L8, front camera is Omnivision ov5675
- notification LED has RGB!
- 5 GHz (11ac) only supported for wifi hotspot (wlan.ko issue)
- MIUI features are setup in the /etc/device_features/santoni.xml file
- CPU/kernel features are mostly setup in the /etc/init.qcom.post_boot.sh file
- fastboot: hold vol- and power, release power after vibrate
- recovery: hold vol+ and vol- and power, release power after vibrate
Redmi 4x related sites:
- Official miui.com for Redmi 4x http://en.miui.com/forum-123-1.html
- Resurrection Remix ROM for Redmi 4x https://sourceforge.net/projects/resurrectionremix/files/santoni/ (Antutu score 43000+)
- Miui EU ROM https://xiaomi.eu/community/forums/miui-weekly-rom-releases.103/
- Mi-Globe ROM (like EU ROM but with options) Mi-Globe
- Miui Belarus (MiuiPro) ROM https://miuipro.by/roms/
- Redmi 4x Global Edition on Bangood
- AOSP Extended (AEX) ROM Redmi 4X http://downloads.aospextended.com/santoni/
Note: If you change any file always make a copy of it first. I always copy the file in the same folder and give it extension .ORG. So build.prop becomes build.prop.ORG with adb shell: cp -p build.prop build.prop.ORG
Be sure the permissions of the files are set to rw-r--r-- (644)!!!!!!
Example adb/linux commands
From pc:
adb push "afile" /sdcard
adb shell
On device:
su
stop
mount -o remount,rw /system
cd "/afolder"
cp -p "afile" "afile.ORG"
cp /sdcard/"afile" .
ls -l "afile*"
chmod 644 "afile"
reboot
Ofcourse afile and afolder are just example names.
If you are not familiar with linux shell or adb then you can find zip files to flash in TWRP mode.
You need to REBOOT after changing any of these files.
Note 2: I am not responsible for any damage to your device. Use this at your own risk!
Audio recording mod (mixer mod)
Recording audio on stock rom is terrible. On the internet I found a solution. You need to change 2 mixer files.
If you also want louder speaker you need to copy /etc/mixer_paths.xml too.
/etc/mixer_paths_qrd_sku1.xml
mic volume for voice call
Code:
<path name="voice-call">
<!-- tweakradje add 2 lines -->
<ctl name="DEC1 Volume" value="88" />
<ctl name="DEC2 Volume" value="88" />
<ctl name="PRI_MI2S_RX_Voice Mixer CSVoice" value="1" />
<ctl name="Voice_Tx Mixer TERT_MI2S_TX_Voice" value="1" />
</path>
mic volume for audio rec like movie, try between 100-124, use 100 for very loud env
Code:
<path name="handset-mic">
<path name="adc1" />
<!-- tweakradje add 2 lines -->
<ctl name="DEC1 Volume" value="110" />
<ctl name="DEC2 Volume" value="110" />
<ctl name="IIR1 INP1 MUX" value="DEC1" />
</path>
mic volume for audio rec like movie, try between 100-124, use 100 for very loud env
Code:
<path name="handset-stereo-dmic-ef">
<!-- tweakradje add 2 lines -->
<ctl name="DEC1 Volume" value="110" />
<ctl name="DEC2 Volume" value="110" />
<path name="speaker-dmic-endfire" />
</path>
/etc/audio_platform_info.xml
Code:
<acdb_ids>
<!-- tweakradje add 2 lines, but no more auto rec mic volume -->
<device name="SND_DEVICE_IN_HANDSET_MIC" acdb_id="1"/>
<device name="SND_DEVICE_IN_HANDSET_STEREO_DMIC" acdb_id="1"/>
<device name="SND_DEVICE_OUT_SPEAKER_PROTECTED" acdb_id="136"/>
<device name="SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED" acdb_id="136"/>
<device name="SND_DEVICE_OUT_SPEAKER_PROTECTED_VBAT" acdb_id="136"/>
<device name="SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED_VBAT" acdb_id="136"/>
<device name="SND_DEVICE_IN_CAPTURE_VI_FEEDBACK" acdb_id="137"/>
</acdb_ids>
Now audio is fine when recording video and sounds even great!
You can download the 2 files below. Check if you need to insert these lines in your file or that you can use mine.
For recording stereo audio only I use Sony Audio Recorder which is free and perfect.
EDIT 18 dec 2017: Found that acdb_id="4" works well, which is the default mic profile in ACDB. However you need to lower the "DEC1 Volume" and "DEC2 Volume" to 94.
EDIT 23 dec 2017: About Audio Calibration (ACDB) files
You might have noticed that there are more than one set of acdb file in /etc/acdbdata folder. There are MTP end QRD sets. QRD stands for Qualcomm Reference Design. You can play with these Calibration Profiles for speakers and microphone.
Easiest is to create a new build.prop (644) in the /vendor folder.
Then play with these values. You can also mix MTP and QRD for devices. Like using all MTP but for General and Handset use the QRD version.
Code:
persist.audio.calfile0=/etc/acdbdata/QRD/QRD_Bluetooth_cal.acdb
persist.audio.calfile1=/etc/acdbdata/QRD/QRD_General_cal.acdb
persist.audio.calfile2=/etc/acdbdata/QRD/QRD_Global_cal.acdb
persist.audio.calfile3=/etc/acdbdata/QRD/QRD_Handset_cal.acdb
persist.audio.calfile4=/etc/acdbdata/QRD/QRD_Hdmi_cal.acdb
persist.audio.calfile5=/etc/acdbdata/QRD/QRD_Headset_cal.acdb
persist.audio.calfile6=/etc/acdbdata/QRD/QRD_Speaker_cal.acdb
#persist.audio.calfile0=/etc/acdbdata/MTP/MTP_Bluetooth_cal.acdb
#persist.audio.calfile1=/etc/acdbdata/MTP/MTP_General_cal.acdb
#persist.audio.calfile2=/etc/acdbdata/MTP/MTP_Global_cal.acdb
#persist.audio.calfile3=/etc/acdbdata/MTP/MTP_Handset_cal.acdb
#persist.audio.calfile4=/etc/acdbdata/MTP/MTP_Hdmi_cal.acdb
#persist.audio.calfile5=/etc/acdbdata/MTP/MTP_Headset_cal.acdb
#persist.audio.calfile6=/etc/acdbdata/MTP/MTP_Speaker_cal.acdb
MIUI Camera mod (features unlock)
This is how you unlock those high end features you find on higher end models. To enable the features you need to edit the /etc/device_features/santoni.xml (or /sdcard/device_features/santoni.xml) file. Mostly change false into true to enable them.
Some are also added from other Xiaomi devices.
Download from below.
Camera parameters found:
Code:
support_camera_4k_quality
support_camera_age_detection
support_camera_aohdr
support_camera_audio_focus
support_camera_boost_brightness
support_camera_burst_shoot
support_camera_gradienter
support_camera_hfr
support_camera_manual_function
support_camera_movie_solid
support_camera_peaking_mf
!support_camera_press_down_capture
support_camera_quick_snap
support_camera_record_location
support_camera_shader_effect
support_camera_skin_beauty
support_camera_tilt_shift
support_camera_torch_capture
support_camera_ubifocus
support_camera_video_pause
support_camera_water_mark
Camera 2 API
You can enable Camera 2 API for 3rd party camera apps. Think about manual focus etc.
Add this line to your build.prop:
persist.camera.HAL3.enabled=1
More interesting Camera's: https://forum.xda-developers.com/mi-5/themes/app-collection-camera-modded-t3591177
Better (modded) MIUI Camera
From my friends at 4pda. Much better camera at low light. Also JPEG quality set to 98.
http://4pda.ru/forum/index.php?showtopic=793497&view=findpost&p=57013739
Flash zip in twrp (backup of original camera is made by script)
If you want to do it manualy:
- take the MiuiCamera.apk from the zip
- adb push MiuiCamera.apk /sdcard/
- adb shell
- su
- mount -o remount,rw /system
- cd /system/priv-app/MiuiCamera
- mv MiuiCamera.apk MiuiCamera.apk.ORG
- mv oat oat.ORG
- cp /sdcard/MiuiCamera.apk .
- chmod 644 MiuiCamera.apk
- ls -l
- stop
- sync
- reboot
Enable Dalvik JIT (Android 6)
Add this line to your build.prop file:
debug.usejit=true
When cleaning the dalvik cache your phone will boot much faster. Don't have to wait for 5 or 10 minutes anymore
Test Color Notification Led
See here: http://en.miui.com/thread-605570-1-1.html
EDIT 15 sep 2017:
Color Notification led support: http://en.miui.com/thread-850569-1-1.html
or at the source: http://4pda.ru/forum/index.php?showtopic=841683&st=0#entry64978644
Change MIUI theme and launcher
You can change variables of the package (apk) using MIUI themes. But you can also change the default theme.
The default theme is located at /system/media/theme/default
Changes to the MIUI Launcher (home screen) can easily made. It is a zip file (com.miui.home.zip) with a theme_values.xml in it. Change or add values to the xml file, copy it to /system/media/theme/default/com.miui.home and reboot.
Note that the zip has no extension when you copy it to the folder!!! It must have the name of the package.
Below you find an example of a 5x6 launcher grid. If you want to know more better search google with MIUI_Theme_Values
You can do this for example also with MiuiSystemUI.apk (com.android.systemui) and many more
Alternative CPU core control
There are 4 performance cpu's (cpu 0123) and 4 powersave cpu's (cpu 4567). Depending on the task load they increase or decrease their cpu frequency. But they can also switch on or off. Default 2 perf cores and all 4 power cores stay on.
I modified the /etc/init.qcom.post_boot.sh script for the purpose that only 1 perf and 1 power core stay on with no task load. This consumes less power and increases battery life.
Copy init.qcom.post_boot.sh.txt to /etc/init.qcom.post_boot.sh and reboot. Don't forget to make a copy.
Code:
echo 1 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus
### power cluster min 1 cpu max 4, busy up/down from 0000 to 68 and 40, perf cluster up like 80+
### prefer (low-)power cores cpu4567 up before perf cores cpu0123 (high power consumtion)
echo "80 85 90 95" > /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres #68, only looks at 1st value
echo 68 > /sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres
echo 40 > /sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres
### Wait x ms before switching core off, you might need it again
echo 500 > /sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms #100 (test .5 sec)
echo 500 > /sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms #100 (test .5 sec)
Resurrection Remix strange adb shell prompt
Change /etc/mkshrc, comment last 3 lines
Code:
}$HOSTNAME:${PWD:-?} '"$PS1 "
#if [ "z$ANDROID_SOCKET_adbd" != "z" ]; then
# resize
#fi
Force battery charge to 90%
Code:
# Charge only up to 89% instead of 100% for longer battery life? cat /sys/class/power_supply/battery/voltage_now
echo 4260 > /sys/class/power_supply/battery/voltage_max # 4400 (nominal 3.85V)
My additions to build.prop (/vendor/build.prop)
This is my current /vendor/build.prop and the big advantage is that you can leave your ROM's /system/build.prop as it is. The /vendor/build.prop will overwrite settings from /system/build.prop!
High wakelock with low signal data connection? Try this in build.prop
ro.ril.wake_lock_timeout=2000
Ps: Check for property errors direct after reboot with: dmesg | grep prop
Code:
### always check values with "dmesg | grep prop"
### /default.prop
### /system/build.prop
### /vendor/build.prop (*)
### /factory/factory.prop
### /data/local.prop
### tweakradje RR 5.8.4/5
lockscreen.rot_override=true
#ro.radio.noril=true
# dumpsys SurfaceFlinger will give 1920x1200 density of 295 dpi
#ro.sf.lcd_density=295
#30% faster app loading?
sys.use_fifo_ui=1
# pm multitask def = 6
persist.pm.multitask=8
#ro.recents.grid=true
ro.cutoff_voltage_mv=3200
ro.config.swap=false
ro.config.zram=false
ro.sys.sdcardfs=true
ro.ril.wake_lock_timeout=2000
persist.radio.aosp_usr_pref_sel=true
#ro.audio.offload_wakelock=true (default)
#audio.offload.ignore_setawake=false (default)
#opengl 3d hw accel
debug.egl.hw=1
# hw compositing, if 0 then always software
debug.sf.hw=1
#sys.hwc.gpu_perf_mode=1
### composition valid if debug.sf.hw=0 (and sys.hwc.gpu_perf_mode=0)
#debug.composition.type=c2d
debug.composition.type=mdp
ro.sf.compbypass.enable=0
# use development settings for force gpu
#persist.sys.ui.hw=true
debug.gr.numframebuffers=3
#no debug messages
debug.hwui.level=0
#debug.egl.swapinterval=-1 (def)
#debug.egl.swapinterval=0
#HWUI properties
#ro.hwui.texture_cache_size=72
#ro.hwui.layer_cache_size=48
#ro.hwui.r_buffer_cache_size=8
#ro.hwui.path_cache_size=32
#ro.hwui.gradient_cache_size=1
#ro.hwui.drop_shadow_cache_size=6
###ro.hwui.texture_cache_flushrate=0.4
#ro.hwui.text_small_cache_width=1024
#ro.hwui.text_small_cache_height=1024
#ro.hwui.text_large_cache_width=2048
#ro.hwui.text_large_cache_height=2048
###ro.hwui.fbo_cache_size=32
#debug.hwui.skip_empty_damage=true
#debug.hwui.use_buffer_age=true
#debug.hwui.enable_partial_updates=true
#debug.hwui.render_dirty_regions=true
#debug.hwui.disable_draw_defer=false
#debug.hwui.disable_draw_reorder=true
#debug.choreographer.vsync=false
#debug.choreographer.frametime=false
#debug.choreographer.skipwarning=20
# Use UBWC
###debug.gralloc.map_fb_memory=0
###debug.gralloc.enable_fb_ubwc=1
# 0 = force to enable scrollingCacheEnabled regardless of app setting
# 1 = default is to enable scrollingCacheEnabled unless app specifies
# 2 = default is to disable scrollingCacheEnabled unless app specifies
# 3 = force to disable scrollingCacheEnabled regardless of app setting
persist.sys.scrollingcache=3
ro.config.max_starting_bg=12
#ro.sys.fw.bg_apps_limit=20
ro.config.vc_call_vol_steps=14
ro.config.media_vol_steps=30
#ro.hardware.egl=adreno
#perstist.power.usetwilightadj=true
# JIT Android 6
debug.usejit=true
# JIT Android 7
#dalvik.vm.usejit=true
#dalvik.vm.usejitprofiles=true
#ro.core_ctl_min_cpu=0
#ro.min_freq_0=200000
#ro.min_freq_0=384000
#ro.min_freq_4=384000
### EXTRA CAMERA ###
###https://android.googlesource.com/platform/hardware/qcom/camera/+/9fc7225504a6f969bd7277c1070f0b91b0ce4874/msmcobalt/QCamera2/HAL/QCameraParameters.cpp
###https://android.googlesource.com/platform/hardware/qcom/camera/+/nougat-dev/QCamera2/HAL/QCameraParameters.cpp
persist.sys.camera-sound=0
persist.camera.HAL3.enabled=1
###https://android.googlesource.com/platform/hardware/qcom/camera/+/f9a41d251fab1320345588e7654a1b0f4c70ae1c/QCamera2/stack/common/cam_types.h
#-persist.camera.hal3.feature=32
### HAL3 High Frame Rate
#-persist.camera.hal3hfr.enable=1
#-persist.camera.hal3.force.hdr=0
#persist.camera.perflock.enable=1
# fps def is 60
persist.camera.disp.fps=30
persist.camera.max.previewfps=30
#persist.camera.pdaf.enable=1
# focus call back (def 1)
#-persist.camera.depth.focus.cb=0
#persist.camera.disp.num_vsync=4
#persist.camera.disp.ms_to_vsync=2
#persist.camera.disp.filter_max=2
#persist.camera.disp.filter_min=4
# thumbnail needed
#-persist.camera.tn.disable=0
# anti banding 0 1=auto 2=50Hz 1=60Hz
#persist.camera.set.afd=2
# 0=disable 1=with aggressive AEC 2=with fast AEC
#-persist.camera.instant.capture=2
#-persist.camera.instant.aec=2
#persist.camera.dt=0
#persist.camera.vc=0
### adb shell setprop persist.camera.effect <effect>
### none,mono,negative,solarize,sepia,posterize,whiteboard,blackboard,aqua,emboss,sketch,neon,beauty
#persist.camera.effect=none
### check for raw images /data/misc/camera folder!
#persist.camera.raw.dump=0
#persist.camera.raw.debug.dump=0
# raw format 16(yuv?) 17 or 18
#persist.camera.raw.format=17
#persist.camera.raw.subformat=
#persist.camera.raw_yuv=0
#persist.camera.zsl_raw=0
#persist.camera.snapshot_raw=20
# nr buffers, adb shell setprop persist.camera.preview_yuv 20 <20 preview buffers>
#persist.camera.preview_yuv=0
#persist.camera.preview_raw=0
#persist.camera.video_raw=0
# raw data i? mode
#persist.camera.rdi.mode=disable
#persist.camera.offlineraw=0
### manual exposure, enables persist.camera.exposure.time
#persist.camera.manual.capture=1
### adb shell setprop persist.camera.exposure.time "exposure time" (in millisec) 10 = 1/100
#persist.camera.exposure.time=10
#persist.camera.initial.exp.val=10
# 1=CAM_ISO_MODE_DEBLUR 100 200 ...
#persist.camera.iso=1
#persist.camera.continuous.iso=100
#correlated double sampling mode on off auto(def) (noise reduction)
#persist.camera.CDS=on
#persist.camera.video.CDS=auto
# TemporalDenoise (Supported at all?)
#persist.camera.tnr_cds=1
#persist.camera.tnr.snapshot=on
#persist.camera.tnr.video=on
#persist.camera.tnr.preview=on
# Low light noise feature is to avoid noise seen at the snapshot frame edges due to WNR processing
#persist.camera.llnoise=0
# low light capture
#persist.camera.llc=1
# 0=CAM_WAVELET_DENOISE_YCBCR_PLANE
# 1=CAM_WAVELET_DENOISE_CBCR_ONLY
# 2=CAM_WAVELET_DENOISE_STREAMLINE_YCBCR
# 3=CAM_WAVELET_DENOISE_STREAMLINED_CBCR
#persist.denoise.process.plates=2
#persist.tnr.process.plates=2
#persist.camera.tintless=enable
# Burst LED on period 1-799 def 300
#persist.camera.led.on.period=150
#persist.camera.secure.mode=disable
#camera.lowpower.record.enable=1
#cpp or vfe scaling
#persist.camera.pp_scaling=0
#persist.camera.ltmforseemore=1
#persist.camera.preview.seemore=1
#persist.camera.liveshot.size=1280x720
#persist.camera.stats.af.paaf=1
#persist.camera.preview.ubwc=1
# high temp? then lower fps (or frameskip)
persist.camera.thermal.mode=fps
#persist.camera.batchcount=0
#persist.camera.video.batchsize=6
#persist.camera.opt.livepic=1
# Chromatic Aberation enabled? Check logcat grep -i chroma
# E mm-camera: <IMGLIB><ERROR> 695: module_cac_handle_aec_update: module_cac_handle_aec_update 695: Invalid chromatix ptr
#persist.camera.feature.cac=1
persist.camera.eis.enable=1
# preferred IS type for 8937 is IS_TYPE_DIS i.e, 1
# IS_TYPE_NONE=0, IS_TYPE_DIS=1, IS_TYPE_GA_DIS=2, IS_TYPE_EIS_1_0=3, IS_TYPE_EIS_2_0=4 IS_TYPE_MAX=5
persist.camera.is_type=4
persist.camera.is_type_preview=4
#CAMERA_LONGSHOT_STAGES=4
#persist.camera.longshot.stages=1
#persist.camera.longshot.max=5
#persist.camera.longshot.shotnum=5
#persist.camera.longshot.save=0
# use jpeg burst if persist.camera.longshot.save=0
#persist.camera.jpeg_burst=1
### Check whether shutter should be triggered immediately after capture
persist.camera.feature.shutter=1
#persist.camera.facedetect=1
#persist.camera.snapshot.fd=1
# face detect in video 0 1 2(only for focus)
#persist.camera.fdvideo=1
#persist.camera.mem.usepool=1
# video shooting ION cache, disable for faster shooting
persist.camera.mem.usecache=0
persist.sys.exif.make=Xiaomi
persist.sys.exif.model=Redmi 4X Tweakradje
#persist.camera.auto.hdr.enable=enable
### dual camera range finding
persist.camera.dcrf.enable=0
### multi_pass cause 3/4 green effect when zoomin
persist.camera.multi_pass=0
#persist.camera.zsl.mode=1
#persist.camera.zsl.interval=1
#persist.camera.zsl.backlookcnt=2
#persist.camera.zsl.queuedepth=2
#persist.camera.zsl.buffer.size=
# zigzag hdr
#persist.camera.hdr.outcrop=enable
persist.camera.zzhdr.enable=1
persist.camera.zzhdr.video=1
# disable UBWC (universal bandwidth compression) if enable eztune
#debug.gralloc.gfx_ubwc_disable=0
#persist.camera.eztune.enable=0
#persist.camera.perf.memlimit=0x800
#persist.camera.capture.animate=1
camera.qcom.misc.disable=0
persist.ts.rtmakeup=0
#persist.camcorder.4k.nolimit=1
#persist.camcorder.eis.maxfps=30
#debug.camera.yv12=true
#debug.camera.preview.flip=90
#debug.camera.video.flip=90
#debug.camera.picture.flip=90
#ClearSight? settings
#persist.camera.cs.threshold=0xf4240 clearsight threshold (long)
#persist.camera.cs.burstcount=4
#persist.camera.cs.dumpframes=0
#persist.camera.cs.timeout=0x12c
#ro.miui.screen_layout_size=3
#ro.sys.oosenhance.enable=true
#ro.sys.oosenhance.timer=2000
#debug.oosenhance.turnon=true
### EXTRA AUDIO ###
# resampler DEFAULT=0
# OLD values LOW_QUALITY=1(1st order) MED_QUALITY=2(3rd order) HIGH_QUALITY=3(fixed multi-tap FIR) 4 VERY_HIGH_QUALITY
# 1-3 AudioResampler: Assertion failed: format != AUDIO_FORMAT_PCM_16_BIT /system/lib/libaudioresampler.so (_ZN7android14AudioResampler6createE14audio_format_tiiNS0_11src_qualityE+1024)
# Using the new DYN_*_QUALITY resamplers (modes 5-7) allows floating point audio to work. 8 works too
af.resampler.quality=7
# cat /proc/asound/card0/id -> msm8920sku7sndc -> /etc/acdbdata/QRD/msm8920-sku7-snd-card
### QRD (Qualcomm Reference Design) or MTP Audio Calibration files?
#persist.audio.calfile0=/etc/acdbdata/MTP/MTP_Bluetooth_cal.acdb
#persist.audio.calfile1=/etc/acdbdata/MTP/MTP_General_cal.acdb
#persist.audio.calfile2=/etc/acdbdata/MTP/MTP_Global_cal.acdb
#persist.audio.calfile3=/etc/acdbdata/MTP/MTP_Handset_cal.acdb
#persist.audio.calfile4=/etc/acdbdata/MTP/MTP_Hdmi_cal.acdb
#persist.audio.calfile5=/etc/acdbdata/MTP/MTP_Headset_cal.acdb
#persist.audio.calfile6=/etc/acdbdata/MTP/MTP_Speaker_cal.acdb
# calibrate speaker duration (0) if spk prot true
persist.speaker.prot.enable=false
#persist.spkr.cal.duration=50
# audio, offload to audio hardware
audio.offload.disable=false
audio.offload.buffer.size.kb=256
av.streaming.offload.enable=true
audio.offload.multiple.enabled=true
ro.audio.max_fast_tracks=8
ro.audio.flinger_standbytime_ms=500
audio_hal.period_multiplier=2
#audio_hal.period_size=192
audio_hal.in_period_size=50
#Qualcomm Immersive Audio Noise Cancellation (Fluence), Pro is quadmic
#ro.qc.sdk.audio.fluencetype=fluencepro
#ro.qc.sdk.audio.fluencetype=fluence
#ro.qc.sdk.audio.fluencetype=none
#persist.audio.fluence.voicecall=true
#persist.audio.fluence.audiorec=false
persist.audio.fluence.mode=endfire
#persist.audio.fluence.mode=broadside
#rec.playback.conc.disabled=false
#surround recording
ro.qc.sdk.audio.ssr=false
# dump recording /data/misc/audio/ssr_input_3ch.pcm
#ssr.pcmdump=true
# acdb full freq spectrum on speakers ACDB 131
# persist.audio.FFSP.enable=true -> gives acdb error in logcat!!!
# native audio?
audio.nat.codec.enabled=true
persist.audio.hifi.int_codec=true
# active noise cancelation
#persist.aanc.enable=1
#persist.headset.anc.type=
#persist.audio.vbat.enabled=true
#libdirac.so also /vendor/etc/diracmobile.config
audio.dirac.logging=0
#persist.audio.dirac.headset=5
#persist.audio.dirac.eq=
#persist.audio.dirac.music.state=0
# not complete lib files to enable dirac in RR
persist.audio.dirac.speaker=false
#
use.dts_eagle=false
persist.bt.max.hs.connections=4
persist.bt.max.a2dp.connections=4
persist.bt.enableAptXHD=true
persist.service.bt.a2dp.sink=false
#ro.bluetooth.hfp.ver=1.5
#ro.bluetooth.hfp.ver=1.6
ro.bluetooth.hfp.ver=1.7
#persist.bluetooth.disableabsvol=true
#wc_transport.force_special_byte=true
#bt.pts.certification=true
audio.dolby.ds2.enabled=false
audio.dolby.ds2.hardbypass=true
### EXTRA NETWORK ###
ro.net.dns_cache_size=1500
net.dns.cache_size=1500
net.dns.cache_ttl=1800
net.http.threads=20
net.dns2=8.8.8.8
### EXTRA SQLITE ###
# find /data/data \( -name *-journal -o -name *-wal -o -name *-shm \) -exec rm {} \;
#debug.sqlite.journalmode=DELETE
#debug.sqlite.syncmode=FULL
#debug.sqlite.pagesize=
#sqlite Write Ahead Logging on? creates big WAL files and shm (shared mem) files, log 512KB
debug.sqlite.journalmode=WAL
debug.sqlite.wal.autocheckpoint=0
debug.sqlite.wal.syncmode=FULL
debug.sqlite.journalsizelimit=524288
#debug.sqlite.wal.poolsize=
If you have more interesting mods don't hesitate to post them and I will add them to the OP.
EDIT 5 sep 2017: added new RR init script (v2), better CPU cores and audio !!! v2 might cause battery drain, then v3
EDIT 8 sep 2017: added /etc/wifi/WCNSS_qcom_cfg.ini for 40 Mhz channel on 2.4Ghz
added new RR init script (v3) for better battery life
EDIT 15 oct 2017: removed mixer_paths.xml, use stock. Changes applied to new mixer_paths_qrd_sku1.xml
EDIT 21 oct 2017: added V4 for RR, better target_loads for big/little CPU's
EDIT 31 oct 2017: added V5 for RR, better big perf/little lowpower cpu switching. Perf cpu minimal is 0. Most tasks done with lowpower cpu's. Can run youtube for almost 11 hours now!
EDIT 4 nov 2017: Noticed one little error in V5 RR script.
Echo Y > /sys/module/workqueue/parameters/power_efficient
should be
echo Y > /sys/module/workqueue/parameters/power_efficient
EDIT 16 nov 2017: V6 RR script. Optimal use of RAM. Tested for 3 GB only. All apps stay in ram. Almost no swapping. Example, Chrome keep tabs without reloading. Antutu score now 46350!
EDIT 20 nov 2017: V7 RR script. Create 512 MB ZRAM swap if RAM < 2GB and don't lower swappiness (only for 3 GB)
Little change for V7 script:
### tweakradje use small cores to the max before switch to big cores (antutu only 35000 instead of 46000)
echo 0 > /dev/cpuctl/cpu.upmigrate_discourage
EDIT 23 nov 2017: added stereo recording in AAC with Redmi 4X (speakers cyburg needles with Tangband w3-881sjf https://www.youtube.com/watch?v=MsgAFoTghvw )
EDIT 2 dec 2017: little corrections in V7 RR script and changed to flashable zip.
EDIT 6 jan 2018: change emmc max freq from 200 to 300 MHz. Increase the read speed from 80Mb/s to 120 Mb/s (note: you can try 400 or 500 Mhz. Might cause reboot, please report back) Test with busybox hdparm -tT /dev/block/mmcblk0p49
EDIT 13 feb 2018: V9 of the script. Added tweaked deviceidle (doze) settings. Device looses 0-1% overnight!
EDIT 15 feb 2018: V10 of the script. Improved Light/Deep Doze settings with documentation in the script. Put your email app in the whitelist too!!!
EDIT 18 feb 2018: V11 ready. Won battle with Google Play Services that reset the device_idle_constants to "null" every few hours. Solution: pm disable --user 0 com.google.android.gms/.phenotype.service.sync.PhenotypeConfigurator
Doze settings and explanation are in the script for those who want to change some timings. The script sets it to this scheme:
- Enter light doze after screen off
- Light maintenance windows every 5 minutes
- Enter Deep doze after 15 minutes (enter deep if there is no alarm within 5 minutes from now, was 1 hour)
- Deep maintenance windows every hour
- Whatsapp and Gmail white listed (can do their thing regardless of doze state)
- No delays for phone motion or whatever
EDIT 8 mar 2018: updated some audio related files with comments in it. Change to your liking , now awesome high quality good calibrated stereo sound recording!!
EDIT 6 apr 2018: V13 of the init script. Changed things like min/max cpu speed for custom kernel
EDIT 9 apr 2018: flashable scripts now create backup of replaced files if not exist. (*.ORG)
EDIT 25 may 2018: V15 of the init script for 7.x Nougat ROMs.
EDIT 16 jun 2018: V16 of the init script for 7.x Nougat ROMs (LAST AND FINAL!)
Cheers
PLEASE don't quote first post. Waste of space and it will change anyway. THANKS
Data partition is encrypted
I found that the data partition is encrypted when coming from Miui ROM to RR. Fingerprint is not working with encrypted data partition.
Data is encrypted if TWRP asks for unlock code.
These steps decrypts it and preserves data.
Code:
- Boot into TWRP
- Backup /data to "internal sd" (or to "ext sd card") with TWRP
- On PC: adb pull /data/media/0
- Wipe -> Format /data in TWRP
- Reboot to TWRP again
- On PC: adb push . /data/media/0
- On PC: adb shell chown -R media_rw.media_rw /data/media/0
- Reboot to TWRP again
- Restore the previous backup with TWRP
- On PC: adb shell rm /data/system/locksettings* /data/system/*.key
- On PC: adb shell rm -r /data/dalvik*
- Reboot
Change Doze (deviceidle) settings
On the device you can change the Doze settings very easy. First list the Doze settings to get all current parameters:
Code:
dumpsys deviceidle
Then change parameters by setting some variables in the Android Global Settings db:
Code:
settings put global Phenotype_flags device_idle_constants
settings put global device_idle_constants inactive_to=300000,idle_after_inactive_to=300000
Enable light doze too (mLightEnabled=true mDeepEnabled=true)
Code:
dumpsys deviceidle enable all
Add whatsapp and gmail to the whitelist
Code:
dumpsys deviceidle whitelist +com.whatsapp +com.google.android.gm
Note: Google Play Services reset the device_idle_constants to "null" every few hours. Solution: pm disable --user 0 com.google.android.gms/.phenotype.service.sync.PhenotypeConfigurator
See more info in post above
Use Fingerprint sensor as button
As you might know hardware keys have keycodes. These keycodes can be found using an app like KeyEvent Dipslay
The mapping between Keycode and Function is done in the kl files in the folder /system/usr/keylayout
To map the Fingerprint key (Keycode 353) you use the gf3208.kl file.
Code:
#key 353 ENTER
#key 353 CAMERA
#key 353 MENU
key 353 SLEEP
Reboot for effect. This will not effect the Fingerprint function.
Super audio for Resurrection Remix
To enable HD audio for headphones and other audio tweaks for RR (maybe for Miui too)
Add these lines to the end of your build.prop
Code:
audio.offload.disable=false
audio.offload.buffer.size.kb=1024
persist.audio.FFSP.enable=true
audio.nat.codec.enabled=true
persist.audio.hifi.int_codec=true
persist.audio.dirac.speaker=false
use.dts_eagle=true
Some tweaks for camera driver
To enable some extra features to play with. You can add these to the end of your build.prop
For the stock camera on RR ROM make sure you disable Color Denoise setting.
Code:
#persist.camera.liveshot.size=1280x720
persist.camera.HAL3.enabled=1
persist.camera.hal3hfr.enable=1
persist.camera.ltmforseemore=1
persist.camera.led.on.period=500
persist.camera.stats.af.paaf=1
persist.camera.manual.capture=1
# high temp? then lower fps (or frameskip)
persist.camera.thermal.mode=fps
persist.camera.opt.livepic=1
# Chromatic Aberation enabled? Check logcat grep -i chroma
# E mm-camera: <IMGLIB><ERROR> 695: module_cac_handle_aec_update: module_cac_handle_aec_update 695: Invalid chromatix ptr
persist.camera.feature.cac=1
persist.camera.eis.enable=1
persist.denoise.process.plates=2
persist.camera.longshot.stages=1
persist.camera.facedetect=1
persist.camera.snapshot.fd=1
# face detect in video 0 1 2(only for focus)
persist.camera.fdvideo=1
persist.camera.mem.usepool=1
persist.camera.mem.usecache=5000000
persist.sys.exif.make=Xiaomi
persist.sys.exif.model=Redmi 4X
persist.camera.feature.shutter=1
persist.camera.auto.hdr.enable=1
persist.camera.tintless=1
#persist.camera.continuous.iso=200
#persist.camera.exposure.time=
# dual camera range finding
persist.camera.dcrf.enable=0
persist.camera.multi_pass=1
persist.camera.zsl.mode=1
persist.camera.zsl.interval=1
persist.camera.zsl.backlookcnt=2
persist.camera.zsl.queuedepth=2
# zigzag hdr
persist.camera.zzhdr.enable=1
persist.camera.zzhdr.video=1
persist.camera.eztune.enable=0
# TemporalDenoise (Supported at all?)
persist.camera.tnr_cds=1
persist.camera.tnr.snapshot=1
persist.camera.tnr.video=1
persist.camera.tnr.preview=1
# low light noise enabled?
persist.camera.llnoise=1
More will follow
oke thanks
Sipppp
Mine has rgb led. See led test script in OP. But even in RR rom it is not suported. Pitty. Perhaps support will come later. I've seen users with tasker scripts to make it work.
Very thanks for the cpu control you have created, my backup is now nearly +30% thanks again and also for camera mod keep up the good work:good:
Abugk said:
Does this redmi 4x has RGB LED . Can you please confirm it ?
From these screenshots I'm assuming that it has a RGB LED . How can I enable it ?
Click to expand...
Click to collapse
Easiest way to get it is install camera mod.
For just led colors, change the line on /system/etc/device_features/santoni.xml
Code:
<bool name="support_led_color">[B]true[/B]</bool>
Wow. Great work... cant wait to try these one too. Thanks
Hi, how can I use your CPU cores tweak in MIUI 9?
Thanks!
You can take the RR version. Make copy of your original file first!
Cheers
Anyone running RR with my V2 script having battery drain issues? I have since yesterday.
I am now running new script to test battery drain. The change is to disable all these
low power modes again. Lets see tomorrow.
Oh and if you see the notification led blinking purple after reboot? The V3 script switches it
off again after 3 sec.
Can everything here useful for any rom with nougat or just RR?
Not everything. A lot is MIUI related.
Except the things that are qualcomm related like xml files and init files.
RR files are for nougat in general.
But always make a copy of your original file first!!!
can u make text percentage only mod for miui9 global. this option is present in miuipro
tweakradje said:
Not everything. A lot is MIUI related.
Except the things that are qualcomm related like xml files and init files.
RR files are for nougat in general.
But always make a copy of your original file first!!!
Click to expand...
Click to collapse
So , that means ,these tweaks can be used in miui9???
Sure. Make copy first so that you can always go back to original.
tweakradje said:
Anyone running RR with my V2 script having battery drain issues? I have since yesterday.
I am now running new script to test battery drain. The change is to disable all these
low power modes again. Lets see tomorrow.
Oh and if you see the notification led blinking purple after reboot? The V3 script switches it
off again after 3 sec.
Click to expand...
Click to collapse
Me too, mine dropped 10% after a night with wifi and data off.
I'm on RR build 170815.
Thanks for the feedback. I use v3 of the script now for 2 days and battery is perfect. Try it. After install switch off the phone completely ( no reboot ) and then switch it on again. It worked for me.
tweakradje said:
Thanks for the feedback. I use v3 of the script now for 2 days and battery is perfect. Try it. After install switch off the phone completely ( no reboot ) and then switch it on again. It worked for me.
Click to expand...
Click to collapse
How to install it? your cpu Config, Iam using 8.2..10 and have copied the txt to my sh file, i already save it and set to rwrr too, but cpu config still default, even after i restart my phone.. still default config cpu running helpppp
You have to remove the txt extension. Then copy it over existing file. Check permissions and then reboot.
Don't edit file. It has unix EOL in it.
thanks for your advice, i have tried it.. is RRV3 version have same config as default? 2 perf 4 power cpu on?

Categories

Resources