在目录
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);
}
} }