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

Commit c0886002 authored by Andreas Gampe's avatar Andreas Gampe
Browse files

PackageManager: Skip dexopt on install for debuggable apps

To reduce install-to-started latency, skip dexopt at install-time
for debuggable apps. This is a conscious tradeoff, as the app
will run slower, and do repeated work on every startup. However,
for debuggable apps, turnaround time is more important.

(cherry picked from commit 58adf3a8)

Bug: 78200989
Test: m
Test: Device boots
Test: CTS (wrap & JVMTI)
Merged-In: I749934e794b0c89d72ea8ee413b845e7804de184
Change-Id: I749934e794b0c89d72ea8ee413b845e7804de184
parent 8819dc86
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -17425,6 +17425,7 @@ public class PackageManagerService extends IPackageManager.Stub
        //   1) it is not forward locked.
        //   2) it is not on on an external ASEC container.
        //   3) it is not an instant app or if it is then dexopt is enabled via gservices.
        //   4) it is not debuggable.
        //
        // Note that we do not dexopt instant apps by default. dexopt can take some time to
        // complete, so we skip this step during installation. Instead, we'll take extra time
@@ -17436,7 +17437,8 @@ public class PackageManagerService extends IPackageManager.Stub
                && !forwardLocked
                && !pkg.applicationInfo.isExternalAsec()
                && (!instantApp || Global.getInt(mContext.getContentResolver(),
                Global.INSTANT_APP_DEXOPT_ENABLED, 0) != 0);
                Global.INSTANT_APP_DEXOPT_ENABLED, 0) != 0)
                && ((pkg.applicationInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) == 0);
        if (performDexopt) {
            Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "dexopt");