MiuiCamera Port for Beryllium
Most up-to-date wiki https://github.com/nckmml/ANXCamera/wiki
Self sufficient repository to decompile to smali, recompile, sign, decompile to java, push to device app port.
miui_PHOENIXININGlobal_V11.0.4.0.QGHINXM_fad80cd58f_10.0 was used as src.
Recommended to open this Repository in VSCode
Also requires Java 1.7 or 1.8, and 7-zip.
Instructions for Development:
- Clone this repository
- Run redo.bat
- Start porting
Instructions for Testing:
- Download the
zip
from https://camera.aeonax.com/ - Install the
zip
with Magisk, or with recovery - Reboot Once, if it doesn't work properly, reboot twice.
- Start Testing
Special Thanks to Abhishek Aggarwal (https://github.com/TheScarastic) for bringing this up to Beta version Mustang_ssc (https://github.com/Mustang-ssc) for his help in adding support for other devices Amogha Maiya (https://github.com/amog787) for sponsoring, and all-round help Sandeep (https://github.com/CodeElixir) for help with the libs Psygarden (https://forum.xda-developers.com/member.php?u=7645131) for his general help.
Steps to Port MiuiCamera from scratch:
- Unpack System of Miui ROM
- Setup Original files for Decompiling
- Copy following to ANXCamera\orig\MiuiFrameworks. Files to be taken from Unpacked
system
from ROM above- framework\framework-res.apk
- app\miui\miui.apk
- framework\framework-ext-res\framework-ext-res.apk
- app\miuisystem\miuisystem.apk
- Copy following to ANXCamera\orig
- priv-app\MiuiCamera\MiuiCamera.apk
- Copy following to ANXCamera\orig\MiuiFrameworks. Files to be taken from Unpacked
- Prepare APKTool for decompiling
- Install above framework files by running following commands
.\preparefw
- Install above framework files by running following commands
- Decompile MiuiCamera by running
.\decompile
- Meaning of APKTool Parameters
- d, decode
- -p, --frame-path
- -f, --force
- -b, --no-debug-info
- -o, --output
- Open
src\ANXCamera\AndroidManifest.xml
and format the document - First Compile Attempt
- Run
recompile.bat
just to check whether we are able to recompile without any modification - Run
sign.bat
to sign and zipalign - Run
jadx.bat
to create java code from compiled apk. This fails, don't worry, it does whatever it can
- Run
- Next we decompile the required fw files
- Copy latest baksmali to extracted rom destination
- Disable some required libs. Open
src\ANXCamera\AndroidManifest.xml
- Find the
uses-library
XML Nodes. We need to disable this - We will skip
miui-stat.jar
as we will disable miui-stats from sending data to miui.
- Find the
- Open a cmd inside
<path to deodex destination>
folder. And run the following:java -jar ..\ANXMiuiPortTools\apktool.jar d -p ..\ANXMiuiPortTools\MiuiFrameworks -f -b -o G:\ROOT\phoenix\framework G:\ROOT\phoenix\system\system\framework\framework.jar
java -jar ..\ANXMiuiPortTools\apktool.jar d -p ..\ANXMiuiPortTools\MiuiFrameworks -f -b -o G:\ROOT\phoenix\miui G:\ROOT\phoenix\system\system\app\miui\miui.apk
java -jar ..\ANXMiuiPortTools\apktool.jar d -p ..\ANXMiuiPortTools\MiuiFrameworks -f -b -o G:\ROOT\phoenix\miuisystem G:\ROOT\phoenix\system\system\app\miuisystem\miuisystem.apk
- Now we will add few of the above decompiles libs to our code
- Create a folder
src\ANXCamera\smali_classes5
- Copy the contents of
<path to deodex destination>\android-support-v7-recyclerview
<path to deodex destination>\android-support-v13
<path to deodex destination>\gson
<path to deodex destination>\volley
<path to deodex destination>\zxing
- to
src\ANXCamera\smali_classes2
. It should finally contain two foldersandroid
andcom
- Create a folder
- Set required = false in AndroidManifest of these libs as their code is now included
- Add missing smali files from decompiled miui rom
- Add native libs
- Edit Smali
- ...