Merge "Remove refs of isSeparateProfileChallengeAllowed"

This commit is contained in:
Ayush Sharma
2021-08-13 15:49:11 +00:00
committed by Android (Google) Code Review
10 changed files with 14 additions and 56 deletions

View File

@@ -36,7 +36,6 @@ import android.os.UserManager;
import androidx.annotation.VisibleForTesting;
import com.android.internal.widget.LockPatternUtils;
import com.android.settings.Utils;
/**
@@ -68,17 +67,15 @@ final class SetNewPasswordController {
public static SetNewPasswordController create(Context context, Ui ui, Intent intent,
IBinder activityToken) {
// Trying to figure out which user is setting new password. If it is
// ACTION_SET_NEW_PARENT_PROFILE_PASSWORD or the calling user is not allowed to set
// separate profile challenge, it is the current user to set new password. Otherwise,
// it is the user who starts this activity setting new password.
int userId = ActivityManager.getCurrentUser();
// ACTION_SET_NEW_PARENT_PROFILE_PASSWORD, it is the current user to set
// new password. Otherwise, it is the user who starts this activity
// setting new password.
final int userId;
if (ACTION_SET_NEW_PASSWORD.equals(intent.getAction())) {
final int callingUserId = Utils.getSecureTargetUser(activityToken,
userId = Utils.getSecureTargetUser(activityToken,
UserManager.get(context), null, intent.getExtras()).getIdentifier();
final LockPatternUtils lockPatternUtils = new LockPatternUtils(context);
if (lockPatternUtils.isSeparateProfileChallengeAllowed(callingUserId)) {
userId = callingUserId;
}
} else {
userId = ActivityManager.getCurrentUser();
}
// Create a wrapper of FingerprintManager for testing, see IFingerPrintManager for details.
final FingerprintManager fingerprintManager = Utils.getFingerprintManagerOrNull(context);