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

Commit a3aaeb70 authored by Chen Bai's avatar Chen Bai
Browse files

boot: fix unclosed traceBegin of derivePackageAbi

- PackageAbiHelper#derivePackageAbi's exception skipped its Trace#traceEnd. Therefore, wrap it with try block and call traceEnd() at `finally`.

Test: perfetto traces shouldn't show infinitely long startServices event
BUG: 284054349
Change-Id: Ia9f5f136e92e75ac6bbe2dde7918787744f84ab5
parent 73ef07cd
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -282,12 +282,20 @@ final class ScanPackageUtils {
        if ((scanFlags & SCAN_NEW_INSTALL) == 0) {
            if (needToDeriveAbi) {
                Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "derivePackageAbi");
                final Pair<PackageAbiHelper.Abis, PackageAbiHelper.NativeLibraryPaths> derivedAbi =
                        packageAbiHelper.derivePackageAbi(parsedPackage, isSystemApp,
                                isUpdatedSystemApp, cpuAbiOverride, appLib32InstallDir);
                try {
                    final Pair<PackageAbiHelper.Abis, PackageAbiHelper.NativeLibraryPaths>
                            derivedAbi =
                                    packageAbiHelper.derivePackageAbi(
                                            parsedPackage,
                                            isSystemApp,
                                            isUpdatedSystemApp,
                                            cpuAbiOverride,
                                            appLib32InstallDir);
                    derivedAbi.first.applyTo(parsedPackage);
                    derivedAbi.second.applyTo(parsedPackage);
                } finally {
                    Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
                }

                // Some system apps still use directory structure for native libraries
                // in which case we might end up not detecting abi solely based on apk