Snap for 7711521 from ec9a292393 to sc-qpr1-release

Change-Id: If72aa0b206babda539eb391f24b899cd25069489
This commit is contained in:
Android Build Coastguard Worker
2021-09-08 01:07:55 +00:00
8 changed files with 10180 additions and 17802 deletions

View File

@@ -26,7 +26,7 @@
android:id="@+id/illustration_lottie" android:id="@+id/illustration_lottie"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="400dp" android:layout_height="400dp"
android:scaleType="centerInside" android:scaleType="fitCenter"
app:lottie_imageAssetsFolder="images" app:lottie_imageAssetsFolder="images"
app:lottie_autoPlay="true" app:lottie_autoPlay="true"
app:lottie_loop="true" app:lottie_loop="true"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -9327,7 +9327,7 @@
<string name="notification_listener_security_warning_summary"> <string name="notification_listener_security_warning_summary">
<xliff:g id="notification_listener_name">%1$s</xliff:g> will be able to read all notifications, <xliff:g id="notification_listener_name">%1$s</xliff:g> will be able to read all notifications,
including personal information such as contact names and the text of messages you receive. including personal information such as contact names and the text of messages you receive.
This app will also be able to dismiss notifications or take action on buttons in notifications, including answering phone calls. This app will also be able to snooze or dismiss notifications or take action on buttons in notifications, including answering phone calls.
\n\nThis will also give the app the ability to turn Do Not Disturb on or off and change related settings. \n\nThis will also give the app the ability to turn Do Not Disturb on or off and change related settings.
</string> </string>
<string name="notification_listener_disable_warning_summary"> <string name="notification_listener_disable_warning_summary">

View File

@@ -46,6 +46,7 @@ import android.view.animation.Interpolator;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.IntDef;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import com.android.settings.R; import com.android.settings.R;
@@ -58,6 +59,8 @@ import com.google.android.setupcompat.template.FooterBarMixin;
import com.google.android.setupcompat.template.FooterButton; import com.google.android.setupcompat.template.FooterButton;
import com.google.android.setupcompat.util.WizardManagerHelper; import com.google.android.setupcompat.util.WizardManagerHelper;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.List; import java.util.List;
/** /**
@@ -69,11 +72,26 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
static final String TAG_SIDECAR = "sidecar"; static final String TAG_SIDECAR = "sidecar";
private static final int PROGRESS_BAR_MAX = 10000; private static final int PROGRESS_BAR_MAX = 10000;
private static final int FINISH_DELAY = 250;
/** /**
* Enroll with two center touches before going to guided enrollment. * TODO(b/198928407): Consolidate with UdfpsEnrollHelper
*/ */
private static final int NUM_CENTER_TOUCHES = 2; private static final int[] STAGE_THRESHOLDS = new int[] {
2, // center
18, // guided
22, // fingertip
38, // edges
};
private static final int STAGE_UNKNOWN = -1;
private static final int STAGE_CENTER = 0;
private static final int STAGE_GUIDED = 1;
private static final int STAGE_FINGERTIP = 2;
private static final int STAGE_EDGES = 3;
@IntDef({STAGE_UNKNOWN, STAGE_CENTER, STAGE_GUIDED, STAGE_FINGERTIP, STAGE_EDGES})
@Retention(RetentionPolicy.SOURCE)
private @interface EnrollStage {}
/** /**
* If we don't see progress during this time, we show an error message to remind the users that * If we don't see progress during this time, we show an error message to remind the users that
@@ -149,7 +167,7 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
mIsSetupWizard = WizardManagerHelper.isAnySetupWizard(getIntent()); mIsSetupWizard = WizardManagerHelper.isAnySetupWizard(getIntent());
if (mCanAssumeUdfps) { if (mCanAssumeUdfps) {
updateTitleAndDescription(); updateTitleAndDescriptionForUdfps();
} else { } else {
setHeaderText(R.string.security_settings_fingerprint_enroll_repeat_title); setHeaderText(R.string.security_settings_fingerprint_enroll_repeat_title);
} }
@@ -273,7 +291,7 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
// UDFPS animations are owned by SystemUI // UDFPS animations are owned by SystemUI
if (progress >= PROGRESS_BAR_MAX) { if (progress >= PROGRESS_BAR_MAX) {
// Wait for any animations in SysUI to finish, then proceed to next page // Wait for any animations in SysUI to finish, then proceed to next page
getMainThreadHandler().postDelayed(mDelayedFinishRunnable, FINISH_DELAY); getMainThreadHandler().postDelayed(mDelayedFinishRunnable, getFinishDelay());
} }
return; return;
} }
@@ -300,8 +318,55 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
} }
private void updateTitleAndDescription() { private void updateTitleAndDescription() {
if (mCanAssumeUdfps) {
updateTitleAndDescriptionForUdfps();
return;
}
if (mSidecar == null || mSidecar.getEnrollmentSteps() == -1) { if (mSidecar == null || mSidecar.getEnrollmentSteps() == -1) {
if (mCanAssumeUdfps) { setDescriptionText(R.string.security_settings_fingerprint_enroll_start_message);
} else {
setDescriptionText(R.string.security_settings_fingerprint_enroll_repeat_message);
}
}
private void updateTitleAndDescriptionForUdfps() {
switch (getCurrentStage()) {
case STAGE_CENTER:
setHeaderText(R.string.security_settings_fingerprint_enroll_repeat_title);
setDescriptionText(R.string.security_settings_udfps_enroll_start_message);
break;
case STAGE_GUIDED:
setHeaderText(R.string.security_settings_fingerprint_enroll_repeat_title);
if (mIsAccessibilityEnabled) {
setDescriptionText(R.string.security_settings_udfps_enroll_repeat_a11y_message);
} else {
setDescriptionText(R.string.security_settings_udfps_enroll_repeat_message);
}
break;
case STAGE_FINGERTIP:
setHeaderText(R.string.security_settings_udfps_enroll_fingertip_title);
if (isStageHalfCompleted()) {
setDescriptionText(R.string.security_settings_fingerprint_enroll_repeat_title);
} else {
setDescriptionText("");
}
break;
case STAGE_EDGES:
setHeaderText(R.string.security_settings_udfps_enroll_edge_title);
if (isStageHalfCompleted()) {
setDescriptionText(
R.string.security_settings_fingerprint_enroll_repeat_message);
} else {
setDescriptionText(R.string.security_settings_udfps_enroll_edge_message);
}
break;
case STAGE_UNKNOWN:
default:
// setHeaderText(R.string.security_settings_fingerprint_enroll_udfps_title); // setHeaderText(R.string.security_settings_fingerprint_enroll_udfps_title);
// Don't use BiometricEnrollBase#setHeaderText, since that invokes setTitle, // Don't use BiometricEnrollBase#setHeaderText, since that invokes setTitle,
// which gets announced for a11y upon entering the page. For UDFPS, we want to // which gets announced for a11y upon entering the page. For UDFPS, we want to
@@ -309,41 +374,51 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
getLayout().setHeaderText( getLayout().setHeaderText(
R.string.security_settings_fingerprint_enroll_udfps_title); R.string.security_settings_fingerprint_enroll_udfps_title);
setDescriptionText(R.string.security_settings_udfps_enroll_start_message); setDescriptionText(R.string.security_settings_udfps_enroll_start_message);
final CharSequence description = getString( final CharSequence description = getString(
R.string.security_settings_udfps_enroll_a11y); R.string.security_settings_udfps_enroll_a11y);
getLayout().getHeaderTextView().setContentDescription(description); getLayout().getHeaderTextView().setContentDescription(description);
setTitle(description); setTitle(description);
} else { break;
setDescriptionText(R.string.security_settings_fingerprint_enroll_start_message);
}
} else if (mCanAssumeUdfps && !isCenterEnrollmentComplete()) {
if (mIsSetupWizard) {
setHeaderText(R.string.security_settings_udfps_enroll_title_one_more_time);
} else {
setHeaderText(R.string.security_settings_fingerprint_enroll_repeat_title);
}
setDescriptionText(R.string.security_settings_udfps_enroll_start_message);
} else {
if (mCanAssumeUdfps) {
setHeaderText(R.string.security_settings_fingerprint_enroll_repeat_title);
if (mIsAccessibilityEnabled) {
setDescriptionText(R.string.security_settings_udfps_enroll_repeat_a11y_message);
} else {
setDescriptionText(R.string.security_settings_udfps_enroll_repeat_message);
}
} else {
setDescriptionText(R.string.security_settings_fingerprint_enroll_repeat_message);
}
} }
} }
private boolean isCenterEnrollmentComplete() { @EnrollStage
private int getCurrentStage() {
if (mSidecar == null || mSidecar.getEnrollmentSteps() == -1) {
return STAGE_UNKNOWN;
}
final int progressSteps = mSidecar.getEnrollmentSteps() - mSidecar.getEnrollmentRemaining();
if (progressSteps < STAGE_THRESHOLDS[0]) {
return STAGE_CENTER;
} else if (progressSteps < STAGE_THRESHOLDS[1]) {
return STAGE_GUIDED;
} else if (progressSteps < STAGE_THRESHOLDS[2]) {
return STAGE_FINGERTIP;
} else {
return STAGE_EDGES;
}
}
private boolean isStageHalfCompleted() {
// Prior to first enrollment step.
if (mSidecar == null || mSidecar.getEnrollmentSteps() == -1) { if (mSidecar == null || mSidecar.getEnrollmentSteps() == -1) {
return false; return false;
} }
final int stepsEnrolled = mSidecar.getEnrollmentSteps() - mSidecar.getEnrollmentRemaining();
return stepsEnrolled >= NUM_CENTER_TOUCHES; final int progressSteps = mSidecar.getEnrollmentSteps() - mSidecar.getEnrollmentRemaining();
int prevThreshold = 0;
for (final int threshold : STAGE_THRESHOLDS) {
if (progressSteps >= prevThreshold && progressSteps < threshold) {
final int adjustedProgress = progressSteps - prevThreshold;
final int adjustedThreshold = threshold - prevThreshold;
return adjustedProgress >= adjustedThreshold / 2;
}
prevThreshold = threshold;
}
// After last enrollment step.
return true;
} }
@Override @Override
@@ -367,6 +442,7 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
@Override @Override
public void onEnrollmentProgressChange(int steps, int remaining) { public void onEnrollmentProgressChange(int steps, int remaining) {
correctStageThresholds();
updateProgress(true /* animate */); updateProgress(true /* animate */);
updateTitleAndDescription(); updateTitleAndDescription();
clearError(); clearError();
@@ -389,6 +465,23 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
} }
} }
private void correctStageThresholds() {
if (mSidecar == null || !mSidecar.isEnrolling() || mSidecar.getEnrollmentSteps() <= 0) {
Log.d(TAG, "correctStageThresholds: Enrollment not started yet");
return;
}
// Allocate (or subtract) any extra steps for the first enroll stage.
final int extraSteps = mSidecar.getEnrollmentSteps()
- STAGE_THRESHOLDS[STAGE_THRESHOLDS.length - 1];
if (extraSteps != 0) {
for (int stageIndex = 0; stageIndex < STAGE_THRESHOLDS.length; stageIndex++) {
STAGE_THRESHOLDS[stageIndex] =
Math.max(0, STAGE_THRESHOLDS[stageIndex] + extraSteps);
}
}
}
private void updateProgress(boolean animate) { private void updateProgress(boolean animate) {
if (mSidecar == null || !mSidecar.isEnrolling()) { if (mSidecar == null || !mSidecar.isEnrolling()) {
Log.d(TAG, "Enrollment not started yet"); Log.d(TAG, "Enrollment not started yet");
@@ -489,25 +582,28 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
mOrientationEventListener = null; mOrientationEventListener = null;
} }
private final Animator.AnimatorListener mProgressAnimationListener private final Animator.AnimatorListener mProgressAnimationListener =
= new Animator.AnimatorListener() { new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) { }
@Override @Override
public void onAnimationStart(Animator animation) { } public void onAnimationRepeat(Animator animation) { }
@Override @Override
public void onAnimationRepeat(Animator animation) { } public void onAnimationEnd(Animator animation) {
if (mProgressBar.getProgress() >= PROGRESS_BAR_MAX) {
mProgressBar.postDelayed(mDelayedFinishRunnable, getFinishDelay());
}
}
@Override @Override
public void onAnimationEnd(Animator animation) { public void onAnimationCancel(Animator animation) { }
if (mProgressBar.getProgress() >= PROGRESS_BAR_MAX) { };
mProgressBar.postDelayed(mDelayedFinishRunnable, FINISH_DELAY);
}
}
@Override private long getFinishDelay() {
public void onAnimationCancel(Animator animation) { } return mCanAssumeUdfps ? 400L : 250L;
}; }
// Give the user a chance to see progress completed before jumping to the next stage. // Give the user a chance to see progress completed before jumping to the next stage.
private final Runnable mDelayedFinishRunnable = new Runnable() { private final Runnable mDelayedFinishRunnable = new Runnable() {

View File

@@ -22,11 +22,9 @@ import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.view.accessibility.AccessibilityManager;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.airbnb.lottie.LottieAnimationView;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.Utils; import com.android.settings.Utils;
import com.android.settings.biometrics.BiometricEnrollBase; import com.android.settings.biometrics.BiometricEnrollBase;
@@ -82,13 +80,6 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
.setTheme(R.style.SudGlifButton_Primary) .setTheme(R.style.SudGlifButton_Primary)
.build() .build()
); );
LottieAnimationView lottieAnimationView = findViewById(R.id.illustration_lottie);
AccessibilityManager am = getSystemService(AccessibilityManager.class);
if (am.isEnabled()) {
lottieAnimationView.setAnimation(R.raw.udfps_edu_a11y_lottie);
}
} else { } else {
setHeaderText(R.string.security_settings_fingerprint_enroll_find_sensor_title); setHeaderText(R.string.security_settings_fingerprint_enroll_find_sensor_title);
setDescriptionText(R.string.security_settings_fingerprint_enroll_find_sensor_message); setDescriptionText(R.string.security_settings_fingerprint_enroll_find_sensor_message);

View File

@@ -90,7 +90,6 @@ public class NotificationHistoryAdapter extends
.putExtra(EXTRA_APP_PACKAGE, hn.getPackage()) .putExtra(EXTRA_APP_PACKAGE, hn.getPackage())
.putExtra(EXTRA_CHANNEL_ID, hn.getChannelId()) .putExtra(EXTRA_CHANNEL_ID, hn.getChannelId())
.putExtra(EXTRA_CONVERSATION_ID, hn.getConversationId()); .putExtra(EXTRA_CONVERSATION_ID, hn.getConversationId());
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
holder.itemView.getContext().startActivityAsUser(intent, UserHandle.of(hn.getUserId())); holder.itemView.getContext().startActivityAsUser(intent, UserHandle.of(hn.getUserId()));
}; };
holder.itemView.setOnClickListener(onClick); holder.itemView.setOnClickListener(onClick);

View File

@@ -133,7 +133,6 @@ public class NotificationSbnAdapter extends
.putExtra(EXTRA_APP_PACKAGE, sbn.getPackageName()) .putExtra(EXTRA_APP_PACKAGE, sbn.getPackageName())
.putExtra(EXTRA_CHANNEL_ID, sbn.getNotification().getChannelId()) .putExtra(EXTRA_CHANNEL_ID, sbn.getNotification().getChannelId())
.putExtra(EXTRA_CONVERSATION_ID, sbn.getNotification().getShortcutId()); .putExtra(EXTRA_CONVERSATION_ID, sbn.getNotification().getShortcutId());
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
holder.itemView.getContext().startActivityAsUser(intent, UserHandle.of(userId)); holder.itemView.getContext().startActivityAsUser(intent, UserHandle.of(userId));
return true; return true;
}); });