Android R锁屏界面屏蔽下拉状态栏

修改文件:

frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java

    private boolean handleQsTouch(MotionEvent event) {
        ... ...
        // 增加 mUnallowedState 属性屏蔽状态栏下滑的Touch事件
        if (!mQsExpandImmediate && mQsTracking && mUnallowedState) {
            onQsTouch(event);
            if (!mConflictingQsExpansionGesture) {
                return true;
            }
        }
        if (action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_UP) {
            mConflictingQsExpansionGesture = false;
        }
        ... ...
    }

    private void setQsExpansion(float height) {
        // 增加 mUnallowedState 判断禁止对状态栏布局的设置
        if (mUnallowedState) {
            return;
        }
        // end
        height = Math.min(Math.max(height, mQsMinExpansionHeight), mQsMaxExpansionHeight);
        mQsFullyExpanded = height == mQsMaxExpansionHeight && mQsMaxExpansionHeight != 0;
        ... ...
    }


    @Override
    protected TouchHandler createTouchHandler() {
        return new TouchHandler() {
            @Override
            public boolean onInterceptTouchEvent(MotionEvent event) {
                ... ...
                if (!shouldQuickSettingsIntercept(mDownX, mDownY, 0)
                        && mPulseExpansionHandler.onInterceptTouchEvent(event)) {
                    return true;
                }

                // 增加 mUnallowedState 拦截事件分发到子VIEW通知消息栏中,屏蔽通知栏左右滑动等
                if (mUnallowedState && !isFullyCollapsed() && onQsIntercept(event)) {
                    return true;
                }
                return super.onInterceptTouchEvent(event);
            }
    }   }

    原文作者:虫师魁拔
    原文地址: https://blog.csdn.net/tq501501/article/details/122733365
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞