Android 屏蔽\取消(禁止)下拉通知栏包括二级菜单下拉
修改方案很简单,就是直接返回类型进行屏蔽掉,让下拉效果失去,有些修改建议一起修改,不然会有意想不到的冲突,单独修改需要验证再验证,确保无其他bug产生。
有些版本可能方法的位置不一样,需要搜索一番才能尝试修改。
第一种情况,依据版本看panelsEnabled()方法的位置,if判断后其他代码不用注释掉
/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
boolean panelsEnabled() {
if(true) return false; //*/add start
return (mDisabled1 & StatusBarManager.DISABLE_EXPAND) == 0 && !ONLY_CORE_APPS;
}
第二种:
/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
@Override
public boolean panelEnabled() {
if(true) return false; //*/add start
return mCommandQueue.panelsEnabled();
}
第三种:禁止解锁状态的亮屏中下拉通知菜单【单个验证有效】
vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar$
CommandQueue.java
// TODO(b/118592525): add multi-display support if needed.
public boolean panelsEnabled() {
if(true) return false; //*/add start
final int disabled1 = getDisabled1(DEFAULT_DISPLAY);
final int disabled2 = getDisabled2(DEFAULT_DISPLAY);
return (disabled1 & StatusBarManager.DISABLE_EXPAND) == 0
&& (disabled2 & StatusBarManager.DISABLE2_NOTIFICATION_SHADE) == 0
&& !ONLY_CORE_APPS;
}
第四种:不加载下拉高度;禁止锁屏状态的亮屏中下拉通知菜单 + 【单个验证有效】
/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
private void setQsExpansion(float height) {
if(true) return; //*/add startheight = Math.min(Math.max(height, mQsMinExpansionHeight), mQsMaxExpansionHeight);
mQsFullyExpanded = height == mQsMaxExpansionHeight && mQsMaxExpansionHeight != 0;
第五种:如何删除屏蔽二次下拉菜单 +【同上第四个有点修改差异】
/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
private void setQsExpansion(float height) {
//height = Math.min(Math.max(height, mQsMinExpansionHeight), mQsMaxExpansionHeight);高度直接等于后者
height = mQsMinExpansionHeight;//*/add start
mQsFullyExpanded = height == mQsMaxExpansionHeight && mQsMaxExpansionHeight != 0;
if (height > mQsMinExpansionHeight && !mQsExpanded && !mStackScrollerOverscrolling) {
setQsExpanded(true);
} else if (height <= mQsMinExpansionHeight && mQsExpanded) {
setQsExpanded(false);
if (mLastAnnouncementWasQuickSettings && !mTracking && !isCollapsing()) {
announceForAccessibility(getKeyguardOrLockScreenString());
mLastAnnouncementWasQuickSettings = false;
}
}