Merge "Create secondary dex profiles relative to the provided dex path" am: f7f5732e2c
am: 310bc2b571
Change-Id: Ic639fd4d9f0e0a76669c1dd05bc0c0a86f84a074
This commit is contained in:
@@ -19,7 +19,6 @@ package android.app;
|
|||||||
import android.os.FileUtils;
|
import android.os.FileUtils;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
import android.system.ErrnoException;
|
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
|
|
||||||
import com.android.internal.annotations.GuardedBy;
|
import com.android.internal.annotations.GuardedBy;
|
||||||
@@ -27,8 +26,6 @@ import com.android.internal.annotations.GuardedBy;
|
|||||||
import dalvik.system.BaseDexClassLoader;
|
import dalvik.system.BaseDexClassLoader;
|
||||||
import dalvik.system.VMRuntime;
|
import dalvik.system.VMRuntime;
|
||||||
|
|
||||||
import libcore.io.Libcore;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -155,23 +152,12 @@ import java.util.Set;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
File realDexPath;
|
// Secondary dex profiles are stored in the oat directory, next to dex file
|
||||||
try {
|
// and have the same name with 'cur.prof' appended.
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE: Keep this in sync with installd expectations.
|
// NOTE: Keep this in sync with installd expectations.
|
||||||
File secondaryProfileDir = new File(realDexPath.getParent(), "oat");
|
File dexPathFile = new File(dexPath);
|
||||||
File secondaryProfile = new File(secondaryProfileDir, realDexPath.getName() + ".cur.prof");
|
File secondaryProfileDir = new File(dexPathFile.getParent(), "oat");
|
||||||
|
File secondaryProfile = new File(secondaryProfileDir, dexPathFile.getName() + ".cur.prof");
|
||||||
|
|
||||||
// Create the profile if not already there.
|
// Create the profile if not already there.
|
||||||
// Returns true if the file was created, false if the file already exists.
|
// Returns true if the file was created, false if the file already exists.
|
||||||
|
|||||||
Reference in New Issue
Block a user