diff --git a/base/debug/trace_event_android.cc b/base/debug/trace_event_android.cc index 23e022d6ed0b80..224eb8bd7d3b96 100644 --- a/base/debug/trace_event_android.cc +++ b/base/debug/trace_event_android.cc @@ -67,8 +67,11 @@ void TraceLog::StartATrace() { AutoLock lock(lock_); if (g_atrace_fd == -1) { g_atrace_fd = open(kATraceMarkerFile, O_WRONLY); - if (g_atrace_fd == -1) + if (g_atrace_fd == -1) { LOG(WARNING) << "Couldn't open " << kATraceMarkerFile; + } else { + EnableIncludedCategoryGroups(); + } } } @@ -77,6 +80,7 @@ void TraceLog::StopATrace() { if (g_atrace_fd != -1) { close(g_atrace_fd); g_atrace_fd = -1; + EnableIncludedCategoryGroups(); } } diff --git a/base/debug/trace_event_impl.cc b/base/debug/trace_event_impl.cc index 7ce411946489ce..ab4078afc3ad2c 100644 --- a/base/debug/trace_event_impl.cc +++ b/base/debug/trace_event_impl.cc @@ -831,6 +831,10 @@ void TraceLog::EnableIncludedCategoryGroup(int category_index) { g_category_groups[category_index]); g_category_group_enabled[category_index] = is_enabled ? TraceLog::CATEGORY_ENABLED : 0; + +#if defined(OS_ANDROID) + ApplyATraceEnabledFlag(&g_category_group_enabled[category_index]); +#endif } void TraceLog::EnableIncludedCategoryGroups() { @@ -880,9 +884,6 @@ const unsigned char* TraceLog::GetCategoryGroupEnabledInternal( &g_category_group_enabled[g_category_categories_exhausted]; } } -#if defined(OS_ANDROID) - ApplyATraceEnabledFlag(category_group_enabled); -#endif return category_group_enabled; }