diff options
author | David Brazdil <dbrazdil@google.com> | 2018-01-18 16:50:58 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-01-18 16:50:58 +0000 |
commit | 1ec1d318c76ef3232ac5ee14c4313f77432c910f (patch) | |
tree | 4ed28d4cec632086b216b92cc287f4deaf4bb757 | |
parent | 4dafb1abcf1af20135ee4a0b818362725b716e9e (diff) | |
parent | 975416667698cbe139e0f12baa3f7dd6c278209d (diff) |
Merge "Set runtime hidden API access flags" am: 9ee6fe008d am: 0187bee09a
am: 9754166676
Change-Id: I87085f0c7d3ad780731992b1b249cf2b1eb2f1a7
-rw-r--r-- | runtime/art_method-inl.h | 2 | ||||
-rw-r--r-- | runtime/art_method.h | 4 | ||||
-rw-r--r-- | runtime/class_linker.cc | 17 | ||||
-rw-r--r-- | runtime/dex/dex_file.h | 8 | ||||
-rw-r--r-- | runtime/dex/dex_hidden_access_flags.h | 110 | ||||
-rw-r--r-- | runtime/hidden_api_access_flags.h | 152 | ||||
-rw-r--r-- | runtime/modifiers.h | 9 | ||||
-rw-r--r-- | tools/hiddenapi/hiddenapi.cc | 14 | ||||
-rw-r--r-- | tools/hiddenapi/hiddenapi_test.cc | 100 |
9 files changed, 241 insertions, 175 deletions
diff --git a/runtime/art_method-inl.h b/runtime/art_method-inl.h index bdebe2d9e9..c9a77331a7 100644 --- a/runtime/art_method-inl.h +++ b/runtime/art_method-inl.h @@ -398,6 +398,7 @@ inline void ArtMethod::SetIntrinsic(uint32_t intrinsic) { bool is_default_conflict = IsDefaultConflicting(); bool is_compilable = IsCompilable(); bool must_count_locks = MustCountLocks(); + HiddenApiAccessFlags::ApiList hidden_api_list = GetHiddenApiAccessFlags(); SetAccessFlags(new_value); DCHECK_EQ(java_flags, (GetAccessFlags() & kAccJavaFlagsMask)); DCHECK_EQ(is_constructor, IsConstructor()); @@ -411,6 +412,7 @@ inline void ArtMethod::SetIntrinsic(uint32_t intrinsic) { DCHECK_EQ(is_default_conflict, IsDefaultConflicting()); DCHECK_EQ(is_compilable, IsCompilable()); DCHECK_EQ(must_count_locks, MustCountLocks()); + DCHECK_EQ(hidden_api_list, GetHiddenApiAccessFlags()); } else { SetAccessFlags(new_value); } diff --git a/runtime/art_method.h b/runtime/art_method.h index cd06354859..4501450e05 100644 --- a/runtime/art_method.h +++ b/runtime/art_method.h @@ -336,6 +336,10 @@ class ArtMethod FINAL { AddAccessFlags(kAccMustCountLocks); } + HiddenApiAccessFlags::ApiList GetHiddenApiAccessFlags() { + return HiddenApiAccessFlags::DecodeFromRuntime(GetAccessFlags()); + } + // Returns true if this method could be overridden by a default method. bool IsOverridableByDefaultMethod() REQUIRES_SHARED(Locks::mutator_lock_); diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index 877654247c..b61fb4afe9 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -3286,7 +3286,15 @@ void ClassLinker::LoadField(const ClassDataItemIterator& it, const uint32_t field_idx = it.GetMemberIndex(); dst->SetDexFieldIndex(field_idx); dst->SetDeclaringClass(klass.Get()); - dst->SetAccessFlags(it.GetFieldAccessFlags()); + + // Get access flags from the DexFile. If this is a boot class path class, + // also set its runtime hidden API access flags. + uint32_t access_flags = it.GetFieldAccessFlags(); + if (klass->IsBootStrapClassLoaded()) { + access_flags = + HiddenApiAccessFlags::EncodeForRuntime(access_flags, it.DecodeHiddenAccessFlags()); + } + dst->SetAccessFlags(access_flags); } void ClassLinker::LoadMethod(const DexFile& dex_file, @@ -3302,8 +3310,15 @@ void ClassLinker::LoadMethod(const DexFile& dex_file, dst->SetDeclaringClass(klass.Get()); dst->SetCodeItemOffset(it.GetMethodCodeItemOffset()); + // Get access flags from the DexFile. If this is a boot class path class, + // also set its runtime hidden API access flags. uint32_t access_flags = it.GetMethodAccessFlags(); + if (klass->IsBootStrapClassLoaded()) { + access_flags = + HiddenApiAccessFlags::EncodeForRuntime(access_flags, it.DecodeHiddenAccessFlags()); + } + if (UNLIKELY(strcmp("finalize", method_name) == 0)) { // Set finalizable flag on declaring class. if (strcmp("V", dex_file.GetShorty(method_id.proto_idx_)) == 0) { diff --git a/runtime/dex/dex_file.h b/runtime/dex/dex_file.h index 2055f848d9..1ee48f71bc 100644 --- a/runtime/dex/dex_file.h +++ b/runtime/dex/dex_file.h @@ -27,9 +27,9 @@ #include "base/macros.h" #include "base/value_object.h" #include "dex_file_types.h" -#include "dex_hidden_access_flags.h" #include "dex_instruction_iterator.h" #include "globals.h" +#include "hidden_api_access_flags.h" #include "jni.h" #include "modifiers.h" @@ -1261,10 +1261,10 @@ class ClassDataItemIterator { return GetMemberAccessFlags() & kAccValidMethodFlags; } uint32_t GetMemberAccessFlags() const { - return DexHiddenAccessFlags::RemoveHiddenFlags(GetRawMemberAccessFlags()); + return HiddenApiAccessFlags::RemoveFromDex(GetRawMemberAccessFlags()); } - DexHiddenAccessFlags::ApiList DecodeHiddenAccessFlags() const { - return DexHiddenAccessFlags::Decode(GetRawMemberAccessFlags()); + HiddenApiAccessFlags::ApiList DecodeHiddenAccessFlags() const { + return HiddenApiAccessFlags::DecodeFromDex(GetRawMemberAccessFlags()); } bool MemberIsNative() const { return GetRawMemberAccessFlags() & kAccNative; diff --git a/runtime/dex/dex_hidden_access_flags.h b/runtime/dex/dex_hidden_access_flags.h deleted file mode 100644 index 16fae86b24..0000000000 --- a/runtime/dex/dex_hidden_access_flags.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (C) 2011 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_RUNTIME_DEX_DEX_HIDDEN_ACCESS_FLAGS_H_ -#define ART_RUNTIME_DEX_DEX_HIDDEN_ACCESS_FLAGS_H_ - -#include "base/bit_utils.h" -#include "modifiers.h" - -namespace art { - -/* This class is used for encoding and decoding access flags of DexFile 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. - * - * First bit is encoded as inversion of visibility flags (public/private/protected). - * At most one can be set for any given class member. If two or three are set, - * this is interpreted as the first bit being set and actual visibility flags - * being the complement of the encoded flags. - * - * Second bit is either encoded as bit 5 for fields and non-native methods, where - * it carries no other meaning. If a method is native, bit 9 is used. - * - * Bits were selected so that they never increase the length of unsigned LEB-128 - * encoding of the access flags. - */ -class DexHiddenAccessFlags { - public: - enum ApiList { - kWhitelist = 0, - kLightGreylist, - kDarkGreylist, - kBlacklist, - }; - - static ALWAYS_INLINE ApiList Decode(uint32_t access_flags) { - DexHiddenAccessFlags flags(access_flags); - uint32_t int_value = (flags.IsFirstBitSet() ? 1 : 0) + (flags.IsSecondBitSet() ? 2 : 0); - return static_cast<ApiList>(int_value); - } - - static ALWAYS_INLINE uint32_t RemoveHiddenFlags(uint32_t access_flags) { - DexHiddenAccessFlags flags(access_flags); - flags.SetFirstBit(false); - flags.SetSecondBit(false); - return flags.GetEncoding(); - } - - static ALWAYS_INLINE uint32_t Encode(uint32_t access_flags, ApiList value) { - DexHiddenAccessFlags flags(access_flags); - uint32_t int_value = static_cast<uint32_t>(value); - flags.SetFirstBit((int_value & 1) != 0); - flags.SetSecondBit((int_value & 2) != 0); - return flags.GetEncoding(); - } - - private: - explicit DexHiddenAccessFlags(uint32_t access_flags) : access_flags_(access_flags) {} - - ALWAYS_INLINE uint32_t GetSecondFlag() { - return ((access_flags_ & kAccNative) != 0) ? kAccDexHiddenBitNative : kAccDexHiddenBit; - } - - ALWAYS_INLINE bool IsFirstBitSet() { - static_assert(IsPowerOfTwo(0u), "Following statement checks if *at most* one bit is set"); - return !IsPowerOfTwo(access_flags_ & kAccVisibilityFlags); - } - - ALWAYS_INLINE void SetFirstBit(bool value) { - if (IsFirstBitSet() != value) { - access_flags_ ^= kAccVisibilityFlags; - } - } - - ALWAYS_INLINE bool IsSecondBitSet() { - return (access_flags_ & GetSecondFlag()) != 0; - } - - ALWAYS_INLINE void SetSecondBit(bool value) { - if (value) { - access_flags_ |= GetSecondFlag(); - } else { - access_flags_ &= ~GetSecondFlag(); - } - } - - ALWAYS_INLINE uint32_t GetEncoding() const { - return access_flags_; - } - - uint32_t access_flags_; -}; - -} // namespace art - - -#endif // ART_RUNTIME_DEX_DEX_HIDDEN_ACCESS_FLAGS_H_ diff --git a/runtime/hidden_api_access_flags.h b/runtime/hidden_api_access_flags.h new file mode 100644 index 0000000000..80a002d96e --- /dev/null +++ b/runtime/hidden_api_access_flags.h @@ -0,0 +1,152 @@ +/* + * 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_RUNTIME_HIDDEN_API_ACCESS_FLAGS_H_ +#define ART_RUNTIME_HIDDEN_API_ACCESS_FLAGS_H_ + +#include "base/bit_utils.h" +#include "modifiers.h" + +namespace art { + +/* 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. + * + * The encoding is different inside DexFile, where we are concerned with size, + * and at runtime where we want to optimize for speed of access. The class + * provides helper functions to decode/encode both of them. + * + * Encoding in DexFile + * =================== + * + * First bit is encoded as inversion of visibility flags (public/private/protected). + * At most one can be set for any given class member. If two or three are set, + * this is interpreted as the first bit being set and actual visibility flags + * being the complement of the encoded flags. + * + * Second bit is either encoded as bit 5 for fields and non-native methods, where + * it carries no other meaning. If a method is native (bit 8 set), bit 9 is used. + * + * Bits were selected so that they never increase the length of unsigned LEB-128 + * encoding of the access flags. + * + * Encoding 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. + * + */ +class HiddenApiAccessFlags { + public: + enum ApiList { + kWhitelist = 0, + kLightGreylist, + kDarkGreylist, + kBlacklist, + }; + + static ALWAYS_INLINE ApiList DecodeFromDex(uint32_t dex_access_flags) { + DexHiddenAccessFlags flags(dex_access_flags); + uint32_t int_value = (flags.IsFirstBitSet() ? 1 : 0) + (flags.IsSecondBitSet() ? 2 : 0); + return static_cast<ApiList>(int_value); + } + + static ALWAYS_INLINE uint32_t RemoveFromDex(uint32_t dex_access_flags) { + DexHiddenAccessFlags flags(dex_access_flags); + flags.SetFirstBit(false); + flags.SetSecondBit(false); + return flags.GetEncoding(); + } + + static ALWAYS_INLINE uint32_t EncodeForDex(uint32_t dex_access_flags, ApiList value) { + DexHiddenAccessFlags flags(RemoveFromDex(dex_access_flags)); + uint32_t int_value = static_cast<uint32_t>(value); + flags.SetFirstBit((int_value & 1) != 0); + flags.SetSecondBit((int_value & 2) != 0); + return flags.GetEncoding(); + } + + static ALWAYS_INLINE ApiList DecodeFromRuntime(uint32_t runtime_access_flags) { + if ((runtime_access_flags & kAccIntrinsic) != 0) { + return kWhitelist; + } else { + uint32_t int_value = (runtime_access_flags & kAccHiddenApiBits) >> kAccFlagsShift; + return static_cast<ApiList>(int_value); + } + } + + static ALWAYS_INLINE uint32_t EncodeForRuntime(uint32_t runtime_access_flags, ApiList value) { + CHECK_EQ(runtime_access_flags & kAccIntrinsic, 0u); + + uint32_t hidden_api_flags = static_cast<uint32_t>(value) << kAccFlagsShift; + CHECK_EQ(hidden_api_flags & ~kAccHiddenApiBits, 0u); + + runtime_access_flags &= ~kAccHiddenApiBits; + return runtime_access_flags | hidden_api_flags; + } + + private: + static const int kAccFlagsShift = CTZ(kAccHiddenApiBits); + static_assert(IsPowerOfTwo((kAccHiddenApiBits >> kAccFlagsShift) + 1), + "kAccHiddenApiBits are not continuous"); + + struct DexHiddenAccessFlags { + explicit DexHiddenAccessFlags(uint32_t access_flags) : access_flags_(access_flags) {} + + ALWAYS_INLINE uint32_t GetSecondFlag() { + return ((access_flags_ & kAccNative) != 0) ? kAccDexHiddenBitNative : kAccDexHiddenBit; + } + + ALWAYS_INLINE bool IsFirstBitSet() { + static_assert(IsPowerOfTwo(0u), "Following statement checks if *at most* one bit is set"); + return !IsPowerOfTwo(access_flags_ & kAccVisibilityFlags); + } + + ALWAYS_INLINE void SetFirstBit(bool value) { + if (IsFirstBitSet() != value) { + access_flags_ ^= kAccVisibilityFlags; + } + } + + ALWAYS_INLINE bool IsSecondBitSet() { + return (access_flags_ & GetSecondFlag()) != 0; + } + + ALWAYS_INLINE void SetSecondBit(bool value) { + if (value) { + access_flags_ |= GetSecondFlag(); + } else { + access_flags_ &= ~GetSecondFlag(); + } + } + + ALWAYS_INLINE uint32_t GetEncoding() const { + return access_flags_; + } + + uint32_t access_flags_; + }; +}; + +} // namespace art + + +#endif // ART_RUNTIME_HIDDEN_API_ACCESS_FLAGS_H_ diff --git a/runtime/modifiers.h b/runtime/modifiers.h index a72f9daad6..0e2db932bb 100644 --- a/runtime/modifiers.h +++ b/runtime/modifiers.h @@ -89,9 +89,11 @@ static constexpr uint32_t kAccMustCountLocks = 0x04000000; // method (ru // virtual call. static constexpr uint32_t kAccSingleImplementation = 0x08000000; // method (runtime) +static constexpr uint32_t kAccHiddenApiBits = 0x30000000; // field, method + // Not currently used, except for intrinsic methods where these bits // are part of the intrinsic ordinal. -static constexpr uint32_t kAccMayBeUnusedBits = 0x70000000; +static constexpr uint32_t kAccMayBeUnusedBits = 0x40000000; // Set by the compiler driver when compiling boot classes with instrinsic methods. static constexpr uint32_t kAccIntrinsic = 0x80000000; // method (runtime) @@ -106,8 +108,9 @@ static constexpr uint32_t kAccClassIsFinalizable = 0x80000000; // Continuous sequence of bits used to hold the ordinal of an intrinsic method. Flags // which overlap are not valid when kAccIntrinsic is set. -static constexpr uint32_t kAccIntrinsicBits = kAccMayBeUnusedBits | kAccSingleImplementation | - kAccMustCountLocks | kAccCompileDontBother | kAccDefaultConflict | kAccPreviouslyWarm; +static constexpr uint32_t kAccIntrinsicBits = kAccMayBeUnusedBits | kAccHiddenApiBits | + kAccSingleImplementation | kAccMustCountLocks | kAccCompileDontBother | kAccDefaultConflict | + kAccPreviouslyWarm; // Valid (meaningful) bits for a field. static constexpr uint32_t kAccValidFieldFlags = kAccPublic | kAccPrivate | kAccProtected | diff --git a/tools/hiddenapi/hiddenapi.cc b/tools/hiddenapi/hiddenapi.cc index fe72bb0231..a755fdb40b 100644 --- a/tools/hiddenapi/hiddenapi.cc +++ b/tools/hiddenapi/hiddenapi.cc @@ -24,7 +24,7 @@ #include "base/unix_file/fd_file.h" #include "dex/art_dex_file_loader.h" #include "dex/dex_file-inl.h" -#include "dex/dex_hidden_access_flags.h" +#include "hidden_api_access_flags.h" #include "mem_map.h" #include "os.h" @@ -108,9 +108,9 @@ class DexMember { // Note that this will not update the cached data of ClassDataItemIterator // until it iterates over this item again and therefore will fail a CHECK if // it is called multiple times on the same DexMember. - void SetHidden(DexHiddenAccessFlags::ApiList value) { + void SetHidden(HiddenApiAccessFlags::ApiList value) { const uint32_t old_flags = it_.GetRawMemberAccessFlags(); - const uint32_t new_flags = DexHiddenAccessFlags::Encode(old_flags, value); + const uint32_t new_flags = HiddenApiAccessFlags::EncodeForDex(old_flags, value); CHECK_EQ(UnsignedLeb128Size(new_flags), UnsignedLeb128Size(old_flags)); // Locate the LEB128-encoded access flags in class data. @@ -350,13 +350,13 @@ class HiddenApi FINAL { // as the strictest. bool is_hidden = true; if (member.IsOnApiList(blacklist_)) { - member.SetHidden(DexHiddenAccessFlags::kBlacklist); + member.SetHidden(HiddenApiAccessFlags::kBlacklist); } else if (member.IsOnApiList(dark_greylist_)) { - member.SetHidden(DexHiddenAccessFlags::kDarkGreylist); + member.SetHidden(HiddenApiAccessFlags::kDarkGreylist); } else if (member.IsOnApiList(light_greylist_)) { - member.SetHidden(DexHiddenAccessFlags::kLightGreylist); + member.SetHidden(HiddenApiAccessFlags::kLightGreylist); } else { - member.SetHidden(DexHiddenAccessFlags::kWhitelist); + member.SetHidden(HiddenApiAccessFlags::kWhitelist); is_hidden = false; } diff --git a/tools/hiddenapi/hiddenapi_test.cc b/tools/hiddenapi/hiddenapi_test.cc index 63484053ac..af1439520f 100644 --- a/tools/hiddenapi/hiddenapi_test.cc +++ b/tools/hiddenapi/hiddenapi_test.cc @@ -121,7 +121,7 @@ class HiddenApiTest : public CommonRuntimeTest { UNREACHABLE(); } - DexHiddenAccessFlags::ApiList GetFieldHiddenFlags(const char* name, + HiddenApiAccessFlags::ApiList GetFieldHiddenFlags(const char* name, uint32_t expected_visibility, const DexFile::ClassDef& class_def, const DexFile& dex_file) { @@ -153,7 +153,7 @@ class HiddenApiTest : public CommonRuntimeTest { UNREACHABLE(); } - DexHiddenAccessFlags::ApiList GetMethodHiddenFlags(const char* name, + HiddenApiAccessFlags::ApiList GetMethodHiddenFlags(const char* name, uint32_t expected_visibility, bool expected_native, const DexFile::ClassDef& class_def, @@ -191,30 +191,30 @@ class HiddenApiTest : public CommonRuntimeTest { UNREACHABLE(); } - DexHiddenAccessFlags::ApiList GetIFieldHiddenFlags(const DexFile& dex_file) { + HiddenApiAccessFlags::ApiList GetIFieldHiddenFlags(const DexFile& dex_file) { return GetFieldHiddenFlags("ifield", kAccPublic, FindClass("LMain;", dex_file), dex_file); } - DexHiddenAccessFlags::ApiList GetSFieldHiddenFlags(const DexFile& dex_file) { + HiddenApiAccessFlags::ApiList GetSFieldHiddenFlags(const DexFile& dex_file) { return GetFieldHiddenFlags("sfield", kAccPrivate, FindClass("LMain;", dex_file), dex_file); } - DexHiddenAccessFlags::ApiList GetIMethodHiddenFlags(const DexFile& dex_file) { + HiddenApiAccessFlags::ApiList GetIMethodHiddenFlags(const DexFile& dex_file) { return GetMethodHiddenFlags( "imethod", 0, /* native */ false, FindClass("LMain;", dex_file), dex_file); } - DexHiddenAccessFlags::ApiList GetSMethodHiddenFlags(const DexFile& dex_file) { + HiddenApiAccessFlags::ApiList GetSMethodHiddenFlags(const DexFile& dex_file) { return GetMethodHiddenFlags( "smethod", kAccPublic, /* native */ false, FindClass("LMain;", dex_file), dex_file); } - DexHiddenAccessFlags::ApiList GetINMethodHiddenFlags(const DexFile& dex_file) { + HiddenApiAccessFlags::ApiList GetINMethodHiddenFlags(const DexFile& dex_file) { return GetMethodHiddenFlags( "inmethod", kAccPublic, /* native */ true, FindClass("LMain;", dex_file), dex_file); } - DexHiddenAccessFlags::ApiList GetSNMethodHiddenFlags(const DexFile& dex_file) { + HiddenApiAccessFlags::ApiList GetSNMethodHiddenFlags(const DexFile& dex_file) { return GetMethodHiddenFlags( "snmethod", kAccProtected, /* native */ true, FindClass("LMain;", dex_file), dex_file); } @@ -226,7 +226,7 @@ TEST_F(HiddenApiTest, InstanceFieldNoMatch) { OpenStream(dark_greylist) << "LMain;->ifield:LBadType2;" << std::endl; OpenStream(blacklist) << "LMain;->ifield:LBadType3;" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kWhitelist, GetIFieldHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kWhitelist, GetIFieldHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, InstanceFieldLightGreylistMatch) { @@ -235,7 +235,7 @@ TEST_F(HiddenApiTest, InstanceFieldLightGreylistMatch) { OpenStream(dark_greylist) << "LMain;->ifield:LBadType2;" << std::endl; OpenStream(blacklist) << "LMain;->ifield:LBadType3;" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kLightGreylist, GetIFieldHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kLightGreylist, GetIFieldHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, InstanceFieldDarkGreylistMatch) { @@ -244,7 +244,7 @@ TEST_F(HiddenApiTest, InstanceFieldDarkGreylistMatch) { OpenStream(dark_greylist) << "LMain;->ifield:I" << std::endl; OpenStream(blacklist) << "LMain;->ifield:LBadType3;" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kDarkGreylist, GetIFieldHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kDarkGreylist, GetIFieldHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, InstanceFieldBlacklistMatch) { @@ -253,7 +253,7 @@ TEST_F(HiddenApiTest, InstanceFieldBlacklistMatch) { OpenStream(dark_greylist) << "LMain;->ifield:LBadType2;" << std::endl; OpenStream(blacklist) << "LMain;->ifield:I" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kBlacklist, GetIFieldHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kBlacklist, GetIFieldHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, InstanceFieldTwoListsMatch1) { @@ -262,7 +262,7 @@ TEST_F(HiddenApiTest, InstanceFieldTwoListsMatch1) { OpenStream(dark_greylist) << "LMain;->ifield:I" << std::endl; OpenStream(blacklist) << "LMain;->ifield:I" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kBlacklist, GetIFieldHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kBlacklist, GetIFieldHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, InstanceFieldTwoListsMatch2) { @@ -271,7 +271,7 @@ TEST_F(HiddenApiTest, InstanceFieldTwoListsMatch2) { OpenStream(dark_greylist) << "LMain;->ifield:LBadType2;" << std::endl; OpenStream(blacklist) << "LMain;->ifield:I" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kBlacklist, GetIFieldHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kBlacklist, GetIFieldHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, InstanceFieldTwoListsMatch3) { @@ -280,7 +280,7 @@ TEST_F(HiddenApiTest, InstanceFieldTwoListsMatch3) { OpenStream(dark_greylist) << "LMain;->ifield:I" << std::endl; OpenStream(blacklist) << "LMain;->ifield:LBadType3;" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kDarkGreylist, GetIFieldHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kDarkGreylist, GetIFieldHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, StaticFieldNoMatch) { @@ -289,7 +289,7 @@ TEST_F(HiddenApiTest, StaticFieldNoMatch) { OpenStream(dark_greylist) << "LMain;->sfield:LBadType2;" << std::endl; OpenStream(blacklist) << "LMain;->sfield:LBadType3;" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kWhitelist, GetSFieldHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kWhitelist, GetSFieldHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, StaticFieldLightGreylistMatch) { @@ -298,7 +298,7 @@ TEST_F(HiddenApiTest, StaticFieldLightGreylistMatch) { OpenStream(dark_greylist) << "LMain;->sfield:LBadType2;" << std::endl; OpenStream(blacklist) << "LMain;->sfield:LBadType3;" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kLightGreylist, GetSFieldHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kLightGreylist, GetSFieldHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, StaticFieldDarkGreylistMatch) { @@ -307,7 +307,7 @@ TEST_F(HiddenApiTest, StaticFieldDarkGreylistMatch) { OpenStream(dark_greylist) << "LMain;->sfield:Ljava/lang/Object;" << std::endl; OpenStream(blacklist) << "LMain;->sfield:LBadType3;" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kDarkGreylist, GetSFieldHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kDarkGreylist, GetSFieldHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, StaticFieldBlacklistMatch) { @@ -316,7 +316,7 @@ TEST_F(HiddenApiTest, StaticFieldBlacklistMatch) { OpenStream(dark_greylist) << "LMain;->sfield:LBadType2;" << std::endl; OpenStream(blacklist) << "LMain;->sfield:Ljava/lang/Object;" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kBlacklist, GetSFieldHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kBlacklist, GetSFieldHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, StaticFieldTwoListsMatch1) { @@ -325,7 +325,7 @@ TEST_F(HiddenApiTest, StaticFieldTwoListsMatch1) { OpenStream(dark_greylist) << "LMain;->sfield:Ljava/lang/Object;" << std::endl; OpenStream(blacklist) << "LMain;->sfield:Ljava/lang/Object;" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kBlacklist, GetSFieldHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kBlacklist, GetSFieldHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, StaticFieldTwoListsMatch2) { @@ -334,7 +334,7 @@ TEST_F(HiddenApiTest, StaticFieldTwoListsMatch2) { OpenStream(dark_greylist) << "LMain;->sfield:LBadType2;" << std::endl; OpenStream(blacklist) << "LMain;->sfield:Ljava/lang/Object;" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kBlacklist, GetSFieldHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kBlacklist, GetSFieldHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, StaticFieldTwoListsMatch3) { @@ -343,7 +343,7 @@ TEST_F(HiddenApiTest, StaticFieldTwoListsMatch3) { OpenStream(dark_greylist) << "LMain;->sfield:Ljava/lang/Object;" << std::endl; OpenStream(blacklist) << "LMain;->sfield:LBadType3;" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kDarkGreylist, GetSFieldHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kDarkGreylist, GetSFieldHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, InstanceMethodNoMatch) { @@ -352,7 +352,7 @@ TEST_F(HiddenApiTest, InstanceMethodNoMatch) { OpenStream(dark_greylist) << "LMain;->imethod(LBadType2;)V" << std::endl; OpenStream(blacklist) << "LMain;->imethod(LBadType3;)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kWhitelist, GetIMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kWhitelist, GetIMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, InstanceMethodLightGreylistMatch) { @@ -361,7 +361,7 @@ TEST_F(HiddenApiTest, InstanceMethodLightGreylistMatch) { OpenStream(dark_greylist) << "LMain;->imethod(LBadType2;)V" << std::endl; OpenStream(blacklist) << "LMain;->imethod(LBadType3;)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kLightGreylist, GetIMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kLightGreylist, GetIMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, InstanceMethodDarkGreylistMatch) { @@ -370,7 +370,7 @@ TEST_F(HiddenApiTest, InstanceMethodDarkGreylistMatch) { OpenStream(dark_greylist) << "LMain;->imethod(J)V" << std::endl; OpenStream(blacklist) << "LMain;->imethod(LBadType3;)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kDarkGreylist, GetIMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kDarkGreylist, GetIMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, InstanceMethodBlacklistMatch) { @@ -379,7 +379,7 @@ TEST_F(HiddenApiTest, InstanceMethodBlacklistMatch) { OpenStream(dark_greylist) << "LMain;->imethod(LBadType2;)V" << std::endl; OpenStream(blacklist) << "LMain;->imethod(J)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kBlacklist, GetIMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kBlacklist, GetIMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, InstanceMethodTwoListsMatch1) { @@ -388,7 +388,7 @@ TEST_F(HiddenApiTest, InstanceMethodTwoListsMatch1) { OpenStream(dark_greylist) << "LMain;->imethod(J)V" << std::endl; OpenStream(blacklist) << "LMain;->imethod(J)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kBlacklist, GetIMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kBlacklist, GetIMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, InstanceMethodTwoListsMatch2) { @@ -397,7 +397,7 @@ TEST_F(HiddenApiTest, InstanceMethodTwoListsMatch2) { OpenStream(dark_greylist) << "LMain;->imethod(LBadType2;)V" << std::endl; OpenStream(blacklist) << "LMain;->imethod(J)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kBlacklist, GetIMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kBlacklist, GetIMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, InstanceMethodTwoListsMatch3) { @@ -406,7 +406,7 @@ TEST_F(HiddenApiTest, InstanceMethodTwoListsMatch3) { OpenStream(dark_greylist) << "LMain;->imethod(J)V" << std::endl; OpenStream(blacklist) << "LMain;->imethod(LBadType3;)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kDarkGreylist, GetIMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kDarkGreylist, GetIMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, StaticMethodNoMatch) { @@ -415,7 +415,7 @@ TEST_F(HiddenApiTest, StaticMethodNoMatch) { OpenStream(dark_greylist) << "LMain;->smethod(LBadType2;)V" << std::endl; OpenStream(blacklist) << "LMain;->smethod(LBadType3;)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kWhitelist, GetSMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kWhitelist, GetSMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, StaticMethodLightGreylistMatch) { @@ -424,7 +424,7 @@ TEST_F(HiddenApiTest, StaticMethodLightGreylistMatch) { OpenStream(dark_greylist) << "LMain;->smethod(LBadType2;)V" << std::endl; OpenStream(blacklist) << "LMain;->smethod(LBadType3;)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kLightGreylist, GetSMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kLightGreylist, GetSMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, StaticMethodDarkGreylistMatch) { @@ -433,7 +433,7 @@ TEST_F(HiddenApiTest, StaticMethodDarkGreylistMatch) { OpenStream(dark_greylist) << "LMain;->smethod(Ljava/lang/Object;)V" << std::endl; OpenStream(blacklist) << "LMain;->smethod(LBadType3;)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kDarkGreylist, GetSMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kDarkGreylist, GetSMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, StaticMethodBlacklistMatch) { @@ -442,7 +442,7 @@ TEST_F(HiddenApiTest, StaticMethodBlacklistMatch) { OpenStream(dark_greylist) << "LMain;->smethod(LBadType2;)V" << std::endl; OpenStream(blacklist) << "LMain;->smethod(Ljava/lang/Object;)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kBlacklist, GetSMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kBlacklist, GetSMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, StaticMethodTwoListsMatch1) { @@ -451,7 +451,7 @@ TEST_F(HiddenApiTest, StaticMethodTwoListsMatch1) { OpenStream(dark_greylist) << "LMain;->smethod(Ljava/lang/Object;)V" << std::endl; OpenStream(blacklist) << "LMain;->smethod(Ljava/lang/Object;)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kBlacklist, GetSMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kBlacklist, GetSMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, StaticMethodTwoListsMatch2) { @@ -460,7 +460,7 @@ TEST_F(HiddenApiTest, StaticMethodTwoListsMatch2) { OpenStream(dark_greylist) << "LMain;->smethod(LBadType2;)V" << std::endl; OpenStream(blacklist) << "LMain;->smethod(Ljava/lang/Object;)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kBlacklist, GetSMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kBlacklist, GetSMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, StaticMethodTwoListsMatch3) { @@ -469,7 +469,7 @@ TEST_F(HiddenApiTest, StaticMethodTwoListsMatch3) { OpenStream(dark_greylist) << "LMain;->smethod(Ljava/lang/Object;)V" << std::endl; OpenStream(blacklist) << "LMain;->smethod(LBadType3;)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kDarkGreylist, GetSMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kDarkGreylist, GetSMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, InstanceNativeMethodNoMatch) { @@ -478,7 +478,7 @@ TEST_F(HiddenApiTest, InstanceNativeMethodNoMatch) { OpenStream(dark_greylist) << "LMain;->inmethod(LBadType2;)V" << std::endl; OpenStream(blacklist) << "LMain;->inmethod(LBadType3;)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kWhitelist, GetINMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kWhitelist, GetINMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, InstanceNativeMethodLightGreylistMatch) { @@ -487,7 +487,7 @@ TEST_F(HiddenApiTest, InstanceNativeMethodLightGreylistMatch) { OpenStream(dark_greylist) << "LMain;->inmethod(LBadType2;)V" << std::endl; OpenStream(blacklist) << "LMain;->inmethod(LBadType3;)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kLightGreylist, GetINMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kLightGreylist, GetINMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, InstanceNativeMethodDarkGreylistMatch) { @@ -496,7 +496,7 @@ TEST_F(HiddenApiTest, InstanceNativeMethodDarkGreylistMatch) { OpenStream(dark_greylist) << "LMain;->inmethod(C)V" << std::endl; OpenStream(blacklist) << "LMain;->inmethod(LBadType3;)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kDarkGreylist, GetINMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kDarkGreylist, GetINMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, InstanceNativeMethodBlacklistMatch) { @@ -505,7 +505,7 @@ TEST_F(HiddenApiTest, InstanceNativeMethodBlacklistMatch) { OpenStream(dark_greylist) << "LMain;->inmethod(LBadType2;)V" << std::endl; OpenStream(blacklist) << "LMain;->inmethod(C)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kBlacklist, GetINMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kBlacklist, GetINMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, InstanceNativeMethodTwoListsMatch1) { @@ -514,7 +514,7 @@ TEST_F(HiddenApiTest, InstanceNativeMethodTwoListsMatch1) { OpenStream(dark_greylist) << "LMain;->inmethod(C)V" << std::endl; OpenStream(blacklist) << "LMain;->inmethod(C)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kBlacklist, GetINMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kBlacklist, GetINMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, InstanceNativeMethodTwoListsMatch2) { @@ -523,7 +523,7 @@ TEST_F(HiddenApiTest, InstanceNativeMethodTwoListsMatch2) { OpenStream(dark_greylist) << "LMain;->inmethod(LBadType2;)V" << std::endl; OpenStream(blacklist) << "LMain;->inmethod(C)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kBlacklist, GetINMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kBlacklist, GetINMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, InstanceNativeMethodTwoListsMatch3) { @@ -532,7 +532,7 @@ TEST_F(HiddenApiTest, InstanceNativeMethodTwoListsMatch3) { OpenStream(dark_greylist) << "LMain;->inmethod(C)V" << std::endl; OpenStream(blacklist) << "LMain;->inmethod(LBadType3;)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kDarkGreylist, GetINMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kDarkGreylist, GetINMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, StaticNativeMethodNoMatch) { @@ -541,7 +541,7 @@ TEST_F(HiddenApiTest, StaticNativeMethodNoMatch) { OpenStream(dark_greylist) << "LMain;->snmethod(LBadType2;)V" << std::endl; OpenStream(blacklist) << "LMain;->snmethod(LBadType3;)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kWhitelist, GetSNMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kWhitelist, GetSNMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, StaticNativeMethodLightGreylistMatch) { @@ -550,7 +550,7 @@ TEST_F(HiddenApiTest, StaticNativeMethodLightGreylistMatch) { OpenStream(dark_greylist) << "LMain;->snmethod(LBadType2;)V" << std::endl; OpenStream(blacklist) << "LMain;->snmethod(LBadType3;)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kLightGreylist, GetSNMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kLightGreylist, GetSNMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, StaticNativeMethodDarkGreylistMatch) { @@ -559,7 +559,7 @@ TEST_F(HiddenApiTest, StaticNativeMethodDarkGreylistMatch) { OpenStream(dark_greylist) << "LMain;->snmethod(Ljava/lang/Integer;)V" << std::endl; OpenStream(blacklist) << "LMain;->snmethod(LBadType3;)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kDarkGreylist, GetSNMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kDarkGreylist, GetSNMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, StaticNativeMethodBlacklistMatch) { @@ -568,7 +568,7 @@ TEST_F(HiddenApiTest, StaticNativeMethodBlacklistMatch) { OpenStream(dark_greylist) << "LMain;->snmethod(LBadType2;)V" << std::endl; OpenStream(blacklist) << "LMain;->snmethod(Ljava/lang/Integer;)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kBlacklist, GetSNMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kBlacklist, GetSNMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, StaticNativeMethodTwoListsMatch1) { @@ -577,7 +577,7 @@ TEST_F(HiddenApiTest, StaticNativeMethodTwoListsMatch1) { OpenStream(dark_greylist) << "LMain;->snmethod(Ljava/lang/Integer;)V" << std::endl; OpenStream(blacklist) << "LMain;->snmethod(Ljava/lang/Integer;)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kBlacklist, GetSNMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kBlacklist, GetSNMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, StaticNativeMethodTwoListsMatch2) { @@ -586,7 +586,7 @@ TEST_F(HiddenApiTest, StaticNativeMethodTwoListsMatch2) { OpenStream(dark_greylist) << "LMain;->snmethod(LBadType2;)V" << std::endl; OpenStream(blacklist) << "LMain;->snmethod(Ljava/lang/Integer;)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kBlacklist, GetSNMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kBlacklist, GetSNMethodHiddenFlags(*dex_file)); } TEST_F(HiddenApiTest, StaticNativeMethodTwoListsMatch3) { @@ -595,7 +595,7 @@ TEST_F(HiddenApiTest, StaticNativeMethodTwoListsMatch3) { OpenStream(dark_greylist) << "LMain;->snmethod(Ljava/lang/Integer;)V" << std::endl; OpenStream(blacklist) << "LMain;->snmethod(LBadType3;)V" << std::endl; auto dex_file = RunHiddenApi(light_greylist, dark_greylist, blacklist, {}, &dex); - ASSERT_EQ(DexHiddenAccessFlags::kDarkGreylist, GetSNMethodHiddenFlags(*dex_file)); + ASSERT_EQ(HiddenApiAccessFlags::kDarkGreylist, GetSNMethodHiddenFlags(*dex_file)); } } // namespace art |