From d1904e4b9c133f20efd6028d0fce73ea41614ea8 Mon Sep 17 00:00:00 2001 From: zhidou Date: Fri, 30 Dec 2022 23:07:49 +0000 Subject: Creat hardlink if active apexes are in the same partition Before the code compare the dev of the source, and target file. However, since the target file hasn't been created at this time, the code will always copy the source file instead of hard linkking. Test: sideload train, and check whether the apex in rollback folder is a hardlink. Run presubmit Bug: 168562373 Change-Id: I6e5c6e0d35e4fa44d41d3d2d6fc564e5213e0092 --- services/core/java/com/android/server/rollback/RollbackStore.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/rollback/RollbackStore.java b/services/core/java/com/android/server/rollback/RollbackStore.java index f973f5ce9ce0..8068c6f46733 100644 --- a/services/core/java/com/android/server/rollback/RollbackStore.java +++ b/services/core/java/com/android/server/rollback/RollbackStore.java @@ -249,7 +249,7 @@ class RollbackStore { targetDir.mkdirs(); File targetFile = new File(targetDir, sourceFile.getName()); - boolean fallbackToCopy = !isLinkPossible(sourceFile, targetFile); + boolean fallbackToCopy = !isLinkPossible(sourceFile, targetDir); if (!fallbackToCopy) { try { // Create a hard link to avoid copy -- cgit v1.2.3-59-g8ed1b