public static void allFields() throws HackAssertionException { ActivityThread_mInstrumentation = ActivityThread.field("mInstrumentation").ofType(Instrumentation.class); ActivityThread_mAllApplications = ActivityThread.field("mAllApplications").ofGenericType(ArrayList.class); ActivityThread_mInitialApplication = ActivityThread.field("mInitialApplication").ofType(Application.class); ActivityThread_mPackages = ActivityThread.field("mPackages").ofGenericType(Map.class); ActivityThread_sPackageManager = ActivityThread.staticField("sPackageManager").ofType(IPackageManager.getmClass()); LoadedApk_mApplication = LoadedApk.field("mApplication").ofType(Application.class); LoadedApk_mResources = LoadedApk.field("mResources").ofType(Resources.class); LoadedApk_mResDir = LoadedApk.field("mResDir").ofType(String.class); LoadedApk_mClassLoader = LoadedApk.field("mClassLoader").ofType(ClassLoader.class); LoadedApk_mBaseClassLoader = LoadedApk.field("mBaseClassLoader").ofType(ClassLoader.class); LoadedApk_mAppDir = LoadedApk.field("mAppDir").ofType(String.class); ContextImpl_mResources = ContextImpl.field("mResources").ofType(Resources.class); ContextImpl_mTheme = ContextImpl.field("mTheme").ofType(Theme.class); sIsIgnoreFailure = true; ContextThemeWrapper_mBase = ContextThemeWrapper.field("mBase").ofType(Context.class); sIsIgnoreFailure = false; ContextThemeWrapper_mTheme = ContextThemeWrapper.field("mTheme").ofType(Theme.class); try { if (VERSION.SDK_INT >= 17 && ContextThemeWrapper.getmClass().getDeclaredField("mResources") != null) { ContextThemeWrapper_mResources = ContextThemeWrapper.field("mResources").ofType(Resources.class); } } catch (NoSuchFieldException e) { log.warn("Not found ContextThemeWrapper.mResources on VERSION " + VERSION.SDK_INT); } ContextWrapper_mBase = ContextWrapper.field("mBase").ofType(Context.class); Resources_mAssets = Resources.field("mAssets"); }
public static void allMethods() throws HackAssertionException { ActivityThread_currentActivityThread = ActivityThread.method("currentActivityThread"); AssetManager_addAssetPath = AssetManager.method("addAssetPath", String.class); Application_attach = Application.method("attach", Context.class); ClassLoader_findLibrary = ClassLoader.method("findLibrary", String.class); if (LexFile != null && LexFile.getmClass() != null) { LexFile_loadLex = LexFile.method("loadLex", String.class, Integer.TYPE); LexFile_loadClass = LexFile.method("loadClass", String.class, ClassLoader.class); LexFile_close = LexFile.method("close"); DexClassLoader_findClass = DexClassLoader.method("findClass", String.class); } }