美文网首页
屏蔽禁用下拉状态栏

屏蔽禁用下拉状态栏

作者: 飘絮无意 | 来源:发表于2023-10-26 13:42 被阅读0次

    禁用下拉状态栏主要包含两个地方

    第一个地方就是解锁后进入到桌面时,在顶部和[中部下拉](时会将状态栏拉出来显示

    第二个地方就是[锁屏界面]在顶部和中部下拉时会将状态栏拉出来显示

    具体屏蔽禁用这两处的下拉状态栏修改如下:

    1. 屏蔽禁用解锁后进入到桌面时,在顶部和中部下拉时会将状态栏拉出来显示,修改如下:
      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. 屏蔽禁用锁屏界面在顶部和中部下拉时会将状态栏拉出来显示,修改如下:
      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有效,下拉状态栏包括解锁后在桌面下拉和在锁屏界面下拉,下拉又包括在顶部下拉和在屏幕中间部位下拉,所以总共有4处修改,思路主要就是屏蔽代码执行达到屏蔽禁用的效果

    相关文章

      网友评论

          本文标题:屏蔽禁用下拉状态栏

          本文链接:https://www.haomeiwen.com/subject/lpkjidtx.html