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