Revert "Throw IllegalArgumentException when calling"

This reverts commit eb3e2b3b10.

Reason for revert: Setup Wizard crashing and not able to complete when trying to verify a previous PIN

Bug: 180328449
Change-Id: I04de866699db7febf430b5662bf2638c06e3a72b
Test: Locally reverted this CL and was able to have Setup Wizard successfully ask for and verify PIN.
This commit is contained in:
Greg Kaiser
2021-02-18 01:02:04 +00:00
parent eb3e2b3b10
commit 1caea4a95a
2 changed files with 0 additions and 16 deletions

View File

@@ -1103,10 +1103,6 @@ public class LockPatternUtils {
* {@link #CREDENTIAL_TYPE_PASSWORD}
*/
public @CredentialType int getCredentialTypeForUser(int userHandle) {
if (userHandle < 0) {
throw new IllegalArgumentException("Invalid userHandle: " + userHandle);
}
try {
return getLockSettings().getCredentialType(userHandle);
} catch (RemoteException re) {

View File

@@ -18,13 +18,10 @@ package com.android.internal.widget;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import static org.testng.Assert.assertThrows;
import android.content.Context;
import android.os.UserHandle;
import androidx.test.filters.SmallTest;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
@@ -34,9 +31,6 @@ import org.junit.runner.RunWith;
@SmallTest
public class LockPatternUtilsTest {
private static final int INVALID_USER_ID = -1;
private final Context mContext = InstrumentationRegistry.getInstrumentation().getContext();
@Test
public void testUserFrp_isNotRegularUser() throws Exception {
assertTrue(LockPatternUtils.USER_FRP < 0);
@@ -49,10 +43,4 @@ public class LockPatternUtilsTest {
assertNotEquals(UserHandle.USER_CURRENT, LockPatternUtils.USER_FRP);
assertNotEquals(UserHandle.USER_CURRENT_OR_SELF, LockPatternUtils.USER_FRP);
}
@Test
public void getCredentialTypeForUser_invalidUserId_throwsIllegalArgumentException() {
assertThrows(IllegalArgumentException.class,
() -> new LockPatternUtils(mContext).getCredentialTypeForUser(INVALID_USER_ID));
}
}