• Launcher app prediction


    15、launcher应用列表界面最上面一行应用推荐

    现象:
    Android S上,更新同年四月份gms包后,launcher应用列表上方多出一行图标。
    {相册、时钟、比机、Gmail、YouTube、设置}
    通过studio自带的Layout Inspector查看,这一部分界面属于all_apps_header。也就是应用列表的头信息布局中。
    相关代码:
    launcher view层:
    多出的一行应用:Launcher\quickstep\src\com\android\launcher3\appprediction\PredictionRowView.java这里面初始化最上面一行图标,可以设置图标文字颜色。
    分割线:Launcher\quickstep\src\com\android\launcher3\appprediction\AppsDividerView.java这里面设置分割线的颜色
    多嘴一句,应用列表图标适配器:Launcher\src\com\android\launcher3\allapps\AllAppsGridAdapter.java 这里面标准的adapter,包含多类
    型,根据不同类型显示不同的内容。onCreateViewHolder、onBindViewHolder初始化图标view、设置应用列表图标文字颜色等等。
    launcher model层:
    Launcher\quickstep\src\com\android\launcher3\model\QuickstepModelDelegate.java注册registerPredictor监听,有更新回调时调用PredictionUpdateTask更新数据
    Launcher\quickstep\src\com\android\launcher3\model\PredictionUpdateTask.java更新数据、更新界面信息。
    framework层:—没用太深入的研究,简单看看
    AppPredictionManager、AppPredictionManagerService.java 和其它功能类似,分为manager和service2部分,通过aidl通讯。service负责数据更新和回调。
    SystemServer.java中判断是否配置相关config,来启动对应的service。
    config相关:

    <!-- The package name for the system's app prediction service.
             This service must be trusted, as it can be activated without explicit consent of the user.
             Example: "com.android.intelligence/.AppPredictionService"
    -->
    <string name="config_defaultAppPredictionService" translatable="false"></string>
    
    • 1
    • 2
    • 3
    • 4
    • 5

    gms包:
    新增应用:AndroidSystemIntelligence_Features.apk 包名:com.google.android.as
    新增覆盖:GmsConfigOverlayASI,包名:com.google.android.overlay.gmsconfig.asi,rro技术覆盖framework下面的config文件配置。

    string name="config_defaultAppPredictionService" translatable="false">com.google.android.as/com.google.android.apps.miphone.aiai.app.AiAiPredictionService</string>
    
    • 1

    ========================================================================================================================================
    接上篇15,重新写了一篇
    https://blog.csdn.net/a396604593/article/details/123487805
    本文主要补充说明一下prediction。
    prediction的类型:
    目前有主菜单应用、hotseat应用、widget三种
    Launcher端相关的类:

    Launcher\quickstep\src\com\android\launcher3\uioverrides\PredictedAppIcon.java
    Launcher\quickstep\src\com\android\launcher3\uioverrides\PredictedAppIconInflater.java
    Launcher\quickstep\src\com\android\launcher3\appprediction\PredictionRowView.java
    Launcher\quickstep\src\com\android\launcher3\model\PredictionUpdateTask.java
    Launcher\quickstep\src\com\android\launcher3\hybridhotseat\HotseatPredictionController.java
    Launcher\quickstep\src\com\android\launcher3\hybridhotseat\HotseatPredictionModel.java
    Launcher\quickstep\src\com\android\launcher3\model\WidgetsPredictionUpdateTask.java
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    未完待续

  • 相关阅读:
    在线客服系统源码 客服系统源码
    Linux学习——线程的控制
    Android 保持ImageVIew大小不变,让图片按比例拉伸
    CSS小技巧之单标签loader
    汽车虚拟仿真技术的实现、应用和未来
    QT实现截屏
    Linux 安全 - 内核提权
    Vue3搭建后台管理系统模板
    Java 基于 SpringBoot 的简历招聘系统
    [车联网安全自学篇] 五十五. Android安全之APK应用程序第三方服务/通知功能的敏感信息挖掘
  • 原文地址:https://blog.csdn.net/a396604593/article/details/126060850