Merge "Merge Android 13 QPR3 tm-qpr-dev-plus-aosp-without-vendor@9936994" into stage-aosp-master
This commit is contained in:
@@ -72,6 +72,7 @@ import com.android.settings.EventLogTags;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsActivity;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import com.android.settings.SetupWizardUtils;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.biometrics.BiometricEnrollActivity;
|
||||
import com.android.settings.biometrics.BiometricEnrollBase;
|
||||
@@ -428,6 +429,9 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
Intent chooseLockGenericIntent = new Intent(getActivity(),
|
||||
getInternalActivityClass());
|
||||
chooseLockGenericIntent.setAction(getIntent().getAction());
|
||||
if (WizardManagerHelper.isAnySetupWizard(getIntent())) {
|
||||
SetupWizardUtils.copySetupExtras(getIntent(), chooseLockGenericIntent);
|
||||
}
|
||||
// Forward the target user id to ChooseLockGeneric.
|
||||
chooseLockGenericIntent.putExtra(Intent.EXTRA_USER_ID, mUserId);
|
||||
chooseLockGenericIntent.putExtra(CONFIRM_CREDENTIALS, !mPasswordConfirmed);
|
||||
|
||||
@@ -212,9 +212,10 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
protected LockPatternView mLockPatternView;
|
||||
protected TextView mFooterText;
|
||||
protected FooterButton mSkipOrClearButton;
|
||||
private FooterButton mNextButton;
|
||||
protected FooterButton mNextButton;
|
||||
@VisibleForTesting protected LockscreenCredential mChosenPattern;
|
||||
private ColorStateList mDefaultHeaderColorList;
|
||||
private View mSudContent;
|
||||
|
||||
/**
|
||||
* The patten used during the help screen to show how to draw a pattern.
|
||||
@@ -367,31 +368,34 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
|
||||
Introduction(
|
||||
R.string.lock_settings_picker_biometrics_added_security_message,
|
||||
R.string.lockpattern_recording_intro_header,
|
||||
R.string.lockpassword_choose_your_pattern_description,
|
||||
LeftButtonMode.Gone, RightButtonMode.ContinueDisabled,
|
||||
ID_EMPTY_MESSAGE, true),
|
||||
HelpScreen(
|
||||
ID_EMPTY_MESSAGE, R.string.lockpattern_settings_help_how_to_record,
|
||||
R.string.lockpattern_settings_help_how_to_record,
|
||||
R.string.lockpattern_settings_help_how_to_record,
|
||||
LeftButtonMode.Gone, RightButtonMode.Ok, ID_EMPTY_MESSAGE, false),
|
||||
ChoiceTooShort(
|
||||
R.string.lock_settings_picker_biometrics_added_security_message,
|
||||
R.string.lockpattern_recording_incorrect_too_short,
|
||||
R.string.lockpattern_recording_incorrect_too_short,
|
||||
LeftButtonMode.Retry, RightButtonMode.ContinueDisabled,
|
||||
ID_EMPTY_MESSAGE, true),
|
||||
FirstChoiceValid(
|
||||
R.string.lock_settings_picker_biometrics_added_security_message,
|
||||
R.string.lockpattern_pattern_entered_header,
|
||||
R.string.lockpattern_pattern_entered_header,
|
||||
LeftButtonMode.Retry, RightButtonMode.Continue, ID_EMPTY_MESSAGE, false),
|
||||
NeedToConfirm(
|
||||
ID_EMPTY_MESSAGE, R.string.lockpattern_need_to_confirm,
|
||||
R.string.lockpattern_need_to_confirm, R.string.lockpattern_need_to_confirm,
|
||||
LeftButtonMode.Gone, RightButtonMode.ConfirmDisabled,
|
||||
ID_EMPTY_MESSAGE, true),
|
||||
ConfirmWrong(
|
||||
ID_EMPTY_MESSAGE, R.string.lockpattern_need_to_unlock_wrong,
|
||||
R.string.lockpattern_need_to_unlock_wrong,
|
||||
R.string.lockpattern_need_to_unlock_wrong,
|
||||
LeftButtonMode.Gone, RightButtonMode.ConfirmDisabled,
|
||||
ID_EMPTY_MESSAGE, true),
|
||||
ChoiceConfirmed(
|
||||
ID_EMPTY_MESSAGE, R.string.lockpattern_pattern_confirmed_header,
|
||||
R.string.lockpattern_pattern_confirmed_header,
|
||||
R.string.lockpattern_pattern_confirmed_header,
|
||||
LeftButtonMode.Gone, RightButtonMode.Confirm, ID_EMPTY_MESSAGE, false);
|
||||
|
||||
|
||||
@@ -537,6 +541,10 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
);
|
||||
mSkipOrClearButton = mixin.getSecondaryButton();
|
||||
mNextButton = mixin.getPrimaryButton();
|
||||
// TODO(b/243008023) Workaround for Glif layout on 2 panel choose lock settings.
|
||||
mSudContent = layout.findViewById(R.id.sud_layout_content);
|
||||
mSudContent.setPadding(mSudContent.getPaddingLeft(), 0, mSudContent.getPaddingRight(),
|
||||
0);
|
||||
|
||||
return layout;
|
||||
}
|
||||
@@ -544,7 +552,9 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
mHeaderText = (TextView) view.findViewById(R.id.headerText);
|
||||
final GlifLayout layout = getActivity().findViewById(R.id.setup_wizard_layout);
|
||||
mHeaderText = layout.getDescriptionTextView();
|
||||
mHeaderText.setMinLines(2);
|
||||
mDefaultHeaderColorList = mHeaderText.getTextColors();
|
||||
mLockPatternView = (LockPatternView) view.findViewById(R.id.lockPattern);
|
||||
mLockPatternView.setOnPatternListener(mChooseNewLockPatternListener);
|
||||
@@ -719,30 +729,24 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
*/
|
||||
protected void updateStage(Stage stage) {
|
||||
final Stage previousStage = mUiStage;
|
||||
|
||||
final GlifLayout layout = getActivity().findViewById(R.id.setup_wizard_layout);
|
||||
mUiStage = stage;
|
||||
|
||||
if (stage == Stage.Introduction) {
|
||||
layout.setDescriptionText(stage.headerMessage);
|
||||
}
|
||||
|
||||
// header text, footer text, visibility and
|
||||
// enabled state all known from the stage
|
||||
if (stage == Stage.ChoiceTooShort) {
|
||||
mHeaderText.setText(
|
||||
layout.setDescriptionText(
|
||||
getResources().getString(
|
||||
stage.headerMessage,
|
||||
LockPatternUtils.MIN_LOCK_PATTERN_SIZE));
|
||||
} else {
|
||||
mHeaderText.setText(stage.headerMessage);
|
||||
}
|
||||
final GlifLayout layout = getActivity().findViewById(R.id.setup_wizard_layout);
|
||||
final boolean forAnyBiometric = mForFingerprint || mForFace || mForBiometrics;
|
||||
if (forAnyBiometric) {
|
||||
if (stage.messageForBiometrics == ID_EMPTY_MESSAGE) {
|
||||
layout.setDescriptionText("");
|
||||
} else {
|
||||
layout.setDescriptionText(stage.messageForBiometrics);
|
||||
}
|
||||
} else {
|
||||
layout.getDescriptionTextView().setVisibility(View.GONE);
|
||||
layout.setDescriptionText(stage.headerMessage);
|
||||
}
|
||||
|
||||
if (stage.footerMessage == ID_EMPTY_MESSAGE) {
|
||||
mFooterText.setText("");
|
||||
} else {
|
||||
@@ -760,8 +764,8 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
mHeaderText.setTextColor(mDefaultHeaderColorList);
|
||||
}
|
||||
|
||||
if (stage == Stage.NeedToConfirm && forAnyBiometric) {
|
||||
mHeaderText.setText("");
|
||||
if (stage == Stage.NeedToConfirm) {
|
||||
mHeaderText.setText(stage.headerMessage);
|
||||
layout.setHeaderText(R.string.lockpassword_draw_your_pattern_again_header);
|
||||
}
|
||||
}
|
||||
@@ -791,6 +795,7 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
mLockPatternView.setPattern(DisplayMode.Animate, mAnimatePattern);
|
||||
break;
|
||||
case ChoiceTooShort:
|
||||
case ConfirmWrong:
|
||||
mLockPatternView.setDisplayMode(DisplayMode.Wrong);
|
||||
postClearPatternRunnable();
|
||||
announceAlways = true;
|
||||
@@ -800,11 +805,6 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
case NeedToConfirm:
|
||||
mLockPatternView.clearPattern();
|
||||
break;
|
||||
case ConfirmWrong:
|
||||
mLockPatternView.setDisplayMode(DisplayMode.Wrong);
|
||||
postClearPatternRunnable();
|
||||
announceAlways = true;
|
||||
break;
|
||||
case ChoiceConfirmed:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
getTitleFromCredentialType(credentialType, isEffectiveUserManagedProfile));
|
||||
}
|
||||
if (mDetails == null) {
|
||||
promptInfo.setSubtitle(
|
||||
promptInfo.setDeviceCredentialSubtitle(
|
||||
getDetailsFromCredentialType(credentialType, isEffectiveUserManagedProfile));
|
||||
}
|
||||
|
||||
|
||||
@@ -100,6 +100,7 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
||||
private CountDownTimer mCountdownTimer;
|
||||
|
||||
private GlifLayout mGlifLayout;
|
||||
private View mSudContent;
|
||||
|
||||
// caller-supplied text for various prompts
|
||||
private CharSequence mHeaderText;
|
||||
@@ -129,7 +130,10 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
||||
mGlifLayout = view.findViewById(R.id.setup_wizard_layout);
|
||||
mLockPatternView = (LockPatternView) view.findViewById(R.id.lockPattern);
|
||||
mErrorTextView = (TextView) view.findViewById(R.id.errorText);
|
||||
|
||||
// TODO(b/243008023) Workaround for Glif layout on 2 panel choose lock settings.
|
||||
mSudContent = mGlifLayout.findViewById(R.id.sud_layout_content);
|
||||
mSudContent.setPadding(mSudContent.getPaddingLeft(), 0, mSudContent.getPaddingRight(),
|
||||
0);
|
||||
mIsManagedProfile = UserManager.get(getActivity()).isManagedProfile(mEffectiveUserId);
|
||||
|
||||
// make it so unhandled touch events within the unlock screen go to the
|
||||
|
||||
@@ -24,6 +24,8 @@ import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_R
|
||||
import android.app.RemoteServiceException.MissingRequestPasswordComplexityPermissionException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.os.UserHandle;
|
||||
@@ -45,6 +47,8 @@ import com.android.settings.utils.SettingsDividerItemDecoration;
|
||||
import com.google.android.setupdesign.GlifPreferenceLayout;
|
||||
import com.google.android.setupdesign.util.ThemeHelper;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Setup Wizard's version of ChooseLockGeneric screen. It inherits the logic and basic structure
|
||||
* from ChooseLockGeneric class, and should remain similar to that behaviorally. This class should
|
||||
@@ -105,6 +109,7 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
GlifPreferenceLayout layout = (GlifPreferenceLayout) view;
|
||||
layout.setDescriptionText(loadDescriptionText());
|
||||
layout.setDividerItemDecoration(new SettingsDividerItemDecoration(getContext()));
|
||||
layout.setDividerInset(getContext().getResources().getDimensionPixelSize(
|
||||
R.dimen.sud_items_glif_text_divider_inset));
|
||||
@@ -125,11 +130,9 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric {
|
||||
|
||||
@Override
|
||||
protected void addHeaderView() {
|
||||
if (isForBiometric()) {
|
||||
setHeaderView(R.layout.setup_choose_lock_generic_biometrics_header);
|
||||
} else {
|
||||
setHeaderView(R.layout.setup_choose_lock_generic_header);
|
||||
}
|
||||
// The original logic has been moved to onViewCreated and
|
||||
// uses GlifLayout#setDescriptionText instead,
|
||||
// keep empty body here since we won't call super method.
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -235,9 +238,22 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric {
|
||||
private boolean isForBiometric() {
|
||||
return mForFingerprint || mForFace || mForBiometrics;
|
||||
}
|
||||
|
||||
String loadDescriptionText() {
|
||||
return getString(isForBiometric()
|
||||
? R.string.lock_settings_picker_biometrics_added_security_message
|
||||
: R.string.setup_lock_settings_picker_message);
|
||||
}
|
||||
}
|
||||
|
||||
public static class InternalActivity extends ChooseLockGeneric.InternalActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedState) {
|
||||
setTheme(SetupWizardUtils.getTheme(this, getIntent()));
|
||||
ThemeHelper.trySetDynamicColor(this);
|
||||
super.onCreate(savedState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isValidFragment(String fragmentName) {
|
||||
return InternalSetupChooseLockGenericFragment.class.getName().equals(fragmentName);
|
||||
@@ -254,6 +270,49 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric {
|
||||
protected boolean canRunBeforeDeviceProvisioned() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NotNull View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
GlifPreferenceLayout layout = (GlifPreferenceLayout) view;
|
||||
int titleResource = R.string.lock_settings_picker_new_lock_title;
|
||||
|
||||
layout.setHeaderText(titleResource);
|
||||
setDivider(new ColorDrawable(Color.TRANSPARENT));
|
||||
setDividerHeight(0);
|
||||
getHeaderView().setVisible(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Intent getLockPasswordIntent(int quality) {
|
||||
final Intent intent = SetupChooseLockPassword.modifyIntentForSetup(
|
||||
getContext(), super.getLockPasswordIntent(quality));
|
||||
SetupWizardUtils.copySetupExtras(getIntent(), intent);
|
||||
return intent;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Intent getLockPatternIntent() {
|
||||
final Intent intent = SetupChooseLockPattern.modifyIntentForSetup(
|
||||
getContext(), super.getLockPatternIntent());
|
||||
SetupWizardUtils.copySetupExtras(getIntent(), intent);
|
||||
return intent;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Intent getBiometricEnrollIntent(Context context) {
|
||||
final Intent intent = super.getBiometricEnrollIntent(context);
|
||||
SetupWizardUtils.copySetupExtras(getIntent(), intent);
|
||||
return intent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecyclerView onCreateRecyclerView(LayoutInflater inflater, ViewGroup parent,
|
||||
Bundle savedInstanceState) {
|
||||
GlifPreferenceLayout layout = (GlifPreferenceLayout) parent;
|
||||
return layout.onCreateRecyclerView(inflater, parent, savedInstanceState);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.password;
|
||||
|
||||
import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
@@ -30,8 +32,6 @@ import androidx.fragment.app.Fragment;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SetupRedactionInterstitial;
|
||||
|
||||
import com.google.android.setupdesign.GlifLayout;
|
||||
|
||||
/**
|
||||
* Setup Wizard's version of ChooseLockPattern screen. It inherits the logic and basic structure
|
||||
* from ChooseLockPattern class, and should remain similar to that behaviorally. This class should
|
||||
@@ -123,15 +123,25 @@ public class SetupChooseLockPattern extends ChooseLockPattern {
|
||||
startChooseLockActivity(lock, getActivity());
|
||||
}
|
||||
|
||||
private boolean showMinimalUi() {
|
||||
return getResources().getBoolean(R.bool.config_lock_pattern_minimal_ui);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateStage(Stage stage) {
|
||||
super.updateStage(stage);
|
||||
if (!getResources().getBoolean(R.bool.config_lock_pattern_minimal_ui)
|
||||
&& mOptionsButton != null) {
|
||||
if (!showMinimalUi() && mOptionsButton != null) {
|
||||
// In landscape, keep view stub to avoid pattern view shifting, but in portrait the
|
||||
// header title and description could become multiple lines in confirm stage,
|
||||
// gone the button view to reserve more room for growth height of header.
|
||||
@View.Visibility
|
||||
final int hideOrGone =
|
||||
getResources().getConfiguration().orientation == ORIENTATION_LANDSCAPE
|
||||
? View.INVISIBLE : View.GONE;
|
||||
mOptionsButton.setVisibility(
|
||||
(stage == Stage.Introduction || stage == Stage.HelpScreen ||
|
||||
stage == Stage.ChoiceTooShort || stage == Stage.FirstChoiceValid)
|
||||
? View.VISIBLE : View.INVISIBLE);
|
||||
? View.VISIBLE : hideOrGone);
|
||||
}
|
||||
|
||||
if (stage.leftMode == LeftButtonMode.Gone && stage == Stage.Introduction) {
|
||||
@@ -141,10 +151,6 @@ public class SetupChooseLockPattern extends ChooseLockPattern {
|
||||
} else {
|
||||
mLeftButtonIsSkip = false;
|
||||
}
|
||||
|
||||
final GlifLayout layout = getActivity().findViewById(R.id.setup_wizard_layout);
|
||||
layout.setDescriptionText(
|
||||
getString(R.string.lockpassword_choose_your_pattern_description));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user