summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorCalin Juravle <calin@google.com>2017-09-04 17:32:23 -0700
committerCalin Juravle <calin@google.com>2017-11-06 13:27:51 -0800
commit07e5fc46ea5a8b178d28e57a10e1c77369d5041c (patch)
treee861c9bfa73b254a493bdde9570abce3028c922c /core/java
parent4c10ba499d60f88d24be147beee8ea321a07b34c (diff)
Create secondary dex profiles relative to the provided dex path
We previously used the realpath to simplify the validation and processing in installd. However it ended up making things more complicated when cleaning up the profiles, especially because of /data/user/0 symlinks to /data/data/. Instead of using the realpath of the dex file to compute the profile location, use the file path as given. This makes things consistent with DexManager registration and allows for easier dex file reconciliation in the presence of symlinks. Bug: 64460009 Test: manual Change-Id: I2362f32a679324d4bc1e8a0fe83b5b17ee523e7a
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/DexLoadReporter.java24
1 files changed, 5 insertions, 19 deletions
diff --git a/core/java/android/app/DexLoadReporter.java b/core/java/android/app/DexLoadReporter.java
index f99d1a8e06a4..0643414727cf 100644
--- a/core/java/android/app/DexLoadReporter.java
+++ b/core/java/android/app/DexLoadReporter.java
@@ -19,7 +19,6 @@ package android.app;
import android.os.FileUtils;
import android.os.RemoteException;
import android.os.SystemProperties;
-import android.system.ErrnoException;
import android.util.Slog;
import com.android.internal.annotations.GuardedBy;
@@ -27,8 +26,6 @@ import com.android.internal.annotations.GuardedBy;
import dalvik.system.BaseDexClassLoader;
import dalvik.system.VMRuntime;
-import libcore.io.Libcore;
-
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@@ -155,23 +152,12 @@ import java.util.Set;
return;
}
- File realDexPath;
- try {
- // Secondary dex profiles are stored in the oat directory, next to the real dex file
- // and have the same name with 'cur.prof' appended. We use the realpath because that
- // is what installd is using when processing the dex file.
- // NOTE: Keep in sync with installd.
- realDexPath = new File(Libcore.os.realpath(dexPath));
- } catch (ErrnoException ex) {
- Slog.e(TAG, "Failed to get the real path of secondary dex " + dexPath
- + ":" + ex.getMessage());
- // Do not continue with registration if we could not retrieve the real path.
- return;
- }
-
+ // Secondary dex profiles are stored in the oat directory, next to dex file
+ // and have the same name with 'cur.prof' appended.
// NOTE: Keep this in sync with installd expectations.
- File secondaryProfileDir = new File(realDexPath.getParent(), "oat");
- File secondaryProfile = new File(secondaryProfileDir, realDexPath.getName() + ".cur.prof");
+ File dexPathFile = new File(dexPath);
+ File secondaryProfileDir = new File(dexPathFile.getParent(), "oat");
+ File secondaryProfile = new File(secondaryProfileDir, dexPathFile.getName() + ".cur.prof");
// Create the profile if not already there.
// Returns true if the file was created, false if the file already exists.