diff options
| author | David Brazdil <dbrazdil@google.com> | 2018-10-31 11:04:10 +0000 |
|---|---|---|
| committer | David Brazdil <dbrazdil@google.com> | 2018-11-22 12:49:26 +0000 |
| commit | dcfa89bfc06a6c211bbb64fa81313eaf6454ab67 (patch) | |
| tree | 4aaf6da88861029e387525957bf68796cf95648c /libdexfile | |
| parent | fd667d4165aefe51010e4fe3bd81b820ed9884ef (diff) | |
| download | art-dcfa89bfc06a6c211bbb64fa81313eaf6454ab67.tar.gz art-dcfa89bfc06a6c211bbb64fa81313eaf6454ab67.tar.bz2 art-dcfa89bfc06a6c211bbb64fa81313eaf6454ab67.zip | |
Rename and reorganize hiddenapi::ApiList
Change values of ApiList flags to make them easier to extend in the
future and unify naming across all components. Light greylist is now
just "Greylist", dark greylist becomes "GreylistMaxO".
Note that the version code in "GreylistMaxO" must also include any
maintenance releases, i.e. entries on "GreylistMaxO" are accessible
to apps with targetSdkVersion<=27 (O MR1).
Test: m, phone boots
Test: m test-art
Change-Id: I9622e0646eb265008a8bb2652270876ae95dac84
Diffstat (limited to 'libdexfile')
| -rw-r--r-- | libdexfile/dex/class_accessor-inl.h | 5 | ||||
| -rw-r--r-- | libdexfile/dex/dex_file.h | 1 | ||||
| -rw-r--r-- | libdexfile/dex/dex_file_layout.cc | 1 | ||||
| -rw-r--r-- | libdexfile/dex/dex_file_verifier.cc | 2 | ||||
| -rw-r--r-- | libdexfile/dex/hidden_api_access_flags.h | 80 | ||||
| -rw-r--r-- | libdexfile/dex/test_dex_file_builder.h | 1 |
6 files changed, 6 insertions, 84 deletions
diff --git a/libdexfile/dex/class_accessor-inl.h b/libdexfile/dex/class_accessor-inl.h index e9e3a98224..f0f14c67ea 100644 --- a/libdexfile/dex/class_accessor-inl.h +++ b/libdexfile/dex/class_accessor-inl.h @@ -19,6 +19,7 @@ #include "class_accessor.h" +#include "base/hiddenapi_flags.h" #include "base/leb128.h" #include "class_iterator.h" #include "code_item_accessors-inl.h" @@ -65,7 +66,7 @@ inline void ClassAccessor::Method::Read() { code_off_ = DecodeUnsignedLeb128(&ptr_pos_); if (hiddenapi_ptr_pos_ != nullptr) { hiddenapi_flags_ = DecodeUnsignedLeb128(&hiddenapi_ptr_pos_); - DCHECK(hiddenapi::AreValidFlags(hiddenapi_flags_)); + DCHECK(hiddenapi::AreValidDexFlags(hiddenapi_flags_)); } } @@ -74,7 +75,7 @@ inline void ClassAccessor::Field::Read() { access_flags_ = DecodeUnsignedLeb128(&ptr_pos_); if (hiddenapi_ptr_pos_ != nullptr) { hiddenapi_flags_ = DecodeUnsignedLeb128(&hiddenapi_ptr_pos_); - DCHECK(hiddenapi::AreValidFlags(hiddenapi_flags_)); + DCHECK(hiddenapi::AreValidDexFlags(hiddenapi_flags_)); } } diff --git a/libdexfile/dex/dex_file.h b/libdexfile/dex/dex_file.h index b3e7ad46c6..83f47fec19 100644 --- a/libdexfile/dex/dex_file.h +++ b/libdexfile/dex/dex_file.h @@ -29,7 +29,6 @@ #include "base/value_object.h" #include "class_iterator.h" #include "dex_file_types.h" -#include "hidden_api_access_flags.h" #include "jni.h" #include "modifiers.h" diff --git a/libdexfile/dex/dex_file_layout.cc b/libdexfile/dex/dex_file_layout.cc index 1e36e05f50..75a31112bb 100644 --- a/libdexfile/dex/dex_file_layout.cc +++ b/libdexfile/dex/dex_file_layout.cc @@ -18,6 +18,7 @@ #include <sys/mman.h> +#include "base/bit_utils.h" #include "dex_file.h" namespace art { diff --git a/libdexfile/dex/dex_file_verifier.cc b/libdexfile/dex/dex_file_verifier.cc index 4d33cd59f7..78e4618f04 100644 --- a/libdexfile/dex/dex_file_verifier.cc +++ b/libdexfile/dex/dex_file_verifier.cc @@ -1632,7 +1632,7 @@ bool DexFileVerifier::CheckIntraHiddenapiClassData() { failure = true; return; } - if (!hiddenapi::AreValidFlags(decoded_flags)) { + if (!hiddenapi::AreValidDexFlags(decoded_flags)) { ErrorStringPrintf("Hiddenapi class data flags invalid (%u) for %s %i", decoded_flags, member_type, member.GetIndex()); failure = true; diff --git a/libdexfile/dex/hidden_api_access_flags.h b/libdexfile/dex/hidden_api_access_flags.h deleted file mode 100644 index 77bfbc99b3..0000000000 --- a/libdexfile/dex/hidden_api_access_flags.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ART_LIBDEXFILE_DEX_HIDDEN_API_ACCESS_FLAGS_H_ -#define ART_LIBDEXFILE_DEX_HIDDEN_API_ACCESS_FLAGS_H_ - -#include "base/bit_utils.h" -#include "base/macros.h" -#include "dex/modifiers.h" - -/* This class is used for encoding and decoding access flags of class members - * from the boot class path. These access flags might contain additional two bits - * of information on whether the given class member should be hidden from apps - * and under what circumstances. - * - * Two bits are encoded for each class member in the HiddenapiClassData item, - * stored in a stream of uleb128-encoded values for each ClassDef item. - * The two bits correspond to values in the ApiList enum below. - * - * At runtime, two bits are set aside in the uint32_t access flags in the - * intrinsics ordinal space (thus intrinsics need to be special-cased). These are - * two consecutive bits and they are directly used to store the integer value of - * the ApiList enum values. - * - */ - -namespace art { -namespace hiddenapi { - -enum class ApiList { - kWhitelist = 0, - kLightGreylist, - kDarkGreylist, - kBlacklist, - kNoList, -}; - -inline bool AreValidFlags(uint32_t flags) { - return flags <= static_cast<uint32_t>(ApiList::kBlacklist); -} - -inline std::ostream& operator<<(std::ostream& os, ApiList value) { - switch (value) { - case ApiList::kWhitelist: - os << "whitelist"; - break; - case ApiList::kLightGreylist: - os << "light greylist"; - break; - case ApiList::kDarkGreylist: - os << "dark greylist"; - break; - case ApiList::kBlacklist: - os << "blacklist"; - break; - case ApiList::kNoList: - os << "no list"; - break; - } - return os; -} - -} // namespace hiddenapi -} // namespace art - - -#endif // ART_LIBDEXFILE_DEX_HIDDEN_API_ACCESS_FLAGS_H_ diff --git a/libdexfile/dex/test_dex_file_builder.h b/libdexfile/dex/test_dex_file_builder.h index 2d8a0bbfe4..072aafb394 100644 --- a/libdexfile/dex/test_dex_file_builder.h +++ b/libdexfile/dex/test_dex_file_builder.h @@ -26,6 +26,7 @@ #include <android-base/logging.h> +#include "base/bit_utils.h" #include "dex/dex_file_loader.h" #include "dex/standard_dex_file.h" |
