MCPcopy Create free account
hub / github.com/Snapchat/Valdi / getAllModuleHashes

Method getAllModuleHashes

valdi/src/valdi/android/NativeBridge.cpp:1689–1710  ·  view source on GitHub ↗

* Java->C++ entry point for getting all hashes of loaded modules. * * Parameters: * - clazz: The Java class reference (unused). * - runtimeHandle: The java handle to the runtime. * * Returns: * - A jobject representing a Java array of bundle names and their corresponding hash. * * Notes: * - Iterates over all loaded bundle names and retrieves their hash. * - The result is converted to a

Source from the content-addressed store, hash-verified

1687 * - The result is converted to a jobject. As a double nested array [[bundleName, hash]].
1688 */
1689jobject ValdiAndroid::NativeBridge::getAllModuleHashes( // NOLINT
1690 fbjni::alias_ref<fbjni::JClass> /* clazz */, // NOLINT
1691 jlong runtimeHandle) {
1692 Valdi::Ref<Valdi::ValueArray> retval;
1693
1694 auto runtime = getRuntime(runtimeHandle);
1695 if (runtime != nullptr) {
1696 auto bundles = runtime->getResourceManager().getAllInitializedBundles();
1697 Valdi::ValueArrayBuilder builder;
1698 for (const auto& [bundleName, bundle] : bundles) {
1699 auto hash = bundle->getHash();
1700 if (hash) {
1701 auto bundleNameAndHash = Valdi::ValueArray::make(2);
1702 bundleNameAndHash->emplace(0, Valdi::Value(bundleName));
1703 bundleNameAndHash->emplace(1, Valdi::Value(hash.moveValue()));
1704 builder.append(Valdi::Value(bundleNameAndHash));
1705 }
1706 }
1707 retval = builder.build();
1708 }
1709 return ValdiAndroid::toJavaObject(ValdiAndroid::JavaEnv(), retval).releaseObject();
1710}
1711
1712jobject ValdiAndroid::NativeBridge::dumpMemoryStatistics( // NOLINT
1713 fbjni::alias_ref<fbjni::JClass> /* clazz */, // NOLINT

Callers

nothing calls this directly

Calls 9

getRuntimeFunction · 0.85
toJavaObjectFunction · 0.85
appendMethod · 0.65
releaseObjectMethod · 0.65
ValueClass · 0.50
JavaEnvClass · 0.50
getHashMethod · 0.45
emplaceMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected