android4.0 休眠唤醒会出现之前界面

android4.0 休眠唤醒会出现之前界面,我们通过桌面远程工具可以看到在休眠时候,系统已经进入解锁界面。可是我们唤醒机器的时候,系统会闪一下之前操作的界面,再进入解锁界面。所以判断应该是休眠时候没有把解锁界面写入framebuffer,找到写framebuffer地方:

if (LIKELY(hw.canDraw())) {
        // repaint the framebuffer (if needed)

        const int index = hw.getCurrentBufferIndex();
        GraphicLog& logger(GraphicLog::getInstance());

        logger.log(GraphicLog::SF_REPAINT, index);
        handleRepaint();

        // inform the h/w that we're done compositing
        logger.log(GraphicLog::SF_COMPOSITION_COMPLETE, index);
        hw.compositionComplete();

        logger.log(GraphicLog::SF_SWAP_BUFFERS, index);
        postFramebuffer();

        logger.log(GraphicLog::SF_REPAINT_DONE, index);
    } else {
        // pretend we did the post
        hw.compositionComplete();
        usleep(16667); // 60 fps period
    }

可以看到,是根据hw.canDraw()函数的返回值跳到不同的入口,再找到hw.canDraw()函数的实现:

bool DisplayHardwareBase::canDraw() const
{
    return mScreenAcquired;
}

所以把操作mScreenAcquired的值的相关代码去掉就可以了:

--- a/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp
+++ b/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp
@@ -80,11 +80,13 @@ bool DisplayHardwareBase::DisplayEventThread::threadLoop()
     if (err >= 0) {
         sp<SurfaceFlinger> flinger = mFlinger.promote();
         LOGD("About to give-up screen, flinger = %p", flinger.get());
+        /*
         if (flinger != 0) {
             mBarrier.close();
             flinger->screenReleased(0);
             mBarrier.wait();
         }
+        */
     }
     fd = open(kWakeFileName, O_RDONLY, 0);
     do {
@@ -95,8 +97,10 @@ bool DisplayHardwareBase::DisplayEventThread::threadLoop()
     if (err >= 0) {
         sp<SurfaceFlinger> flinger = mFlinger.promote();
         LOGD("Screen about to return, flinger = %p", flinger.get());
+        /*
         if (flinger != 0)
             flinger->screenAcquired(0);
+        */
     }
     return true;
 }

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值