-
- All Implemented Interfaces:
-
io.sentry.util.thread.IThreadChecker
@ApiStatus.Internal() public final class AndroidThreadChecker implements IThreadCheckerClass that checks if a given thread is the Android Main/UI thread
-
-
Field Summary
Fields Modifier and Type Field Description private final static AndroidThreadCheckerinstancepublic static volatile longmainThreadSystemId
-
Method Summary
Modifier and Type Method Description static AndroidThreadCheckergetInstance()static longgetThreadId(@NotNull() Thread thread)Gets the thread ID in a way that's compatible across Android versions. booleanisMainThread(long threadId)booleanisMainThread(@NotNull() Thread thread)booleanisMainThread()StringgetCurrentThreadName()booleanisMainThread(@NotNull() SentryThread sentryThread)longcurrentThreadSystemId()-
-
Method Detail
-
getInstance
static AndroidThreadChecker getInstance()
-
getThreadId
static long getThreadId(@NotNull() Thread thread)
Gets the thread ID in a way that's compatible across Android versions.
Uses threadId on Android 16 (API 36) and above, and falls back to on older versions.
- Parameters:
thread- the thread to get the ID for
-
isMainThread
boolean isMainThread(long threadId)
-
isMainThread
boolean isMainThread(@NotNull() Thread thread)
-
isMainThread
boolean isMainThread()
-
getCurrentThreadName
@NotNull() String getCurrentThreadName()
-
isMainThread
boolean isMainThread(@NotNull() SentryThread sentryThread)
-
currentThreadSystemId
long currentThreadSystemId()
-
-
-
-