参考文章:
Android R锁屏界面屏蔽下拉状态栏_pulseexpansionhandler-CSDN博客
前提增加状态栏控制显隐属性,以下面文章为前提补充功能
RK3568 Android11 状态栏和导航栏增加显示控制功能-CSDN博客
修改文件位置:
frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
java">import android.os.SystemProperties;private boolean handleQsTouch(MotionEvent event) {... ...// 锁屏状态下根据系统设置参数控制是否屏蔽状态栏下滑的Touch事件boolean statusBarDisplay=SystemProperties.getBoolean(StatusBar.SYS_PROPERTY_STATUS_BAR, false);if (statusBarDisplay && !mQsExpandImmediate && mQsTracking) {onQsTouch(event);if (!mConflictingQsExpansionGesture) {return true;}}if (action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_UP) {mConflictingQsExpansionGesture = false;}... ...}private void setQsExpansion(float height) {// 锁屏状态下根据系统设置参数判断禁止对状态栏布局的设置boolean statusBarDisplay=SystemProperties.getBoolean(StatusBar.SYS_PROPERTY_STATUS_BAR, false);if(!statusBarDisplay){return;}height = Math.min(Math.max(height, mQsMinExpansionHeight), mQsMaxExpansionHeight);mQsFullyExpanded = height == mQsMaxExpansionHeight && mQsMaxExpansionHeight != 0;... ...}@Overrideprotected TouchHandler createTouchHandler() {return new TouchHandler() {@Overridepublic boolean onInterceptTouchEvent(MotionEvent event) {... ...if (!shouldQuickSettingsIntercept(mDownX, mDownY, 0)&& mPulseExpansionHandler.onInterceptTouchEvent(event)) {return true;}// 锁屏状态下根据系统设置参数拦截事件分发boolean statusBarDisplay=SystemProperties.getBoolean(StatusBar.SYS_PROPERTY_STATUS_BAR, false);if (!statusBarDisplay && !isFullyCollapsed() && onQsIntercept(event)) {return true;}return super.onInterceptTouchEvent(event);}} }