launcher数据加载(二)

时间:2020/12/03
之前公司不允许csdn,笔记写在其它地方。最近整理过来

前言

加载流程之前写过很多文章,加载流程(一)有兴趣的可以看看。
本文主要介绍一下launcher是怎么查询到各种图标或者快捷方式或者widget的。

1、 loadWorkspace
2、 loadAllApps
com/android/server/pm/LauncherAppsService
1、queryActivitiesForUser
2new Intent(Intent.ACTION_MAIN)
    .addCategory(Intent.CATEGORY_LAUNCHER)
3、loadDeepShortcuts
1、hasHostPermission--defaultLauncher
<meta-data android:name="android.app.shortcuts"
 android:resource="@xml/shortcuts"/>

com/android/server/pm/ShortcutPackage
4、widgetsModel.update(mApp
1、加载widgets数据
<meta-data android:name="android.appwidget.provider" android:resource="@xml/widget_build" />
2、加载shortcut数据
<action android:name="android.intent.action.CREATE_SHORTCUT" />
5、三方应用创建launcher上的shortcut
<activity android:name="com.android.launcher3.dragndrop.AddItemActivity"
    android:theme="@style/AppItemActivityTheme"
    android:excludeFromRecents="true"
    android:autoRemoveFromRecents="true"
    android:label="@string/action_add_to_workspace" >
    <intent-filter>
        <action android:name="android.content.pm.action.CONFIRM_PIN_SHORTCUT" />
        <action android:name="android.content.pm.action.CONFIRM_PIN_APPWIDGET" />
    </intent-filter>
</activity>

结尾

创建快捷方式的广播好像有变化
com.android.launcher.action.INSTALL_SHORTCUT 变成 android.content.pm.action.CONFIRM_PIN_SHORTCUT

网上其它相关的文章:
https://blog.csdn.net/u011484134/article/details/80443177
https://blog.csdn.net/dax120/article/details/78905334

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值