How are the default AOSP launcher shortcuts installed in a ROM build?

痞子三分冷 提交于 2020-01-05 05:31:31

问题


I'm building my own version of AOSP (using code from the Code Aurora repos for a custom device) and trying to determine how shortcuts to certain apps are being added automatically to the launcher's db (Launcher3 on Marshmallow to be more specific). I want to change these around and remove/reposition some of them. (In this particular instance the apps in question are those from the GMS suite.)

I understand that apps can try to get their shortcuts onto the launcher's workspace by sending a ACTION_CREATE_SHORTCUT intent. Are some of these apps sending these intents after first boot but before the launcher launches for the first time?

I couldn't find any steps or code that adds these values to the db as a prestep at build time.


回答1:


What you're looking for is the "workspace" of the launcher which located under platform/packages/apps/Launcher3/res/xml/default_workspace_*.xml.(here)
You will notice there are different workspace for different screen sizes (e.g 4X4 / 5X5 / 5X6).
To add new apps just add the next tag:

<favorite
    launcher:packageName="com.android.gallery3d" //Your app name
    launcher:className="com.android.gallery3d.app.Gallery" // Your launcher Activity
    launcher:screen="3" // The screen number
    launcher:x="1" // X Location on screen
    launcher:y="3" /> // Y Location on screen

Xml tags -
1. favorite - Specific app.
2. resolve - Resolve default app (e.g default messages app)
3. appwidget - Widget...

AOSP original link



来源:https://stackoverflow.com/questions/39262383/how-are-the-default-aosp-launcher-shortcuts-installed-in-a-rom-build

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!