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

Commit bd0e9e49 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Move both app code and data together.

Refactor app movement code into the normal install flow as a new
flavor of InstallArgs.  It copies both app code and data during the
copy step, and just updates paths during the rename step.

Measure free space before kicking off a move.  Spawn a thread to
derive a hacky progress estimate based on free disk space counting
down.

Remove checkFreeStorage() and getLegacyNativeLibraryPath() which
nobody was calling.  Fix deadlocks around package broadcasts, and fix
wrong lock ordering when loading packages.

Bug: 19993667, 20275578, 20370140
Change-Id: I7bbf14c924a724d6ebb8a41a02434750fa3302bc
parent e31b820d
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.os.storage.StorageManager;
import android.os.storage.StorageVolume;
import android.text.TextUtils;
import android.util.Log;

import java.io.File;
@@ -242,6 +243,15 @@ public class Environment {
        return DATA_DIRECTORY;
    }

    /** {@hide} */
    public static File getDataAppDirectory(String volumeUuid) {
        if (TextUtils.isEmpty(volumeUuid)) {
            return new File("/data/app");
        } else {
            return new File("/mnt/expand/" + volumeUuid + "/app");
        }
    }

    /**
     * Return the primary external storage directory. This directory may not
     * currently be accessible if it has been mounted by the user on their
+5 −3
Original line number Diff line number Diff line
@@ -264,9 +264,9 @@ public final class Installer extends SystemService {
        return mInstaller.execute(builder.toString());
    }

    public int moveUserDataDirs(String fromUuid, String toUuid, String packageName, int appId,
            String seinfo) {
        StringBuilder builder = new StringBuilder("mvuserdata");
    public int moveCompleteApp(String fromUuid, String toUuid, String packageName,
            String dataAppName, int appId, String seinfo) {
        StringBuilder builder = new StringBuilder("mvcompleteapp");
        builder.append(' ');
        builder.append(escapeNull(fromUuid));
        builder.append(' ');
@@ -274,6 +274,8 @@ public final class Installer extends SystemService {
        builder.append(' ');
        builder.append(packageName);
        builder.append(' ');
        builder.append(dataAppName);
        builder.append(' ');
        builder.append(appId);
        builder.append(' ');
        builder.append(seinfo);
+330 −191

File changed.

Preview size limit exceeded, changes collapsed.

+3 −3
Original line number Diff line number Diff line
@@ -3603,8 +3603,8 @@ final class Settings {
        return pkg.getCurrentEnabledStateLPr(classNameStr, userId);
    }

    boolean setPackageStoppedStateLPw(String packageName, boolean stopped,
            boolean allowedByPermission, int uid, int userId) {
    boolean setPackageStoppedStateLPw(PackageManagerService yucky, String packageName,
            boolean stopped, boolean allowedByPermission, int uid, int userId) {
        int appId = UserHandle.getAppId(uid);
        final PackageSetting pkgSetting = mPackages.get(packageName);
        if (pkgSetting == null) {
@@ -3628,7 +3628,7 @@ final class Settings {
            // pkgSetting.pkg.mSetStopped = stopped;
            if (pkgSetting.getNotLaunched(userId)) {
                if (pkgSetting.installerPackageName != null) {
                    PackageManagerService.sendPackageBroadcast(Intent.ACTION_PACKAGE_FIRST_LAUNCH,
                    yucky.sendPackageBroadcast(Intent.ACTION_PACKAGE_FIRST_LAUNCH,
                            pkgSetting.name, null,
                            pkgSetting.installerPackageName, null, new int[] {userId});
                }