Files
reverse-engineering-anything/src/domain/android/androidNativeDeclarations.ts
T
gensokyo-dev 570abe95f2 feat(android): link native declarations to static JNI candidates (#7472)
Link original DEX native declarations to per-ABI function exports and relocated static JNI table candidates through shared CLI/MCP workflows. Preserve global attribution ambiguity, exact provenance, partial coverage and retained Evidence; default MCP delivery to bounded summaries with filtered/batch pages.

Use one immutable ELF relocation decoder with streaming IL2CPP materialization, cooperative bounded export/version parsing and bounded JNI state. Reuse validated session inventories without loading target libraries or executing JNI code.

Validation: relevant type/lint/build and parser/domain/public CLI/MCP regressions; genuine four-ABI NDK fixtures and independent library/slot oracles; actual JDK/JADX Conscrypt workflows with retained-source removal. Full measurements and limitations are recorded in docs/verification/android-jni-bindings-2026-10-27.md.

Closes #6403.
2026-10-27 18:53:22 +08:00

41 lines
1.3 KiB
TypeScript

import { z } from "zod";
import { dexDescriptorSchema } from "./dexTypes.js";
const count = z.int().nonnegative().safe();
/** One original ACC_NATIVE declaration, before decompiler class deduplication. */
export const androidNativeDeclarationSchema = z.strictObject({
source_index: count,
class_name: z.string().min(1),
method_name: z.string().min(1),
descriptor: dexDescriptorSchema,
dex_entry: z.string().min(1),
/** Central-directory ordinal; duplicate names are explicitly unsupported. */
dex_entry_index: count,
/** Class-definition ordinal within this DEX. */
class_index: count,
/** Method-reference index in the originating DEX. */
method_index: count,
});
/** Scope is standard root classes*.dex members, never runtime-loaded code. */
export const androidNativeDeclarationsSchema = z.strictObject({
scope: z.literal("apk-root-dex-declarations"),
methods: z.array(androidNativeDeclarationSchema),
coverage: z.strictObject({
status: z.enum(["complete", "partial", "unknown"]),
dex_entries: count,
examined_dex_entries: count,
examined_classes: count,
examined_methods: count,
}),
unknowns: z.array(z.string()),
});
export type AndroidNativeDeclaration = z.infer<
typeof androidNativeDeclarationSchema
>;
export type AndroidNativeDeclarations = z.infer<
typeof androidNativeDeclarationsSchema
>;