Apktool (4)-practice: Modify Xiaomi desktop and apktool
Preparations:
1. Download the Rom package for mobile phone models and go to the Rom download channel On Xiaomi official website.
2. decompress the downloaded Rom package and use the Rom to help you retrieve the file content in system. img. There are many articles in this regard. refer to how the Rom assistant extracts imgfiles.
3. Find the apk related to Xiaomi desktop --/system/priv-app/miuihome.apk(5.0and the system is miuihome.apk under the miuihomefile folder)
Practice:
1.try to decompile miuihome.apk. For details, refer to: Apktool (3)
2. Step 1 will prompt the required framework file. The dependent file here is/system/app/miui.apk.
Run: apktool if miui.apk-t xiaomi
This command only needs to be executed once. In the future, when the decompilation is performed again, the dependency file will be loaded to the default path. The-t parameter indicates the dependency file.
3.decompress MiuiHome.apk and run: apktool d-cf MiuiHome.apk-t xiaomi.
The MiuiHome folder is displayed.
4. Modify the Desktop
Miuihome.apk has been compiled, but to modify the desktop, you must find the configuration file directly related to the Xiaomi desktop. So where is the Desktop configuration file?
I introduced in Apktool (2) That the res directory is all the resource files in the program. Obviously, we need to find them in this directory.
Which configuration file will be loaded when Xiaomi phone is started for the first time? Conclusion: res/xml/default_workspace4x5.xml (four columns and five rows of desktop icons)
There are so many configuration files in this directory, how do you know that the file is loaded at startup? Specific can refer to: http://forum.xda-developers.com/showpost.php? P = 40167735
We can conclude that if you do not want to load the file when the mobile phone is started, you can modify config_cell_count_x and config_cell_count_y In the res/values/integers. xml file.
(Not verified, readers can verify it by themselves)
Knowing the key configuration file related to Xiaomi desktop, we can modify the desktop by modifying the configuration file. (The configuration file is as follows)
#1. Several keywords
Folder indicates a folder. By default, there are two folders on the desktop.
Launcher: title is the name of the folder. com. miui. home: string/is fixed in front of it, informing the system to load the configuration file from this location.
Launcher: the number of screens on the desktop. the first screen is launcher: screen = 0 by default, and so on.
Launcher: x and launcher: y represent the column number and row number respectively. By default, they are numbered from 0. For example, in the fourth column of the third row, launcher: x = 3, launcher: y = 2.
Clock2x4 is the system clock loaded by the system.
Favorite is the shortcut of the Program (apk.
Launcher: the class name whose className is apk, and launcher: packageName is the package name of apk. For more information about how to get the class name and package name, see the following blog.
#2. Modify favorite
Obviously, you can modify launcher: x and launcher: y to adjust the position of the apk, and launcher: screen to modify the screen on which the apk should be placed.
#3. Modify the folder
Similarly, you can modify launcher: x and launcher: y to adjust the folder location and launcher: screen to modify the screen on which the folder should be placed.
It should be noted that:
1) how to define the folder name?
The configuration file of the Chinese name loaded by the system is res \ values-zh-rCN \ string. xml, you can see that the two folders loaded by the system by default are named "System Tools" and "recommended ".
Therefore, you can modify the folder name or add a custom file name.
2) how to add the apk program to the folder?
Launcher: the container is the id of the folder, Which is numbered from 1 by default.
By observing launcher: x and launcher: y, we find that y is fixed and x is numbered from 0. In this way, the apk shortcut added to the folder is left to right, arranged from top to bottom.
#4. Modify hotseat
Hostseat is apk
View the configuration file:
You can see that launcher: container is defined as-101, launcher: y remains unchanged, and launcher: x starts from 0. In this way, you can modify it accordingly.
5. Compile
So far, we have modified Xiaomi's desktop by modifying the configuration file.
Finally, we must decompile the modified file to generate the modified apk.
Run: apktool B-cf-t xiaomi MiuiHome-o out \ MiuiHome.apk
In this way, we compile and generate the modified apk.
Q: 1. How can I get the apk class name and package name?
2. How can I access the modified apk system to Xiaomi mobile phone?
3. How to package and generate an imgfile for the system. img unlocked by the rom assistant?
Keep an eye on blog updates.
References:
1. http://forum.xda-developers.com/showpost.php? P = 40167735
2. How the Rom assistant extracts imgfiles: http://www.yzmg.com/news/show-89909.html