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

Commit b6c77038 authored by Lucas Silva's avatar Lucas Silva
Browse files

Disable communal touch handler when not on keyguard

After ag/32431678, isCommunalAvailable may be true when keyguard isn't
showing. Avoid grabbing touches in this case by also checking if
keyguard is showing in the touch handler.

Also had to rename existing function in KeyguardInteractor to resolving
naming conflict when calling methods from java. That class currently has
two methods in java called "isKeyguardShowing()" - one for the flow and
one for a getter which returns a boolean. This renames the getter to
disambiguate from the flow.

Bug: 392969914
Test: atest CommunalTouchHandlerTest
Flag: EXEMPT no-op when v2 flag is disabled
Change-Id: I97cc393bb079ee8bf679d43301e3da1959689301
parent 815fdd84
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -31,10 +31,12 @@ import com.android.systemui.ambient.touch.TouchHandler;
import com.android.systemui.common.ui.domain.interactor.ConfigurationInteractor;
import com.android.systemui.communal.domain.interactor.CommunalInteractor;
import com.android.systemui.dreams.touch.dagger.CommunalTouchModule;
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor;
import com.android.systemui.scene.domain.interactor.SceneInteractor;
import com.android.systemui.scene.shared.flag.SceneContainerFlag;
import com.android.systemui.scene.ui.view.WindowRootView;
import com.android.systemui.statusbar.phone.CentralSurfaces;
import com.android.systemui.util.kotlin.BooleanFlowOperators;

import kotlinx.coroutines.Job;

@@ -76,6 +78,7 @@ public class CommunalTouchHandler implements TouchHandler {
            CommunalInteractor communalInteractor,
            ConfigurationInteractor configurationInteractor,
            SceneInteractor sceneInteractor,
            KeyguardInteractor keyguardInteractor,
            Optional<Provider<WindowRootView>> windowRootViewProvider,
            Lifecycle lifecycle) {
        mInitiationWidth = initiationWidth;
@@ -88,7 +91,10 @@ public class CommunalTouchHandler implements TouchHandler {

        mFlows.add(collectFlow(
                mLifecycle,
                BooleanFlowOperators.INSTANCE.allOf(
                        mCommunalInteractor.isCommunalAvailable(),
                        keyguardInteractor.isKeyguardShowing()
                ),
                mIsCommunalAvailableCallback
        ));

+1 −1
Original line number Diff line number Diff line
@@ -448,7 +448,7 @@ constructor(
        return dozeTransitionModel.filter { states.contains(it.to) }
    }

    fun isKeyguardShowing(): Boolean {
    fun isKeyguardCurrentlyShowing(): Boolean {
        return repository.isKeyguardShowing()
    }

+1 −1
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ constructor(
        // we
        // are we will dismiss it which will also collapse the shade.
        val shouldAnimateFromExpandable =
            expandable != null && !keyguardInteractor.isKeyguardShowing()
            expandable != null && !keyguardInteractor.isKeyguardCurrentlyShowing()
        val dismissAction =
            ActivityStarter.OnDismissAction {
                if (shouldAnimateFromExpandable) {
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ constructor(
                    if (
                        sensorPrivacyController.requiresAuthentication() &&
                            keyguardInteractor.isKeyguardDismissible.value &&
                            keyguardInteractor.isKeyguardShowing()
                            keyguardInteractor.isKeyguardCurrentlyShowing()
                    ) {
                        activityStarter.postQSRunnableDismissingKeyguard {
                            sensorPrivacyController.setSensorBlocked(QS_TILE, sensorId, !blocked)
+2 −5
Original line number Diff line number Diff line
@@ -128,10 +128,7 @@ constructor(
    }

    /** Notifies the item for a user has been clicked. */
    fun onUserListItemClicked(
        record: UserRecord,
        dialogShower: DialogShower?,
    ) {
    fun onUserListItemClicked(record: UserRecord, dialogShower: DialogShower?) {
        mUserSwitcherInteractor.onRecordSelected(record, dialogShower)
    }

@@ -184,7 +181,7 @@ constructor(

    /** Whether keyguard is showing. */
    val isKeyguardShowing: Boolean
        get() = keyguardInteractor.isKeyguardShowing()
        get() = keyguardInteractor.isKeyguardCurrentlyShowing()

    /** Starts an activity with the given [Intent]. */
    fun startActivity(intent: Intent) {
Loading