[ZTE Nubia X Guides, News, & Discussion] RomanLeFrais:
Hi everyone ! I spent 4 entire day figure it out how to make a more "normal" ROM for this phone

I hope it could help someone. Its my first post and my first tutorial, english is not my main language. ;)

##I don't use any of the .exe virus provided by nubia in this post:laugh:##

___________________________________________________________________________________________________________________________________​

The links are here : https://www.mega.nz/#!SSIwzabC key : dcmF39szbt0yJ9e04KrCHYWrAra1yPSxHl11VSkkcMs

Mirror : https://www.1fichier.com/?u60nxhibfx1zn5raahpx

Note : I bought the Z20 :p I no longer have this phone so I wil stop maintening this ROM

there is some issue with the GPS, OpenGapps or google do some sort of disabling things I don't know :confused: I tried my best but I could not get it to work :(

The mokee team ported mokee on this phone though you can find it here : https://download.mokeedev.com/nx616j.html Thanks to EspritNewGen to let me know and test it for me :highfive: He wasn't able to pass BasicIntegrity but I'm pretty sure if you install Magisk and hide the root for the play service and install MagiskProps Config to spoof your ROM fingerprint you will even be able to play PokemonGo :laugh:​

#CHANGES :

Google app (play store etc) provided but not installed by default

Support Google backup

Disabled vbmeta (your devices is corrupt)

Changed the launcher by Lawnchair

Changed the SMS app by Silence

Changed the Nubia Browser by Firefox

Changed the default languages to en_US

Installed the latest Magisk

Riot is pre-installed (you can remove it in /system/priv-app)

Telegram is pre-installed (you can remove it in /system/priv-app)

FX PRO is pre-installed (you can remove it in /system/priv-app)

Simple-keyboard is pre-installed (you can remove it in /system/priv-app)

F-Droid is pre-installed (you can remove it in /system/priv-app)

AF-Wall is pre-installed (you can remove it in /system/priv-app)

Nubia file manager removed You need it for the MTP transfer so you need to install it later by using the two tar.gz provided in the attachment of this post

Removed all the Chinese apps

Note : Because i removed some Chinese apps like the nubia_play store for example the pets in AOD don't work (you need to install an application completely in Chinese that want call logs, contact location etc etc lol

Actually the things that don't work in the settings are :

AOD pets

Lockscreen, Launcher and Theme -> Launcher Settings

Google

Smart Service Card (i uninstalled NeoPay you can ask me if you want or mount the systemmodified.img and take it from here)

#PREPARE THE TERRAIN

First of all before loosing anything make a backup of your apps and settings using adb and also with an app like "Super Backup & Restore" for example that export your contact, sms history etc. Export all your pictures, downloads etc to your computer by usb or anything else.

You are on your own. In this tutorial i will suggest to wipe the data partition to have a clean base.

If you do something wrong simply Do the STEP 1 : Flash the ROM, TWRP and MAGISK in one paste. If there is a problem for some reason don't ask for a Discord but post here your problem -> if you can't install adb or fastboot I will help you but please search before asking.

Also, Adb does not work on all apps, some disable it in their AndroidManifest :(

I also say a lot of time to be in the adb directory but that's only valid for Windows and maybe Mac, on Linux its in the path except if you downloaded adb or fastboot directly as executable

Backup using ADB :

Go to settings

Click on About phone

Tap 7 times on "Build number" below the JOS version

Scroll down a little and enable "USB debugging"

Now plug it to your PC

In the notification you can see that USB debugging is turned ON

Click on "Android System · Charging this device via USB"

Click again

Select Transmit files

Now you can backup your device using adb by

adb backup -all -f backup.ab

Note : you need to have adb on your computer lol type "How to install adb" on YouTube and you will be good to go. Remember on windows you need to press Ctrl + Shift inside the directory where adb.exe and maybe some dlls are stocked to open the terminal and be able to launch adb

You phone should now suggest you to enter a password

Click backup my data and don't touch it.

Note : to see if the backup do something you can see its size on your computer Adb don't show anythings even success.

to restore the backup do

adb restore backup.ab

Now backup with USB and "Super Backup & Restore" or anything else blablabla :p

#LET'S THE FUN BEGIN

You need to have Fastboot on your computer, like Adb, in a directory where you opened the cmd (it is provided with the 15 seconds script on windows, on Linux(Arch) its with android-tools.)

Don't forget to run cmd as an administrator !

On windows right click on start (windows logo) and click on "Start cmd as administrator" (if its powershell its the same you just need to enter "cmd" to launch cmd in powershell) now enter "cd \Users\(username)\Desktop\Adb-Fastboot"

Extract my ROM in the fastboot directory in its own folder for example : Desktop/Adb-Fastboot/ROM

So in ROM/ directory you need to have systemmodified.img vendor.img vbmeta.img aop.mbn etc etc

#STEP 1

Flash the ROM, TWRP and MAGISK in one paste :

Long press the Power button and swipe restart

Press and hold the VOLUME- button like you want to lower the volume

Note : the VOLUME- button need to be pressed at least before the nubia logo on restart (not the shutdown animation). You don't need to press POWER because you restarted it

Now you should be in the bootloader, you can select boot to system, recovery, emerg recovery etc

Don't press on the POWER button or it will boot to something you selected

Plug your phone to your computer

In the cmd opened in the Fastboot directory select all this and paste it in the cmd (select from the first fastboot to the "s" of "stop selection here" so the cmd enter the command automatically at each new line):

fastboot oem nubia_unlock_critical NUBIA_NX616J_CRITICAL
fastboot oem nubia_unlock NUBIA_NX616J
fastboot flash recovery ROM/recoveryTWRP.img
fastboot flash boot ROM/bootMAGISK.img
fastboot flash dtbo ROM/dtbo.img
fastboot flash parameter ROM/parameter.img
fastboot flash splash ROM/splash.img
fastboot flash system ROM/systemodified.img
fastboot flash vbmeta ROM/vbmetaDISABLED.img
fastboot flash vendor ROM/vendor.img
fastboot flash abl ROM/abl.elf
fastboot flash aop ROM/aop.mbn
fastboot flash cmnlib ROM/cmnlib.mbn
fastboot flash cmnlib64 ROM/cmnlib64.mbn
fastboot flash devcfg ROM/devcfg.mbn
fastboot flash hyp ROM/hyp.mbn
fastboot flash keymaster ROM/keymaster64.mbn
fastboot flash tz ROM/tz.mbn
fastboot flash xbl_config ROM/xbl_config.elf
fastboot flash xbl ROM/xbl.elf

stop selection here

Note : You need to perform these command as an elevated privilege on linux too. In fact i don't know if Fastboot require to be admin on Windows lol.

Note : You can now flash a A/B ARM64 Treble ROM if you want to learn android :p

#STEP 2

Make my pre-installed app working

Because i don't really know chcon and context etc my pre-installed app need some extra something to work as well as the nubia_account app because i deleted it and undo etc :

Select with the VOLUME button "reboot to recovery"

Wait for TWRP to load

Click on "Mount"

Select "System"

With the phone pluged and the cmd opened in the adb directory do :

adb shell "cd /system/system/priv-app && chcon -R u:object_r:system_file:s0 THE-BEST-FILE-EXPLORER-OF-THE-UNIVERSE TELEGRAM SMS-WITH-ENCRYPTION-BETTER-THAN-THE-NUBIA-ONE RIOT MAGISK-MANAGER LAUNCHER-OPENSOURCE KEYBOARD-OPENSOURCE FLUD-TORRENT FIREWALL FIREFOX F-DROID ../app/nubia_account"

Note : You need to perform these command as an elevated privilege on linux too. In fact i don't know if Fastboot require to be admin on Windows lol. If you launched adb as a normal user you need to first kill the adb server to relaunch it as an admin by typing "adb kill-server". It can say "WARNING: linker: Warning: couldn't read "/system/etc/ld.config.txt" for "/sbin/sh" blablabla" it doesn't matter

Now try to reboot without wiping the data to see if its working. :fingers-crossed:

If : the launcher blink and you receive some notification saying that the launcher crashed etc try to open the notification drawer and click on settings, go in app info and reset the data of Lawnchair same for Silence if it crash on start.

Else -> thanks god i made a backup. ;)

Go back to TWRP by pressing VOLUME- (If the device is not responding when you want to shut it down press for 10-15 seconds on it to force a reboot)

in TWRP go to Wipe and swipe the button.

Try to reboot

Note : Its normal if it reboot two times

If its not working again you need to wipe everything including your pictures downloads etc (your app data was already deleted by the first wipe)

Go back to TWRP again

In the wipe option re-wipe by security the first one

Click home and re-click on wipe.

This time select "Format data", write yes and apply.

Reboot and it will work for sures.

Note : Its normal if it reboot two times

Setup you phone by disallow the localization to some nubia app etc. I included AF-Wall to block internet for the gallery, Camera etc (don't forget to Select "Block selected" by clicking the button on the right of the search button and deactivate the AF-Wall notification in the AF-Wall settings)

To receive the notification for the SMS go to settings -> App info -> Silence -> Notifications -> Importance : Urgent

#OPTIONAL - G-APPS

Install Google data-mining apps :

Note : If you install the Google apps you will have the GPS working on google maps and its all I don't appear on the Snapchat map. You need to install MicroG wich is a Open-Source alternative of the google service, so you don't have google spying on you, only Nubia :laugh: The Pico version of OpenGapps don't provide the file needed for the GPS you can download the micro version (ARM64/9.0) here[/STRIKE] -> wrong even the micro version make the GPS unavailable, I think its a OpenGapps issue I'm trying to figure it out.

I included OpenGapps Pico in /system but you can't have the GPS with it

Mount system again

Go home and click install

Click on "(Up A Level)"

Scroll down and click on system

Scroll down and click on "open_gapps-arm64-etc"

Swipe and Wait

When its done simply reboot and to the google setup

Note : Google setup don't work on the fingerprint section so skip it as well for the password or pin, just set it in the settings after.

Install Gapps MICRO wich have the GPS available

On your computer download here the ARM64/9.0/micro OpenGapps .zip file

Once finished open a terminal in the same directory where the openGapps.zipi is located (in Download I guess;))

Reboot into TWRP and plug your device in your computer

Type as an elevated user

adb push OpenGapps.zip /sdcard/Download

where OpenGapps.zip is the real name of the one downloaded

In TWRP click Install and go in the Download folder

You should see OpenGapps.zip that has been copied by adb

Click, Swipe and Wait

When its done simply reboot and do the google setup

Note : Google setup don't work on the fingerprint section so skip it as well for the password or pin, just set it in the settings after.

You have now the google backup working and the Play store !

At this point your system is finally ready !

If you want to know somethings about an app or anythings that you found -> I spent 4 full day on this maybe I can help you :)

#OPTIONAL - MICROG

Install an Open-Source alternative of Google Service:

Note : Safetynet don't work so you can't use Snapchat or Pokemon GO for example :(

First you need to fake the google app signature with a Xposed module called "FakeGapps" I did not tested Tingle because I don't know how to deodex a rom as i understood it doesn't require Xposed to work, maybe Safetynet can work with it but unfortunately I didn't find any relevent tutorial :(.

Install "Riru - Core" from magisk

Open Magisk

Open the left panel by clicking on the Hamburger icon or swipe to the right

Click on "Download"

Wait and search for "Riru"

Scroll down to "Riru - Core", Click on the Download button and Click on install

Wait and hit reboot when its done

Install "Riru - EdXposed" from Magisk

Open Magisk

Open the left panel by clicking on the Hamburger icon or swipe to the right

Click on "Download"

Wait and search for "Riru"

Scroll down to "Riru - EdXposed", Click on the Download button and Click on install

Note : there are two version, I tested both and both work so pick wich one you want

Wait and hit reboot when its done

Install "EdXposed Installer" from Github wich is basically the Xposed app

Open Magisk

Open the left panel by clicking on the Hamburger icon or swipe to the right

Click on "Download"

Click on "Riru - "EdXposed", scroll down to "Usage" and click on "EdXposed Installer" from the step 4

You should be redirected to the Github's release page of the EdXposed Installer

Click on "Assets" and click on EdXposedInstaller_v...-release.apk"

Wait for it to download and click "OPEN" in Firefox to install it

Install "FakeGapps" from Xposed wich will fake the microG into a valid Google App

After installed it, open it and open the left panel by clicking on the Hamburger icon or swipe to the right like Magisk

Click on "Download"

Wait and search for "FakeGapps", click on it

Swipe left to go in the "VERSIONS" panel and click on "Download" the latest version

Install it

Note : if for whatever reason you can't download through Xposed in the description click on the repository link, scroll down and click on the download link, install it and go back to Xposed, Click on the hamburger icon -> Modules and tick FakeGapps

Activate FakeGapps by going in the "Modules" section of Xposed by clicking on the Hamburger icon again and tick "FakeGapps"

Reboot

Now, install MicroG

Download the latest version of NanoDroid-MicroG-NUMBER.zip (and not NanoDroid-NUMBER.zip) on your computer here : https://downloads.nanolx.org/NanoDroid/Stable/

Reboot in TWRP

Plug your devices to your computer and open a cmd in the same folder where the NanoDroid-microG-NUMBER.zip is located

Type

adb push NanoDroid-microG-NUMBER.zip /sdcard/Download

Wait and in TWRP click on "Install", it should be in the /sdcard/Download folder by default so just click on NanoDroid-microG-NUMBER.zip and swipe to install

Reboot

You should now have MicroG installed on your system and Aurora Store to replace the Play Store ! But you need some extra work to make it work lol

Open MicroG

On the Top you should see a message that say "Grant permission", click on it and allow all

Tweak some settings like you want (I have "Google device registration" Activated and UnifiedNlb Settings set on "Déjà vu" and "Nominatim")

Exit MicroG and open the Aurora Store which is the play store opensource

Note : I can't have my google account connected to it I have no idea why but you can always connect anonymously

Click on "Apps" at the bottom

Blacklist microG from updating itself by clicking on it and openning the option menu.

Refresh the installed app and you should see microG diseapear

Note : If you find something related to MicroG or google -> Blacklist

Note : to allow auto install from the Aurora Store go in Aurora Store -> settings -> Installation -> Aurora Services and grant the permission, (you need to relaunch Aurora Services to update the red icon) Go back in Installations settings and click on "Installation method", select "Aurora Services and you will be good to go !

#ADDITIONAL TWEAKS :

I deleted FileBrowser and nubia_myfile thinking there were no use for it. If you don't have them the MTP file transfer will not work !

I attached two tar.gz in this post you can open FX an create a web access to transmit those archives into your phone

Note that nubia_Myfile is maybe not needed but when we plug a OTG usb if you click on "open file" in the notification nothing will appears so I think its better to have it

Open FX and select "Web access"

Make sure you are in the same network as your computer (on the same wifi)

Click on the start button and with your computer open Firefox and go at the url displayed on your phone mine is http://192.168.1.243:2112/

Enter the password

Double click on your Download folder or where you want it doesn't matter

Drag and drop my two tar.gz file, sometime the files are not copied so you may need to drag and drop multiple times

Once the transfer is finished open FX and open one of the tar.gz, click on the folder up to either FileBrowser or nubia_myfile

Copy FileBrowser or nubia_myfile and go back to the main menu and open "System (Root)"

Go in System/priv-app and past here FileBrowser and nubia_myfile

At this point I don't know why but I could not copy the symlink in FileBrowser/lib/arm and arm64 so plug your device into your computer, select file transfer and type in a terminal

adb shell

su

Make sure to grant the permission on your phone

echo "mount your system in read write" && mount -o rw,remount /system && echo "deleting the symlink that were not copied" && rm /system/priv-app/FileBrowser/lib/arm/* /system/priv-app/FileBrowser/lib/arm64/* && echo "Creating the symlink" && ln -s /system/lib/libnubiamtp.so /system/priv-app/FileBrowser/lib/arm/libnubiamtp.so && ln -s /system/lib64/libnubiamtp.so /system/priv-app/FileBrowser/lib/arm64/libnubiamtp.so && echo "chmod 644 the symlink" && chmod 644 /system/priv-app/FileBrowser/lib/arm/libnubiamtp.so && chmod 644 /system/priv-app/FileBrowser/lib/arm64/libnubiamtp.so && echo "delete the data of the app "Media Storage" (not your data lol)" && rm -r /data/user/0/com.android.providers.media/* && echo "remount your system in read only" && mount -o ro,remount /system

Reboot

Disable the Nubia Voiceassistant button -> Settings -> More Features ->voiceassistant to not have to wait 20 years to have the shutdown menu

Disable the Colorful mode in Settings -> Display -> Screen display preferences -> Natural Mode to not have the satured black on the AOD mode

This phone is strange, i installed YouTube vanced with magisk and it keep killing the app when I listen in background it does this in call too lol, because its a system app its not shown in NeoSafe "Application power management" you need to go in Neosafe -> Detailed electricity records -> Screen or another apps but screen should be here for sure -> battery optimization -> Select all apps by clicking on "Not optimized" :

I disabled the optimization for :

Call Management

Cell Broadcasts

com.android.cellbroadcastreceiver.overlay.common

com.android.phone.overlay.common

com.android.smspush

Google Play Store

InCallUI

LocationServices

Maps

Music

Phone Services

Silence

Youtube

I am kinda dumb and wrongly edited to build.prop at the end :silly:

Open Fx File Explorer

Go to System (Root)

Click OK

Go in System

Click on the padlock

In remount "/system" Filesystem R/W tick "I understand the risk"

Click OK and open build.prop

Click on the edit button (the one with the pen)

Go all the way down and on the line "ro.min_pointer_dur=8 ro.max.fling_velocity=12000" insert a line after the 8 and remove the extra space before the ro.max.fling

Click on the option button and Save.

Now the scrolling should be a little better

To have an animation when you return on home you need to allow Lawnchair (the launcher) to have access to the recents apps

Open Magisk

Open the left panel by clicking on the Hamburger icon or swipe to the right

Click on "Download"

Wait and search for "QuickSwitch"

Click on the Download button and Click on install

Wait and hit reboot when its done

After reboot go in the app and launch the newly installed app "QuickSwitch"

Click on Lawnchair and in "Use Lawnchair as recents provider" click OK

Reboot again

After reboot open an app for example the Camera app and go back to home by swiping the middle bar and you will see a little animation like on iPhone !