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

Commit 655a5b9c authored by Winson's avatar Winson
Browse files

Revert Revert PackageParser#Package fixes

To separate the changes from the massive commit that reverted the revert,
this commit includes any rebase/merge fixes since the original commit.

Change-Id: I556881a44068d38e6816f445d138f4b4e48d2df0
parent 14ff7171
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -277,7 +277,7 @@ public interface AndroidPackage extends Parcelable {

    String getRealPackage();

    // TODO(b/135203078): Rename to getRequiredFeatures? Somewhat ambigious whether "Req" is
    // TODO(b/135203078): Rename to getRequiredFeatures? Somewhat ambiguous whether "Req" is
    //  required or requested.
    @Nullable
    List<FeatureInfo> getReqFeatures();
+0 −10
Original line number Diff line number Diff line
@@ -384,16 +384,6 @@ public class ApkParseUtils {
            return parseInput.error(PackageManager.INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME);
        }

        // TODO: Remove when manifest overlaying removed
        if (callback != null) {
            String[] overlayPaths = callback.getOverlayPaths(pkgName, apkPath);
            if (overlayPaths != null && overlayPaths.length > 0) {
                for (String overlayPath : overlayPaths) {
                    res.getAssets().addOverlayPath(overlayPath);
                }
            }
        }

        TypedArray manifestArray = null;

        try {
+4 −0
Original line number Diff line number Diff line
@@ -340,6 +340,10 @@ public class ComponentParseUtils {
            this.componentName = null;
        }

        public void setEnabled(boolean enabled) {
            this.enabled = enabled;
        }

        public String getPackageName() {
            return packageName;
        }
+8 −7
Original line number Diff line number Diff line
@@ -21,7 +21,8 @@ import static android.content.pm.parsing.library.SharedLibraryNames.ANDROID_TEST
import android.compat.annotation.ChangeId;
import android.compat.annotation.EnabledAfter;
import android.content.Context;
import android.content.pm.PackageParser.Package;
import android.content.pm.parsing.AndroidPackage;
import android.content.pm.parsing.ParsedPackage;
import android.os.Build;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -54,25 +55,25 @@ public class AndroidTestBaseUpdater extends PackageSharedLibraryUpdater {
    @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.Q)
    private static final long REMOVE_ANDROID_TEST_BASE = 133396946L;

    private static boolean isChangeEnabled(Package pkg) {
    private static boolean isChangeEnabled(AndroidPackage pkg) {
        // Do not ask platform compat for system apps to prevent a boot time regression in tests.
        // b/142558883.
        if (!pkg.applicationInfo.isSystemApp()) {
        if (!pkg.isSystem()) {
            IPlatformCompat platformCompat = IPlatformCompat.Stub.asInterface(
                    ServiceManager.getService(Context.PLATFORM_COMPAT_SERVICE));
            try {
                return platformCompat.isChangeEnabled(REMOVE_ANDROID_TEST_BASE,
                        pkg.applicationInfo);
                        pkg.toAppInfo());
            } catch (RemoteException | NullPointerException e) {
                Log.e(TAG, "Failed to get a response from PLATFORM_COMPAT_SERVICE", e);
            }
        }
        // Fall back to previous behaviour.
        return pkg.applicationInfo.targetSdkVersion > Build.VERSION_CODES.Q;
        return pkg.getTargetSdkVersion() > Build.VERSION_CODES.Q;
    }

    @Override
    public void updatePackage(ParsedPackage parsedPackage) {
    public void updatePackage(ParsedPackage pkg) {
        // Packages targeted at <= Q expect the classes in the android.test.base library
        // to be accessible so this maintains backward compatibility by adding the
        // android.test.base library to those packages.
@@ -82,7 +83,7 @@ public class AndroidTestBaseUpdater extends PackageSharedLibraryUpdater {
            // If a package already depends on android.test.runner then add a dependency on
            // android.test.base because android.test.runner depends on classes from the
            // android.test.base library.
            prefixImplicitDependency(parsedPackage, ANDROID_TEST_RUNNER, ANDROID_TEST_BASE);
            prefixImplicitDependency(pkg, ANDROID_TEST_RUNNER, ANDROID_TEST_BASE);
        }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -456,7 +456,7 @@ public class NativeLibraryHelper {
     * @param useIsaSubdir Whether or not to set up a sub dir for the ISA.
     * @return ABI code if installation succeeds or error code if installation fails.
     */
    public static int configureNativeBinariesForSupportedAbi(Package pkg, Handle handle,
    public static int configureNativeBinariesForSupportedAbi(AndroidPackage pkg, Handle handle,
            File libraryRoot, String[] abiList, boolean useIsaSubdir) {
        // TODO(b/136132412): Implement this.
        return -1;
Loading