summaryrefslogtreecommitdiffstats
path: root/packages/DefaultContainerService
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2014-07-06 20:44:55 -0700
committerJeff Sharkey <jsharkey@android.com>2014-07-08 00:38:57 -0700
commitd746057f2414cba2bdc69257cc5be8cb681bb592 (patch)
treed25c88f1e3e5406bdb3fa149df0cb596602a302f /packages/DefaultContainerService
parent255edb556e289a53d1c62a700028c25dab90010e (diff)
downloadframeworks_base-d746057f2414cba2bdc69257cc5be8cb681bb592.zip
frameworks_base-d746057f2414cba2bdc69257cc5be8cb681bb592.tar.gz
frameworks_base-d746057f2414cba2bdc69257cc5be8cb681bb592.tar.bz2
Change new file installs to be cluster-based!
Now that all the other pieces are in place, we're ready to start installing new file-based packages as a cluster (the new unified directory-based layout). This greatly simplifies the renaming process. Also add helper methods to ApplicationInfo to give a much clearer mapping between it and internal field names, since we can't change the public API. Add recursive restorecon(). Bug: 14975160 Change-Id: I72a63c5ddbc594c2fec4a91dd59f73ef253fbfd7
Diffstat (limited to 'packages/DefaultContainerService')
-rw-r--r--packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java17
1 files changed, 12 insertions, 5 deletions
diff --git a/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java b/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java
index 7a21b92..67ed97c 100644
--- a/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java
+++ b/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java
@@ -499,19 +499,26 @@ public class DefaultContainerService extends IntentService {
private int copyPackageInner(PackageLite pkg, IParcelFileDescriptorFactory target)
throws IOException, RemoteException {
- // TODO: extend to support copying all split APKs
+ copyFile(pkg.baseCodePath, "base.apk", target);
if (!ArrayUtils.isEmpty(pkg.splitNames)) {
- throw new UnsupportedOperationException("Copying split APKs not yet supported");
+ for (int i = 0; i < pkg.splitNames.length; i++) {
+ copyFile(pkg.splitCodePaths[i], "split_" + pkg.splitNames[i] + ".apk", target);
+ }
}
+ return PackageManager.INSTALL_SUCCEEDED;
+ }
+
+ private void copyFile(String sourcePath, String targetName,
+ IParcelFileDescriptorFactory target) throws IOException, RemoteException {
+ Slog.d(TAG, "Copying " + sourcePath + " to " + targetName);
InputStream in = null;
OutputStream out = null;
try {
- in = new FileInputStream(pkg.baseCodePath);
+ in = new FileInputStream(sourcePath);
out = new ParcelFileDescriptor.AutoCloseOutputStream(
- target.open(null, ParcelFileDescriptor.MODE_READ_WRITE));
+ target.open(targetName, ParcelFileDescriptor.MODE_READ_WRITE));
Streams.copy(in, out);
- return PackageManager.INSTALL_SUCCEEDED;
} finally {
IoUtils.closeQuietly(out);
IoUtils.closeQuietly(in);