From 2bb2fbd2879d0a6d9ebf7acff817079dde89b417 Mon Sep 17 00:00:00 2001 From: David Brazdil Date: Tue, 13 Nov 2018 18:24:26 +0000 Subject: Create SdkVersion enum, migrate users to it Creates a new SdkVersion enum with integer codes of known Android SDK versions, together with helper functions for common predicates. Also converts target_sdk_version_ in Runtime to uint32_t and cleans up its uses. Test: m test-art Change-Id: Idc6e518c8675068bf952d0256686c88bb0eb833e --- runtime/entrypoints/entrypoint_utils.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'runtime/entrypoints/entrypoint_utils.cc') diff --git a/runtime/entrypoints/entrypoint_utils.cc b/runtime/entrypoints/entrypoint_utils.cc index 12136bf476..19498f386c 100644 --- a/runtime/entrypoints/entrypoint_utils.cc +++ b/runtime/entrypoints/entrypoint_utils.cc @@ -20,6 +20,7 @@ #include "art_method-inl.h" #include "base/enums.h" #include "base/mutex.h" +#include "base/sdk_version.h" #include "class_linker-inl.h" #include "dex/dex_file-inl.h" #include "entrypoints/entrypoint_utils-inl.h" @@ -64,9 +65,9 @@ JValue InvokeProxyInvocationHandler(ScopedObjectAccessAlreadyRunnable& soa, cons soa.Self()->AssertThreadSuspensionIsAllowable(); jobjectArray args_jobj = nullptr; const JValue zero; - int32_t target_sdk_version = Runtime::Current()->GetTargetSdkVersion(); + uint32_t target_sdk_version = Runtime::Current()->GetTargetSdkVersion(); // Do not create empty arrays unless needed to maintain Dalvik bug compatibility. - if (args.size() > 0 || (target_sdk_version > 0 && target_sdk_version <= 21)) { + if (args.size() > 0 || IsSdkVersionSetAndAtMost(target_sdk_version, SdkVersion::kL)) { args_jobj = soa.Env()->NewObjectArray(args.size(), WellKnownClasses::java_lang_Object, nullptr); if (args_jobj == nullptr) { CHECK(soa.Self()->IsExceptionPending()); -- cgit v1.2.3-59-g8ed1b