Merge "Migrate DomainVerificationUtils to no log ChangeId" into sc-dev

This commit is contained in:
Winson Chiu
2021-03-22 19:32:00 +00:00
committed by Android (Google) Code Review
7 changed files with 13 additions and 15 deletions

View File

@@ -22,7 +22,6 @@ import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Binder;
import com.android.internal.util.CollectionUtils;
import com.android.server.compat.PlatformCompat;
@@ -77,9 +76,7 @@ public final class DomainVerificationUtils {
static boolean isChangeEnabled(PlatformCompat platformCompat, AndroidPackage pkg,
long changeId) {
//noinspection ConstantConditions
return Binder.withCleanCallingIdentity(
() -> platformCompat.isChangeEnabled(changeId, buildMockAppInfo(pkg)));
return platformCompat.isChangeEnabledInternalNoLogging(changeId, buildMockAppInfo(pkg));
}
/**

View File

@@ -41,7 +41,12 @@ class DomainVerificationCollectorTest {
}
private val platformCompat: PlatformCompat = mockThrowOnUnmocked {
whenever(isChangeEnabled(eq(DomainVerificationCollector.RESTRICT_DOMAINS), any())) {
whenever(
isChangeEnabledInternalNoLogging(
eq(DomainVerificationCollector.RESTRICT_DOMAINS),
any()
)
) {
(arguments[1] as ApplicationInfo).targetSdkVersion >= Build.VERSION_CODES.S
}
}

View File

@@ -114,12 +114,7 @@ class DomainVerificationEnforcerTest {
it,
mockThrowOnUnmocked { whenever(linkedApps) { ArraySet<String>() } },
mockThrowOnUnmocked {
whenever(
isChangeEnabled(
anyLong(),
any()
)
) { true }
whenever(isChangeEnabledInternalNoLogging(anyLong(), any())) { true }
}).apply {
setConnection(connection)
}

View File

@@ -310,7 +310,7 @@ class DomainVerificationManagerApiTest {
}, mockThrowOnUnmocked {
whenever(linkedApps) { ArraySet<String>() }
}, mockThrowOnUnmocked {
whenever(isChangeEnabled(anyLong(), any())) { true }
whenever(isChangeEnabledInternalNoLogging(anyLong(), any())) { true }
}).apply {
setConnection(mockThrowOnUnmocked {
whenever(filterAppAccess(anyString(), anyInt(), anyInt())) { false }

View File

@@ -43,6 +43,7 @@ import org.junit.Test
import org.mockito.ArgumentMatchers
import org.mockito.ArgumentMatchers.any
import org.mockito.ArgumentMatchers.anyInt
import org.mockito.ArgumentMatchers.anyLong
import org.mockito.ArgumentMatchers.anyString
import java.util.UUID
@@ -366,7 +367,7 @@ class DomainVerificationPackageTest {
}, mockThrowOnUnmocked {
whenever(linkedApps) { ArraySet<String>() }
}, mockThrowOnUnmocked {
whenever(isChangeEnabled(ArgumentMatchers.anyLong(), any())) { true }
whenever(isChangeEnabledInternalNoLogging(anyLong(), any())) { true }
}).apply {
setConnection(mockThrowOnUnmocked {
whenever(filterAppAccess(anyString(), anyInt(), anyInt())) { false }

View File

@@ -98,7 +98,7 @@ class DomainVerificationSettingsMutationTest {
context,
mockThrowOnUnmocked { whenever(linkedApps) { ArraySet<String>() } },
mockThrowOnUnmocked {
whenever(isChangeEnabled(anyLong(),any())) { true }
whenever(isChangeEnabledInternalNoLogging(anyLong(), any())) { true }
}).apply {
setConnection(connection)
}

View File

@@ -71,7 +71,7 @@ class DomainVerificationUserStateOverrideTest {
}, mockThrowOnUnmocked {
whenever(linkedApps) { ArraySet<String>() }
}, mockThrowOnUnmocked {
whenever(isChangeEnabled(anyLong(), any())) { true }
whenever(isChangeEnabledInternalNoLogging(anyLong(), any())) { true }
}).apply {
setConnection(mockThrowOnUnmocked {
whenever(filterAppAccess(anyString(), anyInt(), anyInt())) { false }