mirror of
https://github.com/morluto/rea.git
synced 2026-11-20 05:32:44 +00:00
fix(android): qualify the JNI library inventory by required splits
A base APK whose manifest requires ABI or density splits keeps its native libraries in those splits, yet inspect_android_jni_bindings reported a complete library inventory with zero libraries. The bridge's native declaration inventory now also decodes the root binary manifest without a session and reports its requiredSplitTypes and isSplitRequired facts, or why they are unknown (bridge identity 11). When splits are required or unknown, the library inventory is partial with an unknown that says so, and a binding without a candidate is unknown instead of unmatched. The binary manifest fixture from #9769 was used to check the bridge with the real jadx-headless-mcp 0.7.1 JAR, including stripped attribute names that resolve through framework resource IDs. Fixes #9756 Co-Authored-By: 2SinceJuly <202121119+2SinceJuly@users.noreply.github.com> Co-Authored-By: Phon <twilyt1@proton.me> Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
This commit is contained in:
1 parent
101e0986b0
commit
18b72ca461
11 files changed
+252
-13
No files matched your search
@@ -2,6 +2,7 @@ import { expect, it } from "vitest";
|
||||
import { readAndroidNativeInventory } from "./AndroidNativeInventory.js";
|
||||
import type { JadxToolPort } from "./JadxAnalysis.js";
|
||||
import type { JsonValue } from "../domain/jsonValue.js";
|
||||
import type { AndroidNativeDeclarations } from "../domain/android/androidNativeDeclarations.js";
|
||||
|
||||
const SNAPSHOT = "/admitted/immutable target.apk";
|
||||
|
||||
@@ -26,6 +27,11 @@ const inventory = () => ({
|
||||
examined_methods: 9,
|
||||
},
|
||||
unknowns: [] as string[],
|
||||
manifest_splits: {
|
||||
status: "observed",
|
||||
required_split_types: [] as string[],
|
||||
split_required: false,
|
||||
},
|
||||
});
|
||||
const tools = (value: unknown): JadxToolPort => ({
|
||||
json: async (name, input) => {
|
||||
@@ -56,6 +62,23 @@ it("preserves duplicate native identities from distinct original DEX members", a
|
||||
expect(actual.coverage.status).toBe("complete");
|
||||
});
|
||||
|
||||
it("keeps the manifest's split requirements and unread split facts", async () => {
|
||||
for (const manifest_splits of [
|
||||
{
|
||||
status: "observed",
|
||||
required_split_types: ["base__abi", "base__density"],
|
||||
split_required: true,
|
||||
},
|
||||
{ status: "unknown", reason: "Root AndroidManifest.xml is absent" },
|
||||
] satisfies AndroidNativeDeclarations["manifest_splits"][]) {
|
||||
const source = { ...inventory(), manifest_splits };
|
||||
expect(
|
||||
(await readAndroidNativeInventory(tools(source), SNAPSHOT))
|
||||
.manifest_splits,
|
||||
).toEqual(manifest_splits);
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps usable facts and explicit incomplete DEX coverage", async () => {
|
||||
const source = inventory();
|
||||
source.coverage.status = "partial";
|
||||
@@ -88,6 +111,10 @@ it.each([
|
||||
(source: ReturnType<typeof inventory>) => {
|
||||
source.methods.push({ ...row, source_index: 1, dex_entry: "other.dex" });
|
||||
},
|
||||
// A bridge that predates split facts cannot say whether splits hold code.
|
||||
(source: ReturnType<typeof inventory>) => {
|
||||
delete (source as Partial<typeof source>).manifest_splits;
|
||||
},
|
||||
])("rejects malformed or inconsistent producer facts (%#)", async (mutate) => {
|
||||
const source = inventory();
|
||||
mutate(source);
|
||||
|
||||
Reference in new issue
Block a user