android.os.Trace.isTagEnabled()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(157)

本文整理了Java中android.os.Trace.isTagEnabled()方法的一些代码示例,展示了Trace.isTagEnabled()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Trace.isTagEnabled()方法的具体详情如下:
包路径:android.os.Trace
类名称:Trace
方法名:isTagEnabled

Trace.isTagEnabled介绍

暂无

代码示例

代码示例来源:origin: robolectric/robolectric

/** Starts a new trace section with given name. */
@Implementation(minSdk = JELLY_BEAN_MR2)
protected static void beginSection(String sectionName) {
 if (Trace.isTagEnabled(TRACE_TAG_APP)) {
  if (crashOnIncorrectUsage) {
   if (sectionName.length() > MAX_SECTION_NAME_LEN) {
    throw new IllegalArgumentException("sectionName is too long");
   }
  } else if (sectionName == null) {
   Log.w(TAG, "Section name cannot be null");
   return;
  } else if (sectionName.length() > MAX_SECTION_NAME_LEN) {
   Log.w(TAG, "Section name is too long");
   return;
  }
  synchronized (lock) {
   currentSections.addFirst(sectionName);
  }
 }
}

代码示例来源:origin: robolectric/robolectric

/**
 * Ends the most recent active trace section.
 *
 * @throws {@link AssertionError} if called without any active trace section.
 */
@Implementation(minSdk = JELLY_BEAN_MR2)
protected static void endSection() {
 if (Trace.isTagEnabled(TRACE_TAG_APP)) {
  synchronized (lock) {
   if (currentSections.isEmpty()) {
    Log.e(TAG, "Trying to end a trace section that was never started");
    return;
   }
   previousSections.offer(currentSections.removeFirst());
  }
 }
}

代码示例来源:origin: org.robolectric/shadows-framework

/**
 * Ends the most recent active trace section.
 *
 * @throws {@link AssertionError} if called without any active trace section.
 */
@Implementation(minSdk = JELLY_BEAN_MR2)
protected static void endSection() {
 if (Trace.isTagEnabled(TRACE_TAG_APP)) {
  synchronized (lock) {
   if (currentSections.isEmpty()) {
    Log.e(TAG, "Trying to end a trace section that was never started");
    return;
   }
   previousSections.offer(currentSections.removeFirst());
  }
 }
}

代码示例来源:origin: org.robolectric/shadows-framework

/** Starts a new trace section with given name. */
@Implementation(minSdk = JELLY_BEAN_MR2)
protected static void beginSection(String sectionName) {
 if (Trace.isTagEnabled(TRACE_TAG_APP)) {
  if (crashOnIncorrectUsage) {
   if (sectionName.length() > MAX_SECTION_NAME_LEN) {
    throw new IllegalArgumentException("sectionName is too long");
   }
  } else if (sectionName == null) {
   Log.w(TAG, "Section name cannot be null");
   return;
  } else if (sectionName.length() > MAX_SECTION_NAME_LEN) {
   Log.w(TAG, "Section name is too long");
   return;
  }
  synchronized (lock) {
   currentSections.addFirst(sectionName);
  }
 }
}

相关文章