全部博文(478)
分类: Android平台
2016-03-25 10:44:15
目前默认设计,关机会设置一个灭屏时间,不同运营商有不同需求。设置灭屏时间的主要考虑是用户体验关机更快,但实际上灭屏后关机流程还会有一些操作。
如果有需要实现真正关机完成才灭屏振动的体验,可以参照如下修改(灭屏时间延长,用户体验的关机时间延长):
frameworks/base/core/java/com/android/internal/app/ShutdownThread.java:
1.去掉触发灭屏的message
private static void beginShutdownSequence(Context context) {
.......
/* set screen brightness off after shutdownThread start */
//sInstance.mHandler.postDelayed(mDelayDim, screen_turn_off_time);
//modify shutdown screen off time
......
}
2.IPO关机振动与灭屏同步
public void running() {
......
if(mShutdownFlow == IPO_SHUTDOWN_FLOW)
{
……
delayForPlayAnimation();
if (sInstance.mScreenWakeLock != null && sInstance.mScreenWakeLock.isHeld()) {
sInstance.mScreenWakeLock.release();
sInstance.mScreenWakeLock = null;
}
//modify shutdown screen off time
Log.d(TAG, "setBacklightBrightness: Off");
sInstance.mPowerManager.setBacklightBrightnessOff(true);
//modify shutdown screen off time
//sInstance.mHandler.removeCallbacks(mDelayDim);
stMgr.shutdown(mContext);
......
}
3,正常关机流程振动与灭屏同步
public static void rebootOrShutdown(boolean reboot, String reason) {
......
delayForPlayAnimation();
//modify shutdown screen off time to start
Log.d(TAG, "setBacklightBrightness: Off");
if (sInstance.mScreenWakeLock != null && sInstance.mScreenWakeLock.isHeld()) {
sInstance.mScreenWakeLock.release();
sInstance.mScreenWakeLock = null;
}
sInstance.mPowerManager.setBacklightBrightnessOff(true);
//modify shutdown screen off time to end
// Shutdown power
Log.i(TAG, "Performing low-level shutdown...");
......
}