Created ADB Tricks, DIY Launcher App (markdown)

HappyZ 2018-12-29 22:10:15 -06:00
parent 8b137a967c
commit f0ad828e9f
1 changed files with 79 additions and 0 deletions

@ -0,0 +1,79 @@
### Open settings via commandline
```
adb shell am start -a android.settings.SETTINGS
```
### Switch language
Only three are supported: Chinese, English, and Japanese
```
adb shell am start -a android.settings.LOCALE_SETTINGS
```
### Switch input method
```
adb shell am start -a android.settings.INPUT_METHOD_SETTINGS
```
If you saw error dialog `Unfortunately, the iWnn IME keyboard has stopped`, this is (potentially) due to the language switch that enables an extra input method. Just go in the `Keyboard & input methods` and only enable `iWnnkbd IME`.
### Launcher app
DPT Launcher is funny. It uses `ExtensionManagerService` that scans through `/etc/dp_extensions`. Ideally we shall have an automated tool to add/remove icons (not a plan), but for now, a commandline approach is the following:
Re-mount your system to be writable (requiring sudo), and then use `NoteCreator` as a template:
```
> adb shell
$ su
# mount -o rw,remount /system
# cd /etc/dp_extensions
# cp -R NoteCreator MyTemplate
# cd MyTemplate
```
Then we need to change the filenames:
```
mv NoteCreator_extension.xml MyTemplate_extension.xml
mv NoteCreator_strings-en.xml MyTemplate_strings-en.xml
mv NoteCreator_strings-ja.xml MyTemplate_strings-ja.xml
mv NoteCreator_strings-zh_CN.xml MyTemplate_strings-zh_CN.xml
mv ic_homemenu_createnote.png ic_homemenu_mytemplate.png
```
Finally, we need to edit each file (use `busybox vi file/path/filename`):
1. For MyTemplate_extension.xml (`****` is the Android app intent name, e.g., `com.android.browser/.BrowserActivity`):
```
<?xml version="1.0" encoding="utf-8"?>
<Application name="MyTemplate" type="System" version="1">
<LauncherEntry name="MyTemplate" category="Launcher" uri="intent:#Intent;launchFlags=0x10000000;component=****;end" string="STR_ICONMENU_9999" icon="ic_homemenu_mytemplate.png" order="999"/>
</Application>
```
2. For each `****_strings-****.xml`:
```
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<string name="STR_ICONMENU_9999">MyTemplate</string>
</resources>
```
3. You can upload a different png for icon `ic_homemenu_mytemplate.png` (must be 220x120 size)
4. Make sure the files under `MyTemplate` are all permission `0644` (`ls -la /etc/dp_extensions/MyTemplate/*` and `chmod 0644 /etc/dp_extensions/MyTemplate/*`).
5. Remove the database (cache) from the Extension Manager and allow it to rebuid the database:
```
cd /data/system
mv ExtMgr.db ExtMgr.db_bak
mv ExtMgr.db-journal ExtMgr.db-journal_bak
```
6. Reboot
### Guide to use Taobao PKG
(FYI, I personally prefer a clean system with changes I know, over using their PKGs with unknown changes.)
People have shared their system.img with the extracted apps from taobao pkg. Check [#37](https://github.com/HappyZ/dpt-tools/issues/37) out.