Add Systrace support for API 18+ in OSS

Differential Revision: D2627757

fb-gh-sync-id: a01347800d8e9ffda8759cc17df04f7cd139b17c
This commit is contained in:
Andy Street 2015-11-06 14:01:47 -08:00 committed by facebook-github-bot-4
parent b6340ee2b0
commit 853d249468
1 changed files with 11 additions and 1 deletions

View File

@ -9,8 +9,12 @@
package com.facebook.systrace; package com.facebook.systrace;
import android.os.Build;
import android.os.Trace;
/** /**
* Systrace stub. * Systrace stub that mostly does nothing but delegates to Trace for beginning/ending sections.
* The internal version of this file has not been opensourced yet.
*/ */
public class Systrace { public class Systrace {
@ -50,9 +54,15 @@ public class Systrace {
} }
public static void beginSection(long tag, final String sectionName) { public static void beginSection(long tag, final String sectionName) {
if (Build.VERSION.SDK_INT >= 18) {
Trace.beginSection(sectionName);
}
} }
public static void endSection(long tag) { public static void endSection(long tag) {
if (Build.VERSION.SDK_INT >= 18) {
Trace.endSection();
}
} }
public static void beginAsyncSection( public static void beginAsyncSection(