Keyguard drawn timeout

有时log中会出现keyguard 1S超时的log
08-05 22:09:48.397957  1109  1184 W WindowManager: Keyguard drawn timeout. Setting mKeyguardDrawComplete

//framework部分代码流程
DisplayPowerController中设置完设置完模式之后
PhoneWindowManager.screenTurningOn{
//上面有个一个1秒超时Handle,超时会强制绘制keyguard
mKeyguardDelegate.onScreenTurningOn(mKeyguardDrawnCallback);
}
--->
KeyguardServiceDelegate.onScreenTurningOn(final DrawnListener drawnListener) {
 mKeyguardService.onScreenTurningOn(new KeyguardShowDelegate(drawnListener));
}
--->
KeyguardServiceWrapper.onScreenTurningOn(IKeyguardDrawnCallback callback)

IKeyguardService.aidl  void onScreenTurningOn(IKeyguardDrawnCallback callback);

//systemUI部分代码流程

KeyguardService.onScreenTurningOn(IKeyguardDrawnCallback callback)
-->
KeyguardViewMediator.onScreenTurningOn(IKeyguardDrawnCallback callback){
   notifyScreenOn(callback);
}
-->
    public void onScreenTurningOn(IKeyguardDrawnCallback callback) {
        Trace.beginSection("KeyguardViewMediator#onScreenTurningOn");
        notifyScreenOn(callback);
        Trace.endSection();
    }
--->
//如果系统卡顿,可能这么Handle处理都可能会有有延迟出现,导致绘制超时
通过H.NOTIFY_SCREEN_TURNING_ON处理
--->
Trace.beginSection("KeyguardViewMediator#handleMessage NOTIFY_SCREEN_TURNING_ON");
handleNotifyScreenTurningOn((IKeyguardDrawnCallback) msg.obj);
Trace.endSection();   
---> 
这边会持有KeyguardViewMediator.this的锁,可能会导致回调延时
private void handleNotifyScreenTurningOn(IKeyguardDrawnCallback callback) {
        Trace.beginSection("KeyguardViewMediator#handleNotifyScreenTurningOn");
        synchronized (KeyguardViewMediator.this) {
            if (DEBUG) Log.d(TAG, "handleNotifyScreenTurningOn");
            mKeyguardViewControllerLazy.get().onScreenTurningOn();
            if (callback != null) {
                if (mWakeAndUnlocking) {
                    mDrawnCallback = callback;
                } else {
                    notifyDrawn(callback);
                }
            }
        }
        Trace.endSection();
}

///
private void notifyDrawn(final IKeyguardDrawnCallback callback) {
        Trace.beginSection("KeyguardViewMediator#notifyDrawn");
        try {
            callback.onDrawn();
        } catch (RemoteException e) {
            Slog.w(TAG, "Exception calling onDrawn():", e);
        }
        Trace.endSection();
}
onDraw这边回调的是PhoneWindowManager,如果1秒内没有调用则会出现keyguard绘制超时
437      final DrawnListener mKeyguardDrawnCallback = new DrawnListener() {
438          @Override
439          public void onDrawn() {
440              if (DEBUG_WAKEUP) Slog.d(TAG, "mKeyguardDelegate.ShowListener.onDrawn.");
441              mHandler.sendEmptyMessage(MSG_KEYGUARD_DRAWN_COMPLETE);
442          }
443      };

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值