Update titles & messages for password enrolment flows

Show different titles and description messages when
enrolling password under various conditions:
* personal lock verus work lock
* adding a new lock versus updating existing lock
* enrolling a PIN verus password versus pattern

Add icons to options in screen lock picker.

Add an option to redirect to work lock flow if the admin
has set device-wide password requirement.

Bug: 183922696
Test: m RunSettingsRoboTests -j ROBOTEST_FILTER=com.android.settings.password
Change-Id: I40417b113814659d3226a44eb7f9d553386e3c58
This commit is contained in:
Rubin Xu
2021-03-25 10:34:28 +00:00
parent cdd73e7fec
commit 1ac05237ab
17 changed files with 283 additions and 99 deletions

View File

@@ -0,0 +1,28 @@
<!--
Copyright (C) 2021 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6h2c0,-1.66 1.34,-3 3,-3s3,1.34 3,3v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM18,20L6,20L6,10h12v10z"
android:fillColor="?attr/sudListItemIconColor"/>
<path
android:pathData="M12,15m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0"
android:fillColor="?attr/sudListItemIconColor"/>
</vector>

View File

@@ -0,0 +1,25 @@
<!--
Copyright (C) 2021 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M6,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,20c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM6,20c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM6,14c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,14c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM16,6c0,1.1 0.9,2 2,2s2,-0.9 2,-2 -0.9,-2 -2,-2 -2,0.9 -2,2zM12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM18,14c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM18,20c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2z"
android:fillColor="?attr/sudListItemIconColor"/>
</vector>

View File

@@ -0,0 +1,28 @@
<!--
Copyright (C) 2021 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M20.5,2v2.02C18.18,2.13 15.22,1 12,1S5.82,2.13 3.5,4.02V2H2v3.5V7h1.5H7V5.5H4.09c2.11,-1.86 4.88,-3 7.91,-3s5.79,1.14 7.91,3H17V7h3.5H22V5.5V2H20.5z"
android:fillColor="?attr/sudListItemIconColor"/>
<path
android:pathData="M18.89,13.77l-3.8,-1.67C14.96,12.04 14.81,12 14.65,12H14l0,-4.37c0,-1.32 -0.96,-2.5 -2.27,-2.62C10.25,4.88 9,6.05 9,7.5v8.15l-1.87,-0.4c-0.19,-0.03 -1.02,-0.15 -1.73,0.56L4,17.22l5.12,5.19C9.49,22.79 10,23 10.53,23h6.55c0.98,0 1.81,-0.7 1.97,-1.67l0.92,-5.44C20.12,15.03 19.68,14.17 18.89,13.77zM18,15.56L17.08,21h-6.55l-3.7,-3.78L11,18.11V7.5C11,7.22 11.22,7 11.5,7S12,7.22 12,7.5v6.18h1.76L18,15.56z"
android:fillColor="?attr/sudListItemIconColor"/>
</vector>

View File

@@ -23,5 +23,4 @@
android:minHeight="56dp" android:minHeight="56dp"
android:paddingStart="?android:attr/listPreferredItemPaddingStart" android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:text="@string/lock_settings_picker_biometric_message"
style="@style/BiometricHeaderStyle" /> style="@style/BiometricHeaderStyle" />

View File

@@ -21,8 +21,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:icon="@drawable/ic_lock" android:icon="@drawable/ic_lock"
android:importantForAutofill="noExcludeDescendants" android:importantForAutofill="noExcludeDescendants">
settings:sucHeaderText="@string/lockpassword_choose_your_screen_lock_header">
<LinearLayout <LinearLayout
style="@style/SudContentFrame" style="@style/SudContentFrame"

View File

@@ -23,8 +23,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:icon="@drawable/ic_lock" android:icon="@drawable/ic_lock"
android:layout="@layout/sud_glif_blank_template" android:layout="@layout/sud_glif_blank_template">
settings:sucHeaderText="@string/lockpassword_choose_your_screen_lock_header">
<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient <com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
android:id="@+id/topLayout" android:id="@+id/topLayout"

View File

@@ -1311,8 +1311,17 @@
<!-- Title for security picker to choose the unlock method: None/Pattern/PIN/Password [CHAR LIMIT=22] --> <!-- Title for security picker to choose the unlock method: None/Pattern/PIN/Password [CHAR LIMIT=22] -->
<string name="lock_settings_picker_title">Choose screen lock</string> <string name="lock_settings_picker_title">Choose screen lock</string>
<!-- Title for security picker to choose the profile unlock method: None/Pattern/PIN/Password [CHAR LIMIT=22] --> <!-- Screen title. This title is asking the user to choose a type of screen lock for their device, such as a pattern, PIN, or password. [CHAR LIMIT=27] -->
<string name="lock_settings_picker_title_profile">Choose work lock</string> <string name="lock_settings_picker_new_lock_title">Choose a screen lock</string>
<!-- Screen title. This title is asking the user to choose a new screen lock for their device, such as a pattern, PIN, or password. [CHAR LIMIT=27] -->
<string name="lock_settings_picker_update_lock_title">Choose a new screen lock</string>
<!-- Screen title. This title is asking the user to choose a type of screen lock (such as a pattern, PIN, or password) that they need to enter to use their work apps. [CHAR LIMIT=27] -->
<string name="lock_settings_picker_new_profile_lock_title">Choose a lock for work apps</string>
<!-- Screen title. This title is asking the user to choose a new screen lock (such as a pattern, PIN, or password) that they need to enter to use their work apps. [CHAR LIMIT=27] -->
<string name="lock_settings_picker_update_profile_lock_title">Choose a new work lock</string>
<!-- Title for security picker in setup wizard to choose the unlock method: None/Pattern/PIN/Password (tablet) [CHAR LIMIT=22] --> <!-- Title for security picker in setup wizard to choose the unlock method: None/Pattern/PIN/Password (tablet) [CHAR LIMIT=22] -->
<string name="setup_lock_settings_picker_title" product="tablet">Protect your tablet</string> <string name="setup_lock_settings_picker_title" product="tablet">Protect your tablet</string>
@@ -1334,6 +1343,12 @@
<!-- Message shown in screen lock picker while setting up the backup/fallback screen lock method for biometrics. Users can choose to use this method to unlock the screen instead of biometrics, or when biometrics are not accepted. [CHAR LIMIT=80] [BACKUP_MESSAGE_ID=2799884038398627882] --> <!-- Message shown in screen lock picker while setting up the backup/fallback screen lock method for biometrics. Users can choose to use this method to unlock the screen instead of biometrics, or when biometrics are not accepted. [CHAR LIMIT=80] [BACKUP_MESSAGE_ID=2799884038398627882] -->
<string name="lock_settings_picker_biometric_message">Choose your backup screen lock method</string> <string name="lock_settings_picker_biometric_message">Choose your backup screen lock method</string>
<!-- Text shown on the screen lock menu. This text is letting the user know that their IT admin can't reset their screen lock if they forget it, and they can choose to set another lock that would be specifically for their work apps. The place-holders "LINK_BEGIN" and "LINK_END" must NOT be translated. They mark a link to bring the user to enroll a work profile screen lock instead. [CHAR LIMIT=100] -->
<string name="lock_settings_picker_admin_restricted_personal_message">This lock can\u2019t be reset by your IT admin. <xliff:g id="link_begin" example="">LINK_BEGIN</xliff:g>Set a separate work lock instead<xliff:g id="link_end" example="">LINK_END</xliff:g></string>
<!-- Message shown in screen lock picker for setting up a work profile screen lock. [CHAR LIMIT=80] -->
<string name="lock_settings_picker_profile_message">If you forget this lock, ask your IT admin to reset it</string>
<!-- Label for button in screen lock settings, allowing users to choose other types of screen locks. [CHAR LIMIT=40] --> <!-- Label for button in screen lock settings, allowing users to choose other types of screen locks. [CHAR LIMIT=40] -->
<string name="setup_lock_settings_options_button_label">Screen lock options</string> <string name="setup_lock_settings_options_button_label">Screen lock options</string>
@@ -4289,10 +4304,19 @@
<string name="settings_safetylegal_activity_loading">Loading\u2026</string> <string name="settings_safetylegal_activity_loading">Loading\u2026</string>
<!-- Lock Pattern settings --> <!-- Lock Pattern settings -->
<!-- Header on first screen of choose password/PIN flow [CHAR LIMIT=40] --> <!-- Header on first screen of choose device password flow [CHAR LIMIT=40] -->
<string name="lockpassword_choose_your_screen_lock_header">Set screen lock</string> <string name="lockpassword_choose_your_password_header">Set a password</string>
<!-- Message on first screen of choose password flow [CHAR LIMIT=NONE] --> <!-- Header on first screen of choose work profile password flow [CHAR LIMIT=40] -->
<string name="lockpassword_choose_your_password_message">For security, set password</string> <string name="lockpassword_choose_your_profile_password_header">Set a work password</string>
<!-- Header on first screen of choose device PIN flow [CHAR LIMIT=40] -->
<string name="lockpassword_choose_your_pin_header">Set a PIN</string>
<!-- Header on first screen of choose work profile PIN flow [CHAR LIMIT=40] -->
<string name="lockpassword_choose_your_profile_pin_header">Set a work PIN</string>
<!-- Header on first screen of choose device pattern flow [CHAR LIMIT=40] -->
<string name="lockpassword_choose_your_pattern_header">Set a pattern</string>
<!-- Header on first screen of choose work profile pattern flow [CHAR LIMIT=40] -->
<string name="lockpassword_choose_your_profile_pattern_header">Set a work pattern</string>
<!-- Header on first screen of choose password/PIN as backup for fingerprint flow. If this string cannot be translated in under 40 characters, please translate "Set fingerprint backup" [CHAR LIMIT=40] --> <!-- Header on first screen of choose password/PIN as backup for fingerprint flow. If this string cannot be translated in under 40 characters, please translate "Set fingerprint backup" [CHAR LIMIT=40] -->
<string name="lockpassword_choose_your_password_header_for_fingerprint">To use fingerprint, set password</string> <string name="lockpassword_choose_your_password_header_for_fingerprint">To use fingerprint, set password</string>
<!-- Header on first screen of choose pattern as backup for fingerprint flow. If this string cannot be translated in under 40 characters, please translate "Set fingerprint backup" [CHAR LIMIT=40] --> <!-- Header on first screen of choose pattern as backup for fingerprint flow. If this string cannot be translated in under 40 characters, please translate "Set fingerprint backup" [CHAR LIMIT=40] -->
@@ -4301,10 +4325,10 @@
<string name="lockpassword_choose_your_pin_message">For security, set PIN</string> <string name="lockpassword_choose_your_pin_message">For security, set PIN</string>
<!-- Header on first screen of choose password/PIN as backup for fingerprint flow. If this string cannot be translated in under 40 characters, please translate "Set fingerprint backup" [CHAR LIMIT=40] --> <!-- Header on first screen of choose password/PIN as backup for fingerprint flow. If this string cannot be translated in under 40 characters, please translate "Set fingerprint backup" [CHAR LIMIT=40] -->
<string name="lockpassword_choose_your_pin_header_for_fingerprint">To use fingerprint, set PIN</string> <string name="lockpassword_choose_your_pin_header_for_fingerprint">To use fingerprint, set PIN</string>
<!-- Message on first screen of choose pattern flow [CHAR LIMIT=NONE] -->
<string name="lockpassword_choose_your_pattern_message">For security, set pattern</string>
<!-- Header on password confirm screen [CHAR LIMIT=40] --> <!-- Header on password confirm screen [CHAR LIMIT=40] -->
<string name="lockpassword_confirm_your_password_header">Re-enter your password</string> <string name="lockpassword_confirm_your_password_header">Re-enter your password</string>
<!-- Header on work profile password confirm screen [CHAR LIMIT=40] -->
<string name="lockpassword_reenter_your_profile_password_header">Re-enter your work password</string>
<!-- Header on password confirm screen for the work profile [CHAR LIMIT=40] --> <!-- Header on password confirm screen for the work profile [CHAR LIMIT=40] -->
<string name="lockpassword_confirm_your_work_password_header">Enter your work password</string> <string name="lockpassword_confirm_your_work_password_header">Enter your work password</string>
<!-- Header on pattern confirm screen [CHAR LIMIT=30] --> <!-- Header on pattern confirm screen [CHAR LIMIT=30] -->
@@ -4313,6 +4337,8 @@
<string name="lockpassword_confirm_your_work_pattern_header">Enter your work pattern</string> <string name="lockpassword_confirm_your_work_pattern_header">Enter your work pattern</string>
<!-- Header on password confirm screen [CHAR LIMIT=40] --> <!-- Header on password confirm screen [CHAR LIMIT=40] -->
<string name="lockpassword_confirm_your_pin_header">Re-enter your PIN</string> <string name="lockpassword_confirm_your_pin_header">Re-enter your PIN</string>
<!-- Header on work profile password confirm screen [CHAR LIMIT=40] -->
<string name="lockpassword_reenter_your_profile_pin_header">Re-enter your work PIN</string>
<!-- Header on password confirm screen for the work profile [CHAR LIMIT=40] --> <!-- Header on password confirm screen for the work profile [CHAR LIMIT=40] -->
<string name="lockpassword_confirm_your_work_pin_header">Enter your work PIN</string> <string name="lockpassword_confirm_your_work_pin_header">Enter your work PIN</string>
<!-- Header on password confirm screen if second password doesn't match the first. [CHAR LIMIT=30] --> <!-- Header on password confirm screen if second password doesn't match the first. [CHAR LIMIT=30] -->

View File

@@ -16,32 +16,36 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto" xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/lock_settings_picker_title"
android:key="lock_settings_picker"> android:key="lock_settings_picker">
<com.android.settingslib.RestrictedPreference <com.android.settingslib.RestrictedPreference
android:key="unlock_set_off" android:key="unlock_set_off"
android:title="@string/unlock_set_unlock_off_title" android:title="@string/unlock_set_unlock_off_title"
android:icon="@drawable/ic_lock_none"
android:persistent="false"/> android:persistent="false"/>
<com.android.settingslib.RestrictedPreference <com.android.settingslib.RestrictedPreference
android:key="unlock_set_none" android:key="unlock_set_none"
android:title="@string/unlock_set_unlock_none_title" android:title="@string/unlock_set_unlock_none_title"
android:icon="@drawable/ic_lock_swipe"
android:persistent="false"/> android:persistent="false"/>
<com.android.settingslib.RestrictedPreference <com.android.settingslib.RestrictedPreference
android:key="unlock_set_pattern" android:key="unlock_set_pattern"
android:title="@string/unlock_set_unlock_pattern_title" android:title="@string/unlock_set_unlock_pattern_title"
android:icon="@drawable/ic_pattern"
android:persistent="false"/> android:persistent="false"/>
<com.android.settingslib.RestrictedPreference <com.android.settingslib.RestrictedPreference
android:key="unlock_set_pin" android:key="unlock_set_pin"
android:title="@string/unlock_set_unlock_pin_title" android:title="@string/unlock_set_unlock_pin_title"
android:icon="@drawable/ic_lock_pin"
android:persistent="false"/> android:persistent="false"/>
<com.android.settingslib.RestrictedPreference <com.android.settingslib.RestrictedPreference
android:key="unlock_set_password" android:key="unlock_set_password"
android:title="@string/unlock_set_unlock_password_title" android:title="@string/unlock_set_unlock_password_title"
android:icon="@drawable/ic_password"
android:persistent="false"/> android:persistent="false"/>
<com.android.settingslib.RestrictedPreference <com.android.settingslib.RestrictedPreference

View File

@@ -16,32 +16,36 @@
--> -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/lock_settings_picker_title"
android:key="lock_settings_picker"> android:key="lock_settings_picker">
<com.android.settingslib.RestrictedPreference <com.android.settingslib.RestrictedPreference
android:key="unlock_set_off" android:key="unlock_set_off"
android:title="@string/unlock_set_unlock_off_title" android:title="@string/unlock_set_unlock_off_title"
android:icon="@drawable/ic_lock_none"
android:persistent="false"/> android:persistent="false"/>
<com.android.settingslib.RestrictedPreference <com.android.settingslib.RestrictedPreference
android:key="unlock_set_none" android:key="unlock_set_none"
android:title="@string/unlock_set_unlock_none_title" android:title="@string/unlock_set_unlock_none_title"
android:icon="@drawable/ic_lock_swipe"
android:persistent="false"/> android:persistent="false"/>
<com.android.settingslib.RestrictedPreference <com.android.settingslib.RestrictedPreference
android:key="unlock_set_pattern" android:key="unlock_set_pattern"
android:title="@string/unlock_set_unlock_pattern_title" android:title="@string/unlock_set_unlock_pattern_title"
android:icon="@drawable/ic_pattern"
android:persistent="false"/> android:persistent="false"/>
<com.android.settingslib.RestrictedPreference <com.android.settingslib.RestrictedPreference
android:key="unlock_set_pin" android:key="unlock_set_pin"
android:title="@string/unlock_set_unlock_pin_title" android:title="@string/unlock_set_unlock_pin_title"
android:icon="@drawable/ic_lock_pin"
android:persistent="false"/> android:persistent="false"/>
<com.android.settingslib.RestrictedPreference <com.android.settingslib.RestrictedPreference
android:key="unlock_set_password" android:key="unlock_set_password"
android:title="@string/unlock_set_unlock_password_title" android:title="@string/unlock_set_unlock_password_title"
android:icon="@drawable/ic_password"
android:persistent="false"/> android:persistent="false"/>
<com.android.settingslib.RestrictedPreference <com.android.settingslib.RestrictedPreference

View File

@@ -47,6 +47,9 @@ import android.service.persistentdata.PersistentDataBlockManager;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.EventLog; import android.util.EventLog;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityManager;
import android.widget.TextView; import android.widget.TextView;
@@ -62,12 +65,14 @@ import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.LockscreenCredential; import com.android.internal.widget.LockscreenCredential;
import com.android.settings.EncryptionInterstitial; import com.android.settings.EncryptionInterstitial;
import com.android.settings.EventLogTags; import com.android.settings.EventLogTags;
import com.android.settings.LinkifyUtils;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.SettingsActivity; import com.android.settings.SettingsActivity;
import com.android.settings.SettingsPreferenceFragment; import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.Utils; import com.android.settings.Utils;
import com.android.settings.biometrics.BiometricEnrollActivity; import com.android.settings.biometrics.BiometricEnrollActivity;
import com.android.settings.biometrics.BiometricEnrollBase; import com.android.settings.biometrics.BiometricEnrollBase;
import com.android.settings.core.SubSettingLauncher;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment; import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
import com.android.settings.search.SearchFeatureProvider; import com.android.settings.search.SearchFeatureProvider;
import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin; import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
@@ -154,7 +159,13 @@ public class ChooseLockGeneric extends SettingsActivity {
private FingerprintManager mFingerprintManager; private FingerprintManager mFingerprintManager;
private FaceManager mFaceManager; private FaceManager mFaceManager;
private int mUserId; private int mUserId;
private boolean mIsManagedProfile;
private ManagedLockPasswordProvider mManagedPasswordProvider; private ManagedLockPasswordProvider mManagedPasswordProvider;
/**
* Whether the activity is launched by admins via
* {@link DevicePolicyManager#ACTION_SET_NEW_PASSWORD} or
* {@link DevicePolicyManager#ACTION_SET_NEW_PARENT_PROFILE_PASSWORD}
*/
private boolean mIsSetNewPassword = false; private boolean mIsSetNewPassword = false;
private UserManager mUserManager; private UserManager mUserManager;
private ChooseLockGenericController mController; private ChooseLockGenericController mController;
@@ -215,6 +226,10 @@ public class ChooseLockGeneric extends SettingsActivity {
mPasswordConfirmed = !confirmCredentials; mPasswordConfirmed = !confirmCredentials;
mUserPassword = intent.getParcelableExtra( mUserPassword = intent.getParcelableExtra(
ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD); ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD);
} else if (arguments != null) {
mUserPassword = (LockscreenCredential) arguments.getParcelable(
ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD);
mPasswordConfirmed = mUserPassword != null;
} }
mRequestGatekeeperPasswordHandle = intent.getBooleanExtra( mRequestGatekeeperPasswordHandle = intent.getBooleanExtra(
@@ -261,6 +276,7 @@ public class ChooseLockGeneric extends SettingsActivity {
UserManager.get(activity), UserManager.get(activity),
arguments, arguments,
intent.getExtras()).getIdentifier(); intent.getExtras()).getIdentifier();
mIsManagedProfile = UserManager.get(getActivity()).isManagedProfile(mUserId);
mController = new ChooseLockGenericController( mController = new ChooseLockGenericController(
getContext(), mUserId, mRequestedMinComplexity, getContext(), mUserId, mRequestedMinComplexity,
mOnlyEnforceDevicePasswordRequirement, mOnlyEnforceDevicePasswordRequirement,
@@ -278,12 +294,6 @@ public class ChooseLockGeneric extends SettingsActivity {
mCallerAppName = isComplexityProvidedByAdmin ? null : mCallerAppName = isComplexityProvidedByAdmin ? null :
intent.getStringExtra(EXTRA_KEY_CALLER_APP_NAME); intent.getStringExtra(EXTRA_KEY_CALLER_APP_NAME);
if (ACTION_SET_NEW_PASSWORD.equals(chooseLockAction)
&& UserManager.get(activity).isManagedProfile(mUserId)
&& mLockPatternUtils.isSeparateProfileChallengeEnabled(mUserId)) {
activity.setTitle(R.string.lock_settings_picker_title_profile);
}
mManagedPasswordProvider = ManagedLockPasswordProvider.get(activity, mUserId); mManagedPasswordProvider = ManagedLockPasswordProvider.get(activity, mUserId);
if (mPasswordConfirmed) { if (mPasswordConfirmed) {
@@ -300,7 +310,7 @@ public class ChooseLockGeneric extends SettingsActivity {
.setReturnCredentials(true) .setReturnCredentials(true)
.setUserId(mUserId); .setUserId(mUserId);
boolean managedProfileWithUnifiedLock = boolean managedProfileWithUnifiedLock =
UserManager.get(activity).isManagedProfile(mUserId) mIsManagedProfile
&& !mLockPatternUtils.isSeparateProfileChallengeEnabled(mUserId); && !mLockPatternUtils.isSeparateProfileChallengeEnabled(mUserId);
boolean skipConfirmation = managedProfileWithUnifiedLock && !mIsSetNewPassword; boolean skipConfirmation = managedProfileWithUnifiedLock && !mIsSetNewPassword;
if (skipConfirmation || !builder.show()) { if (skipConfirmation || !builder.show()) {
@@ -313,6 +323,40 @@ public class ChooseLockGeneric extends SettingsActivity {
addHeaderView(); addHeaderView();
} }
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
updateActivityTitle();
return super.onCreateView(inflater, container, savedInstanceState);
}
private void updateActivityTitle() {
if (mLockPatternUtils == null) {
// mLockPatternUtils will be uninitialized if ChooseLockGenericFragment.onCreate()
// finishes early.
return;
}
final boolean updateExistingLock;
if (mIsManagedProfile) {
// Going from unified challenge -> separate challenge is considered as adding
// a new lock to the profile, while if the profile already has a separate challenge
// it's an update.
updateExistingLock = mLockPatternUtils.isSeparateProfileChallengeEnabled(mUserId);
if (updateExistingLock) {
getActivity().setTitle(R.string.lock_settings_picker_update_profile_lock_title);
} else {
getActivity().setTitle(R.string.lock_settings_picker_new_profile_lock_title);
}
} else {
updateExistingLock = mLockPatternUtils.isSecure(mUserId);
if (updateExistingLock) {
getActivity().setTitle(R.string.lock_settings_picker_update_lock_title);
} else {
getActivity().setTitle(R.string.lock_settings_picker_new_lock_title);
}
}
}
protected boolean canRunBeforeDeviceProvisioned() { protected boolean canRunBeforeDeviceProvisioned() {
PersistentDataBlockManager pdbm = (PersistentDataBlockManager) PersistentDataBlockManager pdbm = (PersistentDataBlockManager)
getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE); getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
@@ -333,14 +377,48 @@ public class ChooseLockGeneric extends SettingsActivity {
if (mForFingerprint) { if (mForFingerprint) {
if (mIsSetNewPassword) { if (mIsSetNewPassword) {
textView.setText(R.string.fingerprint_unlock_title); textView.setText(R.string.fingerprint_unlock_title);
} else {
textView.setText(R.string.lock_settings_picker_biometric_message);
} }
} else if (mForFace) { } else if (mForFace) {
if (mIsSetNewPassword) { if (mIsSetNewPassword) {
textView.setText(R.string.face_unlock_title); textView.setText(R.string.face_unlock_title);
} else {
textView.setText(R.string.lock_settings_picker_biometric_message);
} }
} else if (mForBiometrics) { } else if (mForBiometrics) {
if (mIsSetNewPassword) { if (mIsSetNewPassword) {
textView.setText(R.string.biometrics_unlock_title); textView.setText(R.string.biometrics_unlock_title);
} else {
textView.setText(R.string.lock_settings_picker_biometric_message);
}
} else {
if (mIsManagedProfile) {
textView.setText(R.string.lock_settings_picker_profile_message);
} else {
int profileUserId = Utils.getManagedProfileId(mUserManager, mUserId);
if (mController.isScreenLockRestrictedByAdmin()
&& profileUserId != UserHandle.USER_NULL) {
final StringBuilder description = new StringBuilder(getText(
R.string.lock_settings_picker_admin_restricted_personal_message));
final LinkifyUtils.OnClickListener clickListener = () -> {
final Bundle extras = new Bundle();
extras.putInt(Intent.EXTRA_USER_ID, profileUserId);
if (mUserPassword != null) {
extras.putParcelable(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD,
mUserPassword);
}
new SubSettingLauncher(getActivity())
.setDestination(ChooseLockGenericFragment.class.getName())
.setSourceMetricsCategory(getMetricsCategory())
.setArguments(extras)
.launch();
finish();
};
LinkifyUtils.linkify(textView, description, clickListener);
} else {
textView.setText("");
}
} }
} }
} }
@@ -891,8 +969,7 @@ public class ChooseLockGeneric extends SettingsActivity {
} }
private int getResIdForFactoryResetProtectionWarningTitle() { private int getResIdForFactoryResetProtectionWarningTitle() {
boolean isProfile = UserManager.get(getActivity()).isManagedProfile(mUserId); return mIsManagedProfile ? R.string.unlock_disable_frp_warning_title_profile
return isProfile ? R.string.unlock_disable_frp_warning_title_profile
: R.string.unlock_disable_frp_warning_title; : R.string.unlock_disable_frp_warning_title;
} }
@@ -903,26 +980,25 @@ public class ChooseLockGeneric extends SettingsActivity {
} else { } else {
hasFingerprints = false; hasFingerprints = false;
} }
boolean isProfile = UserManager.get(getActivity()).isManagedProfile(mUserId);
switch (mLockPatternUtils.getKeyguardStoredPasswordQuality(mUserId)) { switch (mLockPatternUtils.getKeyguardStoredPasswordQuality(mUserId)) {
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING: case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
if (hasFingerprints && isProfile) { if (hasFingerprints && mIsManagedProfile) {
return R.string return R.string
.unlock_disable_frp_warning_content_pattern_fingerprint_profile; .unlock_disable_frp_warning_content_pattern_fingerprint_profile;
} else if (hasFingerprints && !isProfile) { } else if (hasFingerprints && !mIsManagedProfile) {
return R.string.unlock_disable_frp_warning_content_pattern_fingerprint; return R.string.unlock_disable_frp_warning_content_pattern_fingerprint;
} else if (isProfile) { } else if (mIsManagedProfile) {
return R.string.unlock_disable_frp_warning_content_pattern_profile; return R.string.unlock_disable_frp_warning_content_pattern_profile;
} else { } else {
return R.string.unlock_disable_frp_warning_content_pattern; return R.string.unlock_disable_frp_warning_content_pattern;
} }
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC: case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX: case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX:
if (hasFingerprints && isProfile) { if (hasFingerprints && mIsManagedProfile) {
return R.string.unlock_disable_frp_warning_content_pin_fingerprint_profile; return R.string.unlock_disable_frp_warning_content_pin_fingerprint_profile;
} else if (hasFingerprints && !isProfile) { } else if (hasFingerprints && !mIsManagedProfile) {
return R.string.unlock_disable_frp_warning_content_pin_fingerprint; return R.string.unlock_disable_frp_warning_content_pin_fingerprint;
} else if (isProfile) { } else if (mIsManagedProfile) {
return R.string.unlock_disable_frp_warning_content_pin_profile; return R.string.unlock_disable_frp_warning_content_pin_profile;
} else { } else {
return R.string.unlock_disable_frp_warning_content_pin; return R.string.unlock_disable_frp_warning_content_pin;
@@ -931,23 +1007,23 @@ public class ChooseLockGeneric extends SettingsActivity {
case DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC: case DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC:
case DevicePolicyManager.PASSWORD_QUALITY_COMPLEX: case DevicePolicyManager.PASSWORD_QUALITY_COMPLEX:
case DevicePolicyManager.PASSWORD_QUALITY_MANAGED: case DevicePolicyManager.PASSWORD_QUALITY_MANAGED:
if (hasFingerprints && isProfile) { if (hasFingerprints && mIsManagedProfile) {
return R.string return R.string
.unlock_disable_frp_warning_content_password_fingerprint_profile; .unlock_disable_frp_warning_content_password_fingerprint_profile;
} else if (hasFingerprints && !isProfile) { } else if (hasFingerprints && !mIsManagedProfile) {
return R.string.unlock_disable_frp_warning_content_password_fingerprint; return R.string.unlock_disable_frp_warning_content_password_fingerprint;
} else if (isProfile) { } else if (mIsManagedProfile) {
return R.string.unlock_disable_frp_warning_content_password_profile; return R.string.unlock_disable_frp_warning_content_password_profile;
} else { } else {
return R.string.unlock_disable_frp_warning_content_password; return R.string.unlock_disable_frp_warning_content_password;
} }
default: default:
if (hasFingerprints && isProfile) { if (hasFingerprints && mIsManagedProfile) {
return R.string return R.string
.unlock_disable_frp_warning_content_unknown_fingerprint_profile; .unlock_disable_frp_warning_content_unknown_fingerprint_profile;
} else if (hasFingerprints && !isProfile) { } else if (hasFingerprints && !mIsManagedProfile) {
return R.string.unlock_disable_frp_warning_content_unknown_fingerprint; return R.string.unlock_disable_frp_warning_content_unknown_fingerprint;
} else if (isProfile) { } else if (mIsManagedProfile) {
return R.string.unlock_disable_frp_warning_content_unknown_profile; return R.string.unlock_disable_frp_warning_content_unknown_profile;
} else { } else {
return R.string.unlock_disable_frp_warning_content_unknown; return R.string.unlock_disable_frp_warning_content_unknown;

View File

@@ -18,6 +18,8 @@ package com.android.settings.password;
import static android.app.admin.DevicePolicyManager.PASSWORD_COMPLEXITY_NONE; import static android.app.admin.DevicePolicyManager.PASSWORD_COMPLEXITY_NONE;
import static com.android.internal.widget.LockPatternUtils.CREDENTIAL_TYPE_NONE;
import android.app.admin.DevicePolicyManager.PasswordComplexity; import android.app.admin.DevicePolicyManager.PasswordComplexity;
import android.app.admin.PasswordMetrics; import android.app.admin.PasswordMetrics;
import android.content.Context; import android.content.Context;
@@ -88,7 +90,7 @@ public class ChooseLockGenericController {
} }
/** /**
* Returns the highest quality among the specified {@code quality}, the password requiremnet * Returns the highest quality among the specified {@code quality}, the password requirement
* set by device admins (legacy password quality metrics and password complexity), and the * set by device admins (legacy password quality metrics and password complexity), and the
* min password complexity requested by the calling app. * min password complexity requested by the calling app.
*/ */
@@ -207,4 +209,9 @@ public class ChooseLockGenericController {
mLockPatternUtils.getRequestedPasswordComplexity( mLockPatternUtils.getRequestedPasswordComplexity(
mUserId, mDevicePasswordRequirementOnly)); mUserId, mDevicePasswordRequirementOnly));
} }
public boolean isScreenLockRestrictedByAdmin() {
return getAggregatedPasswordMetrics().credType != CREDENTIAL_TYPE_NONE
|| getAggregatedPasswordComplexity() != PASSWORD_COMPLEXITY_NONE;
}
} }

View File

@@ -49,6 +49,7 @@ import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.os.UserHandle; import android.os.UserHandle;
import android.os.UserManager;
import android.text.Editable; import android.text.Editable;
import android.text.InputType; import android.text.InputType;
import android.text.Selection; import android.text.Selection;
@@ -207,23 +208,6 @@ public class ChooseLockPassword extends SettingsActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
final boolean forFingerprint = getIntent()
.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT, false);
final boolean forFace = getIntent()
.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FACE, false);
final boolean forBiometrics = getIntent()
.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_BIOMETRICS, false);
CharSequence msg = getText(R.string.lockpassword_choose_your_screen_lock_header);
if (forFingerprint) {
msg = getText(R.string.lockpassword_choose_your_password_header_for_fingerprint);
} else if (forFace) {
msg = getText(R.string.lockpassword_choose_your_password_header_for_face);
} else if (forBiometrics) {
msg = getText(R.string.lockpassword_choose_your_password_header_for_biometrics);
}
setTitle(msg);
findViewById(R.id.content_parent).setFitsSystemWindows(false); findViewById(R.id.content_parent).setFitsSystemWindows(false);
} }
@@ -262,6 +246,7 @@ public class ChooseLockPassword extends SettingsActivity {
private LockscreenCredential mFirstPassword; private LockscreenCredential mFirstPassword;
private RecyclerView mPasswordRestrictionView; private RecyclerView mPasswordRestrictionView;
protected boolean mIsAlphaMode; protected boolean mIsAlphaMode;
protected boolean mIsManagedProfile;
protected FooterButton mSkipOrClearButton; protected FooterButton mSkipOrClearButton;
private FooterButton mNextButton; private FooterButton mNextButton;
private TextView mMessage; private TextView mMessage;
@@ -277,33 +262,33 @@ public class ChooseLockPassword extends SettingsActivity {
protected enum Stage { protected enum Stage {
Introduction( Introduction(
R.string.lockpassword_choose_your_screen_lock_header, // password R.string.lockpassword_choose_your_password_header, // password
R.string.lockpassword_choose_your_profile_password_header,
R.string.lockpassword_choose_your_password_header_for_fingerprint, R.string.lockpassword_choose_your_password_header_for_fingerprint,
R.string.lockpassword_choose_your_password_header_for_face, R.string.lockpassword_choose_your_password_header_for_face,
R.string.lockpassword_choose_your_password_header_for_biometrics, R.string.lockpassword_choose_your_password_header_for_biometrics,
R.string.lockpassword_choose_your_screen_lock_header, // pin R.string.lockpassword_choose_your_pin_header, // pin
R.string.lockpassword_choose_your_profile_pin_header,
R.string.lockpassword_choose_your_pin_header_for_fingerprint, R.string.lockpassword_choose_your_pin_header_for_fingerprint,
R.string.lockpassword_choose_your_pin_header_for_face, R.string.lockpassword_choose_your_pin_header_for_face,
R.string.lockpassword_choose_your_pin_header_for_biometrics, R.string.lockpassword_choose_your_pin_header_for_biometrics,
R.string.lockpassword_choose_your_password_message, // added security message
R.string.lock_settings_picker_biometrics_added_security_message, R.string.lock_settings_picker_biometrics_added_security_message,
R.string.lockpassword_choose_your_pin_message,
R.string.lock_settings_picker_biometrics_added_security_message, R.string.lock_settings_picker_biometrics_added_security_message,
R.string.next_label), R.string.next_label),
NeedToConfirm( NeedToConfirm(
R.string.lockpassword_confirm_your_password_header, R.string.lockpassword_confirm_your_password_header,
R.string.lockpassword_reenter_your_profile_password_header,
R.string.lockpassword_confirm_your_password_header, R.string.lockpassword_confirm_your_password_header,
R.string.lockpassword_confirm_your_password_header, R.string.lockpassword_confirm_your_password_header,
R.string.lockpassword_confirm_your_password_header, R.string.lockpassword_confirm_your_password_header,
R.string.lockpassword_confirm_your_pin_header, R.string.lockpassword_confirm_your_pin_header,
R.string.lockpassword_reenter_your_profile_pin_header,
R.string.lockpassword_confirm_your_pin_header, R.string.lockpassword_confirm_your_pin_header,
R.string.lockpassword_confirm_your_pin_header, R.string.lockpassword_confirm_your_pin_header,
R.string.lockpassword_confirm_your_pin_header, R.string.lockpassword_confirm_your_pin_header,
0, 0,
0, 0,
0,
0,
R.string.lockpassword_confirm_label), R.string.lockpassword_confirm_label),
ConfirmWrong( ConfirmWrong(
@@ -311,36 +296,36 @@ public class ChooseLockPassword extends SettingsActivity {
R.string.lockpassword_confirm_passwords_dont_match, R.string.lockpassword_confirm_passwords_dont_match,
R.string.lockpassword_confirm_passwords_dont_match, R.string.lockpassword_confirm_passwords_dont_match,
R.string.lockpassword_confirm_passwords_dont_match, R.string.lockpassword_confirm_passwords_dont_match,
R.string.lockpassword_confirm_passwords_dont_match,
R.string.lockpassword_confirm_pins_dont_match,
R.string.lockpassword_confirm_pins_dont_match, R.string.lockpassword_confirm_pins_dont_match,
R.string.lockpassword_confirm_pins_dont_match, R.string.lockpassword_confirm_pins_dont_match,
R.string.lockpassword_confirm_pins_dont_match, R.string.lockpassword_confirm_pins_dont_match,
R.string.lockpassword_confirm_pins_dont_match, R.string.lockpassword_confirm_pins_dont_match,
0,
0,
0, 0,
0, 0,
R.string.lockpassword_confirm_label); R.string.lockpassword_confirm_label);
Stage(int hintInAlpha, Stage(int hintInAlpha, int hintInAlphaForProfile,
int hintInAlphaForFingerprint, int hintInAlphaForFace, int hintInAlphaForBiometrics, int hintInAlphaForFingerprint, int hintInAlphaForFace, int hintInAlphaForBiometrics,
int hintInNumeric, int hintInNumeric, int hintInNumericForProfile,
int hintInNumericForFingerprint, int hintInNumericForFace, int hintInNumericForBiometrics, int hintInNumericForFingerprint, int hintInNumericForFace, int hintInNumericForBiometrics,
int messageInAlpha, int messageInAlphaForBiometrics, int messageInAlphaForBiometrics,
int messageInNumeric, int messageInNumericForBiometrics, int messageInNumericForBiometrics,
int nextButtonText) { int nextButtonText) {
this.alphaHint = hintInAlpha; this.alphaHint = hintInAlpha;
this.alphaHintForProfile = hintInAlphaForProfile;
this.alphaHintForFingerprint = hintInAlphaForFingerprint; this.alphaHintForFingerprint = hintInAlphaForFingerprint;
this.alphaHintForFace = hintInAlphaForFace; this.alphaHintForFace = hintInAlphaForFace;
this.alphaHintForBiometrics = hintInAlphaForBiometrics; this.alphaHintForBiometrics = hintInAlphaForBiometrics;
this.numericHint = hintInNumeric; this.numericHint = hintInNumeric;
this.numericHintForProfile = hintInNumericForProfile;
this.numericHintForFingerprint = hintInNumericForFingerprint; this.numericHintForFingerprint = hintInNumericForFingerprint;
this.numericHintForFace = hintInNumericForFace; this.numericHintForFace = hintInNumericForFace;
this.numericHintForBiometrics = hintInNumericForBiometrics; this.numericHintForBiometrics = hintInNumericForBiometrics;
this.alphaMessage = messageInAlpha;
this.alphaMessageForBiometrics = messageInAlphaForBiometrics; this.alphaMessageForBiometrics = messageInAlphaForBiometrics;
this.numericMessage = messageInNumeric;
this.numericMessageForBiometrics = messageInNumericForBiometrics; this.numericMessageForBiometrics = messageInNumericForBiometrics;
this.buttonText = nextButtonText; this.buttonText = nextButtonText;
} }
@@ -352,23 +337,23 @@ public class ChooseLockPassword extends SettingsActivity {
// Password // Password
public final int alphaHint; public final int alphaHint;
public final int alphaHintForProfile;
public final int alphaHintForFingerprint; public final int alphaHintForFingerprint;
public final int alphaHintForFace; public final int alphaHintForFace;
public final int alphaHintForBiometrics; public final int alphaHintForBiometrics;
// PIN // PIN
public final int numericHint; public final int numericHint;
public final int numericHintForProfile;
public final int numericHintForFingerprint; public final int numericHintForFingerprint;
public final int numericHintForFace; public final int numericHintForFace;
public final int numericHintForBiometrics; public final int numericHintForBiometrics;
public final int alphaMessage;
public final int alphaMessageForBiometrics; public final int alphaMessageForBiometrics;
public final int numericMessage;
public final int numericMessageForBiometrics; public final int numericMessageForBiometrics;
public final int buttonText; public final int buttonText;
public @StringRes int getHint(boolean isAlpha, int type) { public @StringRes int getHint(boolean isAlpha, int type, boolean isProfile) {
if (isAlpha) { if (isAlpha) {
if (type == TYPE_FINGERPRINT) { if (type == TYPE_FINGERPRINT) {
return alphaHintForFingerprint; return alphaHintForFingerprint;
@@ -377,7 +362,7 @@ public class ChooseLockPassword extends SettingsActivity {
} else if (type == TYPE_BIOMETRIC) { } else if (type == TYPE_BIOMETRIC) {
return alphaHintForBiometrics; return alphaHintForBiometrics;
} else { } else {
return alphaHint; return isProfile ? alphaHintForProfile : alphaHint;
} }
} else { } else {
if (type == TYPE_FINGERPRINT) { if (type == TYPE_FINGERPRINT) {
@@ -387,16 +372,16 @@ public class ChooseLockPassword extends SettingsActivity {
} else if (type == TYPE_BIOMETRIC) { } else if (type == TYPE_BIOMETRIC) {
return numericHintForBiometrics; return numericHintForBiometrics;
} else { } else {
return numericHint; return isProfile ? numericHintForProfile : numericHint;
} }
} }
} }
public @StringRes int getMessage(boolean isAlpha, int type) { public @StringRes int getMessage(boolean isAlpha, int type) {
if (isAlpha) { if (isAlpha) {
return type != TYPE_NONE ? alphaMessageForBiometrics : alphaMessage; return type != TYPE_NONE ? alphaMessageForBiometrics : 0;
} else { } else {
return type != TYPE_NONE ? numericMessageForBiometrics : numericMessage; return type != TYPE_NONE ? numericMessageForBiometrics : 0;
} }
} }
} }
@@ -416,6 +401,7 @@ public class ChooseLockPassword extends SettingsActivity {
} }
// Only take this argument into account if it belongs to the current profile. // Only take this argument into account if it belongs to the current profile.
mUserId = Utils.getUserIdFromBundle(getActivity(), intent.getExtras()); mUserId = Utils.getUserIdFromBundle(getActivity(), intent.getExtras());
mIsManagedProfile = UserManager.get(getActivity()).isManagedProfile(mUserId);
mForFingerprint = intent.getBooleanExtra( mForFingerprint = intent.getBooleanExtra(
ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT, false); ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT, false);
mForFace = intent.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FACE, false); mForFace = intent.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FACE, false);
@@ -576,7 +562,8 @@ public class ChooseLockPassword extends SettingsActivity {
if (activity instanceof SettingsActivity) { if (activity instanceof SettingsActivity) {
final SettingsActivity sa = (SettingsActivity) activity; final SettingsActivity sa = (SettingsActivity) activity;
int title = Stage.Introduction.getHint(mIsAlphaMode, getStageType()); int title = Stage.Introduction.getHint(mIsAlphaMode, getStageType(),
mIsManagedProfile);
sa.setTitle(title); sa.setTitle(title);
mLayout.setHeaderText(title); mLayout.setHeaderText(title);
} }
@@ -870,7 +857,8 @@ public class ChooseLockPassword extends SettingsActivity {
} else { } else {
// Hide password requirement view when we are just asking user to confirm the pw. // Hide password requirement view when we are just asking user to confirm the pw.
mPasswordRestrictionView.setVisibility(View.GONE); mPasswordRestrictionView.setVisibility(View.GONE);
setHeaderText(getString(mUiStage.getHint(mIsAlphaMode, getStageType()))); setHeaderText(getString(mUiStage.getHint(mIsAlphaMode, getStageType(),
mIsManagedProfile)));
setNextEnabled(canInput && length >= LockPatternUtils.MIN_LOCK_PASSWORD_SIZE); setNextEnabled(canInput && length >= LockPatternUtils.MIN_LOCK_PASSWORD_SIZE);
mSkipOrClearButton.setVisibility(toVisibility(canInput && length > 0)); mSkipOrClearButton.setVisibility(toVisibility(canInput && length > 0));
} }

View File

@@ -27,6 +27,7 @@ import android.content.res.ColorStateList;
import android.content.res.Resources.Theme; import android.content.res.Resources.Theme;
import android.os.Bundle; import android.os.Bundle;
import android.os.UserHandle; import android.os.UserHandle;
import android.os.UserManager;
import android.util.Log; import android.util.Log;
import android.util.Pair; import android.util.Pair;
import android.util.TypedValue; import android.util.TypedValue;
@@ -172,19 +173,6 @@ public class ChooseLockPattern extends SettingsActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
// requestWindowFeature(Window.FEATURE_NO_TITLE); // requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
final boolean forFingerprint = getIntent()
.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT, false);
final boolean forFace = getIntent()
.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FACE, false);
int msg = R.string.lockpassword_choose_your_screen_lock_header;
if (forFingerprint) {
msg = R.string.lockpassword_choose_your_pattern_header_for_fingerprint;
} else if (forFace) {
msg = R.string.lockpassword_choose_your_pattern_header_for_face;
}
setTitle(msg);
findViewById(R.id.content_parent).setFitsSystemWindows(false); findViewById(R.id.content_parent).setFitsSystemWindows(false);
} }
@@ -390,7 +378,7 @@ public class ChooseLockPattern extends SettingsActivity {
Introduction( Introduction(
R.string.lock_settings_picker_biometrics_added_security_message, R.string.lock_settings_picker_biometrics_added_security_message,
R.string.lockpassword_choose_your_pattern_message, ID_EMPTY_MESSAGE,
R.string.lockpattern_recording_intro_header, R.string.lockpattern_recording_intro_header,
LeftButtonMode.Gone, RightButtonMode.ContinueDisabled, LeftButtonMode.Gone, RightButtonMode.ContinueDisabled,
ID_EMPTY_MESSAGE, true), ID_EMPTY_MESSAGE, true),
@@ -399,13 +387,13 @@ public class ChooseLockPattern extends SettingsActivity {
LeftButtonMode.Gone, RightButtonMode.Ok, ID_EMPTY_MESSAGE, false), LeftButtonMode.Gone, RightButtonMode.Ok, ID_EMPTY_MESSAGE, false),
ChoiceTooShort( ChoiceTooShort(
R.string.lock_settings_picker_biometrics_added_security_message, R.string.lock_settings_picker_biometrics_added_security_message,
R.string.lockpassword_choose_your_pattern_message, ID_EMPTY_MESSAGE,
R.string.lockpattern_recording_incorrect_too_short, R.string.lockpattern_recording_incorrect_too_short,
LeftButtonMode.Retry, RightButtonMode.ContinueDisabled, LeftButtonMode.Retry, RightButtonMode.ContinueDisabled,
ID_EMPTY_MESSAGE, true), ID_EMPTY_MESSAGE, true),
FirstChoiceValid( FirstChoiceValid(
R.string.lock_settings_picker_biometrics_added_security_message, R.string.lock_settings_picker_biometrics_added_security_message,
R.string.lockpassword_choose_your_pattern_message, ID_EMPTY_MESSAGE,
R.string.lockpattern_pattern_entered_header, R.string.lockpattern_pattern_entered_header,
LeftButtonMode.Retry, RightButtonMode.Continue, ID_EMPTY_MESSAGE, false), LeftButtonMode.Retry, RightButtonMode.Continue, ID_EMPTY_MESSAGE, false),
NeedToConfirm( NeedToConfirm(
@@ -464,6 +452,7 @@ public class ChooseLockPattern extends SettingsActivity {
private LockPatternUtils mLockPatternUtils; private LockPatternUtils mLockPatternUtils;
private SaveAndFinishWorker mSaveAndFinishWorker; private SaveAndFinishWorker mSaveAndFinishWorker;
protected int mUserId; protected int mUserId;
protected boolean mIsManagedProfile;
protected boolean mForFingerprint; protected boolean mForFingerprint;
protected boolean mForFace; protected boolean mForFace;
protected boolean mForBiometrics; protected boolean mForBiometrics;
@@ -481,6 +470,7 @@ public class ChooseLockPattern extends SettingsActivity {
Intent intent = getActivity().getIntent(); Intent intent = getActivity().getIntent();
// Only take this argument into account if it belongs to the current profile. // Only take this argument into account if it belongs to the current profile.
mUserId = Utils.getUserIdFromBundle(getActivity(), intent.getExtras()); mUserId = Utils.getUserIdFromBundle(getActivity(), intent.getExtras());
mIsManagedProfile = UserManager.get(getActivity()).isManagedProfile(mUserId);
mLockPatternUtils = new LockPatternUtils(getActivity()); mLockPatternUtils = new LockPatternUtils(getActivity());
@@ -504,6 +494,20 @@ public class ChooseLockPattern extends SettingsActivity {
ChooseLockSettingsHelper.EXTRA_KEY_FOR_BIOMETRICS, false); ChooseLockSettingsHelper.EXTRA_KEY_FOR_BIOMETRICS, false);
} }
private void updateActivityTitle() {
final int msg;
if (mForFingerprint) {
msg = R.string.lockpassword_choose_your_pattern_header_for_fingerprint;
} else if (mForFace) {
msg = R.string.lockpassword_choose_your_pattern_header_for_face;
} else {
msg = mIsManagedProfile
? R.string.lockpassword_choose_your_profile_pattern_header
: R.string.lockpassword_choose_your_pattern_header;
}
getActivity().setTitle(msg);
}
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
@@ -515,7 +519,7 @@ public class ChooseLockPattern extends SettingsActivity {
layout.setLandscapeHeaderAreaVisible(false /* visible */); layout.setLandscapeHeaderAreaVisible(false /* visible */);
break; break;
} }
layout.setHeaderText(getActivity().getTitle()); updateActivityTitle();
if (getResources().getBoolean(R.bool.config_lock_pattern_minimal_ui)) { if (getResources().getBoolean(R.bool.config_lock_pattern_minimal_ui)) {
View iconView = layout.findViewById(R.id.sud_layout_icon); View iconView = layout.findViewById(R.id.sud_layout_icon);
if (iconView != null) { if (iconView != null) {

View File

@@ -60,7 +60,7 @@ public class SetupChooseLockPattern extends ChooseLockPattern {
// Show generic pattern title when pattern lock screen launch in Setup wizard flow before // Show generic pattern title when pattern lock screen launch in Setup wizard flow before
// fingerprint and face setup. // fingerprint and face setup.
setTitle(R.string.lockpassword_choose_your_screen_lock_header); setTitle(R.string.lockpassword_choose_your_pattern_header);
} }
public static class SetupChooseLockPatternFragment extends ChooseLockPatternFragment public static class SetupChooseLockPatternFragment extends ChooseLockPatternFragment

View File

@@ -78,7 +78,6 @@ public class ChangeProfileScreenLockPreferenceController extends
extras.putInt(Intent.EXTRA_USER_ID, mProfileChallengeUserId); extras.putInt(Intent.EXTRA_USER_ID, mProfileChallengeUserId);
new SubSettingLauncher(mContext) new SubSettingLauncher(mContext)
.setDestination(ChooseLockGeneric.ChooseLockGenericFragment.class.getName()) .setDestination(ChooseLockGeneric.ChooseLockGenericFragment.class.getName())
.setTitleRes(R.string.lock_settings_picker_title_profile)
.setSourceMetricsCategory(mHost.getMetricsCategory()) .setSourceMetricsCategory(mHost.getMetricsCategory())
.setArguments(extras) .setArguments(extras)
.launch(); .launch();

View File

@@ -136,7 +136,6 @@ public class ChangeScreenLockPreferenceController extends AbstractPreferenceCont
new SubSettingLauncher(mContext) new SubSettingLauncher(mContext)
.setDestination(ChooseLockGeneric.ChooseLockGenericFragment.class.getName()) .setDestination(ChooseLockGeneric.ChooseLockGenericFragment.class.getName())
.setTitleRes(R.string.lock_settings_picker_title)
.setSourceMetricsCategory(mHost.getMetricsCategory()) .setSourceMetricsCategory(mHost.getMetricsCategory())
.launch(); .launch();
return true; return true;

View File

@@ -170,7 +170,6 @@ public class LockUnificationPreferenceController extends AbstractPreferenceContr
extras.putParcelable(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD, mCurrentDevicePassword); extras.putParcelable(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD, mCurrentDevicePassword);
new SubSettingLauncher(mContext) new SubSettingLauncher(mContext)
.setDestination(ChooseLockGeneric.ChooseLockGenericFragment.class.getName()) .setDestination(ChooseLockGeneric.ChooseLockGenericFragment.class.getName())
.setTitleRes(R.string.lock_settings_picker_title_profile)
.setSourceMetricsCategory(mHost.getMetricsCategory()) .setSourceMetricsCategory(mHost.getMetricsCategory())
.setArguments(extras) .setArguments(extras)
.launch(); .launch();