"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
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.settings.password;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.app.Activity;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Intent;
|
||||
@@ -181,9 +182,18 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
||||
getFragmentManager().beginTransaction().add(mCredentialCheckResultTracker,
|
||||
FRAGMENT_TAG_CHECK_LOCK_RESULT).commit();
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
if (mForgotButton != null) {
|
||||
mForgotButton.setText(R.string.lockpassword_forgot_pattern);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
// deliberately not calling super since we are managing this in full
|
||||
@@ -230,6 +240,7 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
||||
super.prepareEnterAnimation();
|
||||
mHeaderTextView.setAlpha(0f);
|
||||
mCancelButton.setAlpha(0f);
|
||||
mForgotButton.setAlpha(0f);
|
||||
mLockPatternView.setAlpha(0f);
|
||||
mDetailsTextView.setAlpha(0f);
|
||||
}
|
||||
@@ -252,10 +263,13 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
||||
|
||||
private Object[][] getActiveViews() {
|
||||
ArrayList<ArrayList<Object>> result = new ArrayList<>();
|
||||
result.add(new ArrayList<Object>(Collections.singletonList(mHeaderTextView)));
|
||||
result.add(new ArrayList<Object>(Collections.singletonList(mDetailsTextView)));
|
||||
result.add(new ArrayList<>(Collections.singletonList(mHeaderTextView)));
|
||||
result.add(new ArrayList<>(Collections.singletonList(mDetailsTextView)));
|
||||
if (mCancelButton.getVisibility() == View.VISIBLE) {
|
||||
result.add(new ArrayList<Object>(Collections.singletonList(mCancelButton)));
|
||||
result.add(new ArrayList<>(Collections.singletonList(mCancelButton)));
|
||||
}
|
||||
if (mForgotButton.getVisibility() == View.VISIBLE) {
|
||||
result.add(new ArrayList<>(Collections.singletonList(mForgotButton)));
|
||||
}
|
||||
LockPatternView.CellState[][] cellStates = mLockPatternView.getCellStates();
|
||||
for (int i = 0; i < cellStates.length; i++) {
|
||||
|
Reference in New Issue
Block a user