OTA升级之Directboot模式下失效

一、问题描述

        客诉问题:锁屏模式下OTA未自动升级;

二、问题跟进

        设计了自动检测测试实验;实验结果如客诉,开机后不解锁设备没有实现自动升级。且日志分析后,发现多个问题,这里不做展开,主要问题是OTA应用未跟随系统自启动;

        日志显示:

08-21 04:39:49.703   869   900 E ANDR-IOP: io prefetch is disabled waiting for boot_completed
08-21 04:39:49.747   869   900 E ANDR-IOP: io prefetch is disabled waiting for boot_completed
08-21 04:39:49.751   869   900 E ANDR-IOP: io prefetch is disabled waiting for boot_completed
08-21 04:39:49.819   869   900 E ANDR-IOP: io prefetch is disabled waiting for boot_completed
08-21 04:39:49.836   869   900 E ANDR-IOP: io prefetch is disabled waiting for boot_completed
08-21 04:39:49.856   869   900 E ANDR-IOP: io prefetch is disabled waiting for boot_completed
08-21 04:39:49.975   869   900 E ANDR-IOP: io prefetch is disabled waiting for boot_completed
08-21 04:39:50.046   869   900 E ANDR-IOP: io prefetch is disabled waiting for boot_completed
08-21 04:39:50.071   869   900 E ANDR-IOP: io prefetch is disabled waiting for boot_completed
08-21 04:39:50.109   869   900 E ANDR-IOP: io prefetch is disabled waiting for boot_completed
08-21 04:39:50.157   869   900 E ANDR-IOP: io prefetch is disabled waiting for boot_completed
08-21 04:39:50.158   869   900 E ANDR-IOP: io prefetch is disabled waiting for boot_completed
08-21 04:39:50.225   869   900 E ANDR-IOP: io prefetch is disabled waiting for boot_completed
08-21 04:39:50.277   869   900 E ANDR-IOP: io prefetch is disabled waiting for boot_completed
08-21 04:39:51.381   869   900 E ANDR-IOP: io prefetch is disabled waiting for boot_completed
08-21 04:39:51.623  1950  1950 D ONSAutoboot: Received android.intent.action.LOCKED_BOOT_COMPLETED
08-21 04:39:51.781  2393  2393 I AlarmClock: AlarmInitReceiver android.intent.action.LOCKED_BOOT_COMPLETED
08-21 04:39:52.356  1894  1894 D QCNEJ/CneAppReceiver: ACTION_LOCKED_BOOT_COMPLETED or ACTION_BOOT_COMPLETED received
08-21 04:39:52.612  2446  2533 I chatty  : uid=10128(com.google.android.gms) _BOOT_COMPLETED identical 31 lines
08-21 04:39:52.767  2446  2533 I chatty  : uid=10128(com.google.android.gms) _BOOT_COMPLETED identical 1 line
08-21 04:39:52.796  2538  2538 D QDMA_UI - bootReceiver : : android.intent.action.LOCKED_BOOT_COMPLETED intent received
08-21 04:39:52.802  1917  1917 D QtiTelephonyService BootReceiver: onReceive: Intent { act=android.intent.action.LOCKED_BOOT_COMPLETED flg=0x9000010 cmp=com.qualcomm.qti.telephonyservice/.BootReceiver (has extras) }

系统根本就没法发出android.intent.action.BOOT_COMPLETED广播,但是看到了一个陌生广播android.intent.action.LOCKED_BOOT_COMPLETED;

这里就可以引入问题的主要原因了:Directboot 模式(http://www.mi-dong.com/post/android/directboot-%E6%A8%A1%E5%BC%8F/);

用户未解锁的情况下,开机并不会发出开机广播;也就导致应用无法自启动。

摘出关键部分:

当设备已开机但用户尚未解锁设备时,Android 7.0 将在安全的Direct boot模式下运行。

默认情况下,应用不会在Direct boot模式下运行。如果您的应用需要在Direct boot模式下执行操作,您可以注册应在此模式下运行的应用组件。需要在Direct boot模式下运行的一些常见应用用例包括:

  • 已安排通知的应用,如闹钟应用。
  • 提供重要用户通知的应用,如短信应用。
  • 提供无障碍服务的应用,如 Talkback。

APP如何在Direct boot模式下运行?

应用必须先向系统注册其组件,然后才能在Direct boot模式下运行或访问设备加密存储。应用通过将组件标记为加密感知来向系统注册。要将组件标记为加密感知,请在清单中将 android:directBootAware 属性设置为 true

当设备重启后,加密感知组件可以注册以接收来自系统的 ACTION_LOCKED_BOOT_COMPLETED 广播消息。此时,设备加密存储可用,您的组件可以执行需要在Direct boot模式下运行的任务,例如触发已设定的闹铃。

以下代码段示例说明了如何在应用清单中将 BroadcastReceiver 注册为加密感知并为 ACTION_LOCKED_BOOT_COMPLETED 添加 intent 过滤器

三、问题解决

        添加ACTION_LOCKED_BOOT_COMPLETED广播监听;

后续继续验证添加ACTION_LOCKED_BOOT_COMPLETED广播接收后,OTA运行是否有其他问题存在,

待续.....

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值