Home | History | Annotate | Download | only in util
      1 /*
      2  * Copyright (C) 2013 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.ex.photo.util;
     18 
     19 import android.os.Build;
     20 
     21 /**
     22  * Stand-in for {@link android.os.Trace}.
     23  */
     24 public abstract class Trace {
     25 
     26     /**
     27      * Begins systrace tracing for a given tag. No-op on unsupported platform versions.
     28      *
     29      * @param tag systrace tag to use
     30      *
     31      * @see android.os.Trace#beginSection(String)
     32      */
     33     public static void beginSection(String tag) {
     34         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
     35             android.os.Trace.beginSection(tag);
     36         }
     37     }
     38 
     39     /**
     40      * Ends systrace tracing for the most recently begun section. No-op on unsupported platform
     41      * versions.
     42      *
     43      * @see android.os.Trace#endSection()
     44      */
     45     public static void endSection() {
     46         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
     47             android.os.Trace.endSection();
     48         }
     49     }
     50 
     51 }
     52