• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright 2014 The WebRTC Project Authors. All rights reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 package org.appspot.apprtc.util;
12 
13 import android.os.Build;
14 import android.util.Log;
15 
16 /**
17  * AppRTCUtils provides helper functions for managing thread safety.
18  */
19 public final class AppRTCUtils {
AppRTCUtils()20   private AppRTCUtils() {}
21 
22   /** Helper method which throws an exception  when an assertion has failed. */
assertIsTrue(boolean condition)23   public static void assertIsTrue(boolean condition) {
24     if (!condition) {
25       throw new AssertionError("Expected condition to be true");
26     }
27   }
28 
29   /** Helper method for building a string of thread information.*/
getThreadInfo()30   public static String getThreadInfo() {
31     return "@[name=" + Thread.currentThread().getName() + ", id=" + Thread.currentThread().getId()
32         + "]";
33   }
34 
35   /** Information about the current build, taken from system properties. */
logDeviceInfo(String tag)36   public static void logDeviceInfo(String tag) {
37     Log.d(tag, "Android SDK: " + Build.VERSION.SDK_INT + ", "
38             + "Release: " + Build.VERSION.RELEASE + ", "
39             + "Brand: " + Build.BRAND + ", "
40             + "Device: " + Build.DEVICE + ", "
41             + "Id: " + Build.ID + ", "
42             + "Hardware: " + Build.HARDWARE + ", "
43             + "Manufacturer: " + Build.MANUFACTURER + ", "
44             + "Model: " + Build.MODEL + ", "
45             + "Product: " + Build.PRODUCT);
46   }
47 }
48