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

Bug: 162757029
Fixes: 162757029
Test: presubmit
Change-Id: If3f10117cef28afe1dcf28424254515c5c7c48b8
This commit is contained in:
Alex Buynytskyy
2022-02-14 21:40:24 -08:00
parent a22c7e6be6
commit 7c3a3a8f32
2 changed files with 20 additions and 0 deletions

View File

@@ -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);

View File

@@ -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 {