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

Commit 6cb04896 authored by burakov's avatar burakov
Browse files

[Dual Shade] Fix invocation gesture on fast launcher/trackpad swipe.

Fix: 432669961
Test: Manually tested by swiping down quickly on both sides of the
 launcher.
Flag: com.android.systemui.scene_container
Change-Id: I7bc3b1d4a94b5e12a6800e412acd45a9cf814727
parent 3a05a99e
Loading
Loading
Loading
Loading
+33 −6
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.Surface;
import android.view.View;
import android.view.accessibility.AccessibilityManager;
import android.view.inputmethod.InputMethodManager;

@@ -115,6 +116,7 @@ import com.android.systemui.settings.UserTracker;
import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.shade.display.StatusBarTouchShadeDisplayPolicy;
import com.android.systemui.shade.domain.interactor.ShadeInteractor;
import com.android.systemui.shade.domain.interactor.ShadeModeInteractor;
import com.android.systemui.shade.shared.flag.ShadeWindowGoesAround;
import com.android.systemui.shared.recents.ILauncherProxy;
import com.android.systemui.shared.recents.ISystemUiProxy;
@@ -175,6 +177,7 @@ public class LauncherProxyService implements CallbackController<LauncherProxyLis
    private final NotificationShadeWindowController mStatusBarWinController;
    private final Provider<SceneInteractor> mSceneInteractor;
    private final Provider<ShadeInteractor> mShadeInteractor;
    private final Provider<ShadeModeInteractor> mShadeModeInteractor;
    private final StatusBarTouchShadeDisplayPolicy mShadeDisplayPolicy;

    private final Runnable mConnectionRunnable = () ->
@@ -276,8 +279,7 @@ public class LauncherProxyService implements CallbackController<LauncherProxyLis
                        } else if (action == ACTION_UP) {
                            // Gesture was too short to be picked up by scene container touch
                            // handling; programmatically start the transition to the shade.
                            mShadeInteractor.get()
                                    .expandNotificationsShade("short launcher swipe", null);
                            onShadeExpansionGesture(event, "short launcher swipe");
                        }
                    }
                    event.recycle();
@@ -317,11 +319,9 @@ public class LauncherProxyService implements CallbackController<LauncherProxyLis
                if (SceneContainerFlag.isEnabled()) {
                    int action = event.getActionMasked();
                    if (action == ACTION_DOWN) {
                        mSceneInteractor.get().onRemoteUserInputStarted(
                                "trackpad swipe");
                        mSceneInteractor.get().onRemoteUserInputStarted("trackpad swipe");
                    } else if (action == ACTION_UP) {
                        mShadeInteractor.get()
                                .expandNotificationsShade("short trackpad swipe", null);
                        onShadeExpansionGesture(event, "short trackpad swipe");
                    }
                    mStatusBarWinController.getWindowRootView().dispatchTouchEvent(event);
                } else {
@@ -508,6 +508,31 @@ public class LauncherProxyService implements CallbackController<LauncherProxyLis
                    mCommandQueue.toggleQuickSettingsPanel());
        }

        private void onShadeExpansionGesture(MotionEvent event, String reason) {
            if (!SceneContainerFlag.isEnabled()) {
                return;
            }
            if (!mShadeModeInteractor.get().isDualShade()) {
                mShadeInteractor.get().expandNotificationsShade(reason, null);
            }

            final DisplayInfo displayInfo = new DisplayInfo();
            mDisplayTracker.getDisplay(event.getDisplayId()).getDisplayInfo(displayInfo);
            boolean isLeftSide = event.getX() < displayInfo.logicalWidth / 2f;

            boolean isRtlLayout =
                    mContext.getResources().getConfiguration().getLayoutDirection()
                            == View.LAYOUT_DIRECTION_RTL;

            boolean isStartSide = (isLeftSide && !isRtlLayout) || (!isLeftSide && isRtlLayout);

            if (isStartSide) {
                mShadeInteractor.get().expandNotificationsShade(reason, null);
            } else {
                mShadeInteractor.get().expandQuickSettingsShade(reason, null);
            }
        }

        private boolean verifyCaller(String reason) {
            final int callerId = Binder.getCallingUserHandle().getIdentifier();
            if (callerId != mCurrentBoundedUserId) {
@@ -745,6 +770,7 @@ public class LauncherProxyService implements CallbackController<LauncherProxyLis
            PerDisplayRepository<SysUiState> perDisplaySysUiStateRepository,
            Provider<SceneInteractor> sceneInteractor,
            Provider<ShadeInteractor> shadeInteractor,
            Provider<ShadeModeInteractor> shadeModeInteractor,
            StatusBarTouchShadeDisplayPolicy shadeDisplayPolicy,
            UserTracker userTracker,
            UserManager userManager,
@@ -788,6 +814,7 @@ public class LauncherProxyService implements CallbackController<LauncherProxyLis
        mStatusBarWinController = statusBarWinController;
        mSceneInteractor = sceneInteractor;
        mShadeInteractor = shadeInteractor;
        mShadeModeInteractor = shadeModeInteractor;
        mShadeDisplayPolicy = shadeDisplayPolicy;
        mUserTracker = userTracker;
        mConnectionBackoffAttempts = 0;
+4 −1
Original line number Diff line number Diff line
@@ -56,6 +56,8 @@ import com.android.systemui.settings.FakeDisplayTracker
import com.android.systemui.settings.UserTracker
import com.android.systemui.shade.ShadeViewController
import com.android.systemui.shade.display.StatusBarTouchShadeDisplayPolicy
import com.android.systemui.shade.domain.interactor.shadeInteractor
import com.android.systemui.shade.domain.interactor.shadeModeInteractor
import com.android.systemui.shared.recents.ILauncherProxy
import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NAVIGATION_BAR_DISABLED
import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_WAKEFULNESS_MASK
@@ -462,7 +464,8 @@ class LauncherProxyServiceTest : SysuiTestCase() {
            statusBarWinController,
            kosmos.fakeSysUIStatePerDisplayRepository,
            { sceneInteractor },
            mock(),
            { kosmos.shadeInteractor },
            { kosmos.shadeModeInteractor },
            statusBarShadeDisplayPolicy,
            userTracker,
            userManager,