use of com.android.internal.os.InstallerConnection.InstallerException in project android_frameworks_base by DirtyUnicorns.
the class Installer method getAppSize.
public void getAppSize(String uuid, String pkgname, int userid, int flags, long ceDataInode, String codePath, PackageStats stats) throws InstallerException {
final String[] res = mInstaller.execute("get_app_size", uuid, pkgname, userid, flags, ceDataInode, codePath);
try {
stats.codeSize += Long.parseLong(res[1]);
stats.dataSize += Long.parseLong(res[2]);
stats.cacheSize += Long.parseLong(res[3]);
} catch (ArrayIndexOutOfBoundsException | NumberFormatException e) {
throw new InstallerException("Invalid size result: " + Arrays.toString(res));
}
}
use of com.android.internal.os.InstallerConnection.InstallerException in project android_frameworks_base by DirtyUnicorns.
the class PackageInstallerSession method destroyInternal.
private void destroyInternal() {
synchronized (mLock) {
mSealed = true;
mDestroyed = true;
// Force shut down all bridges
for (FileBridge bridge : mBridges) {
bridge.forceClose();
}
}
if (stageDir != null) {
try {
mPm.mInstaller.rmPackageDir(stageDir.getAbsolutePath());
} catch (InstallerException ignored) {
}
}
if (stageCid != null) {
PackageHelper.destroySdDir(stageCid);
}
}
use of com.android.internal.os.InstallerConnection.InstallerException in project android_frameworks_base by DirtyUnicorns.
the class PackageManagerService method prepareAppDataContentsLeafLIF.
private void prepareAppDataContentsLeafLIF(PackageParser.Package pkg, int userId, int flags) {
final String volumeUuid = pkg.volumeUuid;
final String packageName = pkg.packageName;
final ApplicationInfo app = pkg.applicationInfo;
if ((flags & StorageManager.FLAG_STORAGE_CE) != 0) {
// this symlink for 64 bit libraries.
if (app.primaryCpuAbi != null && !VMRuntime.is64BitAbi(app.primaryCpuAbi)) {
final String nativeLibPath = app.nativeLibraryDir;
try {
mInstaller.linkNativeLibraryDirectory(volumeUuid, packageName, nativeLibPath, userId);
} catch (InstallerException e) {
Slog.e(TAG, "Failed to link native for " + packageName + ": " + e);
}
}
}
}
use of com.android.internal.os.InstallerConnection.InstallerException in project android_frameworks_base by DirtyUnicorns.
the class PackageManagerService method reconcileAppsDataLI.
/**
* Reconcile all app data on given mounted volume.
* <p>
* Destroys app data that isn't expected, either due to uninstallation or
* reinstallation on another volume.
* <p>
* Verifies that directories exist and that ownership and labeling is
* correct for all installed apps.
*/
private void reconcileAppsDataLI(String volumeUuid, int userId, int flags) {
Slog.v(TAG, "reconcileAppsData for " + volumeUuid + " u" + userId + " 0x" + Integer.toHexString(flags));
final File ceDir = Environment.getDataUserCeDirectory(volumeUuid, userId);
final File deDir = Environment.getDataUserDeDirectory(volumeUuid, userId);
// have changed since we did our last restorecon
if ((flags & StorageManager.FLAG_STORAGE_CE) != 0) {
if (StorageManager.isFileEncryptedNativeOrEmulated() && !StorageManager.isUserKeyUnlocked(userId)) {
throw new RuntimeException("Yikes, someone asked us to reconcile CE storage while " + userId + " was still locked; this would have caused massive data loss!");
}
final File[] files = FileUtils.listFilesOrEmpty(ceDir);
for (File file : files) {
final String packageName = file.getName();
try {
assertPackageKnownAndInstalled(volumeUuid, packageName, userId);
} catch (PackageManagerException e) {
logCriticalInfo(Log.WARN, "Destroying " + file + " due to: " + e);
try {
mInstaller.destroyAppData(volumeUuid, packageName, userId, StorageManager.FLAG_STORAGE_CE, 0);
} catch (InstallerException e2) {
logCriticalInfo(Log.WARN, "Failed to destroy: " + e2);
}
}
}
}
if ((flags & StorageManager.FLAG_STORAGE_DE) != 0) {
final File[] files = FileUtils.listFilesOrEmpty(deDir);
for (File file : files) {
final String packageName = file.getName();
try {
assertPackageKnownAndInstalled(volumeUuid, packageName, userId);
} catch (PackageManagerException e) {
logCriticalInfo(Log.WARN, "Destroying " + file + " due to: " + e);
try {
mInstaller.destroyAppData(volumeUuid, packageName, userId, StorageManager.FLAG_STORAGE_DE, 0);
} catch (InstallerException e2) {
logCriticalInfo(Log.WARN, "Failed to destroy: " + e2);
}
}
}
}
// Ensure that data directories are ready to roll for all packages
// installed for this volume and user
final List<PackageSetting> packages;
synchronized (mPackages) {
packages = mSettings.getVolumePackagesLPr(volumeUuid);
}
int preparedCount = 0;
for (PackageSetting ps : packages) {
final String packageName = ps.name;
if (ps.pkg == null) {
Slog.w(TAG, "Odd, missing scanned package " + packageName);
// and reconcile again once they're scanned
continue;
}
if (ps.getInstalled(userId)) {
prepareAppDataLIF(ps.pkg, userId, flags);
if (maybeMigrateAppDataLIF(ps.pkg, userId)) {
// We may have just shuffled around app data directories, so
// prepare them one more time
prepareAppDataLIF(ps.pkg, userId, flags);
}
preparedCount++;
}
}
Slog.v(TAG, "reconcileAppsData finished " + preparedCount + " packages");
}
use of com.android.internal.os.InstallerConnection.InstallerException in project android_frameworks_base by AOSPA.
the class Installer method getAppSize.
public void getAppSize(String uuid, String pkgname, int userid, int flags, long ceDataInode, String codePath, PackageStats stats) throws InstallerException {
final String[] res = mInstaller.execute("get_app_size", uuid, pkgname, userid, flags, ceDataInode, codePath);
try {
stats.codeSize += Long.parseLong(res[1]);
stats.dataSize += Long.parseLong(res[2]);
stats.cacheSize += Long.parseLong(res[3]);
} catch (ArrayIndexOutOfBoundsException | NumberFormatException e) {
throw new InstallerException("Invalid size result: " + Arrays.toString(res));
}
}
Aggregations