屏蔽禁用下拉狀態(tài)欄

禁用下拉狀態(tài)欄主要包含兩個(gè)地方

第一個(gè)地方就是解鎖后進(jìn)入到桌面時(shí),在頂部和[中部下拉](時(shí)會(huì)將狀態(tài)欄拉出來顯示

第二個(gè)地方就是[鎖屏界面]在頂部和中部下拉時(shí)會(huì)將狀態(tài)欄拉出來顯示

具體屏蔽禁用這兩處的下拉狀態(tài)欄修改如下:

  1. 屏蔽禁用解鎖后進(jìn)入到桌面時(shí),在頂部和中部下拉時(shí)會(huì)將狀態(tài)欄拉出來顯示,修改如下:
    diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
    old mode 100644
    new mode 100755
    index 96d6ecb..b938044
    --- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
    +++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
@@ -371,11 +371,14 @@ public class CommandQueue extends IStatusBar.Stub implements CallbackController<

    // TODO(b/118592525): add multi-display support if needed.
    public boolean panelsEnabled() {
-        final int disabled1 = getDisabled1(DEFAULT_DISPLAY);
+       
+       return false;
+       
+        /*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;
+                && !ONLY_CORE_APPS;*/
    }

diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
+++
b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java

@@ -185,37 +185,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
         // TODO: change the method signature to use (boolean inputFocusTransferStarted)
         @Override
         public void onStatusBarMotionEvent(MotionEvent event) {
-            if (!verifyCaller("onStatusBarMotionEvent")) {
-                return;
-            }
-            long token = Binder.clearCallingIdentity();
-            try {
-                // TODO move this logic to message queue
-                mStatusBarOptionalLazy.ifPresent(statusBarLazy -> {
-                    mHandler.post(()-> {
-                        StatusBar statusBar = statusBarLazy.get();
-                        int action = event.getActionMasked();
-                        if (action == ACTION_DOWN) {
-                            mInputFocusTransferStarted = true;
-                            mInputFocusTransferStartY = event.getY();
-                            mInputFocusTransferStartMillis = event.getEventTime();
-                            statusBar.onInputFocusTransfer(
-                                    mInputFocusTransferStarted, false /* cancel */,
-                                    0 /* velocity */);
-                        }
-                        if (action == ACTION_UP || action == ACTION_CANCEL) {
-                            mInputFocusTransferStarted = false;
-                            statusBar.onInputFocusTransfer(mInputFocusTransferStarted,
-                                    action == ACTION_CANCEL,
-                                    (event.getY() - mInputFocusTransferStartY)
-                                    / (event.getEventTime() - mInputFocusTransferStartMillis));
-                        }
-                        event.recycle();
-                    });
-                });
-            } finally {
-                Binder.restoreCallingIdentity(token);
-            }
+            
         }
  1. 屏蔽禁用鎖屏界面在頂部和中部下拉時(shí)會(huì)將狀態(tài)欄拉出來顯示,修改如下:
    diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java

a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java

@@ -6651,6 +6651,11 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
         /* Only ever called as a consequence of a lockscreen expansion gesture. */
         @Override
         public boolean onDraggedDown(View startingChild, int dragLengthY) {
+
+            if (mStatusBarState == StatusBarState.KEYGUARD) {
+                return false;
+            }
+           
             boolean canDragDown = hasActiveNotifications()
                     || mKeyguardMediaController.getView().getVisibility() == VISIBLE;
             if (mStatusBarState == StatusBarState.KEYGUARD && canDragDown) {

diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPan
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java

@@ -130,6 +130,8 @@ public class NotificationPanelViewController extends PanelViewController {
 
     private static final boolean DEBUG = false;
 
+   private boolean mUnallowedState = true;
+
     /**
      * Fling expanding QS.
      */
@@ -1674,6 +1676,11 @@ public class NotificationPanelViewController extends PanelViewController {
     }
 
     private void setQsExpansion(float height) {
+
+        if(mUnallowedState) {
+           return;
+        }
+
         height = Math.min(Math.max(height, mQsMinExpansionHeight), mQsMaxExpansionHeight);
         mQsFullyExpanded = height == mQsMaxExpansionHeight && mQsMaxExpansionHeight != 0;
         if (height > mQsMinExpansionHeight && !mQsExpanded && !mStackScrollerOverscrolling

以上在Android 11有效,下拉狀態(tài)欄包括解鎖后在桌面下拉和在鎖屏界面下拉,下拉又包括在頂部下拉和在屏幕中間部位下拉,所以總共有4處修改,思路主要就是屏蔽代碼執(zhí)行達(dá)到屏蔽禁用的效果

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容