-
Notifications
You must be signed in to change notification settings - Fork 130
ADB Tricks, DIY Launcher App
adb shell am start -a android.settings.SETTINGS
Only three are supported: Chinese, English, and Japanese
adb shell am start -a android.settings.LOCALE_SETTINGS
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
.
Note: I suggest to install a very basic app manager and only include that in this Launcher, so you do not need to touch this any more later.
Note2: A fair number of people has reported they encountered errors while they modify these. I suggest if you do not fully understand the following, do not attempt to do these. Later I will release a flash-able PKG with a basic app manager.
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
):
- 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>
- 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>
- You can upload a different png for icon
ic_homemenu_mytemplate.png
(must be 220x120 size) - Make sure the files under
MyTemplate
are all permission0644
(ls -la /etc/dp_extensions/MyTemplate/*
andchmod 0644 /etc/dp_extensions/MyTemplate/*
). - 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
- Reboot
It turns out that the previous Launcher analysis, while correct, is incomplete: there is a way to install "Extensions" (Sony name for apks you can see in the launcher) without remounting /system and without restarting/deleting the db
First, the official AppLauncher will scan two search paths:
- /etc/dp_extensions for system apps
- /data/dp_extensions for user apps (but not created initially)
The content is laid out the same way as for /etc/dp_extensions and the db scan happens at the same time. This is however writeable by default and does not require a remount.
The ExtMgr.db database is an sqlite database that contains 3 tables of interest:
app_table
name type version install_path
"DPTTemplate" "System" "2" "/data/dp_extensions/DPTTemplate"
launcher_entry_table
id app_name name category uri string_id icon_path sort_order
"55ed32e52eb51ee0e755afdc122c33f8ffb9ac0eb4fde80b00f76d144c3e2e63" "DPTTemplate" "DPTTemplate" "Launcher" "intent:#Intent;component=intent;action=action ;end" "STR_ICONMENU_1001" "/data/dp_extensions/DPTTemplate/ic_homemenu_dpttemplate.png" "1"
string_table
entry_id locale_string string_value
"55ed32e52eb51ee0e755afdc122c33f8ffb9ac0eb4fde80b00f76d144c3e2e63" "zh_CN" "DPTTemplate"
"55ed32e52eb51ee0e755afdc122c33f8ffb9ac0eb4fde80b00f76d144c3e2e63" "ja" "DPTTemplate"
"55ed32e52eb51ee0e755afdc122c33f8ffb9ac0eb4fde80b00f76d144c3e2e63" "en" "DPTTemplate"
I copied only the rows for a custom apk I made. It is somewhat trivial to automatically create / delete these rows to install / uninstall apks. The main difficulty is to generate the application id (here 55ed32e52eb51ee0e755afdc122c33f8ffb9ac0eb4fde80b00f76d144c3e2e63): it is simply a SHA256 of the app_name, name and category columns.
At the very least, a wannabe tool programmer could uninstall apps by also removing rows from these tables, while installing apps does not seem to break the Launcher.
(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 out.