New UI to hint user about strong auth
Instead of having a separate textview, we now reuse the detail textview to show the hint. Fix: 28204828 Change-Id: I3eff3240bf7ecb1495fbf11a073a273a0de603ae
This commit is contained in:
@@ -59,15 +59,9 @@
|
|||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:layout_marginTop="16dp"/>
|
android:layout_marginTop="16dp"/>
|
||||||
|
|
||||||
<TextView
|
<View android:layout_width="match_parent"
|
||||||
android:id="@+id/strongAuthRequiredText"
|
android:layout_height="0dp"
|
||||||
style="@style/TextAppearance.ConfirmDeviceCredentialsStrongAuthRequiredText"
|
android:layout_weight="1"/>
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:ellipsize="marquee"
|
|
||||||
android:gravity="center"/>
|
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/password_entry"
|
android:id="@+id/password_entry"
|
||||||
|
@@ -59,15 +59,9 @@
|
|||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:layout_marginTop="16dp"/>
|
android:layout_marginTop="16dp"/>
|
||||||
|
|
||||||
<TextView
|
<View android:layout_width="match_parent"
|
||||||
android:id="@+id/strongAuthRequiredText"
|
android:layout_height="0dp"
|
||||||
style="@style/TextAppearance.ConfirmDeviceCredentialsStrongAuthRequiredText"
|
android:layout_weight="0.5"/>
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="0.5"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:ellipsize="marquee"
|
|
||||||
android:gravity="center"/>
|
|
||||||
|
|
||||||
<com.android.internal.widget.LockPatternView
|
<com.android.internal.widget.LockPatternView
|
||||||
android:id="@+id/lockPattern"
|
android:id="@+id/lockPattern"
|
||||||
|
@@ -3069,13 +3069,20 @@
|
|||||||
<!-- Message to be used to explain the user that he needs to enter his work password to continue a
|
<!-- Message to be used to explain the user that he needs to enter his work password to continue a
|
||||||
particular operation. [CHAR LIMIT=70]-->
|
particular operation. [CHAR LIMIT=70]-->
|
||||||
<string name="lockpassword_confirm_your_password_generic_profile">Enter your work password to continue</string>
|
<string name="lockpassword_confirm_your_password_generic_profile">Enter your work password to continue</string>
|
||||||
<!-- An explanation text that the pattern needs to be solved since the device has just been restarted. [CHAR LIMIT=80] -->
|
|
||||||
<string name="lockpassword_strong_auth_required_reason_restart_pattern">Pattern required after device restarts</string>
|
|
||||||
<!-- An explanation text that the pin needs to be entered since the device has just been restarted. [CHAR LIMIT=80] -->
|
|
||||||
<string name="lockpassword_strong_auth_required_reason_restart_pin">PIN required after device restarts</string>
|
|
||||||
|
|
||||||
|
<!-- An explanation text that the pattern needs to be solved since the device has just been restarted. [CHAR LIMIT=80] -->
|
||||||
|
<string name="lockpassword_strong_auth_required_reason_restart_device_pattern">Use your device pattern to continue. It\'s required after the device restarts.</string>
|
||||||
|
<!-- An explanation text that the pin needs to be entered since the device has just been restarted. [CHAR LIMIT=80] -->
|
||||||
|
<string name="lockpassword_strong_auth_required_reason_restart_device_pin">Enter your device PIN to continue. It\'s required after the device restarts.</string>
|
||||||
<!-- An explanation text that the password needs to be entered since the device has just been restarted. [CHAR LIMIT=80] -->
|
<!-- An explanation text that the password needs to be entered since the device has just been restarted. [CHAR LIMIT=80] -->
|
||||||
<string name="lockpassword_strong_auth_required_reason_restart_password">Password required after device restarts</string>
|
<string name="lockpassword_strong_auth_required_reason_restart_device_password">Enter your device password to continue. It\'s required after the device restarts.</string>
|
||||||
|
|
||||||
|
<!-- An explanation text that the pattern needs to be solved since the device has just been restarted. [CHAR LIMIT=80] -->
|
||||||
|
<string name="lockpassword_strong_auth_required_reason_restart_work_pattern">Use your work pattern to continue. It\'s required after the device restarts.</string>
|
||||||
|
<!-- An explanation text that the pin needs to be entered since the device has just been restarted. [CHAR LIMIT=80] -->
|
||||||
|
<string name="lockpassword_strong_auth_required_reason_restart_work_pin">Enter your work PIN to continue. It\'s required after the device restarts.</string>
|
||||||
|
<!-- An explanation text that the password needs to be entered since the device has just been restarted. [CHAR LIMIT=80] -->
|
||||||
|
<string name="lockpassword_strong_auth_required_reason_restart_work_password">Enter your work password to continue. It\'s required after the device restarts.</string>
|
||||||
|
|
||||||
<!-- Security & location settings screen, change security method screen instruction if user
|
<!-- Security & location settings screen, change security method screen instruction if user
|
||||||
enters incorrect PIN [CHAR LIMIT=30] -->
|
enters incorrect PIN [CHAR LIMIT=30] -->
|
||||||
|
@@ -357,11 +357,6 @@
|
|||||||
<item name="android:textColor">@color/warning</item>
|
<item name="android:textColor">@color/warning</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="TextAppearance.ConfirmDeviceCredentialsStrongAuthRequiredText"
|
|
||||||
parent="android:TextAppearance.Material.Body1">
|
|
||||||
<item name="android:textColor">?android:attr/textColorSecondary</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="TextAppearance.Small.SwitchBar">
|
<style name="TextAppearance.Small.SwitchBar">
|
||||||
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
||||||
<item name="android:textStyle">normal</item>
|
<item name="android:textStyle">normal</item>
|
||||||
|
@@ -66,7 +66,7 @@ public abstract class ConfirmDeviceCredentialBaseFragment extends OptionsMenuFra
|
|||||||
PACKAGE + ".ConfirmCredentials.showWhenLocked";
|
PACKAGE + ".ConfirmCredentials.showWhenLocked";
|
||||||
|
|
||||||
private FingerprintUiHelper mFingerprintHelper;
|
private FingerprintUiHelper mFingerprintHelper;
|
||||||
private boolean mIsStrongAuthRequired;
|
protected boolean mIsStrongAuthRequired;
|
||||||
private boolean mAllowFpAuthentication;
|
private boolean mAllowFpAuthentication;
|
||||||
protected Button mCancelButton;
|
protected Button mCancelButton;
|
||||||
protected ImageView mFingerprintIcon;
|
protected ImageView mFingerprintIcon;
|
||||||
@@ -74,7 +74,6 @@ public abstract class ConfirmDeviceCredentialBaseFragment extends OptionsMenuFra
|
|||||||
protected int mUserId;
|
protected int mUserId;
|
||||||
protected LockPatternUtils mLockPatternUtils;
|
protected LockPatternUtils mLockPatternUtils;
|
||||||
protected TextView mErrorTextView;
|
protected TextView mErrorTextView;
|
||||||
protected TextView mStrongAuthRequiredTextView;
|
|
||||||
protected final Handler mHandler = new Handler();
|
protected final Handler mHandler = new Handler();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -97,11 +96,6 @@ public abstract class ConfirmDeviceCredentialBaseFragment extends OptionsMenuFra
|
|||||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
mCancelButton = (Button) view.findViewById(R.id.cancelButton);
|
mCancelButton = (Button) view.findViewById(R.id.cancelButton);
|
||||||
if (mStrongAuthRequiredTextView != null) {
|
|
||||||
// INIVISIBLE instead of GONE because it also acts as a weighted spacer
|
|
||||||
mStrongAuthRequiredTextView.setVisibility(
|
|
||||||
mIsStrongAuthRequired ? View.VISIBLE : View.INVISIBLE);
|
|
||||||
}
|
|
||||||
mFingerprintIcon = (ImageView) view.findViewById(R.id.fingerprintIcon);
|
mFingerprintIcon = (ImageView) view.findViewById(R.id.fingerprintIcon);
|
||||||
mFingerprintHelper = new FingerprintUiHelper(
|
mFingerprintHelper = new FingerprintUiHelper(
|
||||||
mFingerprintIcon,
|
mFingerprintIcon,
|
||||||
|
@@ -50,6 +50,18 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
|
public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
|
||||||
|
|
||||||
|
// The index of the array is isStrongAuth << 2 + isProfile << 1 + isAlpha.
|
||||||
|
private static final int[] DETAIL_TEXTS = new int[] {
|
||||||
|
R.string.lockpassword_confirm_your_pin_generic,
|
||||||
|
R.string.lockpassword_confirm_your_password_generic,
|
||||||
|
R.string.lockpassword_confirm_your_pin_generic_profile,
|
||||||
|
R.string.lockpassword_confirm_your_password_generic_profile,
|
||||||
|
R.string.lockpassword_strong_auth_required_reason_restart_device_pin,
|
||||||
|
R.string.lockpassword_strong_auth_required_reason_restart_device_password,
|
||||||
|
R.string.lockpassword_strong_auth_required_reason_restart_work_pin,
|
||||||
|
R.string.lockpassword_strong_auth_required_reason_restart_work_password,
|
||||||
|
};
|
||||||
|
|
||||||
public static class InternalActivity extends ConfirmLockPassword {
|
public static class InternalActivity extends ConfirmLockPassword {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,18 +136,6 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
|
|||||||
|| DevicePolicyManager.PASSWORD_QUALITY_COMPLEX == storedQuality
|
|| DevicePolicyManager.PASSWORD_QUALITY_COMPLEX == storedQuality
|
||||||
|| DevicePolicyManager.PASSWORD_QUALITY_MANAGED == storedQuality;
|
|| DevicePolicyManager.PASSWORD_QUALITY_MANAGED == storedQuality;
|
||||||
|
|
||||||
// Strong auth is required when the user is locked.
|
|
||||||
// Currently a user does not get locked again until the device restarts. Show the
|
|
||||||
// hint text as "device has just been restarted".
|
|
||||||
mStrongAuthRequiredTextView = (TextView) view.findViewById(R.id.strongAuthRequiredText);
|
|
||||||
if (mIsAlpha) {
|
|
||||||
mStrongAuthRequiredTextView.setText(
|
|
||||||
R.string.lockpassword_strong_auth_required_reason_restart_password);
|
|
||||||
} else {
|
|
||||||
mStrongAuthRequiredTextView.setText(
|
|
||||||
R.string.lockpassword_strong_auth_required_reason_restart_pin);
|
|
||||||
}
|
|
||||||
|
|
||||||
mImm = (InputMethodManager) getActivity().getSystemService(
|
mImm = (InputMethodManager) getActivity().getSystemService(
|
||||||
Context.INPUT_METHOD_SERVICE);
|
Context.INPUT_METHOD_SERVICE);
|
||||||
|
|
||||||
@@ -186,13 +186,10 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
|
|||||||
private int getDefaultDetails() {
|
private int getDefaultDetails() {
|
||||||
boolean isProfile = Utils.isManagedProfile(
|
boolean isProfile = Utils.isManagedProfile(
|
||||||
UserManager.get(getActivity()), mEffectiveUserId);
|
UserManager.get(getActivity()), mEffectiveUserId);
|
||||||
if (mIsAlpha) {
|
// Map boolean flags to an index by isStrongAuth << 2 + isProfile << 1 + isAlpha.
|
||||||
return isProfile ? R.string.lockpassword_confirm_your_password_generic_profile
|
int index = ((mIsStrongAuthRequired ? 1 : 0) << 2) + ((isProfile ? 1 : 0 ) << 1)
|
||||||
: R.string.lockpassword_confirm_your_password_generic;
|
+ (mIsAlpha ? 1 : 0);
|
||||||
} else {
|
return DETAIL_TEXTS[index];
|
||||||
return isProfile ? R.string.lockpassword_confirm_your_pin_generic_profile
|
|
||||||
: R.string.lockpassword_confirm_your_pin_generic;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getErrorMessage() {
|
private int getErrorMessage() {
|
||||||
|
@@ -118,7 +118,6 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
|||||||
mHeaderTextView = (TextView) view.findViewById(R.id.headerText);
|
mHeaderTextView = (TextView) view.findViewById(R.id.headerText);
|
||||||
mLockPatternView = (LockPatternView) view.findViewById(R.id.lockPattern);
|
mLockPatternView = (LockPatternView) view.findViewById(R.id.lockPattern);
|
||||||
mDetailsTextView = (TextView) view.findViewById(R.id.detailsText);
|
mDetailsTextView = (TextView) view.findViewById(R.id.detailsText);
|
||||||
mStrongAuthRequiredTextView = (TextView) view.findViewById(R.id.strongAuthRequiredText);
|
|
||||||
mErrorTextView = (TextView) view.findViewById(R.id.errorText);
|
mErrorTextView = (TextView) view.findViewById(R.id.errorText);
|
||||||
mLeftSpacerLandscape = view.findViewById(R.id.leftSpacer);
|
mLeftSpacerLandscape = view.findViewById(R.id.leftSpacer);
|
||||||
mRightSpacerLandscape = view.findViewById(R.id.rightSpacer);
|
mRightSpacerLandscape = view.findViewById(R.id.rightSpacer);
|
||||||
@@ -176,13 +175,6 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
|||||||
getFragmentManager().beginTransaction().add(mCredentialCheckResultTracker,
|
getFragmentManager().beginTransaction().add(mCredentialCheckResultTracker,
|
||||||
FRAGMENT_TAG_CHECK_LOCK_RESULT).commit();
|
FRAGMENT_TAG_CHECK_LOCK_RESULT).commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Strong auth is required when the user is locked.
|
|
||||||
// Currently a user does not get locked again until the device restarts. Show the
|
|
||||||
// hint text as "device has just been restarted".
|
|
||||||
mStrongAuthRequiredTextView.setText(
|
|
||||||
R.string.lockpassword_strong_auth_required_reason_restart_pattern);
|
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,6 +229,20 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
|||||||
mFingerprintIcon.setAlpha(0f);
|
mFingerprintIcon.setAlpha(0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getDefaultDetails() {
|
||||||
|
boolean isProfile = Utils.isManagedProfile(
|
||||||
|
UserManager.get(getActivity()), mEffectiveUserId);
|
||||||
|
if (isProfile) {
|
||||||
|
return mIsStrongAuthRequired
|
||||||
|
? R.string.lockpassword_strong_auth_required_reason_restart_work_pattern
|
||||||
|
: R.string.lockpassword_confirm_your_pattern_generic_profile;
|
||||||
|
} else {
|
||||||
|
return mIsStrongAuthRequired
|
||||||
|
? R.string.lockpassword_strong_auth_required_reason_restart_device_pattern
|
||||||
|
: R.string.lockpassword_confirm_your_pattern_generic;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Object[][] getActiveViews() {
|
private Object[][] getActiveViews() {
|
||||||
ArrayList<ArrayList<Object>> result = new ArrayList<>();
|
ArrayList<ArrayList<Object>> result = new ArrayList<>();
|
||||||
result.add(new ArrayList<Object>(Collections.singletonList(mHeaderTextView)));
|
result.add(new ArrayList<Object>(Collections.singletonList(mHeaderTextView)));
|
||||||
@@ -282,13 +288,8 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
|||||||
}
|
}
|
||||||
if (mDetailsText != null) {
|
if (mDetailsText != null) {
|
||||||
mDetailsTextView.setText(mDetailsText);
|
mDetailsTextView.setText(mDetailsText);
|
||||||
} else if (!Utils.isManagedProfile(
|
|
||||||
UserManager.get(getActivity()), mEffectiveUserId)) {
|
|
||||||
mDetailsTextView.setText(
|
|
||||||
R.string.lockpassword_confirm_your_pattern_generic);
|
|
||||||
} else {
|
} else {
|
||||||
mDetailsTextView.setText(
|
mDetailsTextView.setText(getDefaultDetails());
|
||||||
R.string.lockpassword_confirm_your_pattern_generic_profile);
|
|
||||||
}
|
}
|
||||||
mErrorTextView.setText("");
|
mErrorTextView.setText("");
|
||||||
if (isProfileChallenge()) {
|
if (isProfileChallenge()) {
|
||||||
|
Reference in New Issue
Block a user