Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1371835
  • 博文数量: 478
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 4833
  • 用 户 组: 普通用户
  • 注册时间: 2014-06-28 11:12
文章分类

全部博文(478)

文章存档

2019年(1)

2018年(27)

2017年(21)

2016年(171)

2015年(258)

我的朋友

分类: Android平台

2016-03-25 10:44:15

[DESCRIPTION]
关机流程实现灭屏和振动同步,灭屏即完成关机流程
 
 

目前默认设计,关机会设置一个灭屏时间,不同运营商有不同需求。设置灭屏时间的主要考虑是用户体验关机更快,但实际上灭屏后关机流程还会有一些操作。

如果有需要实现真正关机完成才灭屏振动的体验,可以参照如下修改(灭屏时间延长,用户体验的关机时间延长):

 
 
[SOLUTION]
 

 

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...");

......

}

 

阅读(1051) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~