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

Commit 7c3a3a8f authored by Alex Buynytskyy's avatar Alex Buynytskyy
Browse files

Cleanup app data folder for the user as part of reconcile.

Bug: 162757029
Fixes: 162757029
Test: presubmit
Change-Id: If3f10117cef28afe1dcf28424254515c5c7c48b8
parent a22c7e6b
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -377,6 +377,12 @@ final class AppDataHelper {
                + Integer.toHexString(flags) + " migrateAppData=" + migrateAppData);
        List<String> result = onlyCoreApps ? new ArrayList<>() : null;

        try {
            mInstaller.cleanupInvalidPackageDirs(volumeUuid, userId, flags);
        } catch (Installer.InstallerException e) {
            logCriticalInfo(Log.WARN, "Failed to cleanup deleted dirs: " + e);
        }

        final File ceDir = Environment.getDataUserCeDirectory(volumeUuid, userId);
        final File deDir = Environment.getDataUserDeDirectory(volumeUuid, userId);

+14 −0
Original line number Diff line number Diff line
@@ -357,6 +357,20 @@ public class Installer extends SystemService {
        }
    }

    /**
     * Remove all invalid dirs under app data folder.
     * All dirs are supposed to be valid file and package names.
     */
    public void cleanupInvalidPackageDirs(String uuid, int userId, int flags)
            throws InstallerException {
        if (!checkBeforeRemote()) return;
        try {
            mInstalld.cleanupInvalidPackageDirs(uuid, userId, flags);
        } catch (Exception e) {
            throw InstallerException.from(e);
        }
    }

    public void moveCompleteApp(String fromUuid, String toUuid, String packageName,
            int appId, String seInfo, int targetSdkVersion,
            String fromCodePath) throws InstallerException {