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

Commit a6c94e29 authored by Shawn Lee's avatar Shawn Lee Committed by Automerger Merge Worker
Browse files

Merge "[flexiglass] Remove temporary behavior for opening shade scene with...

Merge "[flexiglass] Remove temporary behavior for opening shade scene with remote input" into udc-qpr-dev am: 657e69c9

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24408254



Change-Id: I2db6d47ca817dc93a247aedcbfe2c0ed97fafa8e
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents c357b418 657e69c9
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -21,16 +21,13 @@ import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.scene.data.repository.SceneContainerRepository
import com.android.systemui.scene.shared.logger.SceneLogger
import com.android.systemui.scene.shared.model.ObservableTransitionState
import com.android.systemui.scene.shared.model.RemoteUserInput
import com.android.systemui.scene.shared.model.SceneKey
import com.android.systemui.scene.shared.model.SceneModel
import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.stateIn

@@ -109,10 +106,6 @@ constructor(
    /** Whether the scene container is visible. */
    val isVisible: StateFlow<Boolean> = repository.isVisible

    private val _remoteUserInput: MutableStateFlow<RemoteUserInput?> = MutableStateFlow(null)
    /** A flow of motion events originating from outside of the scene framework. */
    val remoteUserInput: StateFlow<RemoteUserInput?> = _remoteUserInput.asStateFlow()

    /**
     * Returns the keys of all scenes in the container.
     *
@@ -160,11 +153,6 @@ constructor(
        repository.setTransitionState(transitionState)
    }

    /** Handles a remote user input. */
    fun onRemoteUserInput(input: RemoteUserInput) {
        _remoteUserInput.value = input
    }

    /**
     * Notifies that the UI has transitioned sufficiently to the given scene.
     *
+0 −35
Original line number Diff line number Diff line
package com.android.systemui.scene.shared.model

import android.view.MotionEvent

/** A representation of user input that is used by the scene framework. */
data class RemoteUserInput(
    val x: Float,
    val y: Float,
    val action: RemoteUserInputAction,
) {
    companion object {
        fun translateMotionEvent(event: MotionEvent): RemoteUserInput {
            return RemoteUserInput(
                x = event.x,
                y = event.y,
                action =
                    when (event.actionMasked) {
                        MotionEvent.ACTION_DOWN -> RemoteUserInputAction.DOWN
                        MotionEvent.ACTION_MOVE -> RemoteUserInputAction.MOVE
                        MotionEvent.ACTION_UP -> RemoteUserInputAction.UP
                        MotionEvent.ACTION_CANCEL -> RemoteUserInputAction.CANCEL
                        else -> RemoteUserInputAction.UNKNOWN
                    }
            )
        }
    }
}

enum class RemoteUserInputAction {
    DOWN,
    MOVE,
    UP,
    CANCEL,
    UNKNOWN,
}
+0 −9
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@ package com.android.systemui.scene.ui.view

import android.content.Context
import android.util.AttributeSet
import android.view.MotionEvent
import android.view.View
import com.android.systemui.scene.shared.model.Scene
import com.android.systemui.scene.shared.model.SceneContainerConfig
@@ -39,14 +38,6 @@ class SceneWindowRootView(
        )
    }

    override fun onTouchEvent(event: MotionEvent?): Boolean {
        return event?.let {
            viewModel.onRemoteUserInput(event)
            true
        }
            ?: false
    }

    override fun setVisibility(visibility: Int) {
        // Do nothing. We don't want external callers to invoke this. Instead, we drive our own
        // visibility from our view-binder.
+0 −10
Original line number Diff line number Diff line
@@ -16,11 +16,9 @@

package com.android.systemui.scene.ui.viewmodel

import android.view.MotionEvent
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.scene.domain.interactor.SceneInteractor
import com.android.systemui.scene.shared.model.ObservableTransitionState
import com.android.systemui.scene.shared.model.RemoteUserInput
import com.android.systemui.scene.shared.model.SceneKey
import com.android.systemui.scene.shared.model.SceneModel
import javax.inject.Inject
@@ -34,9 +32,6 @@ class SceneContainerViewModel
constructor(
    private val interactor: SceneInteractor,
) {
    /** A flow of motion events originating from outside of the scene framework. */
    val remoteUserInput: StateFlow<RemoteUserInput?> = interactor.remoteUserInput

    /**
     * Keys of all scenes in the container.
     *
@@ -68,11 +63,6 @@ constructor(
        interactor.setTransitionState(transitionState)
    }

    /** Handles a [MotionEvent] representing remote user input. */
    fun onRemoteUserInput(event: MotionEvent) {
        interactor.onRemoteUserInput(RemoteUserInput.translateMotionEvent(event))
    }

    companion object {
        private const val SCENE_TRANSITION_LOGGING_REASON = "user input"
    }
+8 −11
Original line number Diff line number Diff line
@@ -28,8 +28,7 @@ import com.android.systemui.Gefingerpoken
import com.android.systemui.R
import com.android.systemui.flags.FeatureFlags
import com.android.systemui.flags.Flags
import com.android.systemui.scene.domain.interactor.SceneInteractor
import com.android.systemui.scene.shared.model.RemoteUserInput
import com.android.systemui.scene.ui.view.WindowRootView
import com.android.systemui.shade.ShadeController
import com.android.systemui.shade.ShadeLogger
import com.android.systemui.shade.ShadeViewController
@@ -56,7 +55,7 @@ class PhoneStatusBarViewController private constructor(
    private val centralSurfaces: CentralSurfaces,
    private val shadeController: ShadeController,
    private val shadeViewController: ShadeViewController,
    private val sceneInteractor: Provider<SceneInteractor>,
    private val windowRootView: Provider<WindowRootView>,
    private val shadeLogger: ShadeLogger,
    private val moveFromCenterAnimationController: StatusBarMoveFromCenterAnimationController?,
    private val userChipViewModel: StatusBarUserChipViewModel,
@@ -80,7 +79,8 @@ class PhoneStatusBarViewController private constructor(
            statusOverlayHoverListenerFactory.createDarkAwareListener(statusContainer))
        if (moveFromCenterAnimationController == null) return

        val statusBarLeftSide: View = mView.requireViewById(R.id.status_bar_start_side_except_heads_up)
        val statusBarLeftSide: View =
                mView.requireViewById(R.id.status_bar_start_side_except_heads_up)
        val systemIconArea: ViewGroup = mView.requireViewById(R.id.status_bar_end_side_content)

        val viewsToAnimate = arrayOf(
@@ -179,11 +179,8 @@ class PhoneStatusBarViewController private constructor(
            // If scene framework is enabled, route the touch to it and
            // ignore the rest of the gesture.
            if (featureFlags.isEnabled(Flags.SCENE_CONTAINER)) {
                sceneInteractor.get()
                    .onRemoteUserInput(RemoteUserInput.translateMotionEvent(event))
                // TODO(b/291965119): remove once view is expanded to cover the status bar
                sceneInteractor.get().setVisible(true, "swipe down from status bar")
                return false
                windowRootView.get().dispatchTouchEvent(event)
                return true
            }

            if (event.action == MotionEvent.ACTION_DOWN) {
@@ -247,7 +244,7 @@ class PhoneStatusBarViewController private constructor(
        private val centralSurfaces: CentralSurfaces,
        private val shadeController: ShadeController,
        private val shadeViewController: ShadeViewController,
        private val sceneInteractor: Provider<SceneInteractor>,
        private val windowRootView: Provider<WindowRootView>,
        private val shadeLogger: ShadeLogger,
        private val viewUtil: ViewUtil,
        private val configurationController: ConfigurationController,
@@ -269,7 +266,7 @@ class PhoneStatusBarViewController private constructor(
                centralSurfaces,
                shadeController,
                shadeViewController,
                sceneInteractor,
                windowRootView,
                shadeLogger,
                statusBarMoveFromCenterAnimationController,
                userChipViewModel,
Loading