Loading packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java +11 −2 Original line number Diff line number Diff line Loading @@ -782,8 +782,17 @@ public class AuthController implements CoreStartable, CommandQueue.Callbacks, mUdfpsBounds = udfpsProp.getLocation().getRect(); mUdfpsBounds.scale(mScaleFactor); final UdfpsOverlayParams overlayParams = new UdfpsOverlayParams(mUdfpsBounds, mCachedDisplayInfo.getNaturalWidth(), mCachedDisplayInfo.getNaturalHeight(), final Rect overlayBounds = new Rect( 0, /* left */ mCachedDisplayInfo.getNaturalHeight() / 2, /* top */ mCachedDisplayInfo.getNaturalWidth(), /* right */ mCachedDisplayInfo.getNaturalHeight() /* bottom */); final UdfpsOverlayParams overlayParams = new UdfpsOverlayParams( mUdfpsBounds, overlayBounds, mCachedDisplayInfo.getNaturalWidth(), mCachedDisplayInfo.getNaturalHeight(), mScaleFactor, mCachedDisplayInfo.rotation); mUdfpsController.updateOverlayParams(udfpsProp, overlayParams); Loading packages/SystemUI/src/com/android/systemui/biometrics/UdfpsOverlayParams.kt +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.view.Surface.Rotation data class UdfpsOverlayParams( val sensorBounds: Rect = Rect(), val overlayBounds: Rect = Rect(), val naturalDisplayWidth: Int = 0, val naturalDisplayHeight: Int = 0, val scaleFactor: Float = 1f, Loading packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerOverlayTest.kt +2 −1 Original line number Diff line number Diff line Loading @@ -190,11 +190,12 @@ class UdfpsControllerOverlayTest : SysuiTestCase() { // Sensor that's in the top left corner of the display in natural orientation. val sensorBounds = Rect(0, 0, SENSOR_WIDTH, SENSOR_HEIGHT) overlayParams = UdfpsOverlayParams( sensorBounds, sensorBounds, DISPLAY_WIDTH, DISPLAY_HEIGHT, scaleFactor = 1f, rotation rotation = rotation ) block() } Loading packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java +15 −15 Original line number Diff line number Diff line Loading @@ -437,7 +437,7 @@ public class UdfpsControllerTest extends SysuiTestCase { final float[] scaleFactor = new float[]{1f, displayHeight[1] / (float) displayHeight[0]}; final int[] rotation = new int[]{Surface.ROTATION_0, Surface.ROTATION_90}; final UdfpsOverlayParams oldParams = new UdfpsOverlayParams(sensorBounds[0], displayWidth[0], displayHeight[0], scaleFactor[0], rotation[0]); sensorBounds[0], displayWidth[0], displayHeight[0], scaleFactor[0], rotation[0]); for (int i1 = 0; i1 <= 1; ++i1) { for (int i2 = 0; i2 <= 1; ++i2) { Loading @@ -445,8 +445,8 @@ public class UdfpsControllerTest extends SysuiTestCase { for (int i4 = 0; i4 <= 1; ++i4) { for (int i5 = 0; i5 <= 1; ++i5) { final UdfpsOverlayParams newParams = new UdfpsOverlayParams( sensorBounds[i1], displayWidth[i2], displayHeight[i3], scaleFactor[i4], rotation[i5]); sensorBounds[i1], sensorBounds[i1], displayWidth[i2], displayHeight[i3], scaleFactor[i4], rotation[i5]); if (newParams.equals(oldParams)) { continue; Loading Loading @@ -489,8 +489,8 @@ public class UdfpsControllerTest extends SysuiTestCase { // Initialize the overlay. mUdfpsController.updateOverlayParams(mOpticalProps, new UdfpsOverlayParams(sensorBounds, displayWidth, displayHeight, scaleFactor, rotation)); new UdfpsOverlayParams(sensorBounds, sensorBounds, displayWidth, displayHeight, scaleFactor, rotation)); // Show the overlay. mOverlayController.showUdfpsOverlay(TEST_REQUEST_ID, mOpticalProps.sensorId, Loading @@ -500,8 +500,8 @@ public class UdfpsControllerTest extends SysuiTestCase { // Update overlay with the same parameters. mUdfpsController.updateOverlayParams(mOpticalProps, new UdfpsOverlayParams(sensorBounds, displayWidth, displayHeight, scaleFactor, rotation)); new UdfpsOverlayParams(sensorBounds, sensorBounds, displayWidth, displayHeight, scaleFactor, rotation)); mFgExecutor.runAllReady(); // Ensure the overlay was not recreated. Loading Loading @@ -548,8 +548,8 @@ public class UdfpsControllerTest extends SysuiTestCase { // Test ROTATION_0 mUdfpsController.updateOverlayParams(mOpticalProps, new UdfpsOverlayParams(sensorBounds, displayWidth, displayHeight, scaleFactor, Surface.ROTATION_0)); new UdfpsOverlayParams(sensorBounds, sensorBounds, displayWidth, displayHeight, scaleFactor, Surface.ROTATION_0)); MotionEvent event = obtainMotionEvent(ACTION_DOWN, displayWidth, displayHeight, touchMinor, touchMajor); mTouchListenerCaptor.getValue().onTouch(mUdfpsView, event); Loading @@ -565,8 +565,8 @@ public class UdfpsControllerTest extends SysuiTestCase { // Test ROTATION_90 reset(mAlternateTouchProvider); mUdfpsController.updateOverlayParams(mOpticalProps, new UdfpsOverlayParams(sensorBounds, displayWidth, displayHeight, scaleFactor, Surface.ROTATION_90)); new UdfpsOverlayParams(sensorBounds, sensorBounds, displayWidth, displayHeight, scaleFactor, Surface.ROTATION_90)); event = obtainMotionEvent(ACTION_DOWN, displayHeight, 0, touchMinor, touchMajor); mTouchListenerCaptor.getValue().onTouch(mUdfpsView, event); mBiometricsExecutor.runAllReady(); Loading @@ -581,8 +581,8 @@ public class UdfpsControllerTest extends SysuiTestCase { // Test ROTATION_270 reset(mAlternateTouchProvider); mUdfpsController.updateOverlayParams(mOpticalProps, new UdfpsOverlayParams(sensorBounds, displayWidth, displayHeight, scaleFactor, Surface.ROTATION_270)); new UdfpsOverlayParams(sensorBounds, sensorBounds, displayWidth, displayHeight, scaleFactor, Surface.ROTATION_270)); event = obtainMotionEvent(ACTION_DOWN, 0, displayWidth, touchMinor, touchMajor); mTouchListenerCaptor.getValue().onTouch(mUdfpsView, event); mBiometricsExecutor.runAllReady(); Loading @@ -597,8 +597,8 @@ public class UdfpsControllerTest extends SysuiTestCase { // Test ROTATION_180 reset(mAlternateTouchProvider); mUdfpsController.updateOverlayParams(mOpticalProps, new UdfpsOverlayParams(sensorBounds, displayWidth, displayHeight, scaleFactor, Surface.ROTATION_180)); new UdfpsOverlayParams(sensorBounds, sensorBounds, displayWidth, displayHeight, scaleFactor, Surface.ROTATION_180)); // ROTATION_180 is not supported. It should be treated like ROTATION_0. event = obtainMotionEvent(ACTION_DOWN, displayWidth, displayHeight, touchMinor, touchMajor); mTouchListenerCaptor.getValue().onTouch(mUdfpsView, event); Loading packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsViewTest.kt +3 −2 Original line number Diff line number Diff line Loading @@ -40,8 +40,8 @@ import org.mockito.Mock import org.mockito.Mockito.never import org.mockito.Mockito.nullable import org.mockito.Mockito.verify import org.mockito.Mockito.`when` as whenever import org.mockito.junit.MockitoJUnit import org.mockito.Mockito.`when` as whenever private const val SENSOR_X = 50 private const val SENSOR_Y = 250 Loading @@ -68,7 +68,8 @@ class UdfpsViewTest : SysuiTestCase() { view = LayoutInflater.from(context).inflate(R.layout.udfps_view, null) as UdfpsView view.animationViewController = animationViewController val sensorBounds = SensorLocationInternal("", SENSOR_X, SENSOR_Y, SENSOR_RADIUS).rect view.overlayParams = UdfpsOverlayParams(sensorBounds, 1920, 1080, 1f, Surface.ROTATION_0) view.overlayParams = UdfpsOverlayParams(sensorBounds, sensorBounds, 1920, 1080, 1f, Surface.ROTATION_0) view.setUdfpsDisplayModeProvider(hbmProvider) ViewUtils.attachView(view) } Loading Loading
packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java +11 −2 Original line number Diff line number Diff line Loading @@ -782,8 +782,17 @@ public class AuthController implements CoreStartable, CommandQueue.Callbacks, mUdfpsBounds = udfpsProp.getLocation().getRect(); mUdfpsBounds.scale(mScaleFactor); final UdfpsOverlayParams overlayParams = new UdfpsOverlayParams(mUdfpsBounds, mCachedDisplayInfo.getNaturalWidth(), mCachedDisplayInfo.getNaturalHeight(), final Rect overlayBounds = new Rect( 0, /* left */ mCachedDisplayInfo.getNaturalHeight() / 2, /* top */ mCachedDisplayInfo.getNaturalWidth(), /* right */ mCachedDisplayInfo.getNaturalHeight() /* bottom */); final UdfpsOverlayParams overlayParams = new UdfpsOverlayParams( mUdfpsBounds, overlayBounds, mCachedDisplayInfo.getNaturalWidth(), mCachedDisplayInfo.getNaturalHeight(), mScaleFactor, mCachedDisplayInfo.rotation); mUdfpsController.updateOverlayParams(udfpsProp, overlayParams); Loading
packages/SystemUI/src/com/android/systemui/biometrics/UdfpsOverlayParams.kt +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.view.Surface.Rotation data class UdfpsOverlayParams( val sensorBounds: Rect = Rect(), val overlayBounds: Rect = Rect(), val naturalDisplayWidth: Int = 0, val naturalDisplayHeight: Int = 0, val scaleFactor: Float = 1f, Loading
packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerOverlayTest.kt +2 −1 Original line number Diff line number Diff line Loading @@ -190,11 +190,12 @@ class UdfpsControllerOverlayTest : SysuiTestCase() { // Sensor that's in the top left corner of the display in natural orientation. val sensorBounds = Rect(0, 0, SENSOR_WIDTH, SENSOR_HEIGHT) overlayParams = UdfpsOverlayParams( sensorBounds, sensorBounds, DISPLAY_WIDTH, DISPLAY_HEIGHT, scaleFactor = 1f, rotation rotation = rotation ) block() } Loading
packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java +15 −15 Original line number Diff line number Diff line Loading @@ -437,7 +437,7 @@ public class UdfpsControllerTest extends SysuiTestCase { final float[] scaleFactor = new float[]{1f, displayHeight[1] / (float) displayHeight[0]}; final int[] rotation = new int[]{Surface.ROTATION_0, Surface.ROTATION_90}; final UdfpsOverlayParams oldParams = new UdfpsOverlayParams(sensorBounds[0], displayWidth[0], displayHeight[0], scaleFactor[0], rotation[0]); sensorBounds[0], displayWidth[0], displayHeight[0], scaleFactor[0], rotation[0]); for (int i1 = 0; i1 <= 1; ++i1) { for (int i2 = 0; i2 <= 1; ++i2) { Loading @@ -445,8 +445,8 @@ public class UdfpsControllerTest extends SysuiTestCase { for (int i4 = 0; i4 <= 1; ++i4) { for (int i5 = 0; i5 <= 1; ++i5) { final UdfpsOverlayParams newParams = new UdfpsOverlayParams( sensorBounds[i1], displayWidth[i2], displayHeight[i3], scaleFactor[i4], rotation[i5]); sensorBounds[i1], sensorBounds[i1], displayWidth[i2], displayHeight[i3], scaleFactor[i4], rotation[i5]); if (newParams.equals(oldParams)) { continue; Loading Loading @@ -489,8 +489,8 @@ public class UdfpsControllerTest extends SysuiTestCase { // Initialize the overlay. mUdfpsController.updateOverlayParams(mOpticalProps, new UdfpsOverlayParams(sensorBounds, displayWidth, displayHeight, scaleFactor, rotation)); new UdfpsOverlayParams(sensorBounds, sensorBounds, displayWidth, displayHeight, scaleFactor, rotation)); // Show the overlay. mOverlayController.showUdfpsOverlay(TEST_REQUEST_ID, mOpticalProps.sensorId, Loading @@ -500,8 +500,8 @@ public class UdfpsControllerTest extends SysuiTestCase { // Update overlay with the same parameters. mUdfpsController.updateOverlayParams(mOpticalProps, new UdfpsOverlayParams(sensorBounds, displayWidth, displayHeight, scaleFactor, rotation)); new UdfpsOverlayParams(sensorBounds, sensorBounds, displayWidth, displayHeight, scaleFactor, rotation)); mFgExecutor.runAllReady(); // Ensure the overlay was not recreated. Loading Loading @@ -548,8 +548,8 @@ public class UdfpsControllerTest extends SysuiTestCase { // Test ROTATION_0 mUdfpsController.updateOverlayParams(mOpticalProps, new UdfpsOverlayParams(sensorBounds, displayWidth, displayHeight, scaleFactor, Surface.ROTATION_0)); new UdfpsOverlayParams(sensorBounds, sensorBounds, displayWidth, displayHeight, scaleFactor, Surface.ROTATION_0)); MotionEvent event = obtainMotionEvent(ACTION_DOWN, displayWidth, displayHeight, touchMinor, touchMajor); mTouchListenerCaptor.getValue().onTouch(mUdfpsView, event); Loading @@ -565,8 +565,8 @@ public class UdfpsControllerTest extends SysuiTestCase { // Test ROTATION_90 reset(mAlternateTouchProvider); mUdfpsController.updateOverlayParams(mOpticalProps, new UdfpsOverlayParams(sensorBounds, displayWidth, displayHeight, scaleFactor, Surface.ROTATION_90)); new UdfpsOverlayParams(sensorBounds, sensorBounds, displayWidth, displayHeight, scaleFactor, Surface.ROTATION_90)); event = obtainMotionEvent(ACTION_DOWN, displayHeight, 0, touchMinor, touchMajor); mTouchListenerCaptor.getValue().onTouch(mUdfpsView, event); mBiometricsExecutor.runAllReady(); Loading @@ -581,8 +581,8 @@ public class UdfpsControllerTest extends SysuiTestCase { // Test ROTATION_270 reset(mAlternateTouchProvider); mUdfpsController.updateOverlayParams(mOpticalProps, new UdfpsOverlayParams(sensorBounds, displayWidth, displayHeight, scaleFactor, Surface.ROTATION_270)); new UdfpsOverlayParams(sensorBounds, sensorBounds, displayWidth, displayHeight, scaleFactor, Surface.ROTATION_270)); event = obtainMotionEvent(ACTION_DOWN, 0, displayWidth, touchMinor, touchMajor); mTouchListenerCaptor.getValue().onTouch(mUdfpsView, event); mBiometricsExecutor.runAllReady(); Loading @@ -597,8 +597,8 @@ public class UdfpsControllerTest extends SysuiTestCase { // Test ROTATION_180 reset(mAlternateTouchProvider); mUdfpsController.updateOverlayParams(mOpticalProps, new UdfpsOverlayParams(sensorBounds, displayWidth, displayHeight, scaleFactor, Surface.ROTATION_180)); new UdfpsOverlayParams(sensorBounds, sensorBounds, displayWidth, displayHeight, scaleFactor, Surface.ROTATION_180)); // ROTATION_180 is not supported. It should be treated like ROTATION_0. event = obtainMotionEvent(ACTION_DOWN, displayWidth, displayHeight, touchMinor, touchMajor); mTouchListenerCaptor.getValue().onTouch(mUdfpsView, event); Loading
packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsViewTest.kt +3 −2 Original line number Diff line number Diff line Loading @@ -40,8 +40,8 @@ import org.mockito.Mock import org.mockito.Mockito.never import org.mockito.Mockito.nullable import org.mockito.Mockito.verify import org.mockito.Mockito.`when` as whenever import org.mockito.junit.MockitoJUnit import org.mockito.Mockito.`when` as whenever private const val SENSOR_X = 50 private const val SENSOR_Y = 250 Loading @@ -68,7 +68,8 @@ class UdfpsViewTest : SysuiTestCase() { view = LayoutInflater.from(context).inflate(R.layout.udfps_view, null) as UdfpsView view.animationViewController = animationViewController val sensorBounds = SensorLocationInternal("", SENSOR_X, SENSOR_Y, SENSOR_RADIUS).rect view.overlayParams = UdfpsOverlayParams(sensorBounds, 1920, 1080, 1f, Surface.ROTATION_0) view.overlayParams = UdfpsOverlayParams(sensorBounds, sensorBounds, 1920, 1080, 1f, Surface.ROTATION_0) view.setUdfpsDisplayModeProvider(hbmProvider) ViewUtils.attachView(view) } Loading