Remove refs of isSeparateProfileChallengeAllowed

Remove this API usage as this API is being removed from DPMS.

Bug: 189502721
Test: N/A
Change-Id: I395a48cd78c8fb93bfd54c94794de5a680ba6f5d
This commit is contained in:
“Ayush
2021-07-26 15:16:03 +00:00
parent e421a7265d
commit 41873bd7a4
10 changed files with 14 additions and 56 deletions

View File

@@ -32,7 +32,7 @@ public class BiometricFaceProfileStatusPreferenceController extends
@Override
protected boolean isUserSupported() {
return mProfileChallengeUserId != UserHandle.USER_NULL
&& mLockPatternUtils.isSeparateProfileChallengeAllowed(mProfileChallengeUserId);
&& mUm.isManagedProfile(mProfileChallengeUserId);
}
@Override

View File

@@ -32,7 +32,7 @@ public class BiometricFingerprintProfileStatusPreferenceController extends
@Override
protected boolean isUserSupported() {
return mProfileChallengeUserId != UserHandle.USER_NULL
&& mLockPatternUtils.isSeparateProfileChallengeAllowed(mProfileChallengeUserId);
&& mUm.isManagedProfile(mProfileChallengeUserId);
}
@Override

View File

@@ -40,7 +40,7 @@ public class CombinedBiometricProfileStatusPreferenceController extends
@Override
protected boolean isUserSupported() {
return mProfileChallengeUserId != UserHandle.USER_NULL
&& mLockPatternUtils.isSeparateProfileChallengeAllowed(mProfileChallengeUserId);
&& mUm.isManagedProfile(mProfileChallengeUserId);
}
@Override

View File

@@ -50,7 +50,7 @@ public class FaceProfileStatusPreferenceController extends FaceStatusPreferenceC
@Override
protected boolean isUserSupported() {
return mProfileChallengeUserId != UserHandle.USER_NULL
&& mLockPatternUtils.isSeparateProfileChallengeAllowed(mProfileChallengeUserId);
&& mUm.isManagedProfile(mProfileChallengeUserId);
}
@Override

View File

@@ -35,7 +35,7 @@ public class FingerprintProfileStatusPreferenceController
@Override
protected boolean isUserSupported() {
return mProfileChallengeUserId != UserHandle.USER_NULL
&& mLockPatternUtils.isSeparateProfileChallengeAllowed(mProfileChallengeUserId);
&& mUm.isManagedProfile(mProfileChallengeUserId);
}
@Override

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);

View File

@@ -52,7 +52,7 @@ public class ChangeProfileScreenLockPreferenceController extends
public boolean isAvailable() {
if (mProfileChallengeUserId == UserHandle.USER_NULL ||
!mLockPatternUtils.isSeparateProfileChallengeAllowed(mProfileChallengeUserId)) {
!mUm.isManagedProfile(mProfileChallengeUserId)) {
return false;
}
if (!mLockPatternUtils.isSecure(mProfileChallengeUserId)) {

View File

@@ -107,7 +107,7 @@ public class LockUnificationPreferenceController extends AbstractPreferenceContr
@Override
public boolean isAvailable() {
return mProfileUserId != UserHandle.USER_NULL
&& mLockPatternUtils.isSeparateProfileChallengeAllowed(mProfileUserId);
&& mUm.isManagedProfile(mProfileUserId);
}
@Override

View File

@@ -16,8 +16,6 @@
package com.android.settings.biometrics.fingerprint;
import static com.android.settings.core.BasePreferenceController.DISABLED_FOR_USER;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.anyInt;
@@ -82,27 +80,6 @@ public class FingerprintProfileStatusPreferenceControllerTest {
assertThat(mController.getUserId()).isEqualTo(FAKE_PROFILE_USER_ID);
}
@Test
public void isUserSupported_separateChallengeAllowed_true() {
when(mLockPatternUtils.isSeparateProfileChallengeAllowed(anyInt())).thenReturn(true);
assertThat(mController.isUserSupported()).isTrue();
}
@Test
public void isUserSupported_separateChallengeNotAllowed_false() {
when(mLockPatternUtils.isSeparateProfileChallengeAllowed(anyInt())).thenReturn(false);
assertThat(mController.isUserSupported()).isFalse();
}
@Test
public void getAvailabilityStatus_userNotSupported_DISABLED() {
when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
when(mLockPatternUtils.isSeparateProfileChallengeAllowed(anyInt())).thenReturn(false);
assertThat(mController.getAvailabilityStatus()).isEqualTo(DISABLED_FOR_USER);
}
@Test
public void getPreferenceKey_byDefault_returnsDefaultValue() {
mController = new FingerprintProfileStatusPreferenceController(mContext);

View File

@@ -83,22 +83,6 @@ public class LockUnificationPreferenceControllerTest {
assertThat(mController.isAvailable()).isFalse();
}
@Test
public void isAvailable_separateChallengeNotAllowed_false() {
when(mLockPatternUtils.isSeparateProfileChallengeAllowed(anyInt())).thenReturn(false);
init();
assertThat(mController.isAvailable()).isFalse();
}
@Test
public void isAvailable_separateChallengeAllowed_true() {
when(mLockPatternUtils.isSeparateProfileChallengeAllowed(anyInt())).thenReturn(true);
init();
assertThat(mController.isAvailable()).isTrue();
}
@Test
public void getPreferenceKey_byDefault_returnsDefaultValue() {
init();