Merge "Add a setting to remove UDFPS overlay enrollment UI" into tm-qpr-dev am: 8ee656b95c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20157825 Change-Id: Id63e7ffee606a1453ec246a70387d3c4b4772d0b Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -21,13 +21,18 @@ import android.annotation.UiThread
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.PixelFormat
|
import android.graphics.PixelFormat
|
||||||
import android.graphics.Rect
|
import android.graphics.Rect
|
||||||
import android.hardware.biometrics.BiometricOverlayConstants
|
import android.hardware.biometrics.BiometricOverlayConstants.REASON_AUTH_BP
|
||||||
|
import android.hardware.biometrics.BiometricOverlayConstants.REASON_AUTH_KEYGUARD
|
||||||
|
import android.hardware.biometrics.BiometricOverlayConstants.REASON_AUTH_OTHER
|
||||||
|
import android.hardware.biometrics.BiometricOverlayConstants.REASON_AUTH_SETTINGS
|
||||||
import android.hardware.biometrics.BiometricOverlayConstants.REASON_ENROLL_ENROLLING
|
import android.hardware.biometrics.BiometricOverlayConstants.REASON_ENROLL_ENROLLING
|
||||||
import android.hardware.biometrics.BiometricOverlayConstants.REASON_ENROLL_FIND_SENSOR
|
import android.hardware.biometrics.BiometricOverlayConstants.REASON_ENROLL_FIND_SENSOR
|
||||||
import android.hardware.biometrics.BiometricOverlayConstants.ShowReason
|
import android.hardware.biometrics.BiometricOverlayConstants.ShowReason
|
||||||
import android.hardware.fingerprint.FingerprintManager
|
import android.hardware.fingerprint.FingerprintManager
|
||||||
import android.hardware.fingerprint.IUdfpsOverlayControllerCallback
|
import android.hardware.fingerprint.IUdfpsOverlayControllerCallback
|
||||||
|
import android.os.Build
|
||||||
import android.os.RemoteException
|
import android.os.RemoteException
|
||||||
|
import android.provider.Settings
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.util.RotationUtils
|
import android.util.RotationUtils
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
@@ -38,6 +43,7 @@ import android.view.WindowManager
|
|||||||
import android.view.accessibility.AccessibilityManager
|
import android.view.accessibility.AccessibilityManager
|
||||||
import android.view.accessibility.AccessibilityManager.TouchExplorationStateChangeListener
|
import android.view.accessibility.AccessibilityManager.TouchExplorationStateChangeListener
|
||||||
import androidx.annotation.LayoutRes
|
import androidx.annotation.LayoutRes
|
||||||
|
import androidx.annotation.VisibleForTesting
|
||||||
import com.android.keyguard.KeyguardUpdateMonitor
|
import com.android.keyguard.KeyguardUpdateMonitor
|
||||||
import com.android.systemui.R
|
import com.android.systemui.R
|
||||||
import com.android.systemui.animation.ActivityLaunchAnimator
|
import com.android.systemui.animation.ActivityLaunchAnimator
|
||||||
@@ -54,13 +60,16 @@ import com.android.systemui.util.time.SystemClock
|
|||||||
|
|
||||||
private const val TAG = "UdfpsControllerOverlay"
|
private const val TAG = "UdfpsControllerOverlay"
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
const val SETTING_REMOVE_ENROLLMENT_UI = "udfps_overlay_remove_enrollment_ui"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Keeps track of the overlay state and UI resources associated with a single FingerprintService
|
* Keeps track of the overlay state and UI resources associated with a single FingerprintService
|
||||||
* request. This state can persist across configuration changes via the [show] and [hide]
|
* request. This state can persist across configuration changes via the [show] and [hide]
|
||||||
* methods.
|
* methods.
|
||||||
*/
|
*/
|
||||||
@UiThread
|
@UiThread
|
||||||
class UdfpsControllerOverlay(
|
class UdfpsControllerOverlay @JvmOverloads constructor(
|
||||||
private val context: Context,
|
private val context: Context,
|
||||||
fingerprintManager: FingerprintManager,
|
fingerprintManager: FingerprintManager,
|
||||||
private val inflater: LayoutInflater,
|
private val inflater: LayoutInflater,
|
||||||
@@ -82,7 +91,8 @@ class UdfpsControllerOverlay(
|
|||||||
@ShowReason val requestReason: Int,
|
@ShowReason val requestReason: Int,
|
||||||
private val controllerCallback: IUdfpsOverlayControllerCallback,
|
private val controllerCallback: IUdfpsOverlayControllerCallback,
|
||||||
private val onTouch: (View, MotionEvent, Boolean) -> Boolean,
|
private val onTouch: (View, MotionEvent, Boolean) -> Boolean,
|
||||||
private val activityLaunchAnimator: ActivityLaunchAnimator
|
private val activityLaunchAnimator: ActivityLaunchAnimator,
|
||||||
|
private val isDebuggable: Boolean = Build.IS_DEBUGGABLE
|
||||||
) {
|
) {
|
||||||
/** The view, when [isShowing], or null. */
|
/** The view, when [isShowing], or null. */
|
||||||
var overlayView: UdfpsView? = null
|
var overlayView: UdfpsView? = null
|
||||||
@@ -109,7 +119,8 @@ class UdfpsControllerOverlay(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** A helper if the [requestReason] was due to enrollment. */
|
/** A helper if the [requestReason] was due to enrollment. */
|
||||||
val enrollHelper: UdfpsEnrollHelper? = if (requestReason.isEnrollmentReason()) {
|
val enrollHelper: UdfpsEnrollHelper? =
|
||||||
|
if (requestReason.isEnrollmentReason() && !shouldRemoveEnrollmentUi()) {
|
||||||
UdfpsEnrollHelper(context, fingerprintManager, requestReason)
|
UdfpsEnrollHelper(context, fingerprintManager, requestReason)
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
@@ -129,6 +140,17 @@ class UdfpsControllerOverlay(
|
|||||||
|
|
||||||
private var touchExplorationEnabled = false
|
private var touchExplorationEnabled = false
|
||||||
|
|
||||||
|
private fun shouldRemoveEnrollmentUi(): Boolean {
|
||||||
|
if (isDebuggable) {
|
||||||
|
return Settings.Global.getInt(
|
||||||
|
context.contentResolver,
|
||||||
|
SETTING_REMOVE_ENROLLMENT_UI,
|
||||||
|
0 /* def */
|
||||||
|
) != 0
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
/** Show the overlay or return false and do nothing if it is already showing. */
|
/** Show the overlay or return false and do nothing if it is already showing. */
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
fun show(controller: UdfpsController, params: UdfpsOverlayParams): Boolean {
|
fun show(controller: UdfpsController, params: UdfpsOverlayParams): Boolean {
|
||||||
@@ -183,7 +205,18 @@ class UdfpsControllerOverlay(
|
|||||||
view: UdfpsView,
|
view: UdfpsView,
|
||||||
controller: UdfpsController
|
controller: UdfpsController
|
||||||
): UdfpsAnimationViewController<*>? {
|
): UdfpsAnimationViewController<*>? {
|
||||||
return when (requestReason) {
|
val isEnrollment = when (requestReason) {
|
||||||
|
REASON_ENROLL_FIND_SENSOR, REASON_ENROLL_ENROLLING -> true
|
||||||
|
else -> false
|
||||||
|
}
|
||||||
|
|
||||||
|
val filteredRequestReason = if (isEnrollment && shouldRemoveEnrollmentUi()) {
|
||||||
|
REASON_AUTH_OTHER
|
||||||
|
} else {
|
||||||
|
requestReason
|
||||||
|
}
|
||||||
|
|
||||||
|
return when (filteredRequestReason) {
|
||||||
REASON_ENROLL_FIND_SENSOR,
|
REASON_ENROLL_FIND_SENSOR,
|
||||||
REASON_ENROLL_ENROLLING -> {
|
REASON_ENROLL_ENROLLING -> {
|
||||||
UdfpsEnrollViewController(
|
UdfpsEnrollViewController(
|
||||||
@@ -198,7 +231,7 @@ class UdfpsControllerOverlay(
|
|||||||
overlayParams.scaleFactor
|
overlayParams.scaleFactor
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
BiometricOverlayConstants.REASON_AUTH_KEYGUARD -> {
|
REASON_AUTH_KEYGUARD -> {
|
||||||
UdfpsKeyguardViewController(
|
UdfpsKeyguardViewController(
|
||||||
view.addUdfpsView(R.layout.udfps_keyguard_view),
|
view.addUdfpsView(R.layout.udfps_keyguard_view),
|
||||||
statusBarStateController,
|
statusBarStateController,
|
||||||
@@ -216,7 +249,7 @@ class UdfpsControllerOverlay(
|
|||||||
activityLaunchAnimator
|
activityLaunchAnimator
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
BiometricOverlayConstants.REASON_AUTH_BP -> {
|
REASON_AUTH_BP -> {
|
||||||
// note: empty controller, currently shows no visual affordance
|
// note: empty controller, currently shows no visual affordance
|
||||||
UdfpsBpViewController(
|
UdfpsBpViewController(
|
||||||
view.addUdfpsView(R.layout.udfps_bp_view),
|
view.addUdfpsView(R.layout.udfps_bp_view),
|
||||||
@@ -226,8 +259,8 @@ class UdfpsControllerOverlay(
|
|||||||
dumpManager
|
dumpManager
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
BiometricOverlayConstants.REASON_AUTH_OTHER,
|
REASON_AUTH_OTHER,
|
||||||
BiometricOverlayConstants.REASON_AUTH_SETTINGS -> {
|
REASON_AUTH_SETTINGS -> {
|
||||||
UdfpsFpmOtherViewController(
|
UdfpsFpmOtherViewController(
|
||||||
view.addUdfpsView(R.layout.udfps_fpm_other_view),
|
view.addUdfpsView(R.layout.udfps_fpm_other_view),
|
||||||
statusBarStateController,
|
statusBarStateController,
|
||||||
@@ -440,4 +473,4 @@ private fun Int.isEnrollmentReason() =
|
|||||||
private fun Int.isImportantForAccessibility() =
|
private fun Int.isImportantForAccessibility() =
|
||||||
this == REASON_ENROLL_FIND_SENSOR ||
|
this == REASON_ENROLL_FIND_SENSOR ||
|
||||||
this == REASON_ENROLL_ENROLLING ||
|
this == REASON_ENROLL_ENROLLING ||
|
||||||
this == BiometricOverlayConstants.REASON_AUTH_BP
|
this == REASON_AUTH_BP
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import android.hardware.biometrics.BiometricOverlayConstants.REASON_ENROLL_FIND_
|
|||||||
import android.hardware.biometrics.BiometricOverlayConstants.ShowReason
|
import android.hardware.biometrics.BiometricOverlayConstants.ShowReason
|
||||||
import android.hardware.fingerprint.FingerprintManager
|
import android.hardware.fingerprint.FingerprintManager
|
||||||
import android.hardware.fingerprint.IUdfpsOverlayControllerCallback
|
import android.hardware.fingerprint.IUdfpsOverlayControllerCallback
|
||||||
|
import android.provider.Settings
|
||||||
import android.testing.AndroidTestingRunner
|
import android.testing.AndroidTestingRunner
|
||||||
import android.testing.TestableLooper.RunWithLooper
|
import android.testing.TestableLooper.RunWithLooper
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
@@ -124,14 +125,18 @@ class UdfpsControllerOverlayTest : SysuiTestCase() {
|
|||||||
whenever(udfpsEnrollView.context).thenReturn(context)
|
whenever(udfpsEnrollView.context).thenReturn(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun withReason(@ShowReason reason: Int, block: () -> Unit) {
|
private fun withReason(
|
||||||
|
@ShowReason reason: Int,
|
||||||
|
isDebuggable: Boolean = false,
|
||||||
|
block: () -> Unit
|
||||||
|
) {
|
||||||
controllerOverlay = UdfpsControllerOverlay(
|
controllerOverlay = UdfpsControllerOverlay(
|
||||||
context, fingerprintManager, inflater, windowManager, accessibilityManager,
|
context, fingerprintManager, inflater, windowManager, accessibilityManager,
|
||||||
statusBarStateController, shadeExpansionStateManager, statusBarKeyguardViewManager,
|
statusBarStateController, shadeExpansionStateManager, statusBarKeyguardViewManager,
|
||||||
keyguardUpdateMonitor, dialogManager, dumpManager, transitionController,
|
keyguardUpdateMonitor, dialogManager, dumpManager, transitionController,
|
||||||
configurationController, systemClock, keyguardStateController,
|
configurationController, systemClock, keyguardStateController,
|
||||||
unlockedScreenOffAnimationController, udfpsDisplayMode, REQUEST_ID, reason,
|
unlockedScreenOffAnimationController, udfpsDisplayMode, REQUEST_ID, reason,
|
||||||
controllerCallback, onTouch, activityLaunchAnimator
|
controllerCallback, onTouch, activityLaunchAnimator, isDebuggable
|
||||||
)
|
)
|
||||||
block()
|
block()
|
||||||
}
|
}
|
||||||
@@ -150,11 +155,29 @@ class UdfpsControllerOverlayTest : SysuiTestCase() {
|
|||||||
showUdfpsOverlay(isEnrollUseCase = true)
|
showUdfpsOverlay(isEnrollUseCase = true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun showUdfpsOverlay_locate_withEnrollmentUiRemoved() {
|
||||||
|
Settings.Global.putInt(mContext.contentResolver, SETTING_REMOVE_ENROLLMENT_UI, 1)
|
||||||
|
withReason(REASON_ENROLL_FIND_SENSOR, isDebuggable = true) {
|
||||||
|
showUdfpsOverlay(isEnrollUseCase = false)
|
||||||
|
}
|
||||||
|
Settings.Global.putInt(mContext.contentResolver, SETTING_REMOVE_ENROLLMENT_UI, 0)
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun showUdfpsOverlay_enroll() = withReason(REASON_ENROLL_ENROLLING) {
|
fun showUdfpsOverlay_enroll() = withReason(REASON_ENROLL_ENROLLING) {
|
||||||
showUdfpsOverlay(isEnrollUseCase = true)
|
showUdfpsOverlay(isEnrollUseCase = true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun showUdfpsOverlay_enroll_withEnrollmentUiRemoved() {
|
||||||
|
Settings.Global.putInt(mContext.contentResolver, SETTING_REMOVE_ENROLLMENT_UI, 1)
|
||||||
|
withReason(REASON_ENROLL_ENROLLING, isDebuggable = true) {
|
||||||
|
showUdfpsOverlay(isEnrollUseCase = false)
|
||||||
|
}
|
||||||
|
Settings.Global.putInt(mContext.contentResolver, SETTING_REMOVE_ENROLLMENT_UI, 0)
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun showUdfpsOverlay_other() = withReason(REASON_AUTH_OTHER) { showUdfpsOverlay() }
|
fun showUdfpsOverlay_other() = withReason(REASON_AUTH_OTHER) { showUdfpsOverlay() }
|
||||||
|
|
||||||
@@ -372,21 +395,33 @@ class UdfpsControllerOverlayTest : SysuiTestCase() {
|
|||||||
context.resources.getStringArray(R.array.udfps_accessibility_touch_hints)
|
context.resources.getStringArray(R.array.udfps_accessibility_touch_hints)
|
||||||
val rotation = Surface.ROTATION_0
|
val rotation = Surface.ROTATION_0
|
||||||
// touch at 0 degrees
|
// touch at 0 degrees
|
||||||
assertThat(controllerOverlay.onTouchOutsideOfSensorAreaImpl(0.0f /* x */, 0.0f /* y */,
|
assertThat(
|
||||||
0.0f /* sensorX */, 0.0f /* sensorY */, rotation))
|
controllerOverlay.onTouchOutsideOfSensorAreaImpl(
|
||||||
.isEqualTo(touchHints[0])
|
0.0f /* x */, 0.0f /* y */,
|
||||||
|
0.0f /* sensorX */, 0.0f /* sensorY */, rotation
|
||||||
|
)
|
||||||
|
).isEqualTo(touchHints[0])
|
||||||
// touch at 90 degrees
|
// touch at 90 degrees
|
||||||
assertThat(controllerOverlay.onTouchOutsideOfSensorAreaImpl(0.0f /* x */, -1.0f /* y */,
|
assertThat(
|
||||||
0.0f /* sensorX */, 0.0f /* sensorY */, rotation))
|
controllerOverlay.onTouchOutsideOfSensorAreaImpl(
|
||||||
.isEqualTo(touchHints[1])
|
0.0f /* x */, -1.0f /* y */,
|
||||||
|
0.0f /* sensorX */, 0.0f /* sensorY */, rotation
|
||||||
|
)
|
||||||
|
).isEqualTo(touchHints[1])
|
||||||
// touch at 180 degrees
|
// touch at 180 degrees
|
||||||
assertThat(controllerOverlay.onTouchOutsideOfSensorAreaImpl(-1.0f /* x */, 0.0f /* y */,
|
assertThat(
|
||||||
0.0f /* sensorX */, 0.0f /* sensorY */, rotation))
|
controllerOverlay.onTouchOutsideOfSensorAreaImpl(
|
||||||
.isEqualTo(touchHints[2])
|
-1.0f /* x */, 0.0f /* y */,
|
||||||
|
0.0f /* sensorX */, 0.0f /* sensorY */, rotation
|
||||||
|
)
|
||||||
|
).isEqualTo(touchHints[2])
|
||||||
// touch at 270 degrees
|
// touch at 270 degrees
|
||||||
assertThat(controllerOverlay.onTouchOutsideOfSensorAreaImpl(0.0f /* x */, 1.0f /* y */,
|
assertThat(
|
||||||
0.0f /* sensorX */, 0.0f /* sensorY */, rotation))
|
controllerOverlay.onTouchOutsideOfSensorAreaImpl(
|
||||||
.isEqualTo(touchHints[3])
|
0.0f /* x */, 1.0f /* y */,
|
||||||
|
0.0f /* sensorX */, 0.0f /* sensorY */, rotation
|
||||||
|
)
|
||||||
|
).isEqualTo(touchHints[3])
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testTouchOutsideAreaNoRotation90Degrees() = withReason(REASON_ENROLL_ENROLLING) {
|
fun testTouchOutsideAreaNoRotation90Degrees() = withReason(REASON_ENROLL_ENROLLING) {
|
||||||
@@ -394,21 +429,33 @@ class UdfpsControllerOverlayTest : SysuiTestCase() {
|
|||||||
context.resources.getStringArray(R.array.udfps_accessibility_touch_hints)
|
context.resources.getStringArray(R.array.udfps_accessibility_touch_hints)
|
||||||
val rotation = Surface.ROTATION_90
|
val rotation = Surface.ROTATION_90
|
||||||
// touch at 0 degrees -> 90 degrees
|
// touch at 0 degrees -> 90 degrees
|
||||||
assertThat(controllerOverlay.onTouchOutsideOfSensorAreaImpl(0.0f /* x */, 0.0f /* y */,
|
assertThat(
|
||||||
0.0f /* sensorX */, 0.0f /* sensorY */, rotation))
|
controllerOverlay.onTouchOutsideOfSensorAreaImpl(
|
||||||
.isEqualTo(touchHints[1])
|
0.0f /* x */, 0.0f /* y */,
|
||||||
|
0.0f /* sensorX */, 0.0f /* sensorY */, rotation
|
||||||
|
)
|
||||||
|
).isEqualTo(touchHints[1])
|
||||||
// touch at 90 degrees -> 180 degrees
|
// touch at 90 degrees -> 180 degrees
|
||||||
assertThat(controllerOverlay.onTouchOutsideOfSensorAreaImpl(0.0f /* x */, -1.0f /* y */,
|
assertThat(
|
||||||
0.0f /* sensorX */, 0.0f /* sensorY */, rotation))
|
controllerOverlay.onTouchOutsideOfSensorAreaImpl(
|
||||||
.isEqualTo(touchHints[2])
|
0.0f /* x */, -1.0f /* y */,
|
||||||
|
0.0f /* sensorX */, 0.0f /* sensorY */, rotation
|
||||||
|
)
|
||||||
|
).isEqualTo(touchHints[2])
|
||||||
// touch at 180 degrees -> 270 degrees
|
// touch at 180 degrees -> 270 degrees
|
||||||
assertThat(controllerOverlay.onTouchOutsideOfSensorAreaImpl(-1.0f /* x */, 0.0f /* y */,
|
assertThat(
|
||||||
0.0f /* sensorX */, 0.0f /* sensorY */, rotation))
|
controllerOverlay.onTouchOutsideOfSensorAreaImpl(
|
||||||
.isEqualTo(touchHints[3])
|
-1.0f /* x */, 0.0f /* y */,
|
||||||
|
0.0f /* sensorX */, 0.0f /* sensorY */, rotation
|
||||||
|
)
|
||||||
|
).isEqualTo(touchHints[3])
|
||||||
// touch at 270 degrees -> 0 degrees
|
// touch at 270 degrees -> 0 degrees
|
||||||
assertThat(controllerOverlay.onTouchOutsideOfSensorAreaImpl(0.0f /* x */, 1.0f /* y */,
|
assertThat(
|
||||||
0.0f /* sensorX */, 0.0f /* sensorY */, rotation))
|
controllerOverlay.onTouchOutsideOfSensorAreaImpl(
|
||||||
.isEqualTo(touchHints[0])
|
0.0f /* x */, 1.0f /* y */,
|
||||||
|
0.0f /* sensorX */, 0.0f /* sensorY */, rotation
|
||||||
|
)
|
||||||
|
).isEqualTo(touchHints[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testTouchOutsideAreaNoRotation270Degrees() = withReason(REASON_ENROLL_ENROLLING) {
|
fun testTouchOutsideAreaNoRotation270Degrees() = withReason(REASON_ENROLL_ENROLLING) {
|
||||||
@@ -416,21 +463,33 @@ class UdfpsControllerOverlayTest : SysuiTestCase() {
|
|||||||
context.resources.getStringArray(R.array.udfps_accessibility_touch_hints)
|
context.resources.getStringArray(R.array.udfps_accessibility_touch_hints)
|
||||||
val rotation = Surface.ROTATION_270
|
val rotation = Surface.ROTATION_270
|
||||||
// touch at 0 degrees -> 270 degrees
|
// touch at 0 degrees -> 270 degrees
|
||||||
assertThat(controllerOverlay.onTouchOutsideOfSensorAreaImpl(0.0f /* x */, 0.0f /* y */,
|
assertThat(
|
||||||
0.0f /* sensorX */, 0.0f /* sensorY */, rotation))
|
controllerOverlay.onTouchOutsideOfSensorAreaImpl(
|
||||||
.isEqualTo(touchHints[3])
|
0.0f /* x */, 0.0f /* y */,
|
||||||
|
0.0f /* sensorX */, 0.0f /* sensorY */, rotation
|
||||||
|
)
|
||||||
|
).isEqualTo(touchHints[3])
|
||||||
// touch at 90 degrees -> 0 degrees
|
// touch at 90 degrees -> 0 degrees
|
||||||
assertThat(controllerOverlay.onTouchOutsideOfSensorAreaImpl(0.0f /* x */, -1.0f /* y */,
|
assertThat(
|
||||||
0.0f /* sensorX */, 0.0f /* sensorY */, rotation))
|
controllerOverlay.onTouchOutsideOfSensorAreaImpl(
|
||||||
.isEqualTo(touchHints[0])
|
0.0f /* x */, -1.0f /* y */,
|
||||||
|
0.0f /* sensorX */, 0.0f /* sensorY */, rotation
|
||||||
|
)
|
||||||
|
).isEqualTo(touchHints[0])
|
||||||
// touch at 180 degrees -> 90 degrees
|
// touch at 180 degrees -> 90 degrees
|
||||||
assertThat(controllerOverlay.onTouchOutsideOfSensorAreaImpl(-1.0f /* x */, 0.0f /* y */,
|
assertThat(
|
||||||
0.0f /* sensorX */, 0.0f /* sensorY */, rotation))
|
controllerOverlay.onTouchOutsideOfSensorAreaImpl(
|
||||||
.isEqualTo(touchHints[1])
|
-1.0f /* x */, 0.0f /* y */,
|
||||||
|
0.0f /* sensorX */, 0.0f /* sensorY */, rotation
|
||||||
|
)
|
||||||
|
).isEqualTo(touchHints[1])
|
||||||
// touch at 270 degrees -> 180 degrees
|
// touch at 270 degrees -> 180 degrees
|
||||||
assertThat(controllerOverlay.onTouchOutsideOfSensorAreaImpl(0.0f /* x */, 1.0f /* y */,
|
assertThat(
|
||||||
0.0f /* sensorX */, 0.0f /* sensorY */, rotation))
|
controllerOverlay.onTouchOutsideOfSensorAreaImpl(
|
||||||
.isEqualTo(touchHints[2])
|
0.0f /* x */, 1.0f /* y */,
|
||||||
|
0.0f /* sensorX */, 0.0f /* sensorY */, rotation
|
||||||
|
)
|
||||||
|
).isEqualTo(touchHints[2])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user