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