diff options
author | 2024-11-13 08:32:00 -0800 | |
---|---|---|
committer | 2024-11-15 13:27:16 -0800 | |
commit | 121d051b25367340fe27a4f74cd1fac2f0d229fb (patch) | |
tree | 19002d642794f8393e6095f9d5b173014254d6f6 /ravenwood/runtime-common-src | |
parent | 34aa8a61f62b62715f7bc110c07e4849471f91b5 (diff) |
Set package name via the build file, not via Config.
Flag: EXEMPT host test change only
Bug: 377765941
Test: $ANDROID_BUILD_TOP/frameworks/base/ravenwood/scripts/run-ravenwood-tests.sh -t
Change-Id: Ied81b7c246a25ac376db93b2cd14b4d449359ca2
Diffstat (limited to 'ravenwood/runtime-common-src')
-rw-r--r-- | ravenwood/runtime-common-src/com/android/ravenwood/common/RavenwoodCommonUtils.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/ravenwood/runtime-common-src/com/android/ravenwood/common/RavenwoodCommonUtils.java b/ravenwood/runtime-common-src/com/android/ravenwood/common/RavenwoodCommonUtils.java index 520f050f0655..e83f8416214e 100644 --- a/ravenwood/runtime-common-src/com/android/ravenwood/common/RavenwoodCommonUtils.java +++ b/ravenwood/runtime-common-src/com/android/ravenwood/common/RavenwoodCommonUtils.java @@ -284,4 +284,21 @@ public class RavenwoodCommonUtils { th.printStackTrace(writer); return stringWriter.toString(); } + + /** Same as {@link Integer#parseInt(String)} but accepts null and returns null. */ + @Nullable + public static Integer parseNullableInt(@Nullable String value) { + if (value == null) { + return null; + } + return Integer.parseInt(value); + } + + /** + * @return {@code value} if it's non-null. Otherwise, returns {@code def}. + */ + @Nullable + public static <T> T withDefault(@Nullable T value, @Nullable T def) { + return value != null ? value : def; + } } |