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

Commit e2f74175 authored by Kenny Root's avatar Kenny Root
Browse files

Failure to move .dex in eng builds is not fatal

When moving between program locations or application names, the .dex
file is moved by installd. However, in engineering builds, the
applications are run through dexopt on-demand. If the .dex file fails to
move, we can ignore it because it's most likely because the .dex file
does not exist yet.

Change-Id: Id5c4dbfa33f19c976acd9f184ccd637752326629
parent 50871525
Loading
Loading
Loading
Loading
+11 −2
Original line number Original line Diff line number Diff line
@@ -5867,10 +5867,19 @@ class PackageManagerService extends IPackageManager.Stub {
        if ((newPackage.applicationInfo.flags&ApplicationInfo.FLAG_HAS_CODE) != 0) {
        if ((newPackage.applicationInfo.flags&ApplicationInfo.FLAG_HAS_CODE) != 0) {
            retCode = mInstaller.movedex(newPackage.mScanPath, newPackage.mPath);
            retCode = mInstaller.movedex(newPackage.mScanPath, newPackage.mPath);
            if (retCode != 0) {
            if (retCode != 0) {
                if (mNoDexOpt) {
                    /*
                     * If we're in an engineering build, programs are lazily run
                     * through dexopt. If the .dex file doesn't exist yet, it
                     * will be created when the program is run next.
                     */
                    Slog.i(TAG, "dex file doesn't exist, skipping move: " + newPackage.mPath);
                } else {
                    Slog.e(TAG, "Couldn't rename dex file: " + newPackage.mPath);
                    Slog.e(TAG, "Couldn't rename dex file: " + newPackage.mPath);
                    return PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
                    return PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
                }
                }
            }
            }
        }
        return PackageManager.INSTALL_SUCCEEDED;
        return PackageManager.INSTALL_SUCCEEDED;
    }
    }