Merge "Migrate DomainVerificationUtils to no log ChangeId" into sc-dev
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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 }
|
||||
|
||||
@@ -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 }
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user