Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c5c8b7d3 authored by Hyunyoung Song's avatar Hyunyoung Song Committed by Android (Google) Code Review
Browse files

Merge "Fix Panel View not being able to handle touch when NexusLauncher dies"

parents 72621aeb 547e11e8
Loading
Loading
Loading
Loading
+35 −1
Original line number Original line Diff line number Diff line
@@ -17,6 +17,10 @@
package com.android.systemui;
package com.android.systemui;


import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE;
import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE;
import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_UP;
import static android.view.MotionEvent.ACTION_CANCEL;

import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_DISABLE_SWIPE_UP;
import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_DISABLE_SWIPE_UP;
import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_SHOW_OVERVIEW_BUTTON;
import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_SHOW_OVERVIEW_BUTTON;
import static com.android.systemui.shared.system.NavigationBarCompat.InteractionType;
import static com.android.systemui.shared.system.NavigationBarCompat.InteractionType;
@@ -86,6 +90,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
    private boolean mIsEnabled;
    private boolean mIsEnabled;
    private int mCurrentBoundedUserId = -1;
    private int mCurrentBoundedUserId = -1;
    private float mBackButtonAlpha;
    private float mBackButtonAlpha;
    private MotionEvent mStatusBarGestureDownEvent;


    private ISystemUiProxy mSysUiProxy = new ISystemUiProxy.Stub() {
    private ISystemUiProxy mSysUiProxy = new ISystemUiProxy.Stub() {


@@ -108,6 +113,9 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
        }
        }


        public void onStatusBarMotionEvent(MotionEvent event) {
        public void onStatusBarMotionEvent(MotionEvent event) {
            if (!verifyCaller("onStatusBarMotionEvent")) {
                return;
            }
            long token = Binder.clearCallingIdentity();
            long token = Binder.clearCallingIdentity();
            try {
            try {
                // TODO move this logic to message queue
                // TODO move this logic to message queue
@@ -115,6 +123,16 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
                    StatusBar bar = SysUiServiceProvider.getComponent(mContext, StatusBar.class);
                    StatusBar bar = SysUiServiceProvider.getComponent(mContext, StatusBar.class);
                    if (bar != null) {
                    if (bar != null) {
                        bar.dispatchNotificationsPanelTouchEvent(event);
                        bar.dispatchNotificationsPanelTouchEvent(event);

                        int action = event.getActionMasked();
                        if (action == ACTION_DOWN) {
                            mStatusBarGestureDownEvent = MotionEvent.obtain(event);
                        }
                        if (action == ACTION_UP || action == ACTION_CANCEL) {
                            mStatusBarGestureDownEvent.recycle();
                            mStatusBarGestureDownEvent = null;
                        }
                        event.recycle();
                    }
                    }
                });
                });
            } finally {
            } finally {
@@ -298,7 +316,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis


    // This is the death handler for the binder from the launcher service
    // This is the death handler for the binder from the launcher service
    private final IBinder.DeathRecipient mOverviewServiceDeathRcpt
    private final IBinder.DeathRecipient mOverviewServiceDeathRcpt
            = this::startConnectionToCurrentUser;
            = this::cleanupAfterDeath;


    public OverviewProxyService(Context context) {
    public OverviewProxyService(Context context) {
        mContext = context;
        mContext = context;
@@ -328,6 +346,22 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
        return mBackButtonAlpha;
        return mBackButtonAlpha;
    }
    }


    public void cleanupAfterDeath() {
        if (mStatusBarGestureDownEvent != null) {
            mHandler.post(()-> {
                StatusBar bar = SysUiServiceProvider.getComponent(mContext, StatusBar.class);
                if (bar != null) {
                    System.out.println("MERONG dispatchNotificationPanelTouchEvent");
                    mStatusBarGestureDownEvent.setAction(MotionEvent.ACTION_CANCEL);
                    bar.dispatchNotificationsPanelTouchEvent(mStatusBarGestureDownEvent);
                    mStatusBarGestureDownEvent.recycle();
                    mStatusBarGestureDownEvent = null;
                }
            });
        }
        startConnectionToCurrentUser();
    }

    public void startConnectionToCurrentUser() {
    public void startConnectionToCurrentUser() {
        if (mHandler.getLooper() != Looper.myLooper()) {
        if (mHandler.getLooper() != Looper.myLooper()) {
            mHandler.post(mConnectionRunnable);
            mHandler.post(mConnectionRunnable);
+1 −0
Original line number Original line Diff line number Diff line
@@ -2852,6 +2852,7 @@ public class StatusBar extends SystemUI implements DemoMode,
                }
                }
            }
            }
            else if (Intent.ACTION_SCREEN_OFF.equals(action)) {
            else if (Intent.ACTION_SCREEN_OFF.equals(action)) {
                mStatusBarWindowController.setNotTouchable(false);
                finishBarAnimations();
                finishBarAnimations();
                resetUserExpandedStates();
                resetUserExpandedStates();
            }
            }