From 04f783c7592304e4d944ec3fe43defbbd4c7c610 Mon Sep 17 00:00:00 2001 From: Pavel Grafov Date: Thu, 13 Feb 2020 21:39:37 +0000 Subject: [PATCH] "Forgot my password" to start profile in locked state. Currently if a work profile with a separate lock is turned off (a.k.a. in quiet mode), and the user has forgotten the password, profile owner app cannot use DPM.resetPasswordWithToken because the profile user is not running. In BYOD case the user can remove and re-provision the profile but in the new COPE mode (a.k.a. on an organization owned device with work profile) it is not possible to remove the profile. So full factory reset is required. This CL allows the user to start the profile in locked state (a.k.a direct boot mode) so that the admin can reset the password. This CL adds "Forgot my password" button to work profile credential prompt if all of the following conditions are true: * Work profile is turned off * Profile owner app is capable of running in direct boot mode. * Profile owner app has an active password reset token. * The device is an FBE device (otherwise profile will be unlocked). Clicking this button starts the profile in locked state and shows an activity to the user that instruct them to go to their IT admin. Bug: 143516540 Test: manual Change-Id: I832f7121b43e39161c5afa816f44ce89584b66e2 --- AndroidManifest.xml | 4 ++ res/drawable/ic_help_outline_32.xml | 9 +++ res/layout-land/confirm_lock_password.xml | 9 +++ res/layout-land/confirm_lock_pattern.xml | 9 +++ res/layout/confirm_lock_password_base.xml | 9 +++ res/layout/confirm_lock_pattern_base.xml | 11 +++- res/layout/forgot_password_activity.xml | 40 ++++++++++++ res/values/strings.xml | 11 ++++ .../ConfirmDeviceCredentialBaseFragment.java | 36 ++++++----- .../password/ConfirmLockPassword.java | 15 +++++ .../settings/password/ConfirmLockPattern.java | 20 +++++- .../password/ForgotPasswordActivity.java | 61 +++++++++++++++++++ 12 files changed, 216 insertions(+), 18 deletions(-) create mode 100644 res/drawable/ic_help_outline_32.xml create mode 100644 res/layout/forgot_password_activity.xml create mode 100644 src/com/android/settings/password/ForgotPasswordActivity.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 4996aeb83de..e86f2b4b9ef 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1617,6 +1617,10 @@ android:windowSoftInputMode="stateHidden|adjustResize" android:theme="@style/GlifTheme.Light"/> + + diff --git a/res/drawable/ic_help_outline_32.xml b/res/drawable/ic_help_outline_32.xml new file mode 100644 index 00000000000..ffe673eef46 --- /dev/null +++ b/res/drawable/ic_help_outline_32.xml @@ -0,0 +1,9 @@ + + + diff --git a/res/layout-land/confirm_lock_password.xml b/res/layout-land/confirm_lock_password.xml index 546ef67b003..3d2589c5b83 100644 --- a/res/layout-land/confirm_lock_password.xml +++ b/res/layout-land/confirm_lock_password.xml @@ -54,6 +54,15 @@ android:layout_height="wrap_content" android:layout_marginStart="?attr/sudMarginSides" android:layout_marginEnd="?attr/sudMarginSides" /> + +