Merge changes from topic "runtime_skipcache"

* changes:
  VINTF: Remove skipCache boolean.
  Debug.isVmapStack reads kernel configs only
This commit is contained in:
Yifan Hong
2020-07-22 20:06:39 +00:00
committed by Gerrit Code Review
2 changed files with 12 additions and 12 deletions

View File

@@ -846,8 +846,10 @@ static jboolean android_os_Debug_isVmapStack(JNIEnv *env, jobject clazz)
} cfg_state = CONFIG_UNKNOWN; } cfg_state = CONFIG_UNKNOWN;
if (cfg_state == CONFIG_UNKNOWN) { if (cfg_state == CONFIG_UNKNOWN) {
const std::map<std::string, std::string> configs = auto runtime_info = vintf::VintfObject::GetInstance()->getRuntimeInfo(
vintf::VintfObject::GetInstance()->getRuntimeInfo()->kernelConfigs(); vintf::RuntimeInfo::FetchFlag::CONFIG_GZ);
CHECK(runtime_info != nullptr) << "Kernel configs cannot be fetched. b/151092221";
const std::map<std::string, std::string>& configs = runtime_info->kernelConfigs();
std::map<std::string, std::string>::const_iterator it = configs.find("CONFIG_VMAP_STACK"); std::map<std::string, std::string>::const_iterator it = configs.find("CONFIG_VMAP_STACK");
cfg_state = (it != configs.end() && it->second == "y") ? CONFIG_SET : CONFIG_UNSET; cfg_state = (it != configs.end() && it->second == "y") ? CONFIG_SET : CONFIG_UNSET;
} }

View File

@@ -29,14 +29,12 @@ namespace android {
using vintf::RuntimeInfo; using vintf::RuntimeInfo;
using vintf::VintfObject; using vintf::VintfObject;
#define MAP_STRING_METHOD(javaMethod, cppString, flags) \ #define MAP_STRING_METHOD(javaMethod, cppString, flags) \
static jstring android_os_VintfRuntimeInfo_##javaMethod(JNIEnv* env, jclass clazz) \ static jstring android_os_VintfRuntimeInfo_##javaMethod(JNIEnv* env, jclass clazz) { \
{ \ std::shared_ptr<const RuntimeInfo> info = VintfObject::GetRuntimeInfo(flags); \
std::shared_ptr<const RuntimeInfo> info = VintfObject::GetRuntimeInfo( \ if (info == nullptr) return nullptr; \
false /* skipCache */, flags); \ return env->NewStringUTF((cppString).c_str()); \
if (info == nullptr) return nullptr; \ }
return env->NewStringUTF((cppString).c_str()); \
} \
MAP_STRING_METHOD(getCpuInfo, info->cpuInfo(), RuntimeInfo::FetchFlag::CPU_INFO); MAP_STRING_METHOD(getCpuInfo, info->cpuInfo(), RuntimeInfo::FetchFlag::CPU_INFO);
MAP_STRING_METHOD(getOsName, info->osName(), RuntimeInfo::FetchFlag::CPU_VERSION); MAP_STRING_METHOD(getOsName, info->osName(), RuntimeInfo::FetchFlag::CPU_VERSION);
@@ -54,8 +52,8 @@ MAP_STRING_METHOD(getBootVbmetaAvbVersion, vintf::to_string(info->bootVbmetaAvbV
static jlong android_os_VintfRuntimeInfo_getKernelSepolicyVersion(JNIEnv *env, jclass clazz) static jlong android_os_VintfRuntimeInfo_getKernelSepolicyVersion(JNIEnv *env, jclass clazz)
{ {
std::shared_ptr<const RuntimeInfo> info = VintfObject::GetRuntimeInfo( std::shared_ptr<const RuntimeInfo> info =
false /* skipCache */, RuntimeInfo::FetchFlag::POLICYVERS); VintfObject::GetRuntimeInfo(RuntimeInfo::FetchFlag::POLICYVERS);
if (info == nullptr) return 0; if (info == nullptr) return 0;
return static_cast<jlong>(info->kernelSepolicyVersion()); return static_cast<jlong>(info->kernelSepolicyVersion());
} }