| 147 | } |
| 148 | |
| 149 | std::vector<Valdi::StringBox> ViewManager::getClassHierarchy(const Valdi::StringBox& className) { |
| 150 | std::vector<Valdi::StringBox> out; |
| 151 | out.emplace_back(className); |
| 152 | |
| 153 | #ifdef VALDI_DEBUG_JNI_CALLS |
| 154 | __android_log_print(ANDROID_LOG_INFO, "[valdi_jni]", "Resolving classHierarchy for %s", className.getCStr()); |
| 155 | #endif |
| 156 | |
| 157 | auto* jclass = getClassForName(className).javaClass.getClass(); |
| 158 | |
| 159 | while (true) { |
| 160 | jclass = JavaEnv::accessEnvRet([&](JNIEnv& env) -> auto { return env.GetSuperclass(jclass); }); |
| 161 | if (jclass == nullptr) { |
| 162 | break; |
| 163 | } |
| 164 | |
| 165 | auto name = JavaEnv::getCache().getClassGetNameMethod().call(jclass); |
| 166 | auto cppName = ValdiAndroid::toInternedString(getEnv(), name); |
| 167 | |
| 168 | #ifdef VALDI_DEBUG_JNI_CALLS |
| 169 | __android_log_print( |
| 170 | ANDROID_LOG_INFO, "[valdi_jni]", "Parent class of %s -> %s", className.getCStr(), cppName.getCStr()); |
| 171 | #endif |
| 172 | |
| 173 | out.emplace_back(std::move(cppName)); |
| 174 | } |
| 175 | |
| 176 | return out; |
| 177 | } |
| 178 | |
| 179 | void ViewManager::bindAttributes(const Valdi::StringBox& className, Valdi::AttributesBindingContext& binder) { |
| 180 | static auto kObjectClass = STRING_LITERAL("java.lang.Object"); |
no test coverage detected