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

Commit 49bda530 authored by Jackal Guo's avatar Jackal Guo
Browse files

Log if installers drop attribute installLocation

Installers that don't respect installLocation from APKs may result
in a bad user experience when users use adoptable storage. We still
allow this, but just log it.

Bug: 109668833
Test: Install APKs that explicitly set installLocation, and check
      the installLocation from install session.
Change-Id: Idfb33e79cb0df75af68faa3a70ea8559ea1ca003
parent 13b0184e
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -2270,6 +2270,17 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
                        "Invalid filename: " + targetName);
            }

            // Yell loudly if installers drop attribute installLocation when apps explicitly set.
            if (apk.installLocation != PackageInfo.INSTALL_LOCATION_UNSPECIFIED) {
                final String installerPackageName = getInstallerPackageName();
                if (installerPackageName != null
                        && (params.installLocation != apk.installLocation)) {
                    Slog.wtf(TAG, installerPackageName
                            + " drops manifest attribute android:installLocation in " + targetName
                            + " for " + mPackageName);
                }
            }

            final File targetFile = new File(stageDir, targetName);
            resolveAndStageFileLocked(addedFile, targetFile);