20190722海外小米和国内华为的关联唤醒调研

关联/链式启动的拦截机制

Android P机型

进程拦截

组件拦截

预设置自启动名单

海外版-小米MI 8 Pro

国内版-华为P20 Pro

进程拦截:主要在冷启动限制开机启动、后台启动,功能界面一般为自启动管理、后台管理;

原理:ActivityManagerService. startProcessLocked() 条件拦截,即冷启动入口拦截

组件拦截:主要在冷/热启动限制开机启动、后台启动、应用间的唤醒,组件级别拦截,功能界面一般无界面显示、或关联启动界面、或启动记录、拦截记录;

原理:

ActivityManagerService. getContentProviderImpl() 条件拦截

ActiveServices. startServiceLocked() 条件拦截

ActiveServices. bindServiceLocked() 条件拦截

ActivityStarter. startActivity() 条件拦截

BroadcastQueue. processNextBroadcastLocked()条件拦截

区别

两者的效果都是可以限制开机启动和后台启动,组件拦截比进程拦截的区别如下:

  1. 组件拦截的时机更早,因为应用启动是先启动组件,再最后fork进程;
  2. 组件拦截管控的范围更全,热启动类型的行为也可以有效拦截;
  3. 组件拦截精细度更高,例如进程拦截只知道进程被启动了,而组件拦截可以具体到哪个进程通过什么方式启动了目标进程;
  4. 主流的华为、OPPO、VIVO、小米都有组件拦截相关的机制;

综合上述:

  1. 海外版小米 MI 8 Pro 在自启动、后台管理、关联启动都有预置黑名单进行应用管理,故Android P 上我们也可以同海外版小米的配置预置自启动黑名单;

  1. SmartManager完成了进程拦截,组件拦截可以在目前的冷启动场景的基础做查缺补漏的拦截优化,甚至做到个别场景不依赖配置名单,智能识别和拦截关联启动行为;

  1. 热启动场景进行组件级拦截,例如加强Google 原生的规则中后台第三方应用启动后台第三方进程的限制;

  1. 拦截记录的UI界面交互,需要产品工程师进行定义;

  1. 海外版-小米 MI 8 Pro

1.1 小米自启动

    1. 小米关联/链式

小米的没有单独的关联唤醒拦截界面,但是“禁止耗电应用相互调用”属于关联唤醒范畴

2. 国内版-华为P20 Pro

    1. 华为自启动

07-19 14:41:49.771  1000  1681  1705 D Boost   : hostingType=broadcast, hostingName=com.android.cellbroadcastreceiver/.CellBroadcastReceiver, callerPackage=android, isSystem=true, isBoostNeeded=false.

07-19 14:41:52.599  1000  1681  2093 D Boost   : hostingType=service, hostingName=com.miui.analytics/.AnalyticsService, callerPackage=com.miui.msa.global, isSystem=true, isBoostNeeded=false.

07-19 14:41:48.717  1000  1681  2072 D Boost   : hostingType=content provider, hostingName=com.android.settings/.cloud.CloudSettingsProvider, callerPackage=com.android.systemui, isSystem=true, isBoostNeeded=false.

2.2 华为关联/链式

只有组件拦截才可以形成下述拦截记录

3. ROM-SMGR测评

条件

测试结果

1. 安装后,不进行任何操作,桌面待机

1 小时内,23个应用后台启动

2. 安装后,按smgr推荐名单设置,66个自启动黑名单,13个白名单,桌面待机

测试12小时,黑名单应用都被限制自启动,管控Pass

上述中分析:

  1. 不点开任何应用会有应用被启动的原因 第一个被启动的应用,com.ss.android.article.news(uid:10129) 被 com.android.bluetooth(uid:1002) 通过 bind-service 关联启动. 存在第一个第三方应用被启动后,com.ss.android.article.news(uid:10129)通过 PUSH SDK相关的start-activity\start-service\bind-service\send-broadcast\content provider机制启动了更多的应用,手机出现后台进程数量多、卡顿、发热现象
  2. SmartManager 的自启动管控 早期版本的SmartManager存在漏洞,即content provider\activity 类型启动会不区分黑白名单直接允许后台运行。本次版本优化,主要策略如下:
  • 1.启动类型service\broadcast\content provider的为非前台进程应用,后台启动会根据黑名单进行拦截
  • 2.启动类型为 activity 类型的非前台进程,新增了一条过滤,即ClassName为 com.igexin.sdk.GActivity直接拦截启动,除此之外唐敏提供了更多Activity类型的透明界面异常后台启动com.igexin.sdk.GActivity
    com.tencent.pangu.link.LinkProxyActivity
    com.ifeng.news2.getui.DynamicGetuiActivity
    com.pingan.servicewindow.service.GeTuiActivity
  • 3.灭屏30分钟内,查杀3次,亮屏每5分钟查杀后台进程

    private static final List<String> ANNOYING_NAMES = new ArrayList<String>(){{

        add("com.igexin.sdk.GActivity");

    }

3.1 安装后,不进行任何操作,桌面待机

1. com.ss.android.article.news(uid:10129)  com.android.bluetooth(uid:1002) 关联启动

07-16 15:27:03.781543  1010  6236 D PowerConsumptionService: isAllowAppLaunch : com.ss.android.article.news(uid:10129), callingPackage = com.android.bluetooth(uid:1002), reason = bind-service

07-16 15:27:03.781665  1010  6236 D PowerConsumptionService: isAllowAppLaunch : intent action:Intent { act=android.media.browse.MediaBrowserService cmp=com.ss.android.article.news/com.ss.android.detail.feature.detail2.audio.service.AudioService }

2. com.ss.android.essay.joke(uid:10133)  com.ss.android.article.news(uid:10129) 关联启动

07-16 15:37:14.362178  1010  6237 D PowerConsumptionService: isAllowAppLaunch : com.ss.android.essay.joke(uid:10133), callingPackage = com.ss.android.article.news(uid:10129), reason = start-service

07-16 15:37:14.362523  1010  6237 D PowerConsumptionService: isAllowAppLaunch : intent action:Intent { act=com.ss.android.message.action.PUSH_SERVICE pkg=com.ss.android.essay.joke cmp=com.ss.android.essay.joke/com.ss.android.message.NotifyService (has extras) }

3. com.ss.android.article.lite(uid:10133)  com.ss.android.article.news(uid:10129) 关联启动

07-16 15:37:14.493859  1010  4771 D PowerConsumptionService: isAllowAppLaunch : com.ss.android.article.lite(uid:10130), callingPackage = com.ss.android.article.news(uid:10129), reason = start-service

07-16 15:37:14.494085  1010  4771 D PowerConsumptionService: isAllowAppLaunch : intent action:Intent { act=com.ss.android.message.action.PUSH_SERVICE pkg=com.ss.android.article.lite cmp=com.ss.android.article.lite/com.ss.android.message.NotifyService (has extras) }

4. com.baidu.video(uid:10168)  com.android.bluetooth(uid:1002) 关联启动

07-16 15:47:08.596667  1010  4771 D PowerConsumptionService: isAllowAppLaunch : com.baidu.video(uid:10168), callingPackage = com.android.bluetooth(uid:1002), reason = bind-service

07-16 15:47:08.596851  1010  4771 D PowerConsumptionService: isAllowAppLaunch : intent action:Intent { act=android.media.browse.MediaBrowserService cmp=com.baidu.video/.audio.service.AudioService }

5. com.baidu.BaiduMap(uid:10166)  com.baidu.video(uid:10168) 关联启动

07-16 15:47:11.110067  1010  6231 D PowerConsumptionService: isAllowAppLaunch : com.baidu.BaiduMap(uid:10166), callingPackage = com.baidu.video(uid:10168), reason = bind-service

07-16 15:47:11.110231  1010  6231 D PowerConsumptionService: isAllowAppLaunch : intent action:Intent { act=baidu.intent.action.account.SHARE_SERVICE flg=0x20 cmp=com.baidu.BaiduMap/com.baidu.sapi2.share.ShareService }

6. com.qiyi.video(uid:10163)  com.baidu.video(uid:10168) 关联启动

07-16 15:47:11.382107  1010  6231 D werConsumptionService: isAllowAppLaunch : com.qiyi.video(uid:10163), callingPackage = com.baidu.video(uid:10168), reason = bind-service

07-16 15:47:11.382245  1010  6231 D PowerConsumptionService: isAllowAppLaunch : intent action:Intent { act=baidu.intent.action.account.SHARE_SERVICE flg=0x20 cmp=com.qiyi.video/com.baidu.sapi2.share.ShareService }

7. com.baidu.searchbox(uid:10165)  com.baidu.video(uid:10168) 关联启动

07-16 15:47:13.171434  1010  2007 D PowerConsumptionService: isAllowAppLaunch : com.baidu.searchbox(uid:10165), callingPackage = com.baidu.BaiduMap(uid:10166), reason = bind-service

07-16 15:47:13.171539  1010  2007 D PowerConsumptionService: isAllowAppLaunch : intent action:Intent { act=baidu.intent.action.account.SHARE_SERVICE flg=0x20 cmp=com.baidu.searchbox/com.baidu.sapi2.share.ShareService }

8. com.ss.android.ugc.aweme(uid:10150)  com.ss.android.article.news(uid:10129) 关联启动

07-16 15:47:14.479210  1010  6231 D PowerConsumptionService: isAllowAppLaunch : com.ss.android.ugc.aweme(uid:10150), callingPackage = com.ss.android.article.news(uid:10129), reason = start-service

07-16 15:47:14.479379  1010  6231 D PowerConsumptionService: isAllowAppLaunch : intent action:Intent { act=com.ss.android.message.action.PUSH_SERVICE pkg=com.ss.android.ugc.aweme cmp=com.ss.android.ugc.aweme/com.ss.android.message.NotifyService (has extras) }

9. com.sina.weibo(uid:10156)  com.baidu.video(uid:10168) 关联启动

07-16 15:47:38.308859  1010  3307 D PowerConsumptionService: isAllowAppLaunch : com.sina.weibo(uid:10156), callingPackage = com.baidu.video(uid:10168), reason = send-broadcast

07-16 15:47:38.309022  1010  3307 D PowerConsumptionService: isAllowAppLaunch : intent action:Intent { act=com.huawei.intent.action.PUSH flg=0x30 pkg=com.sina.weibo (has extras) }

10. com.cubic.autohome(uid:10160)  com.baidu.video(uid:10168) 关联启动

07-16 15:47:40.020740  1010  4818 D PowerConsumptionService: isAllowAppLaunch : com.cubic.autohome(uid:10160), callingPackage = com.baidu.video(uid:10168), reason = bind-service

07-16 15:47:40.020844  1010  4818 D PowerConsumptionService: isAllowAppLaunch : intent action:Intent { flg=0x20 cmp=com.cubic.autohome/cn.jpush.android.service.DaemonService (has extras) }

11. com.cleanmaster.mguard_cn(uid:10164)  com.baidu.video(uid:10168) 关联启动

07-16 15:47:38.694378  1010  1022 D PowerConsumptionService: isAllowAppLaunch : com.cleanmaster.mguard_cn(uid:10164), callingPackage = com.baidu.video(uid:10168), reason = bind-service

07-16 15:47:38.694760  1010  1022 D PowerConsumptionService: isAllowAppLaunch : intent action:Intent { flg=0x20 cmp=com.cleanmaster.mguard_cn/com.cleanmaster.jpush.JpushDaemonService (has extras) }

12. com.hipu.yidian(uid:10125)  com.baidu.video(uid:10168) 关联启动

07-16 15:47:41.921992  1010  6231 D PowerConsumptionService: isAllowAppLaunch : com.hipu.yidian(uid:10125), callingPackage = com.baidu.video(uid:10168), reason = bind-service

07-16 15:47:41.922168  1010  6231 D PowerConsumptionService: isAllowAppLaunch : intent action:Intent { flg=0x20 cmp=com.hipu.yidian/com.yidian.wakeup.YdDaemonService (has extras) }

13. com.job.android(uid:10135)  com.baidu.video(uid:10168) 关联启动

07-16 15:47:41.949993  1010  6237 D PowerConsumptionService: isAllowAppLaunch : com.job.android(uid:10135), callingPackage = com.baidu.video(uid:10168), reason = bind-service

07-16 15:47:41.950191  1010  6237 D PowerConsumptionService: isAllowAppLaunch : intent action:Intent { flg=0x20 cmp=com.job.android/cn.jpush.android.service.DaemonService (has extras) }

14. com.qq.reader(uid:10121)  com.baidu.video(uid:10168) 关联启动

07-16 15:47:57.251650  1010  2226 D PowerConsumptionService: isAllowAppLaunch : com.qq.reader(uid:10121), callingPackage = com.baidu.video(uid:10168), reason = bind-service

07-16 15:47:57.251862  1010  2226 D PowerConsumptionService: isAllowAppLaunch : intent action:Intent { flg=0x20 cmp=com.qq.reader/cn.jpush.android.service.DaemonService (has extras) }

15.com.xingin.xhs(uid:10144)  com.baidu.video(uid:10168) 关联启动

07-16 15:47:57.888941  1010  1312 D PowerConsumptionService: isAllowAppLaunch : com.xingin.xhs(uid:10144), callingPackage = com.baidu.video(uid:10168), reason = bind-service

07-16 15:47:57.889082  1010  1312 D PowerConsumptionService: isAllowAppLaunch : intent action:Intent { flg=0x20 cmp=com.xingin.xhs/cn.jpush.android.service.DaemonService (has extras) }

16.sogou.mobile.explorer(uid:10153)  com.ss.android.article.news(uid:10129) 关联启动

07-16 15:47:59.321980  1010  1979 D TctPowerConsumptionService: isAllowAppLaunch : sogou.mobile.explorer(uid:10153), callingPackage = com.ss.android.article.news(uid:10129), reason = bind-service

07-16 15:47:59.322151  1010  1979 D PowerConsumptionService: isAllowAppLaunch : intent action:Intent { flg=0x20 cmp=sogou.mobile.explorer/cn.jpush.android.service.DaemonService (has extras) }

17. com.wuba(uid:10117)  com.baidu.video(uid:10168) 关联启动

07-16 15:48:06.202649  1010  1979 D PowerConsumptionService: isAllowAppLaunch : com.wuba(uid:10117), callingPackage = com.baidu.video(uid:10168), reason = start-activity

07-16 15:48:06.202777  1010  1979 D PowerConsumptionService: isAllowAppLaunch : intent action:Intent { flg=0x10000000 cmp=com.wuba/com.igexin.sdk.GActivity (has extras) }

18. air.tv.douyu.android(uid:10155)  com.baidu.video(uid:10168) 关联启动

07-16 15:48:06.550748  1010  6237 D PowerConsumptionService: isAllowAppLaunch : air.tv.douyu.android(uid:10155), callingPackage = com.baidu.video(uid:10168), reason = start-activity

07-16 15:48:06.551987  1010  6237 D PowerConsumptionService: isAllowAppLaunch : intent action:Intent { flg=0x10000000 cmp=air.tv.douyu.android/com.igexin.sdk.GActivity }

19 com.jingdong.app.mall(uid:10128)  com.baidu.video(uid:10168) 关联启动

07-16 15:48:41.178704  1010  1979 D PowerConsumptionService: isAllowAppLaunch : com.jingdong.app.mall(uid:10128), callingPackage = com.baidu.video(uid:10168), reason = start-activity

07-16 15:48:41.178921  1010  1979 D PowerConsumptionService: isAllowAppLaunch : intent action:Intent { flg=0x10000000 cmp=com.jingdong.app.mall/com.igexin.sdk.GActivity }

20 com.android.comicsisland.activity(uid:10162)  com.baidu.video(uid:10168) 关联启动

07-16 15:48:41.241667  1010  1077 D PowerConsumptionService: isAllowAppLaunch : com.android.comicsisland.activity(uid:10162), callingPackage = com.baidu.video(uid:10168), reason = start-activity

07-16 15:48:41.241717  1010  1077 D PowerConsumptionService: isAllowAppLaunch : intent action:Intent { flg=0x10000000 cmp=com.android.comicsisland.activity/com.igexin.sdk.GActivity }

21 com.huaqian(uid:10148)  com.baidu.video(uid:10168) 关联启动

07-16 15:48:06.385103  1010  1076 D PowerConsumptionService: isAllowAppLaunch : com.huaqian(uid:10148), callingPackage = com.baidu.video(uid:10168), reason = start-activity

07-16 15:48:06.385213  1010  1076 D PowerConsumptionService: isAllowAppLaunch : intent action:Intent { flg=0x10000000 cmp=com.huaqian/com.igexin.sdk.GActivity }

22 com.netease.newsreader.activity(uid:10171)  com.android.bluetooth(uid:1002) 关联启动

07-16 15:49:09.438847  1010  4835 D PowerConsumptionService: isAllowAppLaunch : com.netease.newsreader.activity(uid:10171), callingPackage = com.android.bluetooth(uid:1002), reason = bind-service

07-16 15:49:09.438979  1010  4835 D PowerConsumptionService: isAllowAppLaunch : intent action:Intent { act=android.media.browse.MediaBrowserService cmp=com.netease.newsreader.activity/com.netease.awakening.music.MusicService }

23  cn.etouch.ecalendar(uid:10126)  com.huaqian(uid:10148) 关联启动

07-16 15:49:33.559620  1010  2001 D PowerConsumptionService: isAllowAppLaunch : cn.etouch.ecalendar(uid:10126), callingPackage = com.huaqian(uid:10148), reason = start-activity

07-16 15:49:33.559673  1010  2001 D PowerConsumptionService: isAllowAppLaunch : intent action:Intent { flg=0x10000000 cmp=cn.etouch.ecalendar/com.igexin.sdk.GActivity }

24  com.tencent.mtt(uid:10119)  com.netease.newsreader.activity(uid:10171) 关联启动

07-16 15:51:45.573292  1010  1984 D PowerConsumptionService: isAllowAppLaunch : com.tencent.mtt(uid:10119), callingPackage = com.netease.newsreader.activity(uid:10171), reason = start-activity

07-16 15:51:45.573364  1010  1984 D PowerConsumptionService: isAllowAppLaunch : intent action:Intent { flg=0x10000000 cmp=com.tencent.mtt/com.igexin.sdk.GActivity }

3.2. 安装后,按smgr推荐名单设置,桌面待机

1. 根据黑名单和非前台进程和com.igexin.sdk.GActivity 拦截 activity

07-17 17:56:29.047735  1039  1549 D PowerConsumptionService: onStartActivity # target=ActivityInfo{40fd0a0 com.igexin.sdk.GActivity}, callingPkg=com.cubic.autohome

07-17 17:56:29.047786  1039  1549 W PowerConsumptionService: onStartActivity # start activity from annoying component.

2. 根据黑名单和非前台进程拦截 service

07-17 20:00:21.728459  1034  1104 D PowerConsumptionService: onStartProcess # processName=com.baidu.video, pkg=com.baidu.video, type=service, name=com.baidu.video/.audio.service.AudioService

3. 根据黑名单和非前台进程拦截 broadcast

07-17 20:00:26.830424  1034  1050 D PowerConsumptionService: onStartProcess # processName=com.sina.news, pkg=com.sina.news, type=broadcast, name=com.sina.news/.module.base.receiver.BootCompletedReceiver

07-17 20:00:26.830782  1034  1050 W PowerConsumptionService: onStartProcess # abort starting process: com.sina.news, pkg=com.sina.news

4. 根据黑名单和非前台进程拦截 content provider

07-17 20:00:42.839045  1034  1573 D PowerConsumptionService: onStartProcess # processName=com.baidu.video, pkg=com.baidu.video, type=content provider, name=com.baidu.video/cn.jpush.android.service.DownloadProvider

07-17 20:00:42.839381  1034  1573 W PowerConsumptionService: onStartProcess # abort starting process: com.baidu.video, pkg=com.baidu.video

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

法迪

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值