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

Commit 6abdd5c7 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Removing unnecessary event dispatching via touch-controller.

Instead using a poll method similar to other touch controllers

Bug: 259447608
Test: Verified on device
Change-Id: I5c29c7c1b87acb668ea93e9f44fb685379de54fb
parent 9dd595b9
Loading
Loading
Loading
Loading
+6 −10
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import static com.android.launcher3.Utilities.EDGE_NAV_BAR;
import static com.android.launcher3.anim.AnimatorListeners.forSuccessCallback;
import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL;
import static com.android.quickstep.util.VibratorWrapper.OVERVIEW_HAPTIC;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_ONE_HANDED_ACTIVE;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED;

import android.animation.ObjectAnimator;
@@ -86,6 +87,11 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch
    @Override
    protected boolean canInterceptTouch(MotionEvent ev) {
        mDidTouchStartInNavBar = (ev.getEdgeFlags() & EDGE_NAV_BAR) != 0;
        boolean isOneHandedModeActive = (SystemUiProxy.INSTANCE.get(mLauncher)
                .getLastSystemUiStateFlags() & SYSUI_STATE_ONE_HANDED_ACTIVE) != 0;
        // Reset touch slop multiplier to default 1.0f if one-handed-mode is not active
        mDetector.setTouchSlopMultiplier(
                isOneHandedModeActive ? ONE_HANDED_ACTIVATED_SLOP_MULTIPLIER : 1f /* default */);
        return super.canInterceptTouch(ev) && !mLauncher.isInState(HINT_STATE);
    }

@@ -277,14 +283,4 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch
    private float dpiFromPx(float pixels) {
        return Utilities.dpiFromPx(pixels, mLauncher.getResources().getDisplayMetrics().densityDpi);
    }

    @Override
    public void onOneHandedModeStateChanged(boolean activated) {
        if (activated) {
            mDetector.setTouchSlopMultiplier(ONE_HANDED_ACTIVATED_SLOP_MULTIPLIER);
        } else {
            // Reset touch slop multiplier to default 1.0f
            mDetector.setTouchSlopMultiplier(1f /* default */);
        }
    }
}
+0 −3
Original line number Diff line number Diff line
@@ -121,9 +121,6 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T

    public abstract void onAssistantVisibilityChanged(float visibility);

    /** Called when one handed mode activated or deactivated. */
    public abstract void onOneHandedModeStateChanged(boolean activated);

    public abstract AnimationFactory prepareRecentsUI(RecentsAnimationDeviceState deviceState,
            boolean activityVisible, Consumer<AnimatorControllerWithResistance> callback);

+0 −5
Original line number Diff line number Diff line
@@ -77,11 +77,6 @@ public final class FallbackActivityInterface extends
        // set to zero prior to this class becoming active.
    }

    @Override
    public void onOneHandedModeStateChanged(boolean activated) {
        // Do nothing for FallbackActivityInterface
    }

    /** 6 */
    @Override
    public AnimationFactory prepareRecentsUI(RecentsAnimationDeviceState deviceState,
+0 −9
Original line number Diff line number Diff line
@@ -108,15 +108,6 @@ public final class LauncherActivityInterface extends
        launcher.onAssistantVisibilityChanged(visibility);
    }

    @Override
    public void onOneHandedModeStateChanged(boolean activated) {
        Launcher launcher = getCreatedActivity();
        if (launcher == null) {
            return;
        }
        launcher.onOneHandedStateChanged(activated);
    }

    @Override
    public AnimationFactory prepareRecentsUI(RecentsAnimationDeviceState deviceState,
            boolean activityVisible, Consumer<AnimatorControllerWithResistance> callback) {
+0 −5
Original line number Diff line number Diff line
@@ -115,11 +115,6 @@ public final class OverviewComponentObserver {
        if (mDeviceState.isHomeDisabled() != mIsHomeDisabled) {
            updateOverviewTargets();
        }

        // Notify ALL_APPS touch controller when one handed mode state activated or deactivated
        if (mDeviceState.isOneHandedModeEnabled()) {
            mActivityInterface.onOneHandedModeStateChanged(mDeviceState.isOneHandedModeActive());
        }
    }

    private void updateOverviewTargets(Intent unused) {
Loading