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

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

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

Trace.endSection介绍

暂无

代码示例

代码示例来源:origin: facebook/litho

@Override
public void endSection() {
 if (ComponentsConfiguration.IS_INTERNAL_BUILD &&
   Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
  Trace.endSection();
 }
}

代码示例来源:origin: google/ExoPlayer

@TargetApi(18)
private static void endSectionV18() {
 android.os.Trace.endSection();
}

代码示例来源:origin: JakeWharton/hugo

private static void exitMethod(JoinPoint joinPoint, Object result, long lengthMillis) {
 if (!enabled) return;
 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
  Trace.endSection();
 }
 Signature signature = joinPoint.getSignature();
 Class<?> cls = signature.getDeclaringType();
 String methodName = signature.getName();
 boolean hasReturnType = signature instanceof MethodSignature
   && ((MethodSignature) signature).getReturnType() != void.class;
 StringBuilder builder = new StringBuilder("\u21E0 ")
   .append(methodName)
   .append(" [")
   .append(lengthMillis)
   .append("ms]");
 if (hasReturnType) {
  builder.append(" = ");
  builder.append(Strings.toString(result));
 }
 Log.v(asTag(cls), builder.toString());
}

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

@Test
public void endSection_calledBeforeBeginning_doesNotThrow() throws Exception {
 Trace.endSection();
 // Should not crash.
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

break;
case ProcessInput:
  android.os.Trace.endSection();
  android.os.Trace.beginSection("ProcessInput");
  break;
case ProcessAudio:
  android.os.Trace.endSection();
  android.os.Trace.beginSection("ProcessAudio");
  break;
case StateManagerUpdate:
  android.os.Trace.endSection();
  android.os.Trace.beginSection("StateManagerUpdate");
  break;
case SpatialUpdate:
  android.os.Trace.endSection();
  android.os.Trace.beginSection("SpatialUpdate");
  break;
case StateManagerRender:
  android.os.Trace.endSection();
  android.os.Trace.beginSection("StateManagerRender");
  break;
case RenderFrame:
  android.os.Trace.endSection();
  android.os.Trace.beginSection("RenderFrame");
  break;
  break;
case RenderMainViewPorts:
  android.os.Trace.endSection();

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

@Test
public void endSection_oneSectionButCalledTwice_doesNotThrow() throws Exception {
 Trace.beginSection("section1");
 Trace.endSection();
 Trace.endSection();
 // Should not crash.
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public void vpStep(VpStep vpStep, ViewPort vp, RenderQueue.Bucket bucket) {
  if (androidApiLevel >= 18) {
    switch (vpStep) {
      case BeginRender:
        android.os.Trace.beginSection("Render: " + vp.getName());
        break;
      case RenderScene:
        android.os.Trace.beginSection("RenderScene: " + vp.getName());
        break;
      case PostQueue:
        android.os.Trace.endSection();
        android.os.Trace.beginSection("PostQueue: " + vp.getName());
        break;
      case FlushQueue:
        android.os.Trace.endSection();
        android.os.Trace.beginSection("FlushQueue: " + vp.getName());
        break;
      case PostFrame:
        android.os.Trace.endSection();
        android.os.Trace.beginSection("PostFrame: " + vp.getName());
        break;
      case EndRender:
        android.os.Trace.endSection();
        android.os.Trace.endSection();
        break;
    }
  }
}

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

@Test
public void endSection_twoSequentialSections_closesAllSections() throws Exception {
 Trace.beginSection("section1");
 Trace.endSection();
 Trace.beginSection("section2");
 Trace.endSection();
 assertThat(ShadowTrace.getCurrentSections()).isEmpty();
 assertThat(ShadowTrace.getPreviousSections()).containsExactly("section1", "section2");
}

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

@Test
public void endSection_twoRecursiveSectionsAndCalledTwice_closesAllSections() throws Exception {
 Trace.beginSection("section1");
 Trace.beginSection("section2");
 Trace.endSection();
 Trace.endSection();
 assertThat(ShadowTrace.getCurrentSections()).isEmpty();
 assertThat(ShadowTrace.getPreviousSections()).containsExactly("section2", "section1");
}

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

@Test
public void endSection_oneSection_closesSection() throws Exception {
 Trace.beginSection("section1");
 Trace.endSection();
 assertThat(ShadowTrace.getCurrentSections()).isEmpty();
 assertThat(ShadowTrace.getPreviousSections()).containsExactly("section1");
}

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

@Test
public void endSection_twoSections_closesLastSection() throws Exception {
 Trace.beginSection("section1");
 Trace.beginSection("section2");
 Trace.endSection();
 assertThat(ShadowTrace.getCurrentSections()).containsExactly("section1");
 assertThat(ShadowTrace.getPreviousSections()).containsExactly("section2");
}

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

@Test
 public void reset_resetsInternalState() throws Exception {
  Trace.beginSection("section1");
  Trace.endSection();
  Trace.beginSection("section2");

  ShadowTrace.reset();

  assertThat(ShadowTrace.getCurrentSections()).isEmpty();
  assertThat(ShadowTrace.getPreviousSections()).isEmpty();
 }
}

代码示例来源:origin: halfhp/androidplot

public static void end() {
    if(Build.VERSION.SDK_INT >= 18) {
      Trace.endSection();
    } else {
      // TODO: alternate impl?
    }
  }
}

代码示例来源:origin: bitmovin/bitcodin-android-demo

@TargetApi(18)
private static void endSectionV18() {
 android.os.Trace.endSection();
}

代码示例来源:origin: geniusgithub/AndroidDialer

protected static boolean hasPermissions(Context context, String[] permissions) {
    Trace.beginSection("hasPermission");
    try {
      for (String permission : permissions) {
        if (ContextCompat.checkSelfPermission(context, permission)
            != PackageManager.PERMISSION_GRANTED) {
          return false;
        }
      }
      return true;
    } finally {
      Trace.endSection();
    }
  }
}

代码示例来源:origin: conghongjie/SmartStart

@Override
  public void run() {
    // 执行
    long start = System.currentTimeMillis();
    Trace.beginSection(task.taskKey);
    task.runnable.run();
    Trace.endSection();
    taskPriorityManager.setTaskTakeTime(task,System.currentTimeMillis()-start);
    synchronized (TaskManager.this){
      taskStateManager.onTaskFinish(task);
    }
    keepRunning();
    // 所有任务都完成的回调
    tryDoFinishedJob();
  }
});

代码示例来源:origin: geniusgithub/AndroidDialer

@Override
public void onCreate(Bundle savedState) {
  if (DEBUG) Log.d(TAG, "onCreate()");
  Trace.beginSection(TAG + " onCreate");
  super.onCreate(savedState);
  mAnimationDuration = getResources().getInteger(R.integer.fade_duration);
  Trace.endSection();
}

代码示例来源:origin: geniusgithub/AndroidDialer

@Override
public void onCreate(Bundle savedInstanceState) {
  Trace.beginSection(TAG + " onCreate");
  super.onCreate(savedInstanceState);
  mVoicemailStatusHelper = new VoicemailStatusHelperImpl();
  mHasFetchedVoicemailStatus = false;
  mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
  mHasActiveVoicemailProvider = mPrefs.getBoolean(
      VisualVoicemailEnabledChecker.PREF_KEY_HAS_ACTIVE_VOICEMAIL_PROVIDER, false);
  Trace.endSection();
}

代码示例来源:origin: geniusgithub/AndroidDialer

@Override
public void onCreate() {
  sContext = this;
  Trace.beginSection(TAG + " onCreate");
  super.onCreate();
  Trace.beginSection(TAG + " ExtensionsFactory initialization");
  ExtensionsFactory.init(getApplicationContext());
  Trace.endSection();
  new BlockedNumbersAutoMigrator(PreferenceManager.getDefaultSharedPreferences(this),
      new FilteredNumberAsyncQueryHandler(getContentResolver())).autoMigrate();
  Trace.endSection();
  MobclickAgent.setDebugMode(true);
}

代码示例来源:origin: geniusgithub/AndroidDialer

@Override
public void onResume() {
  Trace.beginSection(TAG + " onResume");
  super.onResume();
  mActionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
  if (getUserVisibleHint()) {
    sendScreenViewForCurrentPosition();
  }
  // Fetch voicemail status to determine if we should show the voicemail tab.
  mCallLogQueryHandler =
      new CallLogQueryHandler(getActivity(), getActivity().getContentResolver(), this);
  mCallLogQueryHandler.fetchVoicemailStatus();
  mCallLogQueryHandler.fetchMissedCallsUnreadCount();
  Trace.endSection();
}

相关文章

微信公众号

最新文章

更多