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

Commit 90c0ffb7 authored by TYM Tsai's avatar TYM Tsai
Browse files

Allow sandbox sdk to query intent activities of the client app

Bug: 295842134
Test: atest SdkSandboxManagerTests
Test: atest PackageManagerServiceTests
Test: atest PackageManagerServiceUnitTests
Test: atest PackageManagerTest
Test: atest PackageInstallerTests
Test: atest PackageManagerComponentOverrideTests
Test: atest CtsPackageInstallTestCases
Test: atest PackageManagerServiceServerTests
Change-Id: Iaed3d0464ff3b64618534dc1d6d3dd67197e13e9
parent 40cd34ec
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import static com.android.server.pm.AppsFilterUtils.requestsQueryAllPackages;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.pm.Flags;
import android.content.pm.SigningDetails;
import android.os.Binder;
import android.os.Handler;
@@ -318,6 +319,11 @@ public abstract class AppsFilterBase implements AppsFilterSnapshot {
                existingSettings.untrackedStorage());
    }

    private static boolean isQueryableBySdkSandbox(int callingUid, int targetUid) {
        return Flags.allowSdkSandboxQueryIntentActivities()
                && targetUid == Process.getAppUidForSdkSandboxUid(callingUid);
    }

    /**
     * See
     * {@link AppsFilterSnapshot#shouldFilterApplication(PackageDataSnapshot, int, Object,
@@ -338,9 +344,11 @@ public abstract class AppsFilterBase implements AppsFilterSnapshot {
            } else if (Process.isSdkSandboxUid(callingAppId)) {
                final int targetAppId = targetPkgSetting.getAppId();
                final int targetUid = UserHandle.getUid(userId, targetAppId);
                // we only allow sdk sandbox processes access to forcequeryable packages
                // we only allow sdk sandbox processes access to forcequeryable packages or
                // if the target app is the sandbox's client app
                return !isForceQueryable(targetPkgSetting.getAppId())
                      && !isImplicitlyQueryable(callingUid, targetUid);
                        && !isImplicitlyQueryable(callingUid, targetUid)
                        && !isQueryableBySdkSandbox(callingUid, targetUid);
            }
            // use cache
            if (mCacheReady && mCacheEnabled) {