diff options
| author | Alex Light <allight@google.com> | 2019-10-09 15:26:37 -0700 |
|---|---|---|
| committer | android-build-merger <android-build-merger@google.com> | 2019-10-09 15:26:37 -0700 |
| commit | cfdc4f768694f8e68e8466b57cb860af5d14f98a (patch) | |
| tree | 049256eca76e8e291149d6dc1c57ddb79504c066 /core/java/android/app/ActivityThread.java | |
| parent | f0e71239a5a35e1e2839da4ab09ef7fcbd84b496 (diff) | |
| parent | a10ebfaa56b31957eb633ad64724196afe7bacc6 (diff) | |
Merge "Perform agent startup-attach before bind" am: 7ae1299cdd am: d3337c9051 am: b49226d0be
am: a10ebfaa56
Change-Id: I3bc2422269baebdfe9a9a8aa2894b12c4dfe5586
Diffstat (limited to 'core/java/android/app/ActivityThread.java')
| -rw-r--r-- | core/java/android/app/ActivityThread.java | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 38aac1b47f65..7f27368e017e 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -1163,6 +1163,10 @@ public final class ActivityThread extends ClientTransactionHandler { sendMessage(H.ATTACH_AGENT, agent); } + public void attachStartupAgents(String dataDir) { + sendMessage(H.ATTACH_STARTUP_AGENTS, dataDir); + } + public void setSchedulingGroup(int group) { // Note: do this immediately, since going into the foreground // should happen regardless of what pending work we have to do @@ -1812,6 +1816,7 @@ public final class ActivityThread extends ClientTransactionHandler { public static final int EXECUTE_TRANSACTION = 159; public static final int RELAUNCH_ACTIVITY = 160; public static final int PURGE_RESOURCES = 161; + public static final int ATTACH_STARTUP_AGENTS = 162; String codeToString(int code) { if (DEBUG_MESSAGES) { @@ -1855,6 +1860,7 @@ public final class ActivityThread extends ClientTransactionHandler { case EXECUTE_TRANSACTION: return "EXECUTE_TRANSACTION"; case RELAUNCH_ACTIVITY: return "RELAUNCH_ACTIVITY"; case PURGE_RESOURCES: return "PURGE_RESOURCES"; + case ATTACH_STARTUP_AGENTS: return "ATTACH_STARTUP_AGENTS"; } } return Integer.toString(code); @@ -2043,6 +2049,9 @@ public final class ActivityThread extends ClientTransactionHandler { case PURGE_RESOURCES: schedulePurgeIdler(); break; + case ATTACH_STARTUP_AGENTS: + handleAttachStartupAgents((String) msg.obj); + break; } Object obj = msg.obj; if (obj instanceof SomeArgs) { @@ -3779,6 +3788,27 @@ public final class ActivityThread extends ClientTransactionHandler { } } + static void handleAttachStartupAgents(String dataDir) { + try { + Path code_cache = ContextImpl.getCodeCacheDirBeforeBind(new File(dataDir)).toPath(); + if (!Files.exists(code_cache)) { + return; + } + Path startup_path = code_cache.resolve("startup_agents"); + if (Files.exists(startup_path)) { + for (Path p : Files.newDirectoryStream(startup_path)) { + handleAttachAgent( + p.toAbsolutePath().toString() + + "=" + + dataDir, + null); + } + } + } catch (Exception e) { + // Ignored. + } + } + private static final ThreadLocal<Intent> sCurrentBroadcastIntent = new ThreadLocal<Intent>(); /** @@ -6427,26 +6457,6 @@ 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; |
