高通Qcom修改默认开机时间
程序员文章站
2022-07-01 20:30:03
...
修改默认首次开机时间
有两种方式
1.第一种是使用高通的patch
2.第二种是自己摸索的
第一种方式:高通patch
Index: SystemServer.java
===================================================================
--- SystemServer.java (revision 5703)
+++ SystemServer.java (revision 5704)
@@ -129,8 +129,8 @@
// The earliest supported time. We pick one day into 1970, to
// give any timezone code room without going into negative time.
- //wangxx modify for default time 20170705 start
- //private static final long EARLIEST_SUPPORTED_TIME = 1199275200000L;
+ //wangxx modify for default time 20170706 start
+ private static final long EARLIEST_SUPPORTED_TIME_TEMP = 1199275200000L;
private static final long EARLIEST_SUPPORTED_TIME = 1199275200000L; //20170101 00:00 /*86400 * 1000*/
//wangxx modify for default time 20170705 end
@@ -242,10 +242,14 @@
// APIs crash dealing with negative numbers, notably
// java.io.File#setLastModified, so instead we fake it and
// hope that time from cell towers or NTP fixes it shortly.
- /*if (System.currentTimeMillis() < EARLIEST_SUPPORTED_TIME) { //wangxx modify for default time 20170705 start
- Slog.w(TAG, "System clock is before 1970; setting to 1970.");
- SystemClock.setCurrentTimeMillis(EARLIEST_SUPPORTED_TIME);
- }*/ //wangxx modify for default time 20170705 end
+ //wangxx modify for default time 20170706 start
+ boolean firstBoot = SystemProperties.getBoolean("persist.sys.firstboot", true);
+ if(!firstBoot){//wangxx modify for default time 20170705 start
+ if (System.currentTimeMillis() < EARLIEST_SUPPORTED_TIME_TEMP) {
+ Slog.w(TAG, "System clock is before 1970; setting to 1970.");
+ SystemClock.setCurrentTimeMillis(EARLIEST_SUPPORTED_TIME_TEMP);
+ }
+ }//wangxx modify for default time 20170706 end
// If the system has "persist.sys.language" and friends set, replace them with
// "persist.sys.locale". Note that the default locale at this point is calculated
@@ -350,11 +354,16 @@
} finally {
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
}
- //wangxx modify for default time 20170705 start
+ //wangxx modify for default time 20170706 start
+ boolean firstBoot = SystemProperties.getBoolean("persist.sys.firstboot", true);
Slog.w("XXX", "SystemServer ==> System.currentTimeMillis()=" + System.currentTimeMillis());
- if (System.currentTimeMillis() < EARLIEST_SUPPORTED_TIME) {//1220093030
- SystemClock.setCurrentTimeMillis(EARLIEST_SUPPORTED_TIME);
- }//wangxx modify for default time 20170705 end
+ if(firstBoot){
+ if (System.currentTimeMillis() != EARLIEST_SUPPORTED_TIME) {//1220093030
+ SystemClock.setCurrentTimeMillis(EARLIEST_SUPPORTED_TIME);
+ }
+ SystemProperties.set("persist.sys.firstboot", "false");
+ }//wangxx modify for default time 20170706 end
+
// For debug builds, log event loop stalls to dropbox for analysis.
if (StrictMode.conditionallyEnableDebugLogging()) {
Slog.i(TAG, "Enabled StrictMode for system server main thread.");
---------------------
需要修改的地方:把 SystemClock.setCurrentTimeMillis(EARLIEST_SUPPORTED_TIME) 这句代码放到startOtherServices()后面;
我们对Markdown编辑器进行了一些功能拓展与语法支持,除了标准的Markdown编辑器功能,我们增加了如下几点新功能,帮助你用它写博客:
- 全新的界面设计 ,将会带来全新的写作体验;
- 在创作中心设置你喜爱的代码高亮样式,Markdown 将代码片显示选择的高亮样式 进行展示;
- 增加了 图片拖拽 功能,你可以将本地的图片直接拖拽到编辑区域直接展示;
- 全新的 KaTeX数学公式 语法;
- 增加了支持甘特图的mermaid语法1 功能;
- 增加了 多屏幕编辑 Markdown文章功能;
- 增加了 焦点写作模式、预览模式、简洁写作模式、左右区域同步滚轮设置 等功能,功能按钮位于编辑区域与预览区域中间;
- 增加了 检查列表 功能。
第二种(亲测)
设置默认时间为:20190101 8:0:0
+++ b/LA.UM.7.2/LINUX/android/vendor/qcom/proprietary/time-services/time_daemon_qmi.c
@@ -201,9 +201,13 @@ genoff_pre_init(time_genoff_ptr time_genoff,time_bases_type base)
TIME_LOGD("Daemon:%s::Base = %d\n", __func__, base);
}
+static int rtc_get(int64_t *msecs);//add by bbk lyq
static int genoff_post_init(time_genoff_ptr time_genoff)
{
int rc;
+ int64_t rtc_msecs;
+ int64_t standard_time = 1546300800000; //20190101 8:0:0 add by bbk lyq
+
if (time_genoff->init_func != NULL) {
rc = time_genoff->init_func();
@@ -221,7 +225,18 @@ static int genoff_post_init(time_genoff_ptr time_genoff)
if (rc) {
TIME_LOGD("Daemon:%s:Error in accessing storage\n",
__func__);
- time_genoff->generic_offset = 0;
+
+ /* Get RTC time */
+ if (rtc_get(&rtc_msecs))
+ return -EINVAL;
+
+ time_genoff->generic_offset = standard_time - rtc_msecs;
+ TIME_LOGE("Daemon:%s:enter hah set standard_time off\n", __func__);
+ rc = time_persistent_memory_opr(
+ time_genoff->per_storage_spec.f_name,
+ TIME_WRITE_MEMORY, &(time_genoff->generic_offset));
+ if (rc)
+ return -EINVAL;
}
}
@@ -684,6 +699,8 @@ static int genoff_init_config(void)
int i, rc;
上一篇: 累成狗做的
下一篇: HTML:分区响应图
推荐阅读