Merge "Fix null handling"
diff --git a/res/layout/udfps_enroll_find_sensor_layout.xml b/res/layout/udfps_enroll_find_sensor_layout.xml
new file mode 100644
index 0000000..259d43f
--- /dev/null
+++ b/res/layout/udfps_enroll_find_sensor_layout.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<com.google.android.setupdesign.GlifLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/setup_wizard_layout"
+ style="?attr/fingerprint_layout_theme"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:clipToPadding="false"
+ android:clipChildren="false">
+
+ <LinearLayout
+ style="@style/SudContentFrame"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:clipToPadding="false"
+ android:clipChildren="false">
+
+ <TextView
+ style="@style/SudDescription.Glif"
+ android:id="@+id/sud_layout_description"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/sud_description_glif_margin_top"
+ android:text="@string/security_settings_udfps_enroll_find_sensor_message"/>
+ </LinearLayout>
+ </LinearLayout>
+</com.google.android.setupdesign.GlifLayout>
diff --git a/res/layout/wifi_dpp_qrcode_generator_fragment.xml b/res/layout/wifi_dpp_qrcode_generator_fragment.xml
index d283bfd..f9c7169 100644
--- a/res/layout/wifi_dpp_qrcode_generator_fragment.xml
+++ b/res/layout/wifi_dpp_qrcode_generator_fragment.xml
@@ -55,7 +55,7 @@
android:id="@+id/password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginTop="16dp"
+ android:layout_marginBottom="24dp"
android:textAlignment="center"
android:textIsSelectable="true"
android:focusable="true"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index fb09dc4..34b4041 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -926,6 +926,8 @@
<string name="security_settings_fingerprint_enroll_find_sensor_title">Touch the sensor</string>
<!-- Message shown in fingerprint enrollment dialog to locate the sensor -->
<string name="security_settings_fingerprint_enroll_find_sensor_message">It\u2019s on the back of your phone. Use your index finger.</string>
+ <!-- Message shown in fingerprint enrollment dialog to locate the sensor [CHAR LIMIT=NONE]-->
+ <string name="security_settings_udfps_enroll_find_sensor_message">It\u2019s on the screen. Look for the fingerprint with a glowing circle.</string>
<!-- Content description of graphic that shows where the fingerprint of the device is [CHAR LIMIT=NONE] -->
<string name="security_settings_fingerprint_enroll_find_sensor_content_description">Illustration with device and fingerprint sensor location</string>
<!-- Label text shown in fingerprint dialog for renaming a fingerprint template [CHAR LIMIT=22] -->
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java
index dc0928a..351c828 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java
@@ -19,6 +19,7 @@
import android.app.settings.SettingsEnums;
import android.content.Intent;
import android.hardware.fingerprint.FingerprintManager;
+import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.os.Bundle;
import android.view.View;
@@ -34,6 +35,8 @@
import com.google.android.setupcompat.template.FooterBarMixin;
import com.google.android.setupcompat.template.FooterButton;
+import java.util.List;
+
/**
* Activity explaining the fingerprint sensor location for fingerprint enrollment.
*/
@@ -44,10 +47,16 @@
private FingerprintEnrollSidecar mSidecar;
private boolean mNextClicked;
+ private boolean mCanAssumeUdfps;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+
+ final FingerprintManager fingerprintManager = getSystemService(FingerprintManager.class);
+ final List<FingerprintSensorPropertiesInternal> props =
+ fingerprintManager.getSensorPropertiesInternal();
+ mCanAssumeUdfps = props != null && props.size() == 1 && props.get(0).isAnyUdfpsType();
setContentView(getContentView());
mFooterBarMixin = getLayout().getMixin(FooterBarMixin.class);
mFooterBarMixin.setSecondaryButton(
@@ -84,15 +93,19 @@
throw new IllegalStateException("HAT and GkPwHandle both missing...");
}
- View animationView = findViewById(R.id.fingerprint_sensor_location_animation);
- if (animationView instanceof FingerprintFindSensorAnimation) {
- mAnimation = (FingerprintFindSensorAnimation) animationView;
- } else {
- mAnimation = null;
+ mAnimation = null;
+ if (!mCanAssumeUdfps) {
+ View animationView = findViewById(R.id.fingerprint_sensor_location_animation);
+ if (animationView instanceof FingerprintFindSensorAnimation) {
+ mAnimation = (FingerprintFindSensorAnimation) animationView;
+ }
}
}
protected int getContentView() {
+ if (mCanAssumeUdfps) {
+ return R.layout.udfps_enroll_find_sensor_layout;
+ }
return R.layout.fingerprint_enroll_find_sensor;
}
diff --git a/src/com/android/settings/wifi/dpp/WifiDppQrCodeGeneratorFragment.java b/src/com/android/settings/wifi/dpp/WifiDppQrCodeGeneratorFragment.java
index aa67bde..2ec960e 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppQrCodeGeneratorFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppQrCodeGeneratorFragment.java
@@ -162,7 +162,8 @@
setQrCode();
}
- @VisibleForTesting ComponentName getNearbySharingComponent() {
+ @VisibleForTesting
+ ComponentName getNearbySharingComponent() {
String nearbyComponent = Settings.Secure.getString(
getContext().getContentResolver(),
Settings.Secure.NEARBY_SHARING_COMPONENT);
@@ -221,7 +222,7 @@
}
private Button createActionButton(Drawable icon, CharSequence title, View.OnClickListener r) {
- Button b = (Button) LayoutInflater.from(getContext()).inflate(
+ final Button b = (Button) LayoutInflater.from(getContext()).inflate(
com.android.internal.R.layout.chooser_action_button, null);
if (icon != null) {
final int size = getResources()
@@ -252,8 +253,10 @@
Button createNearbyButton(Intent originalIntent, View.OnClickListener r) {
final TargetInfo ti = getNearbySharingTarget(originalIntent);
if (ti == null) return null;
-
- return createActionButton(ti.getDisplayIcon(getContext()), ti.getDisplayLabel(), r);
+ final Button button = createActionButton(ti.getDisplayIcon(getContext()),
+ ti.getDisplayLabel(), r);
+ button.setAllCaps(false);
+ return button;
}
private void setQrCode() {