阅读:1963回复:0

Android9.0去掉鼠标和触屏唤醒

楼主#
更多 发布于:2022-10-21 13:37
/** {@inheritDoc} */
    @Override
    public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags) {
        /*if ((policyFlags & FLAG_WAKE) != 0) {
            if (wakeUp(whenNanos / 1000000, mAllowTheaterModeWakeFromMotion,
                    "android.policy:MOTION")) {
                return 0;
            }
        }*/
 
        if (shouldDispatchInputWhenNonInteractive(null)) {
            return ACTION_PASS_TO_USER;
        }
 
        // If we have not passed the action up and we are in theater mode without dreaming,
        // there will be no dream to intercept the touch and wake into ambient.  The device should
        // wake up in this case.
        /*if (isTheaterModeEnabled() && (policyFlags & FLAG_WAKE) != 0) {
            wakeUp(whenNanos / 1000000, mAllowTheaterModeWakeFromMotionWhenNotDreaming,
                    "android.policy:MOTION");
        }*/
 
        return 0;
    }



平台:RK3288-9.0


需求:去掉鼠标唤醒和触摸屏唤醒,只保留Power键唤醒


Android系统自带了很多唤醒事件,触摸屏点击唤醒,鼠标移动和左键右键点击都能唤醒屏幕,所以要想去掉这些唤醒事件,关键是要找到这些事件分发和触发的地方,可以在底层分发的地方屏蔽事件,或者在触发唤醒的地方屏蔽唤醒事件。


触摸唤醒可以参考这里,我这里目前没有触摸屏,无法验证。
RK Android7.1 禁用 USB触摸 - 走看看
http://t.zoukankan.com/crushgirl-p-15200388.html

————————————————

版权声明:本文为CSDN博主「zhaoyufei133」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/zhaoyufei133/article/details/127444491
[url]http://190.lsal.cn/195/1329.gif?0728100424873[/url]
游客

返回顶部