Loading core/java/android/os/incremental/IncrementalManager.java +3 −5 Original line number Diff line number Diff line Loading @@ -155,22 +155,21 @@ public final class IncrementalManager { } /** * Set up an app's code path. The expected outcome of this method is: * Link an app's files from the stage dir to the final installation location. * The expected outcome of this method is: * 1) The actual apk directory under /data/incremental is bind-mounted to the parent directory * of {@code afterCodeFile}. * 2) All the files under {@code beforeCodeFile} will show up under {@code afterCodeFile}. * * @param beforeCodeFile Path that is currently bind-mounted and have APKs under it. * Should no longer have any APKs after this method is called. * Example: /data/app/vmdl*tmp * @param afterCodeFile Path that should will have APKs after this method is called. Its parent * directory should be bind-mounted to a directory under /data/incremental. * Example: /data/app/~~[randomStringA]/[packageName]-[randomStringB] * @throws IllegalArgumentException * @throws IOException * TODO(b/147371381): add unit tests */ public void renameCodePath(File beforeCodeFile, File afterCodeFile) public void linkCodePath(File beforeCodeFile, File afterCodeFile) throws IllegalArgumentException, IOException { final File beforeCodeAbsolute = beforeCodeFile.getAbsoluteFile(); final IncrementalStorage apkStorage = openStorage(beforeCodeAbsolute.toString()); Loading @@ -188,7 +187,6 @@ public final class IncrementalManager { try { final String afterCodePathName = afterCodeFile.getName(); linkFiles(apkStorage, beforeCodeAbsolute, "", linkedApkStorage, afterCodePathName); apkStorage.unBind(beforeCodeAbsolute.toString()); } catch (Exception e) { linkedApkStorage.unBind(targetStorageDir); throw e; Loading services/core/java/com/android/server/pm/PackageManagerService.java +3 −2 Original line number Diff line number Diff line Loading @@ -17993,7 +17993,9 @@ public class PackageManagerService extends IPackageManager.Stub try { makeDirRecursive(afterCodeFile.getParentFile(), 0775); if (onIncremental) { mIncrementalManager.renameCodePath(beforeCodeFile, afterCodeFile); // Just link files here. The stage dir will be removed when the installation // session is completed. mIncrementalManager.linkCodePath(beforeCodeFile, afterCodeFile); } else { Os.rename(beforeCodeFile.getAbsolutePath(), afterCodeFile.getAbsolutePath()); } Loading @@ -18002,7 +18004,6 @@ public class PackageManagerService extends IPackageManager.Stub return false; } //TODO(b/136132412): enable selinux restorecon for incremental directories if (!onIncremental && !SELinux.restoreconRecursive(afterCodeFile)) { Slog.w(TAG, "Failed to restorecon"); return false; Loading
core/java/android/os/incremental/IncrementalManager.java +3 −5 Original line number Diff line number Diff line Loading @@ -155,22 +155,21 @@ public final class IncrementalManager { } /** * Set up an app's code path. The expected outcome of this method is: * Link an app's files from the stage dir to the final installation location. * The expected outcome of this method is: * 1) The actual apk directory under /data/incremental is bind-mounted to the parent directory * of {@code afterCodeFile}. * 2) All the files under {@code beforeCodeFile} will show up under {@code afterCodeFile}. * * @param beforeCodeFile Path that is currently bind-mounted and have APKs under it. * Should no longer have any APKs after this method is called. * Example: /data/app/vmdl*tmp * @param afterCodeFile Path that should will have APKs after this method is called. Its parent * directory should be bind-mounted to a directory under /data/incremental. * Example: /data/app/~~[randomStringA]/[packageName]-[randomStringB] * @throws IllegalArgumentException * @throws IOException * TODO(b/147371381): add unit tests */ public void renameCodePath(File beforeCodeFile, File afterCodeFile) public void linkCodePath(File beforeCodeFile, File afterCodeFile) throws IllegalArgumentException, IOException { final File beforeCodeAbsolute = beforeCodeFile.getAbsoluteFile(); final IncrementalStorage apkStorage = openStorage(beforeCodeAbsolute.toString()); Loading @@ -188,7 +187,6 @@ public final class IncrementalManager { try { final String afterCodePathName = afterCodeFile.getName(); linkFiles(apkStorage, beforeCodeAbsolute, "", linkedApkStorage, afterCodePathName); apkStorage.unBind(beforeCodeAbsolute.toString()); } catch (Exception e) { linkedApkStorage.unBind(targetStorageDir); throw e; Loading
services/core/java/com/android/server/pm/PackageManagerService.java +3 −2 Original line number Diff line number Diff line Loading @@ -17993,7 +17993,9 @@ public class PackageManagerService extends IPackageManager.Stub try { makeDirRecursive(afterCodeFile.getParentFile(), 0775); if (onIncremental) { mIncrementalManager.renameCodePath(beforeCodeFile, afterCodeFile); // Just link files here. The stage dir will be removed when the installation // session is completed. mIncrementalManager.linkCodePath(beforeCodeFile, afterCodeFile); } else { Os.rename(beforeCodeFile.getAbsolutePath(), afterCodeFile.getAbsolutePath()); } Loading @@ -18002,7 +18004,6 @@ public class PackageManagerService extends IPackageManager.Stub return false; } //TODO(b/136132412): enable selinux restorecon for incremental directories if (!onIncremental && !SELinux.restoreconRecursive(afterCodeFile)) { Slog.w(TAG, "Failed to restorecon"); return false;