Home/Search key doesn't work, and Power key cann't lock screen 关于home首页 搜索按键失灵,电源键不能锁屏问题

      最近遇到首页按键无反应问题,错误提示主要为   V/KeyguardServiceDelegate(  443): **** onKeyguardExitResult(false) CALLED ****  ,搜索资料找到问题所在。

      问题定位在源码frameworks\base\policy\src\com\android\internal\policy\impl 文件下PhoneWindowManager.java中interceptKeyBeforeDispatching方法下,处理按键消息时,执行launchHomeFromHotKey()函数。跟踪launchHomeFromHotKey()函数时:

 <pre name="code" class="java">else if (!mHideLockScreen && mKeyguardMediator.isInputRestricted()) {     
        //Log.d(TAG,"----------------before launching home" + mHideLockScreen+"isInputRestricted:"+ mKeyguardMediator.isInputRestricted());    
         // when in keyguard restricted mode, must first verify unlock             // before launching home           
  mKeyguardMediator.verifyUnlock(new OnKeyguardExitResult() {                
 public void onKeyguardExitResult(boolean success) {               
      Log.d(TAG,"------------onKeyguardExitResult: "+success);               
      if (true) {                    
     try {                        
     ActivityManagerNative.getDefault().stopAppSwitches();              
           } catch (RemoteException e) {                         }             
            sendCloseSystemWindows(SYSTEM_DIALOG_REASON_HOME_KEY);               
          //Log.i("11111111111111111111111111111","launchHomeFromHotKey  111111");         
                startDockOrHome();                     }          
       }        
     });    
     } 

 

NOTE: This form is only for reporting bugs found while working with the
Android Open-Source Project. For all other AOSP discussions please visit
the appropriate mailing lists.

Please describe the problem in detail. Be sure to include:
- Steps to reproduce the problem.
  Do factory reset and reboot the phone.
- What happened.
  Press HOME or Search key, the phone can vibrate ,but have not other response. And after press the power key, the phone cann't locked and the screen turns off.
- What you think the correct behavior should be.
  The HOME/Search/Power key has the right response.

  This bug is hard to reproduced but it did happen. Google "Home/Search not responding android", we can see that lots of people have got this problem.

Analyse:
  I have add debug log and reproduce it. The root cause is that KeyguardUpdateMonitor.mDeviceProvisioned stays false, so mKeyguardMediator.isInputRestricted() returns true and PhoneWindowManager.launchHomeFromHotKey() will go into the unnormal case.

  After factory reset, the provision app will set Settings.Secure.DEVICE_PROVISIONED to 1. But the 
Settings.Secure.DEVICE_PROVISIONED's value is cached by Settings.Secure When SettingsProvider update Settings.Secure.DEVICE_PROVISIONED, it will update systemproperty "sys.settings_secure_version", and then KeyguardUpdateMonitor is notified to read Settings.Secure.DEVICE_PROVISIONED from Settings.Secure. But Settings.Secure try to read sys.settings_secure_version and find it unchanged and return cached Settings.Secure.DEVICE_PROVISIONED value to KeyguardUpdateMonitor. So that KeyguardUpdateMonitor.mDeviceProvisioned stays false, and the HOME key will not response.

  The real cause is that SettingsProvider update the "sys.settings_secure_version", and soon afterwards Settings.Secure try to read "sys.settings_secure_version" but get the old value. SystemProperties is managed by native.The update operation is done by socket and is asynchronous.

主要问题原因为工厂复位后 Settings.Secure.DEVICE_PROVISIONED被设置为1,但是S ettings.Secure.DEVICE_PROVISIONED已经被 Settings.Secure缓存读取了,所以当 KeyguardUpdateMonitor去取值的时候还是保持以前的false值,导致HOME不响应。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值