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

Commit a1221bcd authored by Bill Lin's avatar Bill Lin
Browse files

2/ Notify adjust touch slop when one handed mode activated

When one handed mode activated, user swipe-up to exit usually
cross over the NavBar region, and then invoke TouchController
intercept touch event to trigger All Apps drawer on Home.

To enhanced the UX of gesture conflict of exit OHM & All Apps,
notify TouchController throught LauncherActivityInterface,
and Launcher dispatch onOneHandedModeStateChanged() event to
all mTouchControllers in DragLayer that touchController can
adjust the touch slop by it's SingleAxisSwipeDetector.

Test: manual trigger One handed mode and swipe-up to exit
Test: monitor minDisplacement of SingleAxisSwipeDetector
      OHM activated : touchSlop x multiplier
      OHM deactivated : touchSlop x 1
Test: check All Apps doesn't mis-trigger when exit one handed mode
Bug: 186235522
Change-Id: I7b9e6e7fa898231697d1866186a5f9b1717a9aa3
parent 945bb34b
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -114,6 +114,9 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T


    public abstract void onAssistantVisibilityChanged(float visibility);
    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,
    public abstract AnimationFactory prepareRecentsUI(RecentsAnimationDeviceState deviceState,
            boolean activityVisible, Consumer<AnimatorControllerWithResistance> callback);
            boolean activityVisible, Consumer<AnimatorControllerWithResistance> callback);


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


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

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


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

    @Override
    @Override
    public AnimationFactory prepareRecentsUI(RecentsAnimationDeviceState deviceState,
    public AnimationFactory prepareRecentsUI(RecentsAnimationDeviceState deviceState,
            boolean activityVisible, Consumer<AnimatorControllerWithResistance> callback) {
            boolean activityVisible, Consumer<AnimatorControllerWithResistance> callback) {
+5 −0
Original line number Original line Diff line number Diff line
@@ -111,6 +111,11 @@ public final class OverviewComponentObserver {
        if (mDeviceState.isHomeDisabled() != mIsHomeDisabled) {
        if (mDeviceState.isHomeDisabled() != mIsHomeDisabled) {
            updateOverviewTargets();
            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) {
    private void updateOverviewTargets(Intent unused) {
+8 −0
Original line number Original line Diff line number Diff line
@@ -576,6 +576,14 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
        mHotseat.getQsb().setAlpha(1f - visibility);
        mHotseat.getQsb().setAlpha(1f - visibility);
    }
    }


    /**
     * Called when one handed mode activated and deactivated.
     * @param activated true if one handed mode activated, false otherwise.
     */
    public void onOneHandedStateChanged(boolean activated) {
        mDragLayer.onOneHandedModeStateChanged(activated);
    }

    private void initDeviceProfile(InvariantDeviceProfile idp) {
    private void initDeviceProfile(InvariantDeviceProfile idp) {
        // Load configuration-specific DeviceProfile
        // Load configuration-specific DeviceProfile
        mDeviceProfile = idp.getDeviceProfile(this);
        mDeviceProfile = idp.getDeviceProfile(this);