[Xiaomi Mi Note Pro] Aqq123:
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:

# gapps-config-leo.txt
# Aqq123 @ XDA, http://xdaforums.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!