commit | d353c81c5c50494d66c8b4bce3294b3b8c86a38b | [log] [tgz] |
---|---|---|
author | Yi Kong <yikong@google.com> | Thu Nov 18 09:12:49 2021 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Thu Nov 18 09:12:49 2021 +0000 |
tree | 4e367ffea100cc8f1a1f88302b08ffe99dde9831 | |
parent | 6e5f8b40b3084723ce2bbb7614e9c95dd583ccfe [diff] | |
parent | f8eb7b136c0238405d86b28c19b1489b0227fe76 [diff] |
Merge "profcollect: trace on background thread" am: f8eb7b136c Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1894997 Change-Id: Ib0fa8116de75f3f2282e4ef53a9f26b67edd29de
diff --git a/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java b/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java index 8369319..fb7ef84 100644 --- a/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java +++ b/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java
@@ -234,14 +234,16 @@ "applaunch_trace_freq", 2); int randomNum = ThreadLocalRandom.current().nextInt(100); if (randomNum < traceFrequency) { - try { - if (DEBUG) { - Log.d(LOG_TAG, "Tracing on app launch event: " + packageName); - } - mIProfcollect.trace_once("applaunch"); - } catch (RemoteException e) { - Log.e(LOG_TAG, e.getMessage()); + if (DEBUG) { + Log.d(LOG_TAG, "Tracing on app launch event: " + packageName); } + BackgroundThread.get().getThreadHandler().post(() -> { + try { + mIProfcollect.trace_once("applaunch"); + } catch (RemoteException e) { + Log.e(LOG_TAG, e.getMessage()); + } + }); } }