Merge "Hint user that fingerprint cannot unlock FBE keys" into nyc-dev
diff --git a/res/layout/confirm_lock_password_base.xml b/res/layout/confirm_lock_password_base.xml
index b104f07..536617d 100644
--- a/res/layout/confirm_lock_password_base.xml
+++ b/res/layout/confirm_lock_password_base.xml
@@ -59,9 +59,15 @@
android:layout_marginEnd="16dp"
android:layout_marginTop="16dp"/>
- <View android:layout_width="match_parent"
+ <TextView
+ android:id="@+id/strongAuthRequiredText"
+ style="@style/TextAppearance.ConfirmDeviceCredentialsStrongAuthRequiredText"
+ android:layout_width="match_parent"
android:layout_height="0dp"
- android:layout_weight="1"/>
+ android:layout_weight="1"
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ android:gravity="center"/>
<EditText
android:id="@+id/password_entry"
diff --git a/res/layout/confirm_lock_pattern_base.xml b/res/layout/confirm_lock_pattern_base.xml
index c188ccf..117c499 100644
--- a/res/layout/confirm_lock_pattern_base.xml
+++ b/res/layout/confirm_lock_pattern_base.xml
@@ -59,9 +59,15 @@
android:layout_marginEnd="16dp"
android:layout_marginTop="16dp"/>
- <View android:layout_width="match_parent"
+ <TextView
+ android:id="@+id/strongAuthRequiredText"
+ style="@style/TextAppearance.ConfirmDeviceCredentialsStrongAuthRequiredText"
+ android:layout_width="match_parent"
android:layout_height="0dp"
- android:layout_weight="0.5"/>
+ android:layout_weight="0.5"
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ android:gravity="center"/>
<com.android.internal.widget.LockPatternView
android:id="@+id/lockPattern"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 311d494..ffcba69 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -3069,6 +3069,13 @@
<!-- Message to be used to explain the user that he needs to enter his work password to continue a
particular operation. [CHAR LIMIT=70]-->
<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 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>
<!-- Security & location settings screen, change security method screen instruction if user
enters incorrect PIN [CHAR LIMIT=30] -->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 45d2c11..0eb566c 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -357,6 +357,11 @@
<item name="android:textColor">@color/warning</item>
</style>
+ <style name="TextAppearance.ConfirmDeviceCredentialsStrongAuthRequiredText"
+ parent="android:TextAppearance.Material.Body1">
+ <item name="android:textColor">?android:attr/textColorSecondary</item>
+ </style>
+
<style name="TextAppearance.Small.SwitchBar">
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:textStyle">normal</item>
diff --git a/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java b/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java
index 16b028f..0572bcf 100644
--- a/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java
+++ b/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java
@@ -66,6 +66,7 @@
PACKAGE + ".ConfirmCredentials.showWhenLocked";
private FingerprintUiHelper mFingerprintHelper;
+ private boolean mIsStrongAuthRequired;
private boolean mAllowFpAuthentication;
protected Button mCancelButton;
protected ImageView mFingerprintIcon;
@@ -73,6 +74,7 @@
protected int mUserId;
protected LockPatternUtils mLockPatternUtils;
protected TextView mErrorTextView;
+ protected TextView mStrongAuthRequiredTextView;
protected final Handler mHandler = new Handler();
@Override
@@ -85,7 +87,9 @@
mUserId = Utils.getUserIdFromBundle(getActivity(), intent.getExtras());
final UserManager userManager = UserManager.get(getActivity());
mEffectiveUserId = userManager.getCredentialOwnerProfile(mUserId);
- mAllowFpAuthentication = mAllowFpAuthentication && !isFingerprintDisabledByAdmin();
+ mIsStrongAuthRequired = isStrongAuthRequired();
+ mAllowFpAuthentication = mAllowFpAuthentication && !isFingerprintDisabledByAdmin()
+ && !mIsStrongAuthRequired;
mLockPatternUtils = new LockPatternUtils(getActivity());
}
@@ -93,6 +97,11 @@
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
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);
mFingerprintHelper = new FingerprintUiHelper(
mFingerprintIcon,
@@ -123,6 +132,10 @@
return (disabledFeatures & DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT) != 0;
}
+ private boolean isStrongAuthRequired() {
+ return !(UserManager.get(getContext()).isUserUnlocked(mEffectiveUserId));
+ }
+
@Override
public void onResume() {
super.onResume();
diff --git a/src/com/android/settings/ConfirmLockPassword.java b/src/com/android/settings/ConfirmLockPassword.java
index d7bdb8b..ca4be6c 100644
--- a/src/com/android/settings/ConfirmLockPassword.java
+++ b/src/com/android/settings/ConfirmLockPassword.java
@@ -124,6 +124,18 @@
|| DevicePolicyManager.PASSWORD_QUALITY_COMPLEX == 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(
Context.INPUT_METHOD_SERVICE);
diff --git a/src/com/android/settings/ConfirmLockPattern.java b/src/com/android/settings/ConfirmLockPattern.java
index 0a52d21..875fcb7 100644
--- a/src/com/android/settings/ConfirmLockPattern.java
+++ b/src/com/android/settings/ConfirmLockPattern.java
@@ -118,6 +118,7 @@
mHeaderTextView = (TextView) view.findViewById(R.id.headerText);
mLockPatternView = (LockPatternView) view.findViewById(R.id.lockPattern);
mDetailsTextView = (TextView) view.findViewById(R.id.detailsText);
+ mStrongAuthRequiredTextView = (TextView) view.findViewById(R.id.strongAuthRequiredText);
mErrorTextView = (TextView) view.findViewById(R.id.errorText);
mLeftSpacerLandscape = view.findViewById(R.id.leftSpacer);
mRightSpacerLandscape = view.findViewById(R.id.rightSpacer);
@@ -176,6 +177,12 @@
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;
}