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

Commit 356010f2 authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Read and apply 'installLocation'

... when installing app via packageInstaller.

This allows the apk to have some limited control over where it will be
installed.

Change-Id: Id5140e7d2a2e3b8dd59815a0febf5c05cee08fbf
Fixes: 30056625
parent 3947c8d1
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageInstaller;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.PackageParser;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Bundle;
@@ -353,6 +354,13 @@ public class InstallAppProgress extends Activity implements View.OnClickListener
            params.originatingUid = getIntent().getIntExtra(Intent.EXTRA_ORIGINATING_UID,
                    UID_UNKNOWN);

            File file = new File(mPackageURI.getPath());
            try {
                params.setInstallLocation(PackageParser.parsePackageLite(file, 0).installLocation);
            } catch (PackageParser.PackageParserException e) {
                Log.e(TAG, "Cannot parse package " + file + ". Assuming defaults.");
            }

            mInstallHandler.post(new Runnable() {
                @Override
                public void run() {