Class AndroidPreconditions
- java.lang.Object
-
- com.google.ar.sceneform.utilities.AndroidPreconditions
-
public class AndroidPreconditions extends java.lang.Object
Helper class for common android specific preconditions used inside of RenderCore.
-
-
Constructor Summary
Constructors Constructor Description AndroidPreconditions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
checkMinAndroidApiLevel()
Enforce the minimum Android api levelstatic void
checkUiThread()
Ensure that the code is being executed on Android's UI thread.static boolean
isAndroidApiAvailable()
Returns true if the Android API is currently available.static boolean
isMinAndroidApiLevel()
Returns true if the Android api level is above the minimum or if not on Android.static boolean
isUnderTesting()
static void
setUnderTesting(boolean isUnderTesting)
-
-
-
Method Detail
-
checkUiThread
public static void checkUiThread()
Ensure that the code is being executed on Android's UI thread. Null-Op if the Android API isn't available (i.e. for unit tests.
-
checkMinAndroidApiLevel
public static void checkMinAndroidApiLevel()
Enforce the minimum Android api level- Throws:
java.lang.IllegalStateException
- if the api level is not high enough
-
isAndroidApiAvailable
public static boolean isAndroidApiAvailable()
Returns true if the Android API is currently available. Useful for branching functionality to make it testable via junit. The android API is available for Robolectric tests and android emulator tests.
-
isUnderTesting
public static boolean isUnderTesting()
-
isMinAndroidApiLevel
public static boolean isMinAndroidApiLevel()
Returns true if the Android api level is above the minimum or if not on Android.Also returns true if not on Android or in a test.
-
setUnderTesting
public static void setUnderTesting(boolean isUnderTesting)
-
-