use TraceCompat (#23780)

Summary:
I was working to use more Android Support Library in RN core, but wasn't able to finish it. So this PR is for only Systrace and TraceCompat only.

[Android] [Changed] - Use TraceCompat in Systrace
Pull Request resolved: https://github.com/facebook/react-native/pull/23780

Differential Revision: D14423742

Pulled By: hramos

fbshipit-source-id: e3c3e2dfd95eac3d2484313f9be69df1c85904cf
This commit is contained in:
Dulmandakh
2019-03-27 12:01:57 -07:00
committed by Facebook Github Bot
parent c13f5d48cf
commit 92f019c666
2 changed files with 6 additions and 10 deletions

View File

@@ -3,6 +3,7 @@ load("//tools/build_defs/oss:rn_defs.bzl", "rn_android_library")
rn_android_library(
name = "systrace",
srcs = glob(["*.java"]),
is_androidx = True,
visibility = [
"PUBLIC",
],

View File

@@ -7,8 +7,7 @@
package com.facebook.systrace;
import android.os.Build;
import android.os.Trace;
import androidx.core.os.TraceCompat;
/**
* Systrace stub that mostly does nothing but delegates to Trace for beginning/ending sections.
@@ -55,15 +54,11 @@ public class Systrace {
}
public static void beginSection(long tag, final String sectionName) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
Trace.beginSection(sectionName);
}
TraceCompat.beginSection(sectionName);
}
public static void endSection(long tag) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
Trace.endSection();
}
TraceCompat.endSection();
}
public static void beginAsyncSection(
@@ -74,7 +69,7 @@ public class Systrace {
public static void beginAsyncSection(
long tag, final String sectionName, final int cookie, final long startNanos) {}
public static void endAsyncSection(
long tag,
final String sectionName,
@@ -83,7 +78,7 @@ public class Systrace {
public static void endAsyncSection(
long tag, final String sectionName, final int cookie, final long endNanos) {}
public static void traceCounter(
long tag,
final String counterName,