[高通SDM450][Android9.0]刷机后RTC时钟不生效问题

文章目录

    • 开发平台基本信息
    • 问题描述
    • 解决方法
      • 1.写入RTC时钟添加增加开机广播

开发平台基本信息

芯片: 高通SDM450
版本: Android 9
kernel: msm-4.19

问题描述

设备刷机后,RTC时钟不会正常功能,断电重启后,时间又恢复成固件打包时间;但是,如果网络同步时间或者手动设置时间之后,RTC时钟又是能正常工作的,证明硬件、驱动上,RTC功能都是正常的。通过代码分析,可以知道RTC时钟更新的条件是时间发生变化,才会写入时间到RTC时钟,那问题就很好解决了,在接收时间变化广播那里增加多一个开机广播接收,如果收到开机广播,也会将时间写入到RTC时钟,即可解决问题。

解决方法

1.写入RTC时钟添加增加开机广播

diff --git a/vendor/qcom/proprietary/time-services/AndroidManifest.xml b/time-services/AndroidManifest.xml
index a489c3a..c70c40d 100755
--- a/vendor/qcom/proprietary/time-services/AndroidManifest.xml
+++ b/vendor/qcom/proprietary/time-services/AndroidManifest.xml
@@ -10,12 +10,14 @@
    package="com.qualcomm.timeservice">
 
    <uses-permission android:name="android.permission.WAKE_LOCK" />
+   <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <application>
       <receiver android:name=".TimeServiceBroadcastReceiver"
          android:exported="false"
          android:label="TimeServiceBroadcastReceiver">
          <intent-filter>
             <action android:name="android.intent.action.TIME_SET" />
+                       <action android:name="android.intent.action.BOOT_COMPLETED" />
          </intent-filter>
          <intent-filter>
             <action android:name="android.intent.action.DATE_CHANGED" />
diff --git a/vendor/qcom/proprietary/time-services/src/com/qualcomm/timeservice/TimeServiceBroadcastReceiver.java b/vendor/qcom/proprietary/time-services/src/com/qualcomm/timeservice/TimeServiceBroadcastReceiver.java
index bcbf67e..e9e8e12 100755
--- a/vendor/qcom/proprietary/time-services/src/com/qualcomm/timeservice/TimeServiceBroadcastReceiver.java
+++ b/vendor/qcom/proprietary/time-services/src/com/qualcomm/timeservice/TimeServiceBroadcastReceiver.java
@@ -54,6 +54,7 @@ public class TimeServiceBroadcastReceiver extends BroadcastReceiver {
     public void onReceive(Context context, Intent intent) {
 
         if ((Intent.ACTION_TIME_CHANGED.equals(intent.getAction())) ||
+                       (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) ||
             (Intent.ACTION_DATE_CHANGED.equals(intent.getAction()))) {
 
             Log.d(TAG, "Received" + intent.getAction() + " intent. " +


你可能感兴趣的:(Android9.0,framework,RTC时钟,RTC失效,SDM450,Android9)