Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cd56ec0d authored by Winson Chiu's avatar Winson Chiu Committed by Automerger Merge Worker
Browse files

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

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13677952

Change-Id: I06eedf7ed714e08386d4749584ba22bca5bf27a3
parents a1d52fe0 ca921e36
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -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));
    }

    /**
+6 −1
Original line number Diff line number Diff line
@@ -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
        }
    }
+1 −6
Original line number Diff line number Diff line
@@ -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)
                }
+1 −1
Original line number Diff line number Diff line
@@ -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 }
+2 −1
Original line number Diff line number Diff line
@@ -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 }
Loading