![JAR search and dependency download from the Maven repository](/logo.png)
src.com.android.clockwork.common.DebugAssert Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of android-all Show documentation
Show all versions of android-all Show documentation
A library jar that provides APIs for Applications written for the Google Android Platform.
package com.android.clockwork.common;
import android.os.Build;
import android.os.Looper;
/**
* A class that throws if an assertion fails. These assertions are compiled away in user builds
* similar to C assertions.
*/
public class DebugAssert {
private static final boolean IS_USER_BUILD = "user".equals(Build.TYPE);
// Do not instantiate.
private DebugAssert() {}
/**
* Asserts that execution control is on the main thread.
*/
public static void isMainThread() {
if (!IS_USER_BUILD && Looper.getMainLooper().getThread() != Thread.currentThread()) {
throw new AssertionError("This function should be called from the main thread.");
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy