aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools/android/java/com/google/devtools/build/android/incrementaldeployment
diff options
context:
space:
mode:
authorGravatar Lukacs Berki <lberki@google.com>2015-09-10 07:50:47 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2015-09-11 09:45:12 +0000
commit3eb0687fde3745cf52bbbb513f7769ecb9d004e4 (patch)
tree247ac92c531a240f139ec9a7834ff2c815b26750 /src/tools/android/java/com/google/devtools/build/android/incrementaldeployment
parent5411129bae8e3f7ec6975ecbdf5c1cc04b50ec65 (diff)
Use ApplicationInfo.dataDir instead of hardcoding "/data/data/<PACKAGE NAME>" in the stub application.
-- MOS_MIGRATED_REVID=102733123
Diffstat (limited to 'src/tools/android/java/com/google/devtools/build/android/incrementaldeployment')
-rw-r--r--src/tools/android/java/com/google/devtools/build/android/incrementaldeployment/StubApplication.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/tools/android/java/com/google/devtools/build/android/incrementaldeployment/StubApplication.java b/src/tools/android/java/com/google/devtools/build/android/incrementaldeployment/StubApplication.java
index 223da8442e..6de57ae800 100644
--- a/src/tools/android/java/com/google/devtools/build/android/incrementaldeployment/StubApplication.java
+++ b/src/tools/android/java/com/google/devtools/build/android/incrementaldeployment/StubApplication.java
@@ -291,7 +291,7 @@ public class StubApplication extends Application {
}
}
- private void instantiateRealApplication(String codeCacheDir) {
+ private void instantiateRealApplication(String codeCacheDir, String dataDir) {
externalResourceFile = getExternalResourceFile();
String nativeLibDir;
@@ -300,7 +300,7 @@ public class StubApplication extends Application {
// and they are chowned to the user of the app from a root shell, dlopen() returns with
// "Permission denied". For some reason, copying them over makes them work (at the cost of
// some execution time and complexity here, of course)
- nativeLibDir = copyNativeLibs();
+ nativeLibDir = copyNativeLibs(dataDir);
} catch (IOException e) {
throw new IllegalStateException(e);
}
@@ -323,12 +323,12 @@ public class StubApplication extends Application {
}
}
- private String copyNativeLibs() throws IOException {
+ private String copyNativeLibs(String dataDir) throws IOException {
File nativeLibDir = new File(INCREMENTAL_DEPLOYMENT_DIR + "/" + packageName + "/native");
File newManifestFile = new File(nativeLibDir, "native_manifest");
- File incrementalDir = new File("/data/data/" + packageName + "/incrementallib");
+ File incrementalDir = new File(dataDir + "/incrementallib");
File installedManifestFile = new File(incrementalDir, "manifest");
- String defaultNativeLibDir = "/data/data/" + packageName + "/lib";
+ String defaultNativeLibDir = dataDir + "/lib";
if (!newManifestFile.exists()) {
// Native libraries are not installed incrementally. Just use the regular directory.
@@ -454,7 +454,9 @@ public class StubApplication extends Application {
@Override
protected void attachBaseContext(Context context) {
- instantiateRealApplication(context.getCacheDir().getPath());
+ instantiateRealApplication(
+ context.getCacheDir().getPath(),
+ context.getApplicationInfo().dataDir);
// This is called from ActivityThread#handleBindApplication() -> LoadedApk#makeApplication().
// Application#mApplication is changed right after this call, so we cannot do the monkey