前言
T527Android13按power按键关机时,屏幕会黑掉没有关机的提示,这样很不友好!于是查找原因。
分析
根据关机的log,找到关机的时候会调用frameworks/base/services/core/java/com/android/server/power/ShutdownThread.java里面的beginShutdownSequence函数。
查看一下这个函数发现如下代码:
java
/// AW CODE:[feat]:shut down screen directly
final boolean shutdownForceScreenOff = context.getResources().getBoolean(
com.android.internal.R.bool.config_shutdownForceScreenOff);
final boolean showShutdownAnimation = SystemProperties.getBoolean("ro.init.shutdown_animation", false);
if (shutdownForceScreenOff && !showShutdownAnimation) {
sInstance.mPowerManager.goToSleep(SystemClock.uptimeMillis(),
PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, 0);
}
//support unattended update for ota
Log.i(TAG, "beginShutdownSequence reason=" + mReason);
if(mReason != null && mReason.toLowerCase().contains("unattend") && mReason.toLowerCase().contains("ota")) {
SystemProperties.set("persist.sys.unattended_update", "true");
}
/// AW add end
从上面看到原来AW原厂在原生代码基础上做了修改,关机的时候会去让机器sleep关屏!于是把判断条件com.android.internal.R.bool.config_shutdownForceScreenOff(位于device目录下的overlay/overlay/frameworks/base/core/res/res/values/config.xml)的值改成false。编译升级后就可以看到关机的提示了。