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:
@@ -32,7 +32,7 @@ public class BiometricFaceProfileStatusPreferenceController extends
|
|||||||
@Override
|
@Override
|
||||||
protected boolean isUserSupported() {
|
protected boolean isUserSupported() {
|
||||||
return mProfileChallengeUserId != UserHandle.USER_NULL
|
return mProfileChallengeUserId != UserHandle.USER_NULL
|
||||||
&& mLockPatternUtils.isSeparateProfileChallengeAllowed(mProfileChallengeUserId);
|
&& mUm.isManagedProfile(mProfileChallengeUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -32,7 +32,7 @@ public class BiometricFingerprintProfileStatusPreferenceController extends
|
|||||||
@Override
|
@Override
|
||||||
protected boolean isUserSupported() {
|
protected boolean isUserSupported() {
|
||||||
return mProfileChallengeUserId != UserHandle.USER_NULL
|
return mProfileChallengeUserId != UserHandle.USER_NULL
|
||||||
&& mLockPatternUtils.isSeparateProfileChallengeAllowed(mProfileChallengeUserId);
|
&& mUm.isManagedProfile(mProfileChallengeUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -40,7 +40,7 @@ public class CombinedBiometricProfileStatusPreferenceController extends
|
|||||||
@Override
|
@Override
|
||||||
protected boolean isUserSupported() {
|
protected boolean isUserSupported() {
|
||||||
return mProfileChallengeUserId != UserHandle.USER_NULL
|
return mProfileChallengeUserId != UserHandle.USER_NULL
|
||||||
&& mLockPatternUtils.isSeparateProfileChallengeAllowed(mProfileChallengeUserId);
|
&& mUm.isManagedProfile(mProfileChallengeUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -50,7 +50,7 @@ public class FaceProfileStatusPreferenceController extends FaceStatusPreferenceC
|
|||||||
@Override
|
@Override
|
||||||
protected boolean isUserSupported() {
|
protected boolean isUserSupported() {
|
||||||
return mProfileChallengeUserId != UserHandle.USER_NULL
|
return mProfileChallengeUserId != UserHandle.USER_NULL
|
||||||
&& mLockPatternUtils.isSeparateProfileChallengeAllowed(mProfileChallengeUserId);
|
&& mUm.isManagedProfile(mProfileChallengeUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -35,7 +35,7 @@ public class FingerprintProfileStatusPreferenceController
|
|||||||
@Override
|
@Override
|
||||||
protected boolean isUserSupported() {
|
protected boolean isUserSupported() {
|
||||||
return mProfileChallengeUserId != UserHandle.USER_NULL
|
return mProfileChallengeUserId != UserHandle.USER_NULL
|
||||||
&& mLockPatternUtils.isSeparateProfileChallengeAllowed(mProfileChallengeUserId);
|
&& mUm.isManagedProfile(mProfileChallengeUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -36,7 +36,6 @@ import android.os.UserManager;
|
|||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
|
|
||||||
import com.android.internal.widget.LockPatternUtils;
|
|
||||||
import com.android.settings.Utils;
|
import com.android.settings.Utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,17 +67,15 @@ final class SetNewPasswordController {
|
|||||||
public static SetNewPasswordController create(Context context, Ui ui, Intent intent,
|
public static SetNewPasswordController create(Context context, Ui ui, Intent intent,
|
||||||
IBinder activityToken) {
|
IBinder activityToken) {
|
||||||
// Trying to figure out which user is setting new password. If it is
|
// 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
|
// ACTION_SET_NEW_PARENT_PROFILE_PASSWORD, it is the current user to set
|
||||||
// separate profile challenge, it is the current user to set new password. Otherwise,
|
// new password. Otherwise, it is the user who starts this activity
|
||||||
// it is the user who starts this activity setting new password.
|
// setting new password.
|
||||||
int userId = ActivityManager.getCurrentUser();
|
final int userId;
|
||||||
if (ACTION_SET_NEW_PASSWORD.equals(intent.getAction())) {
|
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();
|
UserManager.get(context), null, intent.getExtras()).getIdentifier();
|
||||||
final LockPatternUtils lockPatternUtils = new LockPatternUtils(context);
|
} else {
|
||||||
if (lockPatternUtils.isSeparateProfileChallengeAllowed(callingUserId)) {
|
userId = ActivityManager.getCurrentUser();
|
||||||
userId = callingUserId;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Create a wrapper of FingerprintManager for testing, see IFingerPrintManager for details.
|
// Create a wrapper of FingerprintManager for testing, see IFingerPrintManager for details.
|
||||||
final FingerprintManager fingerprintManager = Utils.getFingerprintManagerOrNull(context);
|
final FingerprintManager fingerprintManager = Utils.getFingerprintManagerOrNull(context);
|
||||||
|
@@ -52,7 +52,7 @@ public class ChangeProfileScreenLockPreferenceController extends
|
|||||||
|
|
||||||
public boolean isAvailable() {
|
public boolean isAvailable() {
|
||||||
if (mProfileChallengeUserId == UserHandle.USER_NULL ||
|
if (mProfileChallengeUserId == UserHandle.USER_NULL ||
|
||||||
!mLockPatternUtils.isSeparateProfileChallengeAllowed(mProfileChallengeUserId)) {
|
!mUm.isManagedProfile(mProfileChallengeUserId)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!mLockPatternUtils.isSecure(mProfileChallengeUserId)) {
|
if (!mLockPatternUtils.isSecure(mProfileChallengeUserId)) {
|
||||||
|
@@ -107,7 +107,7 @@ public class LockUnificationPreferenceController extends AbstractPreferenceContr
|
|||||||
@Override
|
@Override
|
||||||
public boolean isAvailable() {
|
public boolean isAvailable() {
|
||||||
return mProfileUserId != UserHandle.USER_NULL
|
return mProfileUserId != UserHandle.USER_NULL
|
||||||
&& mLockPatternUtils.isSeparateProfileChallengeAllowed(mProfileUserId);
|
&& mUm.isManagedProfile(mProfileUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
package com.android.settings.biometrics.fingerprint;
|
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 com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
@@ -82,27 +80,6 @@ public class FingerprintProfileStatusPreferenceControllerTest {
|
|||||||
assertThat(mController.getUserId()).isEqualTo(FAKE_PROFILE_USER_ID);
|
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
|
@Test
|
||||||
public void getPreferenceKey_byDefault_returnsDefaultValue() {
|
public void getPreferenceKey_byDefault_returnsDefaultValue() {
|
||||||
mController = new FingerprintProfileStatusPreferenceController(mContext);
|
mController = new FingerprintProfileStatusPreferenceController(mContext);
|
||||||
|
@@ -83,22 +83,6 @@ public class LockUnificationPreferenceControllerTest {
|
|||||||
assertThat(mController.isAvailable()).isFalse();
|
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
|
@Test
|
||||||
public void getPreferenceKey_byDefault_returnsDefaultValue() {
|
public void getPreferenceKey_byDefault_returnsDefaultValue() {
|
||||||
init();
|
init();
|
||||||
|
Reference in New Issue
Block a user