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

Commit 78c94616 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Ignore register existing app id for sdk library" into main

parents ed19cdfd 9a8727c1
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ import android.util.proto.ProtoOutputStream;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.os.BackgroundThread;
import com.android.internal.pm.parsing.pkg.AndroidPackageInternal;
import com.android.internal.pm.pkg.component.ParsedComponent;
import com.android.internal.pm.pkg.component.ParsedIntentInfo;
import com.android.internal.pm.pkg.component.ParsedPermission;
@@ -911,8 +912,10 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
            sharedUserSetting.mDisabledPackages.remove(p);
        }
        p.getPkgState().setUpdatedSystemApp(false);
        final AndroidPackageInternal pkg = p.getPkg();
        PackageSetting ret = addPackageLPw(name, p.getRealName(), p.getPath(), p.getAppId(),
                p.getFlags(), p.getPrivateFlags(), mDomainVerificationManager.generateNewId());
                p.getFlags(), p.getPrivateFlags(), mDomainVerificationManager.generateNewId(),
                pkg == null ? false : pkg.isSdkLibrary());
        if (ret != null) {
            ret.setLegacyNativeLibraryPath(p.getLegacyNativeLibraryPath());
            ret.setPrimaryCpuAbi(p.getPrimaryCpuAbiLegacy());
@@ -951,8 +954,8 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
        }
    }

    PackageSetting addPackageLPw(String name, String realName, File codePath, int uid, int pkgFlags,
                                 int pkgPrivateFlags, @NonNull UUID domainSetId) {
    PackageSetting addPackageLPw(String name, String realName, File codePath, int uid,
            int pkgFlags, int pkgPrivateFlags, @NonNull UUID domainSetId, boolean isSdkLibrary) {
        PackageSetting p = mPackages.get(name);
        if (p != null) {
            if (p.getAppId() == uid) {
@@ -964,7 +967,8 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
        }
        p = new PackageSetting(name, realName, codePath, pkgFlags, pkgPrivateFlags, domainSetId)
                .setAppId(uid);
        if (mAppIds.registerExistingAppId(uid, p, name)) {
        if ((uid == Process.INVALID_UID && isSdkLibrary && Flags.disallowSdkLibsToBeApps())
                || mAppIds.registerExistingAppId(uid, p, name)) {
            mPackages.put(name, p);
            return p;
        }
@@ -4176,7 +4180,7 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
            } else if (appId > 0 || (appId == Process.INVALID_UID && isSdkLibrary
                    && Flags.disallowSdkLibsToBeApps())) {
                packageSetting = addPackageLPw(name.intern(), realName, new File(codePathStr),
                        appId, pkgFlags, pkgPrivateFlags, domainSetId);
                        appId, pkgFlags, pkgPrivateFlags, domainSetId, isSdkLibrary);
                if (PackageManagerService.DEBUG_SETTINGS)
                    Log.i(PackageManagerService.TAG, "Reading package " + name + ": appId="
                            + appId + " pkg=" + packageSetting);
+1 −1
Original line number Diff line number Diff line
@@ -166,7 +166,7 @@ class MockSystem(withSession: (StaticMockitoSessionBuilder) -> Unit = {}) {
            null
        }
        whenever(mocks.settings.addPackageLPw(nullable(), nullable(), nullable(), nullable(),
                nullable(), nullable(), nullable())) {
                nullable(), nullable(), nullable(), nullable())) {
            val name: String = getArgument(0)
            val pendingAdd = mPendingPackageAdds.firstOrNull { it.first == name }
                    ?: return@whenever null