Merge "Support an x-coordinate for fps location" into sc-v2-dev am: 710a025d69
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15942750 Change-Id: Id6896f663a01455882982b73f289ff9c09b761b7
This commit is contained in:
@@ -1556,6 +1556,13 @@
|
|||||||
<dimen name="physical_volume_up_button_center_screen_location_y">950px</dimen>
|
<dimen name="physical_volume_up_button_center_screen_location_y">950px</dimen>
|
||||||
<dimen name="physical_volume_down_button_center_screen_location_y">1150px</dimen>
|
<dimen name="physical_volume_down_button_center_screen_location_y">1150px</dimen>
|
||||||
|
|
||||||
|
<!-- Location on the screen of the center of the fingerprint sensor. For devices with under
|
||||||
|
display fingerprint sensors, this directly corresponds to the fingerprint sensor's location.
|
||||||
|
For devices with sensors on the back of the device, this corresponds to the location on the
|
||||||
|
screen directly in front of the sensor.
|
||||||
|
By default, this is set to @null to use the horizontal center of the screen. -->
|
||||||
|
<dimen name="physical_fingerprint_sensor_center_screen_location_x">@null</dimen>
|
||||||
|
|
||||||
<!-- Location on the screen of the center of the fingerprint sensor. For devices with under
|
<!-- Location on the screen of the center of the fingerprint sensor. For devices with under
|
||||||
display fingerprint sensors, this directly corresponds to the fingerprint sensor's location.
|
display fingerprint sensors, this directly corresponds to the fingerprint sensor's location.
|
||||||
For devices with sensors on the back of the device, this corresponds to the location on the
|
For devices with sensors on the back of the device, this corresponds to the location on the
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
import android.hardware.biometrics.BiometricAuthenticator.Modality;
|
import android.hardware.biometrics.BiometricAuthenticator.Modality;
|
||||||
import android.hardware.biometrics.BiometricConstants;
|
import android.hardware.biometrics.BiometricConstants;
|
||||||
@@ -97,7 +98,7 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
|
|||||||
private final Provider<UdfpsController> mUdfpsControllerFactory;
|
private final Provider<UdfpsController> mUdfpsControllerFactory;
|
||||||
private final Provider<SidefpsController> mSidefpsControllerFactory;
|
private final Provider<SidefpsController> mSidefpsControllerFactory;
|
||||||
@Nullable private final PointF mFaceAuthSensorLocation;
|
@Nullable private final PointF mFaceAuthSensorLocation;
|
||||||
@Nullable private final PointF mFingerprintLocation;
|
@Nullable private PointF mFingerprintLocation;
|
||||||
private final Set<Callback> mCallbacks = new HashSet<>();
|
private final Set<Callback> mCallbacks = new HashSet<>();
|
||||||
|
|
||||||
// TODO: These should just be saved from onSaveState
|
// TODO: These should just be saved from onSaveState
|
||||||
@@ -481,9 +482,7 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
|
|||||||
(float) faceAuthLocation[1]);
|
(float) faceAuthLocation[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
mFingerprintLocation = new PointF(DisplayUtils.getWidth(mContext) / 2,
|
updateFingerprintLocation();
|
||||||
mContext.getResources().getDimensionPixelSize(
|
|
||||||
com.android.systemui.R.dimen.physical_fingerprint_sensor_center_screen_location_y));
|
|
||||||
|
|
||||||
IntentFilter filter = new IntentFilter();
|
IntentFilter filter = new IntentFilter();
|
||||||
filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
|
filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
|
||||||
@@ -491,6 +490,21 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
|
|||||||
context.registerReceiver(mBroadcastReceiver, filter);
|
context.registerReceiver(mBroadcastReceiver, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateFingerprintLocation() {
|
||||||
|
int xLocation = DisplayUtils.getWidth(mContext) / 2;
|
||||||
|
try {
|
||||||
|
xLocation = mContext.getResources().getDimensionPixelSize(
|
||||||
|
com.android.systemui.R.dimen
|
||||||
|
.physical_fingerprint_sensor_center_screen_location_x);
|
||||||
|
} catch (Resources.NotFoundException e) {
|
||||||
|
}
|
||||||
|
int yLocation = mContext.getResources().getDimensionPixelSize(
|
||||||
|
com.android.systemui.R.dimen.physical_fingerprint_sensor_center_screen_location_y);
|
||||||
|
mFingerprintLocation = new PointF(
|
||||||
|
xLocation,
|
||||||
|
yLocation);
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public void start() {
|
public void start() {
|
||||||
@@ -767,6 +781,7 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
|
|||||||
@Override
|
@Override
|
||||||
protected void onConfigurationChanged(Configuration newConfig) {
|
protected void onConfigurationChanged(Configuration newConfig) {
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
|
updateFingerprintLocation();
|
||||||
|
|
||||||
// Save the state of the current dialog (buttons showing, etc)
|
// Save the state of the current dialog (buttons showing, etc)
|
||||||
if (mCurrentDialog != null) {
|
if (mCurrentDialog != null) {
|
||||||
@@ -796,6 +811,7 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onOrientationChanged() {
|
private void onOrientationChanged() {
|
||||||
|
updateFingerprintLocation();
|
||||||
if (mCurrentDialog != null) {
|
if (mCurrentDialog != null) {
|
||||||
mCurrentDialog.onOrientationChanged();
|
mCurrentDialog.onOrientationChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import android.content.Context
|
|||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.graphics.PointF
|
import android.graphics.PointF
|
||||||
import android.hardware.biometrics.BiometricSourceType
|
import android.hardware.biometrics.BiometricSourceType
|
||||||
|
import android.util.DisplayMetrics
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.annotation.VisibleForTesting
|
import androidx.annotation.VisibleForTesting
|
||||||
import com.android.keyguard.KeyguardUpdateMonitor
|
import com.android.keyguard.KeyguardUpdateMonitor
|
||||||
@@ -45,6 +46,7 @@ import java.io.PrintWriter
|
|||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Provider
|
import javax.inject.Provider
|
||||||
import com.android.systemui.plugins.statusbar.StatusBarStateController
|
import com.android.systemui.plugins.statusbar.StatusBarStateController
|
||||||
|
import com.android.systemui.util.leak.RotationUtils
|
||||||
|
|
||||||
private const val WAKE_AND_UNLOCK_FADE_DURATION = 180L
|
private const val WAKE_AND_UNLOCK_FADE_DURATION = 180L
|
||||||
|
|
||||||
@@ -182,7 +184,7 @@ class AuthRippleController @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun updateSensorLocation() {
|
fun updateSensorLocation() {
|
||||||
fingerprintSensorLocation = authController.fingerprintSensorLocation
|
updateFingerprintLocation()
|
||||||
faceSensorLocation = authController.faceAuthSensorLocation
|
faceSensorLocation = authController.faceAuthSensorLocation
|
||||||
fingerprintSensorLocation?.let {
|
fingerprintSensorLocation?.let {
|
||||||
circleReveal = CircleReveal(
|
circleReveal = CircleReveal(
|
||||||
@@ -197,6 +199,35 @@ class AuthRippleController @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun updateFingerprintLocation() {
|
||||||
|
val displayMetrics = DisplayMetrics()
|
||||||
|
sysuiContext.display?.getRealMetrics(displayMetrics)
|
||||||
|
val width = displayMetrics.widthPixels
|
||||||
|
val height = displayMetrics.heightPixels
|
||||||
|
|
||||||
|
authController.fingerprintSensorLocation?.let {
|
||||||
|
fingerprintSensorLocation = when (RotationUtils.getRotation(sysuiContext)) {
|
||||||
|
RotationUtils.ROTATION_LANDSCAPE -> {
|
||||||
|
val normalizedYPos: Float = it.y / width
|
||||||
|
val normalizedXPos: Float = it.x / height
|
||||||
|
PointF(width * normalizedYPos, height * (1 - normalizedXPos))
|
||||||
|
}
|
||||||
|
RotationUtils.ROTATION_UPSIDE_DOWN -> {
|
||||||
|
PointF(width - it.x, height - it.y)
|
||||||
|
}
|
||||||
|
RotationUtils.ROTATION_SEASCAPE -> {
|
||||||
|
val normalizedYPos: Float = it.y / width
|
||||||
|
val normalizedXPos: Float = it.x / height
|
||||||
|
PointF(width * (1 - normalizedYPos), height * normalizedXPos)
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
// ROTATION_NONE
|
||||||
|
PointF(it.x, it.y)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun updateRippleColor() {
|
private fun updateRippleColor() {
|
||||||
mView.setColor(
|
mView.setColor(
|
||||||
Utils.getColorAttr(sysuiContext, android.R.attr.colorAccent).defaultColor)
|
Utils.getColorAttr(sysuiContext, android.R.attr.colorAccent).defaultColor)
|
||||||
@@ -314,10 +345,12 @@ class AuthRippleController @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
"fingerprint" -> {
|
"fingerprint" -> {
|
||||||
|
updateSensorLocation()
|
||||||
pw.println("fingerprint ripple sensorLocation=$fingerprintSensorLocation")
|
pw.println("fingerprint ripple sensorLocation=$fingerprintSensorLocation")
|
||||||
showRipple(BiometricSourceType.FINGERPRINT)
|
showRipple(BiometricSourceType.FINGERPRINT)
|
||||||
}
|
}
|
||||||
"face" -> {
|
"face" -> {
|
||||||
|
updateSensorLocation()
|
||||||
pw.println("face ripple sensorLocation=$faceSensorLocation")
|
pw.println("face ripple sensorLocation=$faceSensorLocation")
|
||||||
showRipple(BiometricSourceType.FACE)
|
showRipple(BiometricSourceType.FACE)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user