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

Commit 86472f4d authored by Shawn Lee's avatar Shawn Lee
Browse files

[flexiglass] Fix touch gesture interruption when dragging HUN

Calling HeadsUpManager.unpinAll before passing the drag gesture to flexiglass was causing an issue where flexiglass visibility, which depends on state set by unpinAll, was set to false, causing the drag gesture to be interrupted by an ACTION_CANCEL.

Bug: 357661886
Test: manually verified that touch gesture is no longer canceled when dragging a HUN
Test: manually verified with logging that unpinAll is called once flexiglass receives the touch gesture
Flag: com.android.systemui.scene_container
Change-Id: I83c964ebbf99141b93f2f43a1512048f917dee20
parent 83aa0229
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -44,4 +44,7 @@ interface HeadsUpRepository {

    /** Snooze the currently pinned HUN. */
    fun snooze()

    /** Unpin all currently pinned HUNs. */
    fun unpinAll(userUnPinned: Boolean)
}
+5 −0
Original line number Diff line number Diff line
@@ -148,6 +148,11 @@ constructor(
    fun snooze() {
        headsUpRepository.snooze()
    }

    /** Unpin all currently pinned HUNs. */
    fun unpinAll(userUnPinned: Boolean) {
        headsUpRepository.unpinAll(userUnPinned)
    }
}

class HeadsUpRowInteractor(repository: HeadsUpRowRepository)
+0 −1
Original line number Diff line number Diff line
@@ -2053,7 +2053,6 @@ public class NotificationStackScrollLayoutController implements Dumpable {
                hunWantsIt = mHeadsUpTouchHelper.onInterceptTouchEvent(ev);
                if (hunWantsIt) {
                    mView.startDraggingOnHun();
                    mHeadsUpManager.unpinAll(true);
                }
            }
            boolean swipeWantsIt = false;
+11 −1
Original line number Diff line number Diff line
@@ -30,7 +30,10 @@ import com.android.systemui.util.kotlin.ActivatableFlowDumper
import com.android.systemui.util.kotlin.ActivatableFlowDumperImpl
import dagger.assisted.AssistedFactory
import dagger.assisted.AssistedInject
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.launch

/**
 * ViewModel used by the Notification placeholders inside the scene container to update the
@@ -40,7 +43,7 @@ class NotificationsPlaceholderViewModel
@AssistedInject
constructor(
    private val interactor: NotificationStackAppearanceInteractor,
    shadeInteractor: ShadeInteractor,
    private val shadeInteractor: ShadeInteractor,
    private val headsUpNotificationInteractor: HeadsUpNotificationInteractor,
    featureFlags: FeatureFlagsClassic,
    dumpManager: DumpManager,
@@ -58,6 +61,13 @@ constructor(
    val isDebugLoggingEnabled: Boolean = SceneContainerFlag.isEnabled

    override suspend fun onActivated(): Nothing {
        coroutineScope {
            launch {
                shadeInteractor.isAnyExpanded
                    .filter { it }
                    .collect { headsUpNotificationInteractor.unpinAll(true) }
            }
        }
        activateFlowDumper()
    }

+10 −5
Original line number Diff line number Diff line
@@ -60,6 +60,11 @@ import com.android.systemui.util.kotlin.JavaAdapter;
import com.android.systemui.util.settings.GlobalSettings;
import com.android.systemui.util.time.SystemClock;

import kotlinx.coroutines.flow.Flow;
import kotlinx.coroutines.flow.MutableStateFlow;
import kotlinx.coroutines.flow.StateFlow;
import kotlinx.coroutines.flow.StateFlowKt;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashSet;
@@ -70,11 +75,6 @@ import java.util.Stack;

import javax.inject.Inject;

import kotlinx.coroutines.flow.Flow;
import kotlinx.coroutines.flow.MutableStateFlow;
import kotlinx.coroutines.flow.StateFlow;
import kotlinx.coroutines.flow.StateFlowKt;

/** A implementation of HeadsUpManager for phone. */
@SysUISingleton
public class HeadsUpManagerPhone extends BaseHeadsUpManager implements
@@ -297,6 +297,11 @@ public class HeadsUpManagerPhone extends BaseHeadsUpManager implements
        }
    }

    @Override
    public void unpinAll(boolean userUnPinned) {
        super.unpinAll(userUnPinned);
    }

    /**
     * Notifies that a remote input textbox in notification gets active or inactive.
     *
Loading