Merge "[flexiglass] Remove temporary behavior for opening shade scene with remote input" into udc-qpr-dev
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
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,
|
||||
}
|
||||
@@ -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.
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -147,16 +147,4 @@ class SceneInteractorTest : SysuiTestCase() {
|
||||
underTest.setVisible(true, "reason")
|
||||
assertThat(isVisible).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun remoteUserInput() =
|
||||
testScope.runTest {
|
||||
val remoteUserInput by collectLastValue(underTest.remoteUserInput)
|
||||
assertThat(remoteUserInput).isNull()
|
||||
|
||||
for (input in SceneTestUtils.REMOTE_INPUT_DOWN_GESTURE) {
|
||||
underTest.onRemoteUserInput(input)
|
||||
assertThat(remoteUserInput).isEqualTo(input)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,19 +18,14 @@
|
||||
|
||||
package com.android.systemui.scene.ui.viewmodel
|
||||
|
||||
import android.view.MotionEvent
|
||||
import androidx.test.filters.SmallTest
|
||||
import com.android.systemui.SysuiTestCase
|
||||
import com.android.systemui.coroutines.collectLastValue
|
||||
import com.android.systemui.scene.SceneTestUtils
|
||||
import com.android.systemui.scene.shared.model.RemoteUserInput
|
||||
import com.android.systemui.scene.shared.model.RemoteUserInputAction
|
||||
import com.android.systemui.scene.shared.model.SceneKey
|
||||
import com.android.systemui.scene.shared.model.SceneModel
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.test.TestScope
|
||||
import kotlinx.coroutines.test.currentTime
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
@@ -73,35 +68,4 @@ class SceneContainerViewModelTest : SysuiTestCase() {
|
||||
|
||||
assertThat(currentScene).isEqualTo(SceneModel(SceneKey.Shade))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun onRemoteUserInput() = runTest {
|
||||
val remoteUserInput by collectLastValue(underTest.remoteUserInput)
|
||||
assertThat(remoteUserInput).isNull()
|
||||
|
||||
val inputs =
|
||||
SceneTestUtils.REMOTE_INPUT_DOWN_GESTURE.map { remoteUserInputToMotionEvent(it) }
|
||||
|
||||
inputs.forEachIndexed { index, input ->
|
||||
underTest.onRemoteUserInput(input)
|
||||
assertThat(remoteUserInput).isEqualTo(SceneTestUtils.REMOTE_INPUT_DOWN_GESTURE[index])
|
||||
}
|
||||
}
|
||||
|
||||
private fun TestScope.remoteUserInputToMotionEvent(input: RemoteUserInput): MotionEvent {
|
||||
return MotionEvent.obtain(
|
||||
currentTime,
|
||||
currentTime,
|
||||
when (input.action) {
|
||||
RemoteUserInputAction.DOWN -> MotionEvent.ACTION_DOWN
|
||||
RemoteUserInputAction.MOVE -> MotionEvent.ACTION_MOVE
|
||||
RemoteUserInputAction.UP -> MotionEvent.ACTION_UP
|
||||
RemoteUserInputAction.CANCEL -> MotionEvent.ACTION_CANCEL
|
||||
RemoteUserInputAction.UNKNOWN -> MotionEvent.ACTION_OUTSIDE
|
||||
},
|
||||
input.x,
|
||||
input.y,
|
||||
0
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import com.android.systemui.R
|
||||
import com.android.systemui.SysuiTestCase
|
||||
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.ui.view.WindowRootView
|
||||
import com.android.systemui.shade.ShadeControllerImpl
|
||||
import com.android.systemui.shade.ShadeLogger
|
||||
import com.android.systemui.shade.ShadeViewController
|
||||
@@ -77,7 +77,7 @@ class PhoneStatusBarViewControllerTest : SysuiTestCase() {
|
||||
@Mock
|
||||
private lateinit var shadeControllerImpl: ShadeControllerImpl
|
||||
@Mock
|
||||
private lateinit var sceneInteractor: Provider<SceneInteractor>
|
||||
private lateinit var windowRootView: Provider<WindowRootView>
|
||||
@Mock
|
||||
private lateinit var shadeLogger: ShadeLogger
|
||||
@Mock
|
||||
@@ -203,7 +203,7 @@ class PhoneStatusBarViewControllerTest : SysuiTestCase() {
|
||||
centralSurfacesImpl,
|
||||
shadeControllerImpl,
|
||||
shadeViewController,
|
||||
sceneInteractor,
|
||||
windowRootView,
|
||||
shadeLogger,
|
||||
viewUtil,
|
||||
configurationController,
|
||||
|
||||
@@ -39,8 +39,6 @@ import com.android.systemui.keyguard.shared.model.WakefulnessModel
|
||||
import com.android.systemui.keyguard.shared.model.WakefulnessState
|
||||
import com.android.systemui.scene.data.repository.SceneContainerRepository
|
||||
import com.android.systemui.scene.domain.interactor.SceneInteractor
|
||||
import com.android.systemui.scene.shared.model.RemoteUserInput
|
||||
import com.android.systemui.scene.shared.model.RemoteUserInputAction
|
||||
import com.android.systemui.scene.shared.model.SceneContainerConfig
|
||||
import com.android.systemui.scene.shared.model.SceneKey
|
||||
import com.android.systemui.user.data.repository.FakeUserRepository
|
||||
@@ -196,15 +194,6 @@ class SceneTestUtils(
|
||||
}
|
||||
|
||||
companion object {
|
||||
val REMOTE_INPUT_DOWN_GESTURE =
|
||||
listOf(
|
||||
RemoteUserInput(10f, 10f, RemoteUserInputAction.DOWN),
|
||||
RemoteUserInput(10f, 20f, RemoteUserInputAction.MOVE),
|
||||
RemoteUserInput(10f, 30f, RemoteUserInputAction.MOVE),
|
||||
RemoteUserInput(10f, 40f, RemoteUserInputAction.MOVE),
|
||||
RemoteUserInput(10f, 40f, RemoteUserInputAction.UP),
|
||||
)
|
||||
|
||||
fun DomainLayerAuthenticationMethodModel.toDataLayer(): DataLayerAuthenticationMethodModel {
|
||||
return when (this) {
|
||||
DomainLayerAuthenticationMethodModel.None -> DataLayerAuthenticationMethodModel.None
|
||||
|
||||
Reference in New Issue
Block a user