Merge "Show split screen dialog on the introduction and enrolling page." into main
This commit is contained in:
@@ -40,6 +40,7 @@ import com.android.settings.biometrics.fingerprint.FingerprintEnrollEnrolling;
|
||||
import com.android.settings.core.InstrumentedActivity;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settings.password.ChooseLockSettingsHelper;
|
||||
import com.android.settingslib.activityembedding.ActivityEmbeddingUtils;
|
||||
import com.android.systemui.unfold.compat.ScreenSizeFoldProvider;
|
||||
import com.android.systemui.unfold.updates.FoldProvider;
|
||||
|
||||
@@ -173,6 +174,14 @@ public abstract class BiometricEnrollBase extends InstrumentedActivity {
|
||||
mUserId = getIntent().getIntExtra(Intent.EXTRA_USER_ID, UserHandle.myUserId());
|
||||
mPostureGuidanceIntent = FeatureFactory.getFeatureFactory()
|
||||
.getFaceFeatureProvider().getPostureGuidanceIntent(getApplicationContext());
|
||||
|
||||
// Remove the existing split screen dialog.
|
||||
BiometricsSplitScreenDialog dialog =
|
||||
(BiometricsSplitScreenDialog) getSupportFragmentManager()
|
||||
.findFragmentByTag(BiometricsSplitScreenDialog.class.getName());
|
||||
if (dialog != null) {
|
||||
getSupportFragmentManager().beginTransaction().remove(dialog).commit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -338,4 +347,8 @@ public abstract class BiometricEnrollBase extends InstrumentedActivity {
|
||||
final ColorStateList stateList = Utils.getColorAttr(this, android.R.attr.windowBackground);
|
||||
return stateList != null ? stateList.getDefaultColor() : Color.TRANSPARENT;
|
||||
}
|
||||
|
||||
protected boolean shouldShowSplitScreenDialog() {
|
||||
return isInMultiWindowMode() && !ActivityEmbeddingUtils.isActivityEmbedded(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,6 +154,12 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (shouldShowSplitScreenDialog()) {
|
||||
BiometricsSplitScreenDialog
|
||||
.newInstance(getModality(), !WizardManagerHelper.isAnySetupWizard(getIntent()))
|
||||
.show(getSupportFragmentManager(), BiometricsSplitScreenDialog.class.getName());
|
||||
}
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
mConfirmingCredentials = savedInstanceState.getBoolean(KEY_CONFIRMING_CREDENTIALS);
|
||||
mHasScrolledToBottom = savedInstanceState.getBoolean(KEY_SCROLLED_TO_BOTTOM);
|
||||
@@ -293,6 +299,13 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
|
||||
|
||||
@Override
|
||||
protected void onNextButtonClick(View view) {
|
||||
// If it's not on suw, this method shouldn't be accessed.
|
||||
if (shouldShowSplitScreenDialog() && WizardManagerHelper.isAnySetupWizard(getIntent())) {
|
||||
BiometricsSplitScreenDialog.newInstance(getModality(), false /*destroyActivity*/)
|
||||
.show(getSupportFragmentManager(), BiometricsSplitScreenDialog.class.getName());
|
||||
return;
|
||||
}
|
||||
|
||||
mNextClicked = true;
|
||||
if (checkMaxEnrolled() == 0) {
|
||||
// Lock thingy is already set up, launch directly to the next page
|
||||
|
||||
@@ -97,6 +97,14 @@ public abstract class BiometricsEnrollEnrolling extends BiometricEnrollBase
|
||||
}
|
||||
|
||||
public void startEnrollment() {
|
||||
// If it's in multi window mode, dialog is shown, do not start enrollment.
|
||||
if (shouldShowSplitScreenDialog()) {
|
||||
return;
|
||||
}
|
||||
startEnrollmentInternal();
|
||||
}
|
||||
|
||||
protected void startEnrollmentInternal() {
|
||||
mSidecar = (BiometricEnrollSidecar) getSupportFragmentManager()
|
||||
.findFragmentByTag(TAG_SIDECAR);
|
||||
if (mSidecar == null) {
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.android.settings.biometrics;
|
||||
|
||||
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FACE;
|
||||
|
||||
import static com.android.settings.biometrics.BiometricEnrollBase.RESULT_SKIP;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.DialogInterface;
|
||||
@@ -34,23 +36,33 @@ import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
||||
*/
|
||||
public class BiometricsSplitScreenDialog extends InstrumentedDialogFragment {
|
||||
private static final String KEY_BIOMETRICS_MODALITY = "biometrics_modality";
|
||||
private static final String KEU_DESTROY_ACTIVITY = "destroy_activity";
|
||||
|
||||
@BiometricAuthenticator.Modality
|
||||
private int mBiometricsModality;
|
||||
private boolean mDestroyActivity;
|
||||
|
||||
/** Returns the new instance of the class */
|
||||
/**
|
||||
* Returns the new instance of the class
|
||||
* @param biometricsModality Biometric modality.
|
||||
* @param destroyActivity Whether to destroy the activity
|
||||
* @return the current {@link BiometricsSplitScreenDialog}
|
||||
*/
|
||||
public static BiometricsSplitScreenDialog newInstance(
|
||||
@BiometricAuthenticator.Modality int biometricsModality) {
|
||||
@BiometricAuthenticator.Modality int biometricsModality, boolean destroyActivity) {
|
||||
final BiometricsSplitScreenDialog dialog = new BiometricsSplitScreenDialog();
|
||||
final Bundle args = new Bundle();
|
||||
args.putInt(KEY_BIOMETRICS_MODALITY, biometricsModality);
|
||||
args.putBoolean(KEU_DESTROY_ACTIVITY, destroyActivity);
|
||||
dialog.setArguments(args);
|
||||
dialog.setCancelable(false);
|
||||
return dialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
mBiometricsModality = getArguments().getInt(KEY_BIOMETRICS_MODALITY);
|
||||
mDestroyActivity = getArguments().getBoolean(KEU_DESTROY_ACTIVITY);
|
||||
int titleId;
|
||||
int messageId;
|
||||
switch (mBiometricsModality) {
|
||||
@@ -65,9 +77,16 @@ public class BiometricsSplitScreenDialog extends InstrumentedDialogFragment {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
builder.setTitle(titleId)
|
||||
.setMessage(messageId)
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(
|
||||
R.string.biometric_settings_add_biometrics_in_split_mode_ok,
|
||||
(DialogInterface.OnClickListener) (dialog, which) -> dialog.dismiss());
|
||||
(DialogInterface.OnClickListener) (dialog, which) -> {
|
||||
dialog.dismiss();
|
||||
if (mDestroyActivity) {
|
||||
getActivity().setResult(RESULT_SKIP);
|
||||
getActivity().finish();
|
||||
}
|
||||
});
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
package com.android.settings.biometrics.combination;
|
||||
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FACE;
|
||||
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FINGERPRINT;
|
||||
|
||||
import static com.android.settings.password.ChooseLockPattern.RESULT_FINISHED;
|
||||
|
||||
@@ -48,12 +46,10 @@ import com.android.settings.Utils;
|
||||
import com.android.settings.biometrics.BiometricEnrollBase;
|
||||
import com.android.settings.biometrics.BiometricStatusPreferenceController;
|
||||
import com.android.settings.biometrics.BiometricUtils;
|
||||
import com.android.settings.biometrics.BiometricsSplitScreenDialog;
|
||||
import com.android.settings.core.SettingsBaseActivity;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
import com.android.settings.password.ChooseLockGeneric;
|
||||
import com.android.settings.password.ChooseLockSettingsHelper;
|
||||
import com.android.settingslib.activityembedding.ActivityEmbeddingUtils;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
import com.android.settingslib.transition.SettingsTransitionHelper;
|
||||
|
||||
@@ -167,18 +163,6 @@ public abstract class BiometricsSettingsBase extends DashboardFragment {
|
||||
// since FingerprintSettings and FaceSettings revoke the challenge when finishing.
|
||||
if (getFacePreferenceKey().equals(key)) {
|
||||
mDoNotFinishActivity = true;
|
||||
|
||||
// If it's split mode and there is no enrolled face, show the dialog. (if there is
|
||||
// enrolled face, FaceSettingsEnrollButtonPreferenceController#onClick will handle
|
||||
// the dialog)
|
||||
if (getActivity().isInMultiWindowMode() && !ActivityEmbeddingUtils.isActivityEmbedded(
|
||||
getActivity()) && !mFaceManager.hasEnrolledTemplates(mUserId)) {
|
||||
BiometricsSplitScreenDialog.newInstance(TYPE_FACE).show(
|
||||
getActivity().getSupportFragmentManager(),
|
||||
BiometricsSplitScreenDialog.class.getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
mFaceManager.generateChallenge(mUserId, (sensorId, userId, challenge) -> {
|
||||
final Activity activity = getActivity();
|
||||
if (activity == null || activity.isFinishing()) {
|
||||
@@ -209,18 +193,6 @@ public abstract class BiometricsSettingsBase extends DashboardFragment {
|
||||
return true;
|
||||
} else if (getFingerprintPreferenceKey().equals(key)) {
|
||||
mDoNotFinishActivity = true;
|
||||
|
||||
// If it's split mode and there is no enrolled fingerprint, show the dialog. (if
|
||||
// there is enrolled fingerprint, FingerprintSettingsFragment#onPreferenceTreeClick
|
||||
// will handle the dialog)
|
||||
if (getActivity().isInMultiWindowMode() && !ActivityEmbeddingUtils.isActivityEmbedded(
|
||||
getActivity()) && !mFingerprintManager.hasEnrolledFingerprints(mUserId)) {
|
||||
BiometricsSplitScreenDialog.newInstance(TYPE_FINGERPRINT).show(
|
||||
getActivity().getSupportFragmentManager(),
|
||||
BiometricsSplitScreenDialog.class.getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
mFingerprintManager.generateChallenge(mUserId, (sensorId, userId, challenge) -> {
|
||||
final Activity activity = getActivity();
|
||||
if (activity == null || activity.isFinishing()) {
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.biometrics.face;
|
||||
|
||||
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FACE;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Intent;
|
||||
import android.hardware.face.FaceManager;
|
||||
@@ -33,6 +35,7 @@ import com.android.settings.biometrics.BiometricEnrollSidecar;
|
||||
import com.android.settings.biometrics.BiometricErrorDialog;
|
||||
import com.android.settings.biometrics.BiometricUtils;
|
||||
import com.android.settings.biometrics.BiometricsEnrollEnrolling;
|
||||
import com.android.settings.biometrics.BiometricsSplitScreenDialog;
|
||||
import com.android.settings.slices.CustomSliceRegistry;
|
||||
|
||||
import com.google.android.setupcompat.template.FooterBarMixin;
|
||||
@@ -88,6 +91,10 @@ public class FaceEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (shouldShowSplitScreenDialog()) {
|
||||
BiometricsSplitScreenDialog.newInstance(TYPE_FACE, true /*destroyActivity*/)
|
||||
.show(getSupportFragmentManager(), BiometricsSplitScreenDialog.class.getName());
|
||||
}
|
||||
setContentView(R.layout.face_enroll_enrolling);
|
||||
setHeaderText(R.string.security_settings_face_enroll_repeat_title);
|
||||
mErrorText = findViewById(R.id.error_text);
|
||||
@@ -134,7 +141,7 @@ public class FaceEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startEnrollment() {
|
||||
protected void startEnrollmentInternal() {
|
||||
super.startEnrollment();
|
||||
mPreviewFragment = (FaceEnrollPreviewFragment) getSupportFragmentManager()
|
||||
.findFragmentByTag(TAG_FACE_PREVIEW);
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.android.settings.biometrics.face;
|
||||
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.FACE_SETTINGS_FOR_WORK_TITLE;
|
||||
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FACE;
|
||||
|
||||
import static com.android.settings.biometrics.BiometricEnrollBase.CONFIRM_REQUEST;
|
||||
import static com.android.settings.biometrics.BiometricEnrollBase.ENROLL_REQUEST;
|
||||
@@ -43,12 +42,10 @@ import com.android.settings.SettingsActivity;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.biometrics.BiometricEnrollBase;
|
||||
import com.android.settings.biometrics.BiometricUtils;
|
||||
import com.android.settings.biometrics.BiometricsSplitScreenDialog;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settings.password.ChooseLockSettingsHelper;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settingslib.activityembedding.ActivityEmbeddingUtils;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
import com.android.settingslib.search.SearchIndexable;
|
||||
import com.android.settingslib.widget.LayoutPreference;
|
||||
@@ -104,26 +101,8 @@ public class FaceSettings extends DashboardFragment {
|
||||
mEnrollButton.setVisible(true);
|
||||
};
|
||||
|
||||
private final FaceSettingsEnrollButtonPreferenceController.Listener mEnrollListener =
|
||||
new FaceSettingsEnrollButtonPreferenceController.Listener() {
|
||||
@Override
|
||||
public boolean onShowSplitScreenDialog() {
|
||||
if (getActivity().isInMultiWindowMode()
|
||||
&& !ActivityEmbeddingUtils.isActivityEmbedded(getActivity())) {
|
||||
// If it's in split mode, show the error dialog.
|
||||
BiometricsSplitScreenDialog.newInstance(TYPE_FACE).show(
|
||||
getActivity().getSupportFragmentManager(),
|
||||
BiometricsSplitScreenDialog.class.getName());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartEnrolling(Intent intent) {
|
||||
FaceSettings.this.startActivityForResult(intent, ENROLL_REQUEST);
|
||||
}
|
||||
};
|
||||
private final FaceSettingsEnrollButtonPreferenceController.Listener mEnrollListener = intent ->
|
||||
startActivityForResult(intent, ENROLL_REQUEST);
|
||||
|
||||
/**
|
||||
* @param context
|
||||
|
||||
@@ -75,11 +75,6 @@ public class FaceSettingsEnrollButtonPreferenceController extends BasePreference
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// If it's in multi window mode, do not start the introduction intent.
|
||||
if (mListener != null && mListener.onShowSplitScreenDialog()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mIsClicked = true;
|
||||
final Intent intent = new Intent();
|
||||
intent.setClassName(SETTINGS_PACKAGE_NAME, FaceEnrollIntroduction.class.getName());
|
||||
@@ -120,12 +115,6 @@ public class FaceSettingsEnrollButtonPreferenceController extends BasePreference
|
||||
* Interface for registering callbacks related to the face enroll preference button.
|
||||
*/
|
||||
public interface Listener {
|
||||
/**
|
||||
* Called to check whether to show dialog in split screen mode
|
||||
* @return Whether split screen warning dialog shown.
|
||||
*/
|
||||
boolean onShowSplitScreenDialog();
|
||||
|
||||
/**
|
||||
* Called when the user has indicated an intent to begin enrolling a new face.
|
||||
* @param intent The Intent that should be used to launch face enrollment.
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.settings.biometrics.fingerprint;
|
||||
|
||||
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FINGERPRINT;
|
||||
import static android.text.Layout.HYPHENATION_FREQUENCY_NONE;
|
||||
|
||||
import android.animation.Animator;
|
||||
@@ -67,6 +68,7 @@ import com.android.settings.R;
|
||||
import com.android.settings.biometrics.BiometricEnrollSidecar;
|
||||
import com.android.settings.biometrics.BiometricUtils;
|
||||
import com.android.settings.biometrics.BiometricsEnrollEnrolling;
|
||||
import com.android.settings.biometrics.BiometricsSplitScreenDialog;
|
||||
import com.android.settings.biometrics.fingerprint.feature.SfpsEnrollmentFeature;
|
||||
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
||||
import com.android.settings.flags.Flags;
|
||||
@@ -223,7 +225,10 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (shouldShowSplitScreenDialog()) {
|
||||
BiometricsSplitScreenDialog.newInstance(TYPE_FINGERPRINT, true /*destroyActivity*/)
|
||||
.show(getSupportFragmentManager(), BiometricsSplitScreenDialog.class.getName());
|
||||
}
|
||||
if (savedInstanceState != null) {
|
||||
restoreSavedState(savedInstanceState);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ package com.android.settings.biometrics.fingerprint;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.FINGERPRINT_UNLOCK_DISABLED_EXPLANATION;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_FINGERPRINT_LAST_DELETE_MESSAGE;
|
||||
import static android.app.admin.DevicePolicyResources.UNDEFINED;
|
||||
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FINGERPRINT;
|
||||
|
||||
import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
|
||||
import static com.android.settings.biometrics.BiometricEnrollBase.EXTRA_FROM_SETTINGS_SUMMARY;
|
||||
@@ -68,7 +67,6 @@ import com.android.settings.SubSettings;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.biometrics.BiometricEnrollBase;
|
||||
import com.android.settings.biometrics.BiometricUtils;
|
||||
import com.android.settings.biometrics.BiometricsSplitScreenDialog;
|
||||
import com.android.settings.biometrics.GatekeeperPasswordProvider;
|
||||
import com.android.settings.biometrics2.ui.model.EnrollmentRequest;
|
||||
import com.android.settings.biometrics2.ui.view.FingerprintEnrollmentActivity;
|
||||
@@ -84,7 +82,6 @@ import com.android.settingslib.RestrictedLockUtils;
|
||||
import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
|
||||
import com.android.settingslib.RestrictedLockUtilsInternal;
|
||||
import com.android.settingslib.RestrictedSwitchPreference;
|
||||
import com.android.settingslib.activityembedding.ActivityEmbeddingUtils;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
import com.android.settingslib.search.SearchIndexable;
|
||||
import com.android.settingslib.transition.SettingsTransitionHelper;
|
||||
@@ -790,17 +787,6 @@ public class FingerprintSettings extends SubSettings {
|
||||
public boolean onPreferenceTreeClick(Preference pref) {
|
||||
final String key = pref.getKey();
|
||||
if (KEY_FINGERPRINT_ADD.equals(key)) {
|
||||
// If it's in split mode, show the error dialog and don't need to show adding
|
||||
// fingerprint intent.
|
||||
final boolean isActivityEmbedded = ActivityEmbeddingUtils.isActivityEmbedded(
|
||||
getActivity());
|
||||
if (getActivity().isInMultiWindowMode() && !isActivityEmbedded) {
|
||||
BiometricsSplitScreenDialog.newInstance(TYPE_FINGERPRINT).show(
|
||||
getActivity().getSupportFragmentManager(),
|
||||
BiometricsSplitScreenDialog.class.getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
mIsEnrolling = true;
|
||||
Intent intent = new Intent();
|
||||
if (FeatureFlagUtils.isEnabled(getContext(),
|
||||
|
||||
@@ -134,6 +134,7 @@ class FingerprintEnrollmentV2Activity : FragmentActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
// TODO(b/299573056): Show split screen dialog when it's in multi window mode.
|
||||
setContentView(R.layout.fingerprint_v2_enroll_main)
|
||||
|
||||
setTheme(SetupWizardUtils.getTheme(applicationContext, intent))
|
||||
|
||||
Reference in New Issue
Block a user