diff options
| author | 2018-04-01 07:23:35 +0000 | |
|---|---|---|
| committer | 2018-04-01 07:23:35 +0000 | |
| commit | b4278d18f4467cb12b9694945d05813bb9b0eccf (patch) | |
| tree | 4097e070f6856e4e0dca89eee3d89439574360d5 /tools/veridex/hidden_api.h | |
| parent | b3f8d780a7ef9ec4011cd8b13d2ca1459167e407 (diff) | |
| parent | 0a3a6910e29bd8c1cc9f9094a34c6df0a7f1a2fb (diff) | |
Snap for 4693621 from 0a3a6910e29bd8c1cc9f9094a34c6df0a7f1a2fb to pi-release
Change-Id: I526c4ec4cc7a60371f1124a1858dcc3b493c6bf7
Diffstat (limited to 'tools/veridex/hidden_api.h')
| -rw-r--r-- | tools/veridex/hidden_api.h | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/tools/veridex/hidden_api.h b/tools/veridex/hidden_api.h index 282e7cf8e8..5893b8ae33 100644 --- a/tools/veridex/hidden_api.h +++ b/tools/veridex/hidden_api.h @@ -17,6 +17,9 @@ #ifndef ART_TOOLS_VERIDEX_HIDDEN_API_H_ #define ART_TOOLS_VERIDEX_HIDDEN_API_H_ +#include "dex/hidden_api_access_flags.h" + +#include <ostream> #include <set> #include <string> @@ -35,10 +38,20 @@ class HiddenApi { FillList(blacklist, blacklist_); } - bool LogIfInList(const std::string& name, const char* access_kind) const { - return LogIfIn(name, blacklist_, "Blacklist", access_kind) || - LogIfIn(name, dark_greylist_, "Dark greylist", access_kind) || - LogIfIn(name, light_greylist_, "Light greylist", access_kind); + HiddenApiAccessFlags::ApiList GetApiList(const std::string& name) const { + if (IsInList(name, blacklist_)) { + return HiddenApiAccessFlags::kBlacklist; + } else if (IsInList(name, dark_greylist_)) { + return HiddenApiAccessFlags::kDarkGreylist; + } else if (IsInList(name, light_greylist_)) { + return HiddenApiAccessFlags::kLightGreylist; + } else { + return HiddenApiAccessFlags::kWhitelist; + } + } + + bool IsInRestrictionList(const std::string& name) const { + return GetApiList(name) != HiddenApiAccessFlags::kWhitelist; } static std::string GetApiMethodName(const DexFile& dex_file, uint32_t method_index); @@ -46,10 +59,9 @@ class HiddenApi { static std::string GetApiFieldName(const DexFile& dex_file, uint32_t field_index); private: - static bool LogIfIn(const std::string& name, - const std::set<std::string>& list, - const std::string& log, - const std::string& access_kind); + static bool IsInList(const std::string& name, const std::set<std::string>& list) { + return list.find(name) != list.end(); + } static void FillList(const char* filename, std::set<std::string>& entries); |