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

Commit 8730dbd1 authored by Victor Hsieh's avatar Victor Hsieh Committed by Android (Google) Code Review
Browse files

Merge "Match APEX by module name instead of package name"

parents 0e29939c eed5bcbf
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ import android.util.apk.ApkSigningBlockUtils;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.os.IBinaryTransparencyService;
import com.android.internal.util.FrameworkStatsLog;
import com.android.server.pm.ApexManager;

import libcore.util.HexEncoding;

@@ -1266,10 +1267,15 @@ public class BinaryTransparencyService extends SystemService {
    private String getOriginalApexPreinstalledLocation(String packageName,
            String currentInstalledLocation) {
        try {
            // It appears that only apexd knows the preinstalled location, and it uses module name
            // as the identifier instead of package name. Given the input is a package name, we
            // need to covert to module name.
            final String moduleName = ApexManager.getInstance().getApexModuleNameForPackageName(
                    packageName);
            IApexService apexService = IApexService.Stub.asInterface(
                    Binder.allowBlocking(ServiceManager.waitForService("apexservice")));
            for (ApexInfo info : apexService.getAllPackages()) {
                if (packageName.equals(info.moduleName)) {
                if (moduleName.equals(info.moduleName)) {
                    return info.preinstalledModulePath;
                }
            }