diff options
| author | 2019-08-20 16:20:23 +0000 | |
|---|---|---|
| committer | 2019-08-20 16:20:23 +0000 | |
| commit | 2214ede1ec975875268fe36d35fb3ab94e9344bd (patch) | |
| tree | 24d5fb461c5cd3242448c48e28b212f6d28f3d7c | |
| parent | bd8e232e20aeee43723befc110c0fcb1a2fdee73 (diff) | |
| parent | 6e917454f218709a886a642c6baac2eea77805b8 (diff) | |
Merge "Add agent startup-attach"
| -rw-r--r-- | core/java/android/app/ActivityThread.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 6c67191eb3eb..8299492db4ff 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -168,6 +168,8 @@ import java.lang.ref.WeakReference; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.net.InetAddress; +import java.nio.file.Files; +import java.nio.file.Path; import java.text.DateFormat; import java.util.ArrayList; import java.util.Arrays; @@ -5903,6 +5905,26 @@ public final class ActivityThread extends ClientTransactionHandler { NetworkSecurityConfigProvider.install(appContext); Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); + + if (isAppDebuggable) { + try { + // Load all the agents in the code_cache/startup_agents directory. + // We pass the absolute path to the data_dir as an argument. + Path startup_path = appContext.getCodeCacheDir().toPath().resolve("startup_agents"); + if (Files.exists(startup_path)) { + for (Path p : Files.newDirectoryStream(startup_path)) { + handleAttachAgent( + p.toAbsolutePath().toString() + + "=" + + appContext.getDataDir().toPath().toAbsolutePath().toString(), + data.info); + } + } + } catch (Exception e) { + // Ignored. + } + } + // Continue loading instrumentation. if (ii != null) { ApplicationInfo instrApp; |