Skip to content

Commit ba926c6

Browse files
committed
add extra handling logic for trigger callback and exclude some sections
1 parent 416e124 commit ba926c6

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

misc/src/main/java/com/example/snippets/profiling/ProfilingManagerJavaSnippets.java

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,23 +93,37 @@ public void recordWithTrigger() {
9393
new Consumer<ProfilingResult>() {
9494
@Override
9595
public void accept(ProfilingResult profilingResult) {
96-
// ...
9796
if (profilingResult.getErrorCode() == ProfilingResult.ERROR_NONE) {
98-
Log.d(TAG,
99-
"Received profiling result. file: " + profilingResult.getResultFilePath());
97+
Log.d(
98+
"ProfileTest",
99+
"Received profiling result file=" + profilingResult.getResultFilePath());
100+
setupUploadJob(profilingResult.getResultFilePath());
101+
} else {
102+
Log.e(
103+
"ProfileTest",
104+
"Profiling failed errorcode="
105+
+ profilingResult.getErrorCode()
106+
+ " errormsg="
107+
+ profilingResult.getErrorMessage());
100108
}
101109
}
102110
};
103111
profilingManager.registerForAllProfilingResults(mainExecutor, resultCallback);
104112
profilingManager.addProfilingTriggers(triggers);
105113

114+
// [START_EXCLUDE silent]
106115
Choreographer.getInstance().postFrameCallback((f) -> {
107116
// This will cause the TRIGGER_TYPE_APP_FULLY_DRAWN to be emitted.
108117
reportFullyDrawn();
109118
});
119+
// [END_EXCLUDE silent]
110120
}
111121
// [END android_profiling_manager_triggered_trace_java]
112122

113-
123+
// [START android_profiling_manager_triggered_trace_setup_upload_job_java]
124+
public void setupUploadJob(String resultFilePath) {
125+
// Setup job to upload the profiling result file.
126+
}
127+
// [END android_profiling_manager_triggered_trace_setup_upload_job_java]
114128
}
115129
}

0 commit comments

Comments
 (0)