From 39f6e4021dfacf81095522f085c935e515d5c103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=93=83=E6=9F=92=E6=9F=92?= Date: Sun, 8 Dec 2024 02:11:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8=20MMKV=20=E9=87=8D=E6=9E=84?= =?UTF-8?q?=20dexkit=20=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/base/dexkit/DexKit.java | 110 ++++++------- .../module/hook/aiasst/DisableWatermark.java | 8 +- .../module/hook/browser/DebugMode.java | 26 +-- .../hook/browser/EnableDebugEnvironment.java | 8 +- .../hook/calendar/UnlockSubscription.java | 8 +- .../module/hook/camera/BlackLeica.java | 44 +++--- .../module/hook/camera/CustomCameraColor.java | 14 +- .../module/hook/camera/CustomWatermark.java | 11 +- .../module/hook/camera/EnableLabOptions.java | 8 +- .../hook/camera/MaxScreenBrightness.java | 8 +- .../module/hook/clipboard/BaiduClipboard.java | 19 +-- .../module/hook/clipboard/SoGouClipboard.java | 8 +- .../module/hook/cloudservice/CloudList.java | 8 +- .../module/hook/community/DeviceModify.java | 26 +-- .../module/hook/community/FuckDetection.java | 8 +- .../downloadsui/AlwaysShowDownloadLink.java | 26 +-- .../DisableUploadAppListNew.java | 8 +- .../module/hook/home/other/ShowAllHideApp.kt | 9 +- .../module/hook/huanji/AllowMoveAllApps.java | 8 +- .../hook/joyose/DisableCloudControl.java | 8 +- .../module/hook/joyose/EnableGpuTuner.java | 8 +- .../module/hook/lpa/CustomImei.java | 8 +- .../hook/mediaeditor/CustomWatermark.kt | 8 +- .../hook/mediaeditor/FilterManagerAll.kt | 10 +- .../mediaeditor/UnlockCustomPhotoFrames.kt | 45 +++--- .../module/hook/mediaeditor/UnlockDisney.kt | 15 +- .../hook/mediaeditor/UnlockLeicaFilter.kt | 19 ++- .../mediaeditor/UnlockMinimumCropLimit2.kt | 6 +- .../module/hook/milink/NewUnlockHMind.kt | 7 +- .../hook/misettings/CustomRefreshRate.kt | 10 +- .../module/hook/mishare/NoAutoTurnOff.kt | 112 +++++++------ .../module/hook/mishare/UnlockTurboMode.kt | 10 +- .../hook/misound/BluetoothListener.java | 32 ++-- .../module/hook/mms/DisableAd.java | 10 +- .../module/hook/mms/DisableRiskTip.java | 14 +- .../module/hook/mms/ImOldDevice.java | 8 +- .../hook/packageinstaller/AllAsSystemApp.kt | 9 +- .../hook/packageinstaller/DisableAd.java | 20 +-- .../packageinstaller/DisableAppInfoUpload.kt | 20 +-- .../DisableInstallerFullSafeVersion.java | 14 +- .../packageinstaller/DisableSafeModelTip.kt | 9 +- .../packageinstaller/InstallRiskDisable.kt | 7 +- .../BlurPersonalAssistant.kt | 9 +- .../personalassistant/DisableLiteVersion.java | 14 +- .../UnlockWidgetCountLimit.java | 8 +- .../hook/powerkeeper/CustomRefreshRate.java | 8 +- .../powerkeeper/PreventBatteryWitelist.java | 8 +- .../screenrecorder/ScreenRecorderConfig.java | 14 +- .../screenrecorder/UnlockMoreVolumeFromNew.kt | 16 +- .../screenshot/UnlockMinimumCropLimit.java | 10 +- .../securityadd/DisableGameBoosterAds.java | 14 +- .../BypassAdbInstallVerify.java | 14 +- .../hook/securitycenter/DisableReport.kt | 9 +- .../hook/securitycenter/EnableGameSpeed.java | 32 ++-- .../hook/securitycenter/HideXOptModeTip.java | 8 +- .../hook/securitycenter/InstallIntercept.java | 14 +- .../hook/securitycenter/PowerSaver.java | 8 +- .../securitycenter/PrivacyThumbnailBlur.java | 8 +- .../module/hook/securitycenter/ScLockApp.java | 25 ++- .../module/hook/securitycenter/UnlockFbo.java | 14 +- .../hook/securitycenter/app/AppDisable.java | 8 +- .../app/OpenByDefaultSetting.kt | 7 +- .../securitycenter/app/UnlockAppSandbox.java | 26 +-- .../securitycenter/battery/BatteryHealth.kt | 57 ++++--- .../battery/PowerConsumptionRanking.java | 18 +-- .../securitycenter/battery/ScreenUsedTime.kt | 23 ++- .../battery/ShowBatteryTemperatureNew.kt | 7 +- .../battery/UnlockLowTempExtEndurance.java | 8 +- .../battery/UnlockSmartCharge.java | 10 +- .../battery/UnlockSuperWirelessCharge.kt | 18 +-- .../securitycenter/beauty/BeautyLightAuto.kt | 11 +- .../hook/securitycenter/beauty/BeautyPc.kt | 9 +- .../securitycenter/beauty/BeautyPrivacy.kt | 22 +-- .../hook/securitycenter/lab/LabUtilsClass.kt | 10 +- .../other/BypassSimLockMiAccountAuth.kt | 9 +- .../securitycenter/other/DisableRootCheck.kt | 9 +- .../hook/securitycenter/other/FuckRiskPkg.kt | 11 +- .../other/LockOneHundredPoints.kt | 14 +- .../other/SkipCountDownLimit.java | 8 +- .../securitycenter/sidebar/BlurSecurity.kt | 15 +- .../securitycenter/sidebar/DockSuggest.java | 8 +- .../sidebar/game/GamePerformanceWildMode.kt | 8 +- .../sidebar/game/RemoveMacroBlackList.kt | 20 +-- .../sidebar/game/UnlockGunService.kt | 8 +- .../video/DisableRemoveScreenHoldOn.kt | 8 +- .../sidebar/video/UnlockVideoSomeFunc.kt | 38 +++-- .../sidebar/video/VBVideoMode.kt | 8 +- .../sidebar/video/VideoDolbyOpen.java | 8 +- .../hook/systemui/plugin/ShowDeviceName.java | 8 +- .../hook/thememanager/AllowDownloadMore.java | 20 +-- .../hook/thememanager/AllowThirdTheme.java | 8 +- .../module/hook/updater/AutoUpdateDialog.kt | 14 +- .../module/hook/updater/DeviceModify.kt | 9 +- .../module/hook/updater/VersionCodeNew.kt | 28 ++-- .../hook/various/UnlockSuperClipboard.kt | 18 +-- .../voiceassist/DisableChatWatermark.java | 8 +- .../voiceassist/UseThirdPartyBrowser.java | 8 +- .../voicetrigger/BypassUDKWordLegalCheck.kt | 40 ++--- .../hook/weather/SetCardLightDarkMode.java | 14 +- .../api/miuiStringToast/MiuiStringToast.kt | 4 +- .../utils/search/SearchHelper.java | 148 +++++++++--------- 101 files changed, 861 insertions(+), 879 deletions(-) diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/base/dexkit/DexKit.java b/app/src/main/java/com/sevtinge/hyperceiler/module/base/dexkit/DexKit.java index be2a57f372..18513c86f7 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/base/dexkit/DexKit.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/base/dexkit/DexKit.java @@ -18,11 +18,13 @@ */ package com.sevtinge.hyperceiler.module.base.dexkit; +import static com.sevtinge.hyperceiler.utils.shell.ShellUtils.safeExecCommandWithRoot; + +import android.content.Context; + import androidx.annotation.NonNull; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.reflect.TypeToken; +import com.sevtinge.hyperceiler.R; import com.tencent.mmkv.MMKV; import org.jetbrains.annotations.NotNull; @@ -46,9 +48,10 @@ /** * @author 焕晨HChen + * @co-author Ling Qiqi */ public class DexKit { - private static final int mVersion = 4; + private static final int mVersion = 6; public boolean isInit = false; private static final String MMKV_PATH = "/files/mmkv"; private static XC_LoadPackage.LoadPackageParam mParam; @@ -56,7 +59,6 @@ public class DexKit { private static final String TYPE_CLASS = "CLASS"; private static final String TYPE_FIELD = "FIELD"; private static MMKV mMMKV = null; - private static Gson mGson = null; private static DexKit mThis; private static DexKitBridge mDexKitBridge; private final String TAG; @@ -88,36 +90,36 @@ public static T findMember(@NonNull String key, IDexKit iDexKit) { public static T findMember(@NonNull String key, ClassLoader classLoader, IDexKit iDexKit) { DexKitBridge dexKitBridge = initDexkitBridge(); - String descriptor = mMMKV.getString(key, ""); - if (descriptor.isEmpty()) { + String type = mMMKV.getString(key + "_type", ""); + int size = mMMKV.getInt(key + "_size", 0); + if (type.isEmpty() || size == 0) { try { BaseData baseData = iDexKit.dexkit(dexKitBridge); if (baseData instanceof FieldData fieldData) { - mMMKV.putString(key, mGson.toJson(new MemberData(TYPE_FIELD, fieldData.toDexField().serialize()))); + saveToMMKV(key, TYPE_FIELD, List.of(fieldData.toDexField().serialize())); return (T) fieldData.getFieldInstance(classLoader); } else if (baseData instanceof MethodData methodData) { - mMMKV.putString(key, mGson.toJson(new MemberData(TYPE_METHOD, methodData.toDexMethod().serialize()))); + saveToMMKV(key, TYPE_METHOD, List.of(methodData.toDexMethod().serialize())); return (T) methodData.getMethodInstance(classLoader); } else if (baseData instanceof ClassData classData) { - mMMKV.putString(key, mGson.toJson(new MemberData(TYPE_CLASS, classData.toDexType().serialize()))); + saveToMMKV(key, TYPE_CLASS, List.of(classData.toDexType().serialize())); return (T) classData.getInstance(classLoader); } } catch (ReflectiveOperationException e) { throw new RuntimeException(e); } } else { - MemberData data = mGson.fromJson(descriptor, new TypeToken() { - }.getType()); try { - switch (data.type) { + String serializedItem = mMMKV.getString(key + "_item_0", ""); + switch (type) { case TYPE_METHOD -> { - return (T) new DexMethod(descriptor).getMethodInstance(classLoader); + return (T) new DexMethod(serializedItem).getMethodInstance(classLoader); } case TYPE_FIELD -> { - return (T) new DexField(descriptor).getFieldInstance(classLoader); + return (T) new DexField(serializedItem).getFieldInstance(classLoader); } case TYPE_CLASS -> { - return (T) new DexClass(descriptor).getInstance(classLoader); + return (T) new DexClass(serializedItem).getInstance(classLoader); } } } catch (NoSuchMethodException | NoSuchFieldException | ClassNotFoundException e) { @@ -133,8 +135,9 @@ public static List findMemberList(@NonNull String key, IDexKitList iDexKi public static List findMemberList(@NonNull String key, ClassLoader classLoader, IDexKitList iDexKitList) { DexKitBridge dexKitBridge = initDexkitBridge(); - String descriptor = mMMKV.getString(key, ""); - if (descriptor.isEmpty()) { + String type = mMMKV.getString(key + "_type", ""); + int size = mMMKV.getInt(key + "_size", 0); + if (type.isEmpty() || size == 0) { try { BaseDataList baseDataList = iDexKitList.dexkit(dexKitBridge); ArrayList serializeList = new ArrayList<>(); @@ -144,51 +147,39 @@ public static List findMemberList(@NonNull String key, ClassLoader classL serializeList.add(f.toDexField().serialize()); instanceList.add((T) f.getFieldInstance(classLoader)); } - mMMKV.putString(key, mGson.toJson(new MemberData(TYPE_FIELD, serializeList))); + saveToMMKV(key, TYPE_FIELD, serializeList); return instanceList; } else if (baseDataList instanceof MethodDataList methodDataList) { for (MethodData m : methodDataList) { serializeList.add(m.toDexMethod().serialize()); instanceList.add((T) m.getMethodInstance(classLoader)); } - mMMKV.putString(key, mGson.toJson(new MemberData(TYPE_METHOD, serializeList))); + saveToMMKV(key, TYPE_METHOD, serializeList); return instanceList; } else if (baseDataList instanceof ClassDataList classDataList) { for (ClassData c : classDataList) { serializeList.add(c.toDexType().serialize()); instanceList.add((T) c.getInstance(classLoader)); } - mMMKV.putString(key, mGson.toJson(new MemberData(TYPE_CLASS, serializeList))); + saveToMMKV(key, TYPE_CLASS, serializeList); return instanceList; } } catch (ReflectiveOperationException e) { throw new RuntimeException(e); } } else { - MemberData data = mGson.fromJson(descriptor, new TypeToken() { - }.getType()); ArrayList instanceList = new ArrayList<>(); try { - switch (data.type) { - case TYPE_METHOD -> { - for (String s : data.serializeList) { - instanceList.add((T) new DexMethod(s).getMethodInstance(classLoader)); - } - return instanceList; - } - case TYPE_FIELD -> { - for (String s : data.serializeList) { - instanceList.add((T) new DexField(s).getFieldInstance(classLoader)); - } - return instanceList; - } - case TYPE_CLASS -> { - for (String s : data.serializeList) { - instanceList.add((T) new DexClass(s).getInstance(classLoader)); - } - return instanceList; + for (int i = 0; i < size; i++) { + String serializedItem = mMMKV.getString(key + "_item_" + i, ""); + if (serializedItem.isEmpty()) continue; + switch (type) { + case TYPE_METHOD -> instanceList.add((T) new DexMethod(serializedItem).getMethodInstance(classLoader)); + case TYPE_FIELD -> instanceList.add((T) new DexField(serializedItem).getFieldInstance(classLoader)); + case TYPE_CLASS -> instanceList.add((T) new DexClass(serializedItem).getInstance(classLoader)); } } + return instanceList; } catch (NoSuchMethodException | NoSuchFieldException | ClassNotFoundException e) { throw new RuntimeException(e); } @@ -196,6 +187,14 @@ public static List findMemberList(@NonNull String key, ClassLoader classL return new ArrayList<>(); } + private static void saveToMMKV(String key, String type, List serializeList) { + mMMKV.putString(key + "_type", type); + mMMKV.putInt(key + "_size", serializeList.size()); + for (int i = 0; i < serializeList.size(); i++) { + mMMKV.putString(key + "_item_" + i, serializeList.get(i)); + } + } + private void init() { if (mDexKitBridge != null) { return; @@ -207,15 +206,9 @@ private void init() { String hostDir = mParam.appInfo.sourceDir, mmkvPath = mParam.appInfo.dataDir + MMKV_PATH; - mGson = new GsonBuilder().setPrettyPrinting().create(); // 启动 MMKV - MMKV.initialize(mmkvPath, new MMKV.LibLoader() { - @Override - public void loadLibrary(String libName) { - System.loadLibrary(libName); - } - }); + MMKV.initialize(mmkvPath, System::loadLibrary); mMMKV = MMKV.defaultMMKV(); int version = mMMKV.getInt("version", 0); if (version != 0 && version != mVersion) { @@ -246,20 +239,13 @@ public void close() { isInit = false; } - private static final class MemberData { - public String type = ""; - public String serialize = ""; - - public ArrayList serializeList = new ArrayList<>(); - - public MemberData(String type, String serialize) { - this.type = type; - this.serialize = serialize; - } - - public MemberData(String type, ArrayList serializeList) { - this.type = type; - this.serializeList = serializeList; + public static void deleteAllCache(Context context) { + String[] folderNames = context.getResources().getStringArray(R.array.xposed_scope); + for (String folderName : folderNames) { + String folderPath = "/data/data/" + folderName + MMKV_PATH; + if (safeExecCommandWithRoot("ls " + folderPath).contains("mmkv")) { + safeExecCommandWithRoot("rm -rf " + folderPath); + } } } } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/aiasst/DisableWatermark.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/aiasst/DisableWatermark.java index 85f4da9a55..77ae4c95c3 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/aiasst/DisableWatermark.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/aiasst/DisableWatermark.java @@ -26,8 +26,8 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import de.robv.android.xposed.XC_MethodHook; @@ -35,14 +35,14 @@ public class DisableWatermark extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("DisableWatermark", new IDexKit() { + Method method = DexKit.findMember("DisableWatermark", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("userId", "add watermark") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method, new MethodHook() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/browser/DebugMode.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/browser/DebugMode.java index 93e82f203b..6b4915ab7a 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/browser/DebugMode.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/browser/DebugMode.java @@ -28,8 +28,8 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import de.robv.android.xposed.XC_MethodHook; @@ -37,15 +37,15 @@ public class DebugMode extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method1 = (Method) DexKit.findMember("EnvironmentFlag", new IDexKit() { + Method method1 = DexKit.findMember("EnvironmentFlag", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("environment_flag") .returnType(String.class) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method1, new MethodHook() { @@ -55,15 +55,15 @@ protected void before(XC_MethodHook.MethodHookParam param) throws Throwable { } }); - Method method2 = (Method) DexKit.findMember("DebugMode1", new IDexKit() { + Method method2 = DexKit.findMember("DebugMode1", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("pref_key_debug_mode_new") .returnType(boolean.class) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method2, new MethodHook() { @@ -73,15 +73,15 @@ protected void before(XC_MethodHook.MethodHookParam param) throws Throwable { } }); - Method method3 = (Method) DexKit.findMember("DebugMode2", new IDexKit() { + Method method3 = DexKit.findMember("DebugMode2", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("pref_key_debug_mode") .returnType(boolean.class) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method3, new MethodHook() { @@ -91,15 +91,15 @@ protected void before(XC_MethodHook.MethodHookParam param) throws Throwable { } }); - Method method4 = (Method) DexKit.findMember("DebugMode3", new IDexKit() { + Method method4 = DexKit.findMember("DebugMode3", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("pref_key_debug_mode_" + getPackageVersionCode(lpparam)) .returnType(boolean.class) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method4, new MethodHook() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/browser/EnableDebugEnvironment.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/browser/EnableDebugEnvironment.java index b9bd5b065e..4338f061d4 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/browser/EnableDebugEnvironment.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/browser/EnableDebugEnvironment.java @@ -28,8 +28,8 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import de.robv.android.xposed.XC_MethodHook; @@ -37,16 +37,16 @@ public class EnableDebugEnvironment extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("DebugMode", new IDexKit() { + Method method = DexKit.findMember("DebugMode", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("pref_key_debug_mode_" + getPackageVersionCode(lpparam)) .name("getDebugMode") .returnType(boolean.class) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method, new MethodHook() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/calendar/UnlockSubscription.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/calendar/UnlockSubscription.java index 3fc475dbd1..86d18fc7fe 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/calendar/UnlockSubscription.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/calendar/UnlockSubscription.java @@ -27,8 +27,8 @@ import org.luckypray.dexkit.query.matchers.ClassMatcher; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import java.util.Objects; @@ -37,9 +37,9 @@ public class UnlockSubscription extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("CalendarApplication", new IDexKit() { + Method method = DexKit.findMember("CalendarApplication", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .declaredClass(ClassMatcher.create() @@ -47,7 +47,7 @@ public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationEx .usingStrings("key_subscription_display", "key_import_todo", "key_chinese_almanac_pref", "key_weather_display", "key_ai_time_parse") .paramCount(0) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); logD(TAG, lpparam.packageName, "method is "+method); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/camera/BlackLeica.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/camera/BlackLeica.java index 866e32f345..6eaf6a7b75 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/camera/BlackLeica.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/camera/BlackLeica.java @@ -38,8 +38,8 @@ import org.luckypray.dexkit.result.ClassData; import org.luckypray.dexkit.result.FieldData; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -48,76 +48,76 @@ public class BlackLeica extends BaseHook { @Override public void init() throws NoSuchMethodException { - Class clazz2 = (Class) DexKit.findMember("TextColorMakerClazz", new IDexKit() { + Class clazz2 = DexKit.findMember("TextColorMakerClazz", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { ClassData clazzData = bridge.findClass(FindClass.create() .matcher(ClassMatcher.create() .usingStrings("get(ColorSpace.Named.SRGB)", "bitmap") )).singleOrNull(); - return clazzData.getInstance(lpparam.classLoader); + return clazzData; } }); - Method method1 = (Method) DexKit.findMember("WaterMakerLeica", new IDexKit() { + Method method1 = DexKit.findMember("WaterMakerLeica", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .paramTypes(int.class, int.class, float.class, String.class, String.class, String.class, boolean.class, String.class, boolean.class, Drawable.class) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); - Class clazz1 = (Class) DexKit.findMember("DescStringColorMakerClazz", new IDexKit() { + Class clazz1 = DexKit.findMember("DescStringColorMakerClazz", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { ClassData clazzData = bridge.findClass(FindClass.create() .matcher(ClassMatcher.create() .addMethod(MethodMatcher.create() .paramTypes(int.class, int.class, float.class, String.class, String.class, String.class, boolean.class, String.class, boolean.class, Drawable.class) ) )).singleOrNull(); - return clazzData.getInstance(lpparam.classLoader); + return clazzData; } }); // Class clazz1 = method1.getClass(); - Method method2 = (Method) DexKit.findMember("TextPainter", new IDexKit() { + Method method2 = DexKit.findMember("TextPainter", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .paramTypes(Typeface.class, float.class, int.class) .returnType(TextPaint.class) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); - Method method3 = (Method) DexKit.findMember("TextColorMaker", new IDexKit() { + Method method3 = DexKit.findMember("TextColorMaker", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .declaredClass(clazz2) .paramTypes(int.class) .returnType(clazz2) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); - Field field1 = (Field) DexKit.findMember("DescStringColor", new IDexKit() { + Field field1 = DexKit.findMember("DescStringColor", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { FieldData fieldData = bridge.findField(FindField.create() .matcher(FieldMatcher.create() .declaredClass(clazz1) .type(int.class) )).singleOrNull(); - return fieldData.getFieldInstance(lpparam.classLoader); + return fieldData; } }); - Field field2 = (Field) DexKit.findMember("LeicaPendantColor", new IDexKit() { + Field field2 = DexKit.findMember("LeicaPendantColor", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { FieldData fieldData = bridge.findField(FindField.create() .matcher(FieldMatcher.create() .declaredClass(ClassMatcher.create() @@ -125,7 +125,7 @@ public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationEx ) .type(int.class) )).singleOrNull(); - return fieldData.getFieldInstance(lpparam.classLoader); + return fieldData; } }); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/camera/CustomCameraColor.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/camera/CustomCameraColor.java index d4e4626c2b..b764e21124 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/camera/CustomCameraColor.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/camera/CustomCameraColor.java @@ -30,8 +30,8 @@ import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.FieldData; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Modifier; @@ -41,9 +41,9 @@ public class CustomCameraColor extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("CameraColorGetter", new IDexKit() { + Method method = DexKit.findMember("CameraColorGetter", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .addCaller(MethodMatcher.create().declaredClass("com.android.camera.fragment.FragmentMasterFilter")) @@ -55,18 +55,18 @@ public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationEx .returnType(int.class) .paramCount(0) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); - Field field = (Field) DexKit.findMember("CameraColor", new IDexKit() { + Field field = DexKit.findMember("CameraColor", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { FieldData fieldData = bridge.findField(FindField.create() .matcher(FieldMatcher.create() .declaredClass(method.getDeclaringClass()) .type(int.class) )).singleOrNull(); - return fieldData.getFieldInstance(lpparam.classLoader); + return fieldData; } }); XposedHelpers.setStaticIntField(field.getDeclaringClass(), field.getName(), mPrefsMap.getInt("camera_custom_theme_color_picker", -2024677)); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/camera/CustomWatermark.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/camera/CustomWatermark.java index 39c9570f1a..567e365852 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/camera/CustomWatermark.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/camera/CustomWatermark.java @@ -29,18 +29,19 @@ import org.luckypray.dexkit.query.matchers.AnnotationMatcher; import org.luckypray.dexkit.query.matchers.AnnotationsMatcher; import org.luckypray.dexkit.query.matchers.MethodMatcher; +import org.luckypray.dexkit.result.BaseDataList; +import org.luckypray.dexkit.result.MethodData; import org.luckypray.dexkit.result.MethodDataList; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import java.util.List; public class CustomWatermark extends BaseHook { @Override public void init() throws NoSuchMethodException { - List methods = DexKit.getDexKitBridgeList("Watermark", new IDexKitList() { + List methods = DexKit.findMemberList("Watermark", new IDexKitList() { @Override - public List dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseDataList dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodDataList methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .returnType(SparseArray.class) @@ -52,9 +53,9 @@ public List dexkit(DexKitBridge bridge) throws ReflectiveOpera ) ) ); - return DexKit.toElementList(methodData); + return methodData; } - }).toMethodList(); + }); for (Method method : methods) { // Method method = methodData.getMethodInstance(lpparam.classLoader); logD(TAG, lpparam.packageName, "Current hooking method is " + method); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/camera/EnableLabOptions.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/camera/EnableLabOptions.java index 563ce5abf2..ec033e2cf0 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/camera/EnableLabOptions.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/camera/EnableLabOptions.java @@ -26,8 +26,8 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import java.util.Objects; @@ -36,14 +36,14 @@ public class EnableLabOptions extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("LabOptions", new IDexKit() { + Method method = DexKit.findMember("LabOptions", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("getBoolean", "SystemProperties", "Exception while getting system property: ") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method, new MethodHook() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/camera/MaxScreenBrightness.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/camera/MaxScreenBrightness.java index bc3f8dde70..5c36ed82f2 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/camera/MaxScreenBrightness.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/camera/MaxScreenBrightness.java @@ -31,8 +31,8 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import de.robv.android.xposed.XposedHelpers; @@ -42,16 +42,16 @@ public class MaxScreenBrightness extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("GetHaloBrightness", new IDexKit() { + Method method = DexKit.findMember("GetHaloBrightness", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingNumbers(0, -1.0f, 204) .paramTypes(int.class) ) ).singleOrThrow(() -> new IllegalStateException("MaxScreenBrightness: Cannot found getHaloBrightness()")); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/clipboard/BaiduClipboard.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/clipboard/BaiduClipboard.java index e6a254b22d..fae9e98f0c 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/clipboard/BaiduClipboard.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/clipboard/BaiduClipboard.java @@ -28,12 +28,13 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.ClassMatcher; import org.luckypray.dexkit.query.matchers.MethodMatcher; +import org.luckypray.dexkit.result.BaseDataList; import org.luckypray.dexkit.result.ClassData; import org.luckypray.dexkit.result.MethodDataList; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; +import java.lang.reflect.Member; import java.util.Arrays; -import java.util.List; /** * @author 焕晨HChen @@ -42,14 +43,14 @@ public class BaiduClipboard extends BaseHC { @Override public void init() { if ("com.baidu.input".equals(lpparam.packageName)) { - Class ClipboardConfig = (Class) DexKit.findMember("NewGetMaxQueryCount", new IDexKit() { + Class ClipboardConfig = DexKit.findMember("NewGetMaxQueryCount", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { ClassData classData = bridge.findClass(FindClass.create() .matcher(ClassMatcher.create() .usingStrings("begin to checkMaxQueryCount") )).singleOrNull(); - return classData.getInstance(lpparam.classLoader); + return classData; } }); @@ -61,9 +62,9 @@ public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationEx }); } } else if ("com.baidu.input_mi".equals(lpparam.packageName)) { - DexKit.getDexKitBridgeList("GetMaxQueryCountList", new IDexKitList() { + DexKit.findMemberList("GetMaxQueryCountList", new IDexKitList() { @Override - public List dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseDataList dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodDataList methodDataList = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .declaredClass(ClassMatcher.create() @@ -71,9 +72,9 @@ public List dexkit(DexKitBridge bridge) throws ReflectiveOpera ) .returnType(int.class)) ); - return DexKit.toElementList(methodDataList); + return methodDataList; } - }).toMethodList().forEach(method -> hook(method, returnResult(Integer.MAX_VALUE))); + }).forEach(method -> hook((Member) method, returnResult(Integer.MAX_VALUE))); } } } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/clipboard/SoGouClipboard.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/clipboard/SoGouClipboard.java index c7d11faec2..af3a879b1c 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/clipboard/SoGouClipboard.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/clipboard/SoGouClipboard.java @@ -27,8 +27,8 @@ import org.luckypray.dexkit.query.matchers.ClassMatcher; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; public class SoGouClipboard extends BaseHook { @@ -37,16 +37,16 @@ public class SoGouClipboard extends BaseHook { @Override public void init() { long stime = System.currentTimeMillis(); - Method method = (Method) DexKit.findMember("sogou", new IDexKit() { + Method method = DexKit.findMember("sogou", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .declaredClass(ClassMatcher.create() .usingStrings("sogou_clipboard_tmp")) .usingNumbers("com.sohu.inputmethod.sogou.xiaomi".equals(lpparam.packageName) ? 150 : 80064) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); long etime = System.currentTimeMillis(); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/cloudservice/CloudList.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/cloudservice/CloudList.java index ad71a6283b..f5dba96585 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/cloudservice/CloudList.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/cloudservice/CloudList.java @@ -26,8 +26,8 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import de.robv.android.xposed.XC_MethodHook; @@ -35,15 +35,15 @@ public class CloudList extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("DebugMode", new IDexKit() { + Method method = DexKit.findMember("DebugMode", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("support_google_csp_sync") )).singleOrNull(); methodData.toDexMethod().serialize(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method, new MethodHook() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/community/DeviceModify.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/community/DeviceModify.java index 9d6606a2e2..7db5bf9a63 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/community/DeviceModify.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/community/DeviceModify.java @@ -29,8 +29,8 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import de.robv.android.xposed.XposedHelpers; @@ -52,46 +52,46 @@ public void init() throws NoSuchMethodException { XposedHelpers.setStaticObjectField(Build.class, "MODEL", mModel); XposedHelpers.setStaticObjectField(Build.class, "MANUFACTURER", mManufacturer); - Method method1 = (Method) DexKit.getDexKitBridge("SystemPropertiesGetStringWithNull", new IDexKit() { + Method method1 = DexKit.findMember("SystemPropertiesGetStringWithNull", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .declaredClass("com.xiaomi.vipbase.utils.SystemProperties") .paramCount(1) .returnType(String.class) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); - Method method2 = (Method) DexKit.findMember("GetDevice", new IDexKit() { + Method method2 = DexKit.findMember("GetDevice", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("ro.product.device") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); - Method method3 = (Method) DexKit.findMember("GetModel", new IDexKit() { + Method method3 = DexKit.findMember("GetModel", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("ro.product.model") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); - Method method4 = (Method) DexKit.findMember("GetManufacturer", new IDexKit() { + Method method4 = DexKit.findMember("GetManufacturer", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("ro.product.manufacturer") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/community/FuckDetection.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/community/FuckDetection.java index ac3b27896f..fd1f344023 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/community/FuckDetection.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/community/FuckDetection.java @@ -29,21 +29,21 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; public class FuckDetection extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("GetPackageVersionName", new IDexKit() { + Method method = DexKit.findMember("GetPackageVersionName", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("5577218", "binding.editContactInformation.text") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method, new MethodHook() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/downloadsui/AlwaysShowDownloadLink.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/downloadsui/AlwaysShowDownloadLink.java index 1fb0dbcf1c..8e7aed6c1d 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/downloadsui/AlwaysShowDownloadLink.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/downloadsui/AlwaysShowDownloadLink.java @@ -36,8 +36,8 @@ import org.luckypray.dexkit.result.FieldData; import org.luckypray.dexkit.result.FieldDataList; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -46,23 +46,23 @@ public class AlwaysShowDownloadLink extends BaseHook { @Override public void init() { - Class class1 = (Class) DexKit.findMember("DownloadInfo", new IDexKit() { + Class class1 = DexKit.findMember("DownloadInfo", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { ClassData classData = bridge.findClass(FindClass.create() .excludePackages("androidx") .matcher( ClassMatcher.create() .usingEqStrings("/s", " | ", "/") )).singleOrNull(); - return classData.getInstance(lpparam.classLoader); + return classData; } }); - Method method1 = (Method) DexKit.findMember("ShowTaskDetailMatcher", new IDexKit() { + Method method1 = DexKit.findMember("ShowTaskDetailMatcher", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .declaredClass(ClassMatcher.create().usingStrings("onEventMainThread noScrollListView=")) @@ -70,13 +70,13 @@ public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationEx .paramTypes(class1) .returnType(void.class) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); - Field field1 = (Field) DexKit.findMember("DownloadUrl", new IDexKit() { + Field field1 = DexKit.findMember("DownloadUrl", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { FieldData fieldData = bridge.findField(FindField.create() .matcher(FieldMatcher.create() .addReadMethod(MethodMatcher.create() @@ -84,13 +84,13 @@ public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationEx .declaredClass(class1) .type(String.class) )).singleOrNull(); - return fieldData.getFieldInstance(lpparam.classLoader); + return fieldData; } }); - Field field2 = (Field) DexKit.findMember("DownloadDesc", new IDexKit() { + Field field2 = DexKit.findMember("DownloadDesc", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { FieldDataList fieldDataList = bridge.findField(FindField.create() .matcher(FieldMatcher.create() .addReadMethod(MethodMatcher.create() @@ -103,7 +103,7 @@ public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationEx // 感觉不太优雅 先这样吧.jpg 暂时没有更好的匹配方式了 反正method里就这两string for (FieldData field : fieldDataList) { if (field.getName().equals(field1.getName())) continue; - return field.getFieldInstance(lpparam.classLoader); + return field; } return null; diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/guardprovider/DisableUploadAppListNew.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/guardprovider/DisableUploadAppListNew.java index f04686ae5d..32d6098d8e 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/guardprovider/DisableUploadAppListNew.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/guardprovider/DisableUploadAppListNew.java @@ -26,21 +26,21 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; public class DisableUploadAppListNew extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("AntiDefraudAppManager", new IDexKit() { + Method method = DexKit.findMember("AntiDefraudAppManager", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("AntiDefraudAppManager", "https://flash.sec.miui.com/detect/app") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method, new replaceHookedMethod() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/home/other/ShowAllHideApp.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/home/other/ShowAllHideApp.kt index 1d2014d884..c1ca8f4e82 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/home/other/ShowAllHideApp.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/home/other/ShowAllHideApp.kt @@ -18,7 +18,6 @@ */ package com.sevtinge.hyperceiler.module.hook.home.other -import com.github.kyuubiran.ezxhelper.* import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinder import com.sevtinge.hyperceiler.module.base.* @@ -26,13 +25,13 @@ import com.sevtinge.hyperceiler.module.base.dexkit.* object ShowAllHideApp : BaseHook() { override fun init() { - val getClass = DexKit.findMember("ShowAllHideApp") { bridge -> + val getClass: Class<*> = DexKit.findMember("ShowAllHideApp") { bridge -> bridge.findClass { matcher { - addUsingStringsEquals("appInfo.packageName", "com.android.fileexplorer") + usingStrings("appInfo.packageName", "com.android.fileexplorer") } - }.first().getInstance(EzXHelper.classLoader) - }.toClass() + }.single() + } getClass.methodFinder() .filterByName("isHideAppValid") diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/huanji/AllowMoveAllApps.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/huanji/AllowMoveAllApps.java index d1f05d879e..2450eb0797 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/huanji/AllowMoveAllApps.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/huanji/AllowMoveAllApps.java @@ -26,21 +26,21 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; public class AllowMoveAllApps extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("FilePathMatcher", new IDexKit() { + Method method = DexKit.findMember("FilePathMatcher", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings(" skip file path ") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method, new MethodHook() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/joyose/DisableCloudControl.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/joyose/DisableCloudControl.java index 0468d9b9cd..a294290d0c 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/joyose/DisableCloudControl.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/joyose/DisableCloudControl.java @@ -28,22 +28,22 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; public class DisableCloudControl extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("SyncHelper", new IDexKit() { + Method method = DexKit.findMember("SyncHelper", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("job exist, sync local...") .returnType(void.class) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method, returnConstant(null)); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/joyose/EnableGpuTuner.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/joyose/EnableGpuTuner.java index 412f65f113..e35e4cc3c3 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/joyose/EnableGpuTuner.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/joyose/EnableGpuTuner.java @@ -28,22 +28,22 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; public class EnableGpuTuner extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("GpuTunerSwitch", new IDexKit() { + Method method = DexKit.findMember("GpuTunerSwitch", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("GPUTUNER_SWITCH") .returnType(boolean.class) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method, returnConstant(true)); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/lpa/CustomImei.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/lpa/CustomImei.java index 0c6d6fec5f..0696d55a8c 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/lpa/CustomImei.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/lpa/CustomImei.java @@ -27,21 +27,21 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; public class CustomImei extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("GetImei", new IDexKit() { + Method method = DexKit.findMember("GetImei", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("phone", "F") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method, new MethodHook() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/CustomWatermark.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/CustomWatermark.kt index 240bb26b11..a58fb98b50 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/CustomWatermark.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/CustomWatermark.kt @@ -18,11 +18,11 @@ */ package com.sevtinge.hyperceiler.module.hook.mediaeditor -import com.github.kyuubiran.ezxhelper.* import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* import org.luckypray.dexkit.query.enums.* +import java.lang.reflect.* object CustomWatermark : BaseHook() { private val name by lazy { @@ -30,7 +30,7 @@ object CustomWatermark : BaseHook() { } // by StarVoyager - private val search by lazy { + private val search by lazy { DexKit.findMember("CustomWatermark") { it.findMethod { matcher { @@ -39,8 +39,8 @@ object CustomWatermark : BaseHook() { returnType = "java.lang.String" paramCount = 2 } - }.single().getMethodInstance(EzXHelper.classLoader) - }.toMethod() + }.single() + } } override fun init() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/FilterManagerAll.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/FilterManagerAll.kt index 3544980ded..6a51e461e3 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/FilterManagerAll.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/FilterManagerAll.kt @@ -19,24 +19,24 @@ package com.sevtinge.hyperceiler.module.hook.mediaeditor import android.os.* -import com.github.kyuubiran.ezxhelper.ClassLoaderProvider.safeClassLoader import com.github.kyuubiran.ezxhelper.ClassUtils.setStaticObject import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* import com.sevtinge.hyperceiler.utils.api.LazyClass.AndroidBuildCls +import java.lang.reflect.* object FilterManagerAll : BaseHook() { private lateinit var device: String - private val methodResult by lazy { + private val methodResult by lazy { DexKit.findMember("FilterManagerAll") { dexkit -> dexkit.findMethod { matcher { - addUsingStringsEquals("wayne") + addUsingString("wayne") } - }.filter { it.isMethod }.map { it.getMethodInstance(safeClassLoader) }.toTypedArray().firstOrNull() - }.toMethod() + }.filter { it.isMethod }.toTypedArray().firstOrNull() + } } override fun init() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/UnlockCustomPhotoFrames.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/UnlockCustomPhotoFrames.kt index 6f7b479a5a..a769ca18cd 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/UnlockCustomPhotoFrames.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/UnlockCustomPhotoFrames.kt @@ -39,8 +39,8 @@ object UnlockCustomPhotoFrames : BaseHook() { private val isRedmi by lazy { frames == 2 } private val isPOCO by lazy { frames == 3 } - private val publicA by lazy { - DexKit.useDexkitIfNoCache(arrayOf("PC", "PA")) { bridge -> + private val publicA by lazy> { + DexKit.findMemberList("PA") { bridge -> bridge.findMethod { matcher { // 真是妹想到啊,1.5 和 1.6 版本还以为不会套回去了 @@ -62,8 +62,8 @@ object UnlockCustomPhotoFrames : BaseHook() { } // 公共解锁特定机型定制画框使用限制 - private val publicB by lazy { - DexKit.getDexKitBridgeList("PB") { dexkit -> + private val publicB by lazy> { + DexKit.findMemberList("PB") { dexkit -> dexkit.findMethod { matcher { if (isNewMediaeditor) { @@ -78,33 +78,32 @@ object UnlockCustomPhotoFrames : BaseHook() { modifiers = Modifier.STATIC or Modifier.FINAL } } - }.toElementList() - }.toMethodList() + } + } } override fun init() { - // 为了减少查询次数,这玩意写得好懵圈.png - // val publicC = DexKit.getDexKitBridge("PC", publicA?.toMethodDataList()?.filter { methodData -> - // methodData.usingFields.any { - // it.field.typeName == "boolean" // 1.6.3.5 通过此条件应该只会返回 b() 方法 - // } - // }, lpparam.classLoader).toMethodList().toSet() - val publicC = DexKit.getDexKitBridgeList("PC") { _ -> - publicA?.toMethodDataList()?.filter { methodData -> - methodData.usingFields.any { - it.field.typeName == "boolean" // 1.6.3.5 通过此条件应该只会返回 b() 方法 + val publicC = DexKit.findMemberList("PC") { + it.findMethod { + matcher { + publicA.forEach { a -> + name = a.name + } + usingFields { + add { + type = "boolean" + } + } } - }?.toElementList() - }.toMethodList() + } + } + val actions = if (isNewMediaeditor) { listOf<(Method) -> Unit>(::xiaomi, ::redmi, ::poco, ::other) } else { listOf<(Method) -> Unit>(::xiaomi, ::poco, ::redmi, ::other) } - val orderedPublicA = DexKit.getDexKitBridgeList("PA") { _ -> - publicA?.toElementList() - }.toMethodList() - val differentItems = orderedPublicA.subtract(publicC.toSet()) + val differentItems = publicA.subtract(publicC.toSet()) var index = 0 differentItems.forEach { method -> @@ -119,7 +118,7 @@ object UnlockCustomPhotoFrames : BaseHook() { if (isOpenSpring && publicC.isNotEmpty()) { publicC.forEach { method -> - other(method) + other(method) // 1.6.0.5.2 新增限时新春定制画框 // 后续版本已移除,其实可以删掉的,但还是留着吧,兴许后面可能还有用 } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/UnlockDisney.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/UnlockDisney.kt index 8dbc7547ca..ff9e89d5db 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/UnlockDisney.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/UnlockDisney.kt @@ -18,19 +18,18 @@ */ package com.sevtinge.hyperceiler.module.hook.mediaeditor -import com.github.kyuubiran.ezxhelper.EzXHelper.safeClassLoader import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* import java.lang.reflect.* object UnlockDisney : BaseHook() { - private val mickey by lazy { + private val mickey by lazy { DexKit.findMember("UnlockDisneyMickey") { it.findMethod { matcher { addCaller { - addUsingStringsEquals("magic_recycler_matting_0", "magic_recycler_clear_icon") + usingStrings("magic_recycler_matting_0", "magic_recycler_clear_icon") // returnType = "java.util.List" // 你米 1.6.5.10.2 改成了 java.util.ArrayList,所以找不到 paramCount = 0 } @@ -38,11 +37,11 @@ object UnlockDisney : BaseHook() { returnType = "boolean" paramCount = 0 } - }.single().getMethodInstance(safeClassLoader) - }.toMethod() + }.single() + } } - private val bear by lazy { + private val bear by lazy { DexKit.findMember("UnlockDisneyBear") { it.findMethod { matcher { @@ -51,8 +50,8 @@ object UnlockDisney : BaseHook() { returnType = "boolean" paramCount = 0 } - }.last().getMethodInstance(safeClassLoader) - }.toMethod() + }.last() + } } private val isType by lazy { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/UnlockLeicaFilter.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/UnlockLeicaFilter.kt index e957e1b1af..87ef14e7a3 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/UnlockLeicaFilter.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/UnlockLeicaFilter.kt @@ -18,7 +18,6 @@ */ package com.sevtinge.hyperceiler.module.hook.mediaeditor -import com.github.kyuubiran.ezxhelper.EzXHelper.classLoader import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* @@ -27,30 +26,30 @@ import de.robv.android.xposed.* import java.lang.reflect.* object UnlockLeicaFilter : BaseHook() { - private val leicaOld by lazy { - DexKit.getDexKitBridgeList("UnlockLeicaFilterOld") { dexkit -> + private val leicaOld by lazy> { + DexKit.findMemberList("UnlockLeicaFilterOld") { dexkit -> dexkit.findMethod { matcher { - // 仅适配 1.5 及 1.6 的部分版本,新版已更换检测方式 + // 仅适配 1.5 及 1.6 的部分版本,新版更换检测方式 declaredClass { - addUsingStringsEquals("unSupportDeviceList", "stringResUrl") + usingStrings("unSupportDeviceList", "stringResUrl") } modifiers = Modifier.FINAL returnType = "boolean" paramCount = 0 } - }.toElementList() - }.toMethodList() + } + } } - private val leicaNew by lazy { + private val leicaNew by lazy { DexKit.findMember("UnlockLeicaFilterNew") { dexkit -> dexkit.findMethod { matcher { declaredClass = "com.miui.mediaeditor.photo.filter.repository.FilterRepository" returnType = "java.io.Serializable" } - }.single().getMethodInstance(classLoader) - }.toMethod() + }.single() + } } override fun init() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/UnlockMinimumCropLimit2.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/UnlockMinimumCropLimit2.kt index 56696caa12..16421e6f88 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/UnlockMinimumCropLimit2.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/UnlockMinimumCropLimit2.kt @@ -7,7 +7,7 @@ import java.lang.reflect.* object UnlockMinimumCropLimit2 : BaseHook() { override fun init() { - DexKit.getDexKitBridgeList("MinimumCropLimit2") { bridge -> + DexKit.findMemberList("MinimumCropLimit2") { bridge -> bridge.findMethod { matcher { returnType = "int" @@ -18,8 +18,8 @@ object UnlockMinimumCropLimit2 : BaseHook() { // 理论上适配 1.7 - 1.8+ 全版本 addInvoke("Ljava/lang/Math;->max(II)I") } - }.toElementList() - }.toMethodList().forEach { method -> + } + }.forEach { method -> method.createHook { returnConstant(0) } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/milink/NewUnlockHMind.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/milink/NewUnlockHMind.kt index 49339cba64..7c3ebb9bfc 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/milink/NewUnlockHMind.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/milink/NewUnlockHMind.kt @@ -18,14 +18,13 @@ */ package com.sevtinge.hyperceiler.module.hook.milink -import com.github.kyuubiran.ezxhelper.EzXHelper.safeClassLoader import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* import java.lang.reflect.* object NewUnlockHMind : BaseHook() { - private val unlockHMind by lazy { + private val unlockHMind by lazy { // 解锁 Xiaomi HyperMind // 适配 15.x.x.x ~ 16.x.x.x // 这要是坏了,除非动了 cetus 字符串,否则不可能会炸 @@ -41,8 +40,8 @@ object NewUnlockHMind : BaseHook() { returnType = "boolean" modifiers = Modifier.FINAL } - }.single().getMethodInstance(safeClassLoader) - }.toMethod() + }.single() + } } override fun init() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/misettings/CustomRefreshRate.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/misettings/CustomRefreshRate.kt index 6c99a117d6..55db411a15 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/misettings/CustomRefreshRate.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/misettings/CustomRefreshRate.kt @@ -18,23 +18,23 @@ */ package com.sevtinge.hyperceiler.module.hook.misettings -import com.github.kyuubiran.ezxhelper.* import com.github.kyuubiran.ezxhelper.ClassUtils.loadClass import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.github.kyuubiran.ezxhelper.MemberExtensions.isFinal import com.github.kyuubiran.ezxhelper.MemberExtensions.isStatic import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* +import java.lang.reflect.* object CustomRefreshRate : BaseHook() { - private val resultMethod by lazy { + private val resultMethod by lazy { DexKit.findMember("CustomRefreshRate") { it.findMethod { matcher { - addUsingStringsEquals("btn_preferce_category") + addEqString("btn_preferce_category") } - }.single().getMethodInstance(EzXHelper.safeClassLoader) - }.toMethod() + }.single() + } } override fun init() { val resultClass = loadClass("com.xiaomi.misettings.display.RefreshRate.RefreshRateActivity") diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mishare/NoAutoTurnOff.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mishare/NoAutoTurnOff.kt index 96e91d326e..44f453dc88 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mishare/NoAutoTurnOff.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mishare/NoAutoTurnOff.kt @@ -21,10 +21,8 @@ package com.sevtinge.hyperceiler.module.hook.mishare import android.content.* import android.util.* import android.widget.* -import com.github.kyuubiran.ezxhelper.EzXHelper.safeClassLoader import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHooks -import com.sevtinge.hyperceiler.* import com.sevtinge.hyperceiler.R import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* @@ -41,114 +39,112 @@ import org.luckypray.dexkit.result.* import java.lang.reflect.* object NoAutoTurnOff : BaseHook() { - private val nullMethod by lazy { + private val nullMethod by lazy { DexKit.findMember("NoAutoTurnOff1") { it.findMethod { matcher { - addUsingStringsEquals("MiShareService", "EnabledState") + usingStrings("MiShareService", "EnabledState") usingNumbers(600000L) } - }.single().getMethodInstance(safeClassLoader) - }.toMethod() + }.single() + } } - private val nullMethodNew by lazy { + private val nullMethodNew by lazy { DexKit.findMember("NoAutoTurnOff1N") { it.findMethod { matcher { - addUsingStringsEquals("UnionShare", "EnabledState") + usingStrings("UnionShare", "EnabledState") } - }.single().getMethodInstance(safeClassLoader) - }.toMethod() + }.single() + } } - private val null2Method by lazy { + private val null2Method by lazy { DexKit.findMember("NoAutoTurnOff2") { it.findMethod { matcher { declaredClass { - addUsingStringsEquals("mishare:advertise_lock") + usingStrings("mishare:advertise_lock") } paramCount = 2 modifiers = Modifier.STATIC } - }.single().getMethodInstance(safeClassLoader) - }.toMethod() + }.single() + } } - private val null3Method by lazy { + private val null3Method by lazy { DexKit.findMember("NoAutoTurnOff3") { it.findMethod { matcher { - addUsingStringsEquals("com.miui.mishare.action.GRANT_NFC_TOUCH_PERMISSION") + usingStrings("com.miui.mishare.action.GRANT_NFC_TOUCH_PERMISSION") usingNumbers(600000L) modifiers = Modifier.PRIVATE } - }.single().getMethodInstance(safeClassLoader) - }.toMethod() + }.single() + } } - private val stopAdvertAllMethod by lazy { + private val stopAdvertAllMethod by lazy { DexKit.findMember("NoAutoTurnOff9") { it.findMethod { matcher { usingStrings("stopAdvertAll timeout. try stop ") } - }.single().getMethodInstance(safeClassLoader) - }.toMethod() + }.single() + } } - private val toastMethod by lazy { - DexKit.getDexKitBridgeList("NoAutoTurnOff4") { + private val toastMethod by lazy> { + DexKit.findMemberList("NoAutoTurnOff4") { it.findMethod { matcher { declaredClass { - addUsingStringsEquals("EnablingState processMessage(0x%X)", "MiShareService") + usingStrings("EnablingState processMessage(0x%X)", "MiShareService") } returnType = "boolean" paramTypes = listOf("android.os.Message") } - }.toElementList() - }.toMethodList() + } + } } - private val toastMethodNew by lazy { - DexKit.getDexKitBridgeList("NoAutoTurnOff4N") { + private val toastMethodNew by lazy> { + DexKit.findMemberList("NoAutoTurnOff4N") { it.findMethod { matcher { declaredClass { - addUsingStringsEquals("MiShareStateMachine") + usingStrings("MiShareStateMachine") } paramCount = 0 } - }.toElementList() - }.toMethodList() + } + } } - private val showToastMethod by lazy { + private val showToastMethod by lazy { DexKit.findMember("NoAutoTurnOff5") { - it.findMethod ( - FindMethod.create() - .matcher( - MethodMatcher.create() - .declaredClass { - fieldCount(0) - methodCount(2) - } - .returnType("void") - .paramTypes(listOf("android.content.Context", "java.lang.CharSequence", "int")) - .modifiers(Modifier.STATIC) - ) - ).singleOrNull()?.getMethodInstance(safeClassLoader) - }.toMethod() + it.findMethod { + matcher { + declaredClass { + fieldCount(0) + methodCount(2) + } + returnType = "void" + paramTypes = listOf("android.content.Context", "java.lang.CharSequence", "int") + modifiers = Modifier.STATIC + } + }.singleOrNull() + } } - private val nullField by lazy { + private val nullField by lazy { DexKit.findMember("NoAutoTurnOff6") { it.findField { matcher { addReadMethod { - addUsingStringsEquals("NfcShareTaskManager") + usingStrings("NfcShareTaskManager") returnType = "void" paramCount = 1 modifiers = Modifier.PRIVATE @@ -156,16 +152,16 @@ object NoAutoTurnOff : BaseHook() { modifiers = Modifier.PRIVATE or Modifier.STATIC or Modifier.FINAL type = "int" } - }.singleOrNull()?.getFieldInstance(safeClassLoader) - }.toField() + }.singleOrNull() + } } - private val null2Field by lazy { + private val null2Field by lazy { DexKit.findMember("NoAutoTurnOff7") { it.findField { matcher { addReadMethod { - addUsingStringsEquals("stopAdvertAllDelay") + usingStrings("stopAdvertAllDelay") returnType = "void" paramCount = 0 modifiers = Modifier.PRIVATE @@ -173,21 +169,21 @@ object NoAutoTurnOff : BaseHook() { modifiers = Modifier.PRIVATE or Modifier.FINAL type = "int" } - }.singleOrNull()?.getFieldInstance(safeClassLoader) - }.toField() + }.singleOrNull() + } } - private val null2FieldMethod by lazy { + private val null2FieldMethod by lazy { DexKit.findMember("NoAutoTurnOff8") { it.findMethod { matcher { - addUsingStringsEquals("stopAdvertAllDelay") + usingStrings("stopAdvertAllDelay") returnType = "void" paramCount = 0 modifiers = Modifier.PRIVATE } - }.single().getMethodInstance(safeClassLoader) - }.toMethod() + }.single() + } } override fun init() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mishare/UnlockTurboMode.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mishare/UnlockTurboMode.kt index ab7d51571c..3103961e21 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mishare/UnlockTurboMode.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mishare/UnlockTurboMode.kt @@ -18,20 +18,20 @@ */ package com.sevtinge.hyperceiler.module.hook.mishare -import com.github.kyuubiran.ezxhelper.* import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* +import java.lang.reflect.* object UnlockTurboMode : BaseHook() { - private val turboModeMethod by lazy { + private val turboModeMethod by lazy { DexKit.findMember("UnlockTurboMode") { it.findMethod { matcher { - addUsingStringsEquals("DeviceUtil", "xiaomi.hardware.p2p_160m") + usingStrings("DeviceUtil", "xiaomi.hardware.p2p_160m") } - }.single().getMethodInstance(EzXHelper.safeClassLoader) - }.toMethod() + }.single() + } } override fun init() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/misound/BluetoothListener.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/misound/BluetoothListener.java index 002c4d6998..325a5896fe 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/misound/BluetoothListener.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/misound/BluetoothListener.java @@ -46,8 +46,8 @@ import org.luckypray.dexkit.result.ClassData; import org.luckypray.dexkit.result.FieldData; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.UUID; @@ -64,12 +64,12 @@ public class BluetoothListener extends BaseHook { @Override public void init() throws NoSuchMethodException { uuid = mPrefsMap.getString("misound_bluetooth_uuid", ""); - Class clazz1 = (Class) DexKit.findMember("CreateDolbyAudioEffectClazz", new IDexKit() { + Class clazz1 = DexKit.findMember("CreateDolbyAudioEffectClazz", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { ClassData clazzData = bridge.findClass(FindClass.create() .matcher(ClassMatcher.create().usingStrings("Creating a DolbyAudioEffect to global output mix!"))).singleOrNull(); - return clazzData.getInstance(lpparam.classLoader); + return clazzData; } }); if (clazz1 == null) { @@ -86,26 +86,26 @@ protected void after(MethodHookParam param) { } ); } - Class clazz2 = (Class) DexKit.findMember("MiSoundClazz", new IDexKit() { + Class clazz2 = DexKit.findMember("MiSoundClazz", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { ClassData clazzData = bridge.findClass(FindClass.create() .matcher(ClassMatcher.create() .usingStrings("android.media.audiofx.MiSound"))).singleOrNull(); - return clazzData.getInstance(lpparam.classLoader); + return clazzData; } }); if (clazz2 == null) { logE(TAG, "MiSound not found"); } else { - Field field = (Field) DexKit.findMember("Field", new IDexKit() { + Field field = DexKit.findMember("Field", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { FieldData fieldData = bridge.findField(FindField.create() .matcher(FieldMatcher.create() .declaredClass(clazz2).type(Object.class) )).singleOrNull(); - return fieldData.getFieldInstance(lpparam.classLoader); + return fieldData; } }); if (field == null) { @@ -124,9 +124,9 @@ protected void after(MethodHookParam param) { ); } } - Method method1 = (Method) DexKit.findMember("GetEnabledEffect", new IDexKit() { + Method method1 = DexKit.findMember("GetEnabledEffect", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .declaredClass( @@ -135,7 +135,7 @@ public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationEx ) .usingStrings("getEnabledEffect(): both of enabled, force return misound") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); try { @@ -171,13 +171,13 @@ protected void before(MethodHookParam param) { } } ); - Method method2 = (Method) DexKit.findMember("RefreshEffectSelectionEnabled", new IDexKit() { + Method method2 = DexKit.findMember("RefreshEffectSelectionEnabled", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create().declaredClass(method1.getDeclaringClass()) .usingStrings("refreshEffectSelectionEnabled(): currEffect "))).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method2, new MethodHook() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mms/DisableAd.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mms/DisableAd.java index ea667d8f08..775f3e9790 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mms/DisableAd.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mms/DisableAd.java @@ -27,9 +27,9 @@ import org.luckypray.dexkit.DexKitBridge; import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; +import org.luckypray.dexkit.result.BaseDataList; import org.luckypray.dexkit.result.MethodDataList; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.List; @@ -46,17 +46,17 @@ protected void before(MethodHookParam param) throws Throwable { } }); - List methods = DexKit.getDexKitBridgeList("HideButton", new IDexKitList() { + List methods = DexKit.findMemberList("HideButton", new IDexKitList() { @Override - public List dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseDataList dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodDataList methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .name("setHideButton") ) ); - return DexKit.toElementList(methodData); + return methodData; } - }).toMethodList(); + }); for (Method method2 : methods) { if (!Modifier.isAbstract(method2.getModifiers())) { hookMethod(method2, new MethodHook() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mms/DisableRiskTip.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mms/DisableRiskTip.java index a413571e2c..8fb322bf3a 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mms/DisableRiskTip.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mms/DisableRiskTip.java @@ -30,33 +30,33 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; public class DisableRiskTip extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method1 = (Method) DexKit.findMember("Method1", new IDexKit() { + Method method1 = DexKit.findMember("Method1", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("fillSmartContactByB2c: old smart contact is not null") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); - Method method2 = (Method) DexKit.findMember("Method2", new IDexKit() { + Method method2 = DexKit.findMember("Method2", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("11", "460", "12", "") .returnType(void.class) .paramTypes("com.miui.smsextra.sdk.SmartContact", "") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); findAndHookMethod("com.miui.smsextra.sdk.SmartContact", "isRiskyNumber", new MethodHook(){ diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mms/ImOldDevice.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mms/ImOldDevice.java index 4e61fcb837..0943e49189 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mms/ImOldDevice.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mms/ImOldDevice.java @@ -27,8 +27,8 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import de.robv.android.xposed.XC_MethodHook; @@ -36,14 +36,14 @@ public class ImOldDevice extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("IsOld", new IDexKit() { + Method method = DexKit.findMember("IsOld", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("isOld") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method, new MethodHook() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/packageinstaller/AllAsSystemApp.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/packageinstaller/AllAsSystemApp.kt index f0ab36c2b2..25eaf66b5b 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/packageinstaller/AllAsSystemApp.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/packageinstaller/AllAsSystemApp.kt @@ -22,17 +22,18 @@ import android.content.pm.* import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHooks import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* +import java.lang.reflect.* object AllAsSystemApp : BaseHook() { - private val systemMethod by lazy { - DexKit.getDexKitBridgeList("AllAsSystemApp") { + private val systemMethod by lazy> { + DexKit.findMemberList("AllAsSystemApp") { it.findMethod { matcher { paramTypes = listOf("android.content.pm.ApplicationInfo") returnType = "boolean" } - }.toElementList() - }.toMethodList() + } + } } override fun init() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/packageinstaller/DisableAd.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/packageinstaller/DisableAd.java index f3f90b6641..e4297835ac 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/packageinstaller/DisableAd.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/packageinstaller/DisableAd.java @@ -26,22 +26,22 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; public class DisableAd extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method1 = (Method) DexKit.findMember("AdsEnable", new IDexKit() { + Method method1 = DexKit.findMember("AdsEnable", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("ads_enable") .returnType(boolean.class) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method1, new MethodHook() { @@ -51,15 +51,15 @@ protected void before(MethodHookParam param) throws Throwable { } }); - Method method2 = (Method) DexKit.findMember("AppStoreRecommend", new IDexKit() { + Method method2 = DexKit.findMember("AppStoreRecommend", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("app_store_recommend") .returnType(boolean.class) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method2, new MethodHook() { @@ -69,15 +69,15 @@ protected void before(MethodHookParam param) throws Throwable { } }); - Method method3 = (Method) DexKit.findMember("VirusScanInstall", new IDexKit() { + Method method3 = DexKit.findMember("VirusScanInstall", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("virus_scan_install") .returnType(boolean.class) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method3, new MethodHook() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/packageinstaller/DisableAppInfoUpload.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/packageinstaller/DisableAppInfoUpload.kt index 356652ed23..ce4fee09d2 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/packageinstaller/DisableAppInfoUpload.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/packageinstaller/DisableAppInfoUpload.kt @@ -43,7 +43,7 @@ object DisableAppInfoUpload : BaseHook() { /** * methods invoke api '/avl/upload/' */ - val avlUploadInvokerList = DexKit.getDexKitBridgeList("avlUploadInvokerList") { + val avlUploadInvokerList = DexKit.findMemberList("avlUploadInvokerList") { it.findMethod { matcher { paramCount(4) @@ -57,8 +57,8 @@ object DisableAppInfoUpload : BaseHook() { returnType(Void::class.javaPrimitiveType as Class<*>) modifiers(AccessFlagsMatcher.create(Modifier.STATIC)) } - }.toElementList() - }.toMethodList() + } + } if (avlUploadInvokerList.isEmpty()) { throw IllegalStateException("cannot find MethodData invoking '/avl/upload/'") @@ -76,7 +76,7 @@ object DisableAppInfoUpload : BaseHook() { /** * methods invoke api '/v4/game/interceptcheck/' */ - val interceptCheckInvokerList = DexKit.getDexKitBridgeList("interceptCheckInvokerList") { + val interceptCheckInvokerList = DexKit.findMemberList("interceptCheckInvokerList") { it.findMethod { matcher { paramCount(6) @@ -91,8 +91,8 @@ object DisableAppInfoUpload : BaseHook() { returnType(Object::class.java) usingStrings("device_type", "packageName", "installationMode", "apk_bit") } - }.toElementList() - }.toMethodList() + } + } if (interceptCheckInvokerList.isEmpty()) { throw IllegalStateException("cannot find MethodData invoking 'interceptcheck'") @@ -110,7 +110,7 @@ object DisableAppInfoUpload : BaseHook() { /** * methods invoke api '/info/layout' */ - val infoLayoutInvokerList = DexKit.getDexKitBridgeList("interceptCheckInvokerList") { + val infoLayoutInvokerList = DexKit.findMemberList("interceptCheckInvokerList") { it.findMethod { matcher { paramCount(7) @@ -124,8 +124,8 @@ object DisableAppInfoUpload : BaseHook() { null ) } - }.toElementList() - }.toMethodList() + } + } if (infoLayoutInvokerList.isEmpty()) { throw IllegalStateException("cannot find MethodData invoking '/info/layout'") @@ -151,7 +151,7 @@ object DisableAppInfoUpload : BaseHook() { TAG, lpparam.packageName, "'${prefix}' find methods: " + list.stream().map { "${it.javaClass.name}#${ - it.toMethod().name + it.name }" }.collect(Collectors.joining(" | ")) ) diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/packageinstaller/DisableInstallerFullSafeVersion.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/packageinstaller/DisableInstallerFullSafeVersion.java index 903e910e19..d2c55b606c 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/packageinstaller/DisableInstallerFullSafeVersion.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/packageinstaller/DisableInstallerFullSafeVersion.java @@ -32,8 +32,8 @@ import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.FieldData; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Modifier; @@ -41,15 +41,15 @@ public class DisableInstallerFullSafeVersion extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("IsFullSafeVersion", new IDexKit() { + Method method = DexKit.findMember("IsFullSafeVersion", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("installer_full_safe_version") .returnType(boolean.class) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method, new MethodHook() { @@ -58,9 +58,9 @@ protected void before(MethodHookParam param) throws Throwable { param.setResult(false); } }); - Field field = (Field) DexKit.findMember("FullSecurityProtectVersion", new IDexKit() { + Field field = DexKit.findMember("FullSecurityProtectVersion", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { FieldData fieldData = bridge.findField(FindField.create() .matcher(FieldMatcher.create() .declaredClass(ClassMatcher.create() @@ -69,7 +69,7 @@ public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationEx .type(boolean.class) .modifiers(Modifier.FINAL) )).singleOrNull(); - return fieldData.getFieldInstance(lpparam.classLoader); + return fieldData; } }); setStaticBooleanField(field.getDeclaringClass(), field.getName(), false); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/packageinstaller/DisableSafeModelTip.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/packageinstaller/DisableSafeModelTip.kt index 1e6ff73171..2382da9851 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/packageinstaller/DisableSafeModelTip.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/packageinstaller/DisableSafeModelTip.kt @@ -23,16 +23,17 @@ import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinde import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* import com.sevtinge.hyperceiler.utils.* +import java.lang.reflect.* object DisableSafeModelTip : BaseHook() { override fun init() { - DexKit.findMember("DisableSafeModelTip") { + DexKit.findMember("DisableSafeModelTip") { it.findMethod { matcher { - addUsingStringsEquals("android.provider.MiuiSettings\$Ad") + usingEqStrings("android.provider.MiuiSettings\$Ad") } - }.firstOrNull()?.getMethodInstance(lpparam.classLoader) - }.toMethod().createHook { + }.singleOrNull() + }.createHook { returnConstant(false) } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/packageinstaller/InstallRiskDisable.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/packageinstaller/InstallRiskDisable.kt index dd7cb6dbf3..29cc3f3271 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/packageinstaller/InstallRiskDisable.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/packageinstaller/InstallRiskDisable.kt @@ -22,10 +22,11 @@ import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHooks import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* import org.luckypray.dexkit.query.enums.* +import java.lang.reflect.* object InstallRiskDisable : BaseHook() { override fun init() { - DexKit.getDexKitBridgeList("InstallRiskDisable") { + DexKit.findMemberList("InstallRiskDisable") { it.findMethod { matcher { addUsingString("secure_verify_enable", StringMatchType.Equals) @@ -39,8 +40,8 @@ object InstallRiskDisable : BaseHook() { addUsingString("android.provider.MiuiSettings\$Ad", StringMatchType.Equals) returnType = "boolean" } - }.toElementList() - }.toMethodList().createHooks { + } + }.createHooks { returnConstant(false) } } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/personalassistant/BlurPersonalAssistant.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/personalassistant/BlurPersonalAssistant.kt index d904d946df..07b6b57777 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/personalassistant/BlurPersonalAssistant.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/personalassistant/BlurPersonalAssistant.kt @@ -24,6 +24,7 @@ import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createAfterHook import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* import com.sevtinge.hyperceiler.utils.api.* +import java.lang.reflect.* import kotlin.math.* object BlurPersonalAssistant : BaseHook() { @@ -37,13 +38,13 @@ object BlurPersonalAssistant : BaseHook() { override fun init() { var lastBlurRadius = -1 - DexKit.getDexKitBridgeList("BlurPersonalAssistant") { + DexKit.findMemberList("BlurPersonalAssistant") { it.findMethod { matcher { - addUsingStringsEquals("ScrollStateManager") + usingEqStrings("ScrollStateManager") } - }.toElementList() - }.toMethodList().forEach { methodData -> + } + }.forEach { methodData -> methodData.createAfterHook { val scrollX = it.args[0] as Float val fieldNames = ('a'..'z').map { name -> name.toString() } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/personalassistant/DisableLiteVersion.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/personalassistant/DisableLiteVersion.java index c3d8bda6af..02294378ab 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/personalassistant/DisableLiteVersion.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/personalassistant/DisableLiteVersion.java @@ -32,8 +32,8 @@ import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.FieldData; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Modifier; @@ -44,21 +44,21 @@ public class DisableLiteVersion extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("GetDeviceLevel", new IDexKit() { + Method method = DexKit.findMember("GetDeviceLevel", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("getDeviceLevel # physical-memory: ") .returnType(int.class) .paramCount(0) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); - Field field = (Field) DexKit.findMember("CameraColor", new IDexKit() { + Field field = DexKit.findMember("CameraColor", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { FieldData fieldData = bridge.findField(FindField.create() .matcher(FieldMatcher.create() .addReadMethod(MethodMatcher.create() @@ -76,7 +76,7 @@ public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationEx .type(boolean.class) .modifiers(Modifier.PUBLIC) )).singleOrNull(); - return fieldData.getFieldInstance(lpparam.classLoader); + return fieldData; } }); XposedHelpers.setStaticBooleanField(field.getDeclaringClass(), field.getName(), false); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/personalassistant/UnlockWidgetCountLimit.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/personalassistant/UnlockWidgetCountLimit.java index 6ad952b0f0..32141940e8 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/personalassistant/UnlockWidgetCountLimit.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/personalassistant/UnlockWidgetCountLimit.java @@ -28,16 +28,16 @@ import org.luckypray.dexkit.query.matchers.ClassMatcher; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; public class UnlockWidgetCountLimit extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("LimitResult", new IDexKit() { + Method method = DexKit.findMember("LimitResult", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .declaredClass(ClassMatcher.create() @@ -46,7 +46,7 @@ public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationEx .returnType(boolean.class) .paramCount(0) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method, new MethodHook() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/powerkeeper/CustomRefreshRate.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/powerkeeper/CustomRefreshRate.java index 571026cfe3..c6cf680423 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/powerkeeper/CustomRefreshRate.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/powerkeeper/CustomRefreshRate.java @@ -27,22 +27,22 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; public class CustomRefreshRate extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("FucSwitch", new IDexKit() { + Method method = DexKit.findMember("FucSwitch", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("custom_mode_switch", "fucSwitch") .returnType(boolean.class) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method, new MethodHook() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/powerkeeper/PreventBatteryWitelist.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/powerkeeper/PreventBatteryWitelist.java index a185d4c275..cbe0ca851a 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/powerkeeper/PreventBatteryWitelist.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/powerkeeper/PreventBatteryWitelist.java @@ -31,8 +31,8 @@ import org.luckypray.dexkit.query.matchers.ClassMatcher; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import java.util.function.Consumer; @@ -48,16 +48,16 @@ public void init() { // } // }); - Method method = (Method) DexKit.findMember("FucSwitch", new IDexKit() { + Method method = DexKit.findMember("FucSwitch", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .declaredClass(ClassMatcher.create() .usingStrings("addPowerSaveWhitelistApps: ")) .usingStrings("addPowerSaveWhitelistApps: ") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); HookFactory.createMethodHook(method, new Consumer<>() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/screenrecorder/ScreenRecorderConfig.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/screenrecorder/ScreenRecorderConfig.java index 74dfdf9e87..4d1bab0a41 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/screenrecorder/ScreenRecorderConfig.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/screenrecorder/ScreenRecorderConfig.java @@ -26,8 +26,8 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Modifier; @@ -36,14 +36,14 @@ public class ScreenRecorderConfig extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method1 = (Method) DexKit.findMember("Frame", new IDexKit() { + Method method1 = DexKit.findMember("Frame", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("Error when set frame value, maxValue = ") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method1, new MethodHook() { @@ -68,14 +68,14 @@ protected void before(MethodHookParam param) throws Throwable { } }); - Method method2 = (Method) DexKit.findMember("BitRate", new IDexKit() { + Method method2 = DexKit.findMember("BitRate", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("defaultBitRate = ") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method2, new MethodHook() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/screenrecorder/UnlockMoreVolumeFromNew.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/screenrecorder/UnlockMoreVolumeFromNew.kt index d66c614b47..573602fab8 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/screenrecorder/UnlockMoreVolumeFromNew.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/screenrecorder/UnlockMoreVolumeFromNew.kt @@ -18,31 +18,31 @@ */ package com.sevtinge.hyperceiler.module.hook.screenrecorder -import com.github.kyuubiran.ezxhelper.EzXHelper.safeClassLoader import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* import de.robv.android.xposed.* +import java.lang.reflect.* object UnlockMoreVolumeFromNew : BaseHook() { - private val getClass by lazy { + private val getClass by lazy> { DexKit.findMember("UnlockMoreVolumeFromNewClass") { it.findClass { matcher { - addUsingStringsEquals("support_a2dp_inner_record") + usingEqStrings("support_a2dp_inner_record") } - }.single().getInstance(safeClassLoader) - }.toClass() + }.single() + } } override fun init() { - val fieldData = DexKit.getDexKitBridgeList("UnlockMoreVolumeFromNewField") { dexkit -> + val fieldData = DexKit.findMemberList("UnlockMoreVolumeFromNewField") { dexkit -> dexkit.findField { matcher { declaredClass(getClass) type = "boolean" } - }.toElementList() - }.toFieldList() + } + } findAndHookConstructor(getClass, object : MethodHook() { override fun after(param: MethodHookParam) { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/screenshot/UnlockMinimumCropLimit.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/screenshot/UnlockMinimumCropLimit.java index dd998285f0..c580eb09da 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/screenshot/UnlockMinimumCropLimit.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/screenshot/UnlockMinimumCropLimit.java @@ -25,18 +25,18 @@ import org.luckypray.dexkit.DexKitBridge; import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; +import org.luckypray.dexkit.result.BaseDataList; import org.luckypray.dexkit.result.MethodDataList; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import java.util.List; public class UnlockMinimumCropLimit extends BaseHook { @Override public void init() throws NoSuchMethodException { - List methods = DexKit.getDexKitBridgeList("MinimumCropLimit", new IDexKitList() { + List methods = DexKit.findMemberList("MinimumCropLimit", new IDexKitList() { @Override - public List dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseDataList dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodDataList methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .returnType(int.class) @@ -44,9 +44,9 @@ public List dexkit(DexKitBridge bridge) throws ReflectiveOpera .usingNumbers(0.5f, 200) ) ); - return DexKit.toElementList(methodData); + return methodData; } - }).toMethodList(); + }); for (Method method : methods) { hookMethod(method, new MethodHook() { @Override diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securityadd/DisableGameBoosterAds.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securityadd/DisableGameBoosterAds.java index 8bcd0ea52c..7811bf3dee 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securityadd/DisableGameBoosterAds.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securityadd/DisableGameBoosterAds.java @@ -27,21 +27,21 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; public class DisableGameBoosterAds extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method1 = (Method) DexKit.findMember("IsInternational", new IDexKit() { + Method method1 = DexKit.findMember("IsInternational", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("is_international") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method1, new MethodHook() { @@ -56,14 +56,14 @@ protected void before(MethodHookParam param) throws Throwable { } }); - Method method2 = (Method) DexKit.findMember("Xunyou", new IDexKit() { + Method method2 = DexKit.findMember("Xunyou", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("gt_xunyou_net_privacy_alter_not_show") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method2, new replaceHookedMethod() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/BypassAdbInstallVerify.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/BypassAdbInstallVerify.java index fabc65b814..f14917884d 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/BypassAdbInstallVerify.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/BypassAdbInstallVerify.java @@ -28,8 +28,8 @@ import org.luckypray.dexkit.query.matchers.ClassMatcher; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import de.robv.android.xposed.XposedHelpers; @@ -37,26 +37,26 @@ public class BypassAdbInstallVerify extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method1 = (Method) DexKit.findMember("AdbInstallNetworkVerify", new IDexKit() { + Method method1 = DexKit.findMember("AdbInstallNetworkVerify", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .declaredClass(ClassMatcher.create() .usingStrings("https://srv.sec.miui.com/data/adb")) .usingStrings("connectivity") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); - Method method2 = (Method) DexKit.findMember("AdbInstallCaller", new IDexKit() { + Method method2 = DexKit.findMember("AdbInstallCaller", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("AdbInstallActivity", "start request for adb install!") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method1, new MethodHook(){ diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/DisableReport.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/DisableReport.kt index 2f718c197c..fe81b87a37 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/DisableReport.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/DisableReport.kt @@ -21,17 +21,18 @@ package com.sevtinge.hyperceiler.module.hook.securitycenter import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* +import java.lang.reflect.* object DisableReport : BaseHook() { override fun init() { - DexKit.findMember("DisableReport") { + DexKit.findMember("DisableReport") { it.findMethod { matcher { - addUsingStringsEquals("android.intent.action.VIEW", "com.xiaomi.market") + usingEqStrings("android.intent.action.VIEW", "com.xiaomi.market") returnType = "boolean" } - }.single().getMethodInstance(lpparam.classLoader) - }.toMethod().createHook { + }.single() + }.createHook { returnConstant(false) } } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/EnableGameSpeed.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/EnableGameSpeed.java index 9dbd73f5a9..2b6cc015b9 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/EnableGameSpeed.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/EnableGameSpeed.java @@ -28,8 +28,8 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import java.util.Objects; @@ -39,15 +39,15 @@ public class EnableGameSpeed extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method1 = (Method) DexKit.findMember("PropVoidData", new IDexKit() { + Method method1 = DexKit.findMember("PropVoidData", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("android.os.SystemProperties", "set", "SystemPropertiesUtils", "SystemPropertiesUtils getInt:") .returnType(void.class) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method1, new MethodHook() { @@ -58,15 +58,15 @@ protected void before(MethodHookParam param) throws Throwable { } }); - Method method2 = (Method) DexKit.findMember("PropBooleanData", new IDexKit() { + Method method2 = DexKit.findMember("PropBooleanData", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("android.os.SystemProperties", "getBoolean", "SystemPropertiesUtils", "SystemPropertiesUtils getInt:") .returnType(boolean.class) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method2, new MethodHook() { @@ -77,15 +77,15 @@ protected void before(XC_MethodHook.MethodHookParam param) throws Throwable { } }); - Method method3 = (Method) DexKit.findMember("IsSupport", new IDexKit() { + Method method3 = DexKit.findMember("IsSupport", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("debug.game.video.support") .returnType(boolean.class) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method3, new MethodHook() { @@ -95,15 +95,15 @@ protected void before(XC_MethodHook.MethodHookParam param) throws Throwable { } }); - Method method4 = (Method) DexKit.findMember("OpenGameBooster", new IDexKit() { + Method method4 = DexKit.findMember("OpenGameBooster", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("pref_open_game_booster") .returnType(boolean.class) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method4, new MethodHook() { @@ -113,14 +113,14 @@ protected void before(XC_MethodHook.MethodHookParam param) throws Throwable { } }); - Method method5 = (Method) DexKit.findMember("Boot", new IDexKit() { + Method method5 = DexKit.findMember("Boot", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("debug.game.video.boot") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method5, new MethodHook() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/HideXOptModeTip.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/HideXOptModeTip.java index 8fec16c0f7..8be942b68f 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/HideXOptModeTip.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/HideXOptModeTip.java @@ -28,16 +28,16 @@ import org.luckypray.dexkit.query.matchers.ClassMatcher; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; public class HideXOptModeTip extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("IsXOptMode", new IDexKit() { + Method method = DexKit.findMember("IsXOptMode", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .declaredClass(ClassMatcher.create() @@ -45,7 +45,7 @@ public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationEx .paramCount(0) .returnType(boolean.class) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method, new MethodHook() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/InstallIntercept.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/InstallIntercept.java index 7e32569724..356dc8c07d 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/InstallIntercept.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/InstallIntercept.java @@ -26,29 +26,23 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; public class InstallIntercept extends BaseHook { @Override public void init() throws NoSuchMethodException { long stime = System.currentTimeMillis(); - Method method = (Method) DexKit.findMember("install", new IDexKit() { + Method method = DexKit.findMember("install", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) { + public BaseData dexkit(DexKitBridge bridge) { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("permcenter_install_intercept_enabled") .returnType(boolean.class) )).singleOrNull(); - try { - Method method = methodData.getMethodInstance(lpparam.classLoader); - logE(TAG, "new: " + method); - return method; - } catch (NoSuchMethodException e) { - throw new RuntimeException(e); - } + return methodData; } }); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/PowerSaver.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/PowerSaver.java index c04644d616..d63bb379b0 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/PowerSaver.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/PowerSaver.java @@ -27,23 +27,23 @@ import org.luckypray.dexkit.query.matchers.ClassMatcher; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; public class PowerSaver extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("HangUpStatue", new IDexKit() { + Method method = DexKit.findMember("HangUpStatue", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .declaredClass(ClassMatcher.create() .usingStrings("hang_up_enable")) .usingStrings("hang_up_enable") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method, new MethodHook() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/PrivacyThumbnailBlur.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/PrivacyThumbnailBlur.java index 7de8177c7a..e5cbdbeeba 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/PrivacyThumbnailBlur.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/PrivacyThumbnailBlur.java @@ -28,17 +28,17 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.ClassMatcher; import org.luckypray.dexkit.query.matchers.MethodMatcher; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import java.util.Arrays; public class PrivacyThumbnailBlur extends BaseHook { @Override public void init() { - Method method = (Method) DexKit.findMember("ptb", new IDexKit() { + Method method = DexKit.findMember("ptb", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { return bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .declaredClass(ClassMatcher.create() @@ -46,7 +46,7 @@ public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationEx ) .paramTypes(Context.class, String.class, boolean.class) ) - ).singleOrNull().getMethodInstance(lpparam.classLoader); + ).singleOrNull(); } }); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/ScLockApp.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/ScLockApp.java index b4e0e3bc70..b676e5a27c 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/ScLockApp.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/ScLockApp.java @@ -39,7 +39,6 @@ import org.luckypray.dexkit.result.MethodData; import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -54,9 +53,9 @@ public class ScLockApp extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("StartRegionSampling", new IDexKit() { + Method method = DexKit.findMember("StartRegionSampling", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .declaredClass(ClassMatcher.create() @@ -64,25 +63,25 @@ public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationEx ) .name("dispatchTouchEvent") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); - Class clazz = (Class) DexKit.findMember("StartRegionSamplingClazz", new IDexKit() { + Class clazz = DexKit.findMember("StartRegionSamplingClazz", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { ClassData clazzData = bridge.findClass(FindClass.create() .matcher(ClassMatcher.create() .usingStrings("startRegionSampling") )).singleOrNull(); - return clazzData.getInstance(lpparam.classLoader); + return clazzData; } }); Field field = null; if (method == null) { value = 1; - method = (Method) DexKit.findMember("SidebarTouchListener", new IDexKit() { + method = DexKit.findMember("SidebarTouchListener", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .declaredClass(ClassMatcher.create() @@ -90,17 +89,17 @@ public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationEx ) .name("onTouch") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); - clazz = (Class) DexKit.findMember("OnTouchClazz", new IDexKit() { + clazz = DexKit.findMember("OnTouchClazz", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { ClassData clazzData = bridge.findClass(FindClass.create() .matcher(ClassMatcher.create() .usingStrings("onTouch: \taction = ") )).singleOrNull(); - return clazzData.getInstance(lpparam.classLoader); + return clazzData; } }); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/UnlockFbo.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/UnlockFbo.java index b86e785001..dd2ba962be 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/UnlockFbo.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/UnlockFbo.java @@ -26,38 +26,38 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; public class UnlockFbo extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method1 = (Method) DexKit.findMember("FboStateOpenInCloud", new IDexKit() { + Method method1 = DexKit.findMember("FboStateOpenInCloud", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("FBO_STATE_OPEN") .returnType(boolean.class) .paramCount(0) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method1, MethodHook.returnConstant(true)); - Method method2 = (Method) DexKit.findMember("FboManager", new IDexKit() { + Method method2 = DexKit.findMember("FboManager", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("miui.fbo.FboManager") .returnType(boolean.class) .paramTypes(String.class) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method2, MethodHook.returnConstant(true)); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/app/AppDisable.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/app/AppDisable.java index 00a5b12569..8d40cc6b32 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/app/AppDisable.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/app/AppDisable.java @@ -43,8 +43,8 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayList; @@ -123,14 +123,14 @@ protected void after(MethodHookParam param) { } ); - Method method = (Method) DexKit.findMember("MethodOnOptionsItemSelected", new IDexKit() { + Method method = DexKit.findMember("MethodOnOptionsItemSelected", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("application/vnd.android.package-archive") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/app/OpenByDefaultSetting.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/app/OpenByDefaultSetting.kt index 1ff2b2fab0..e27d10705e 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/app/OpenByDefaultSetting.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/app/OpenByDefaultSetting.kt @@ -34,6 +34,7 @@ import com.sevtinge.hyperceiler.module.base.dexkit.* import com.sevtinge.hyperceiler.utils.log.* import de.robv.android.xposed.* import de.robv.android.xposed.XposedHelpers.* +import java.lang.reflect.* @SuppressLint("DiscouragedApi") @@ -67,7 +68,7 @@ class OpenByDefaultSetting : BaseHook() { } /** LiveData 读取后更新 View 的方法 */ - private val onLoadDataFinishMethod by lazy(LazyThreadSafetyMode.NONE) { + private val onLoadDataFinishMethod by lazy(LazyThreadSafetyMode.NONE) { // // public void a(a.j.b.c cVar, Boolean bool) { // <- a // …… @@ -86,8 +87,8 @@ class OpenByDefaultSetting : BaseHook() { paramTypes = listOf("", "") } findFirst = true - }.single().getMethodInstance(classLoader) - }.toMethod() + }.single() + } } companion object { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/app/UnlockAppSandbox.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/app/UnlockAppSandbox.java index 6c89d18800..8f43067259 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/app/UnlockAppSandbox.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/app/UnlockAppSandbox.java @@ -28,59 +28,59 @@ import org.luckypray.dexkit.query.matchers.ClassMatcher; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; public class UnlockAppSandbox extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method1 = (Method) DexKit.findMember("IsSupportAppSandboxByDevice", new IDexKit() { + Method method1 = DexKit.findMember("IsSupportAppSandboxByDevice", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .declaredClass(ClassMatcher.create() .usingStrings("PrivacyFeature")) .usingStrings("rothko") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); - Method method2 = (Method) DexKit.findMember("IsUseSandbox", new IDexKit() { + Method method2 = DexKit.findMember("IsUseSandbox", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .declaredClass(ClassMatcher.create() .usingStrings("SandboxManager")) .usingStrings("android.permission.READ_EXTERNAL_STORAGE", "android.permission.WRITE_EXTERNAL_STORAGE") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); - Method method3 = (Method) DexKit.findMember("IsSupportAppSandboxByProp", new IDexKit() { + Method method3 = DexKit.findMember("IsSupportAppSandboxByProp", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .declaredClass(ClassMatcher.create() .usingStrings("PrivacyFeature")) .usingStrings("persist.sys.mi_isolated") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); - Method method4 = (Method) DexKit.findMember("GetCloudDataBoolean", new IDexKit() { + Method method4 = DexKit.findMember("GetCloudDataBoolean", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .declaredClass(ClassMatcher.create() .usingStrings("content://com.android.settings.cloud.CloudSettings/cloud_all_data")) .usingStrings("getCloudDataBoolean") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method1, new MethodHook() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/BatteryHealth.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/BatteryHealth.kt index 3f0fcc30ae..5e594af84d 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/BatteryHealth.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/BatteryHealth.kt @@ -19,28 +19,28 @@ package com.sevtinge.hyperceiler.module.hook.securitycenter.battery import android.os.* -import com.github.kyuubiran.ezxhelper.* import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createAfterHook import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* import com.sevtinge.hyperceiler.utils.* import de.robv.android.xposed.* import org.luckypray.dexkit.query.enums.* +import java.lang.reflect.* object BatteryHealth : BaseHook() { - private val getSecurityBatteryHealth by lazy { + private val getSecurityBatteryHealth by lazy { DexKit.findMember("getSecurityBatteryHealth") { it.findMethod { matcher { addUsingString("battery_health_soh", StringMatchType.Equals) } - }.single().getMethodInstance(EzXHelper.classLoader) - }.toMethod() + }.single() + } } - private val cc by lazy { - DexKit.useDexkitIfNoCache(arrayOf("SecurityBatteryHealthClass")) { + private val cc by lazy>> { + DexKit.findMemberList("SecurityBatteryHealthClass") { it.findClass { searchPackages("com.miui.powercenter.nightcharge") findFirst = true @@ -65,36 +65,33 @@ object BatteryHealth : BaseHook() { } try { - - findAndHookMethod( - "com.miui.powercenter.nightcharge.SmartChargeFragment", - "onCreatePreferences", - Bundle::class.java, String::class.java, - object : XC_MethodHook() { - override fun afterHookedMethod(param: MethodHookParam) { - gff = param.thisObject - .callMethod("findPreference", "reference_battery_health")!! + findAndHookMethod( + "com.miui.powercenter.nightcharge.SmartChargeFragment", + "onCreatePreferences", + Bundle::class.java, String::class.java, + object : XC_MethodHook() { + override fun afterHookedMethod(param: MethodHookParam) { + gff = param.thisObject + .callMethod("findPreference", "reference_battery_health")!! + } } - } - ) + ) } catch (_: Exception) { - findAndHookMethod( - "com.miui.powercenter.nightcharge.ChargeProtectFragment", - "onCreatePreferences", - Bundle::class.java, String::class.java, - object : XC_MethodHook() { - override fun afterHookedMethod(param: MethodHookParam) { - gff = param.thisObject - .callMethod("findPreference", "reference_battery_health")!! + findAndHookMethod( + "com.miui.powercenter.nightcharge.ChargeProtectFragment", + "onCreatePreferences", + Bundle::class.java, String::class.java, + object : XC_MethodHook() { + override fun afterHookedMethod(param: MethodHookParam) { + gff = param.thisObject + .callMethod("findPreference", "reference_battery_health")!! + } } - } - ) + ) } - val nameClass = DexKit.getDexKitBridgeList("SecurityBatteryHealthClass") { _ -> - cc?.toElementList() - }.toClassList().first().name + val nameClass = cc.first().name findAndHookMethod( nameClass, "handleMessage", diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/PowerConsumptionRanking.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/PowerConsumptionRanking.java index 63b0ab859f..6a28a21889 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/PowerConsumptionRanking.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/PowerConsumptionRanking.java @@ -27,31 +27,31 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.ClassMatcher; import org.luckypray.dexkit.query.matchers.MethodMatcher; +import org.luckypray.dexkit.result.BaseDataList; import org.luckypray.dexkit.result.ClassDataList; import org.luckypray.dexkit.result.MethodDataList; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import java.util.List; public class PowerConsumptionRanking extends BaseHook { @Override public void init() throws NoSuchMethodException { - List> clazzs = DexKit.getDexKitBridgeList("Matcher1Clazz", new IDexKitList() { + List> clazzs = DexKit.findMemberList("Matcher1Clazz", new IDexKitList() { @Override - public List dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseDataList dexkit(DexKitBridge bridge) throws ReflectiveOperationException { ClassDataList clazzData = bridge.findClass( FindClass.create() .matcher(ClassMatcher.create() .usingStrings("%d %s %d %s") ) ); - return DexKit.toElementList(clazzData); + return clazzData; } - }).toClassList(); - List methods = DexKit.getDexKitBridgeList("MiuiVersionCode", new IDexKitList() { + }); + List methods = DexKit.findMemberList("MiuiVersionCode", new IDexKitList() { @Override - public List dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseDataList dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodDataList methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .declaredClass(ClassMatcher.create() @@ -60,9 +60,9 @@ public List dexkit(DexKitBridge bridge) throws ReflectiveOpera .returnType(boolean.class) ) ); - return DexKit.toElementList(methodData); + return methodData; } - }).toMethodList(); + }); /*ClassDataList data = bridge.findClass( FindClass.create() diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/ScreenUsedTime.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/ScreenUsedTime.kt index 0b0af9d642..5cd281e015 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/ScreenUsedTime.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/ScreenUsedTime.kt @@ -18,40 +18,39 @@ */ package com.sevtinge.hyperceiler.module.hook.securitycenter.battery -import com.github.kyuubiran.ezxhelper.* -import com.github.kyuubiran.ezxhelper.EzXHelper.safeClassLoader import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* +import java.lang.reflect.* object ScreenUsedTime : BaseHook() { - private val method1 by lazy { + private val method1 by lazy { DexKit.findMember("ScreenUsedTime1") { it.findMethod { matcher { - addUsingStringsEquals("ishtar", "nuwa", "fuxi") + usingEqStrings("ishtar", "nuwa", "fuxi") returnType = "boolean" paramCount = 0 } - }.single().getMethodInstance(safeClassLoader) - }.toMethod() + }.single() + } } - private val method2 by lazy { - DexKit.getDexKitBridgeList("ScreenUsedTime2") { + private val method2 by lazy> { + DexKit.findMemberList("ScreenUsedTime2") { it.findMethod { matcher { declaredClass { - addUsingStringsEquals("not support screenPowerSplit", "PowerRankHelperHolder") + usingEqStrings("not support screenPowerSplit", "PowerRankHelperHolder") } returnType = "boolean" paramCount = 0 } - }.toElementList() - }.toMethodList() + } + } } override fun init() { - Log.i("methods2 :$method2") + logD(TAG, lpparam.packageName, "methods2 :$method2") method2.forEach { it.createHook { returnConstant( diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/ShowBatteryTemperatureNew.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/ShowBatteryTemperatureNew.kt index 196f2b9e88..027f6994f5 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/ShowBatteryTemperatureNew.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/ShowBatteryTemperatureNew.kt @@ -27,7 +27,6 @@ import android.util.* import android.view.* import android.widget.* import com.github.kyuubiran.ezxhelper.ClassUtils.loadClass -import com.github.kyuubiran.ezxhelper.EzXHelper.safeClassLoader import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.github.kyuubiran.ezxhelper.MemberExtensions.paramCount import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinder @@ -38,7 +37,7 @@ import com.sevtinge.hyperceiler.utils.devicesdk.DisplayUtils.* import java.lang.reflect.* object ShowBatteryTemperatureNew : BaseHook() { - private val smartChargeClazz by lazy { + private val smartChargeClazz by lazy { DexKit.findMember("SmartChargeClazz") { it.findMethod { searchPackages("com.miui.powercenter.nightcharge") @@ -48,8 +47,8 @@ object ShowBatteryTemperatureNew : BaseHook() { addInvoke("Ljava/lang/Math;->abs(I)I") } - }.single().getMethodInstance(safeClassLoader) - }.toMethod() + }.single() + } } override fun init() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/UnlockLowTempExtEndurance.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/UnlockLowTempExtEndurance.java index 9548a19574..3b1050a1c6 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/UnlockLowTempExtEndurance.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/UnlockLowTempExtEndurance.java @@ -27,8 +27,8 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import de.robv.android.xposed.XC_MethodHook; @@ -36,14 +36,14 @@ public class UnlockLowTempExtEndurance extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("LowTempExtEnduranceSupport", new IDexKit() { + Method method = DexKit.findMember("LowTempExtEnduranceSupport", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("low_temperature_extreme_endurance_support") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method, new MethodHook() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/UnlockSmartCharge.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/UnlockSmartCharge.java index 258112f86c..78c488af23 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/UnlockSmartCharge.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/UnlockSmartCharge.java @@ -27,26 +27,26 @@ import org.luckypray.dexkit.DexKitBridge; import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; +import org.luckypray.dexkit.result.BaseDataList; import org.luckypray.dexkit.result.MethodDataList; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import java.util.List; public class UnlockSmartCharge extends BaseHook { @Override public void init() throws NoSuchMethodException { - List methods = DexKit.getDexKitBridgeList("VendorSmartChg", new IDexKitList() { + List methods = DexKit.findMemberList("VendorSmartChg", new IDexKitList() { @Override - public List dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseDataList dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodDataList methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("persist.vendor.smartchg") ) ); - return DexKit.toElementList(methodData); + return methodData; } - }).toMethodList(); + }); for (Method method : methods) { hookMethod(method, returnConstant(true)); } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/UnlockSuperWirelessCharge.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/UnlockSuperWirelessCharge.kt index 3a9adada2f..1021ddf20c 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/UnlockSuperWirelessCharge.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/battery/UnlockSuperWirelessCharge.kt @@ -18,32 +18,32 @@ */ package com.sevtinge.hyperceiler.module.hook.securitycenter.battery -import com.github.kyuubiran.ezxhelper.* import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* +import java.lang.reflect.* object UnlockSuperWirelessCharge : BaseHook() { - private val superWirelessCharge by lazy { + private val superWirelessCharge by lazy { DexKit.findMember("superWirelessCharge") { it.findMethod { matcher { - addUsingStringsEquals("persist.vendor.tx.speed.control") + usingEqStrings("persist.vendor.tx.speed.control") returnType = "boolean" } - }.single().getMethodInstance(EzXHelper.classLoader) - }.toMethod() + }.single() + } } - private val superWirelessChargeTip by lazy { + private val superWirelessChargeTip by lazy { DexKit.findMember("superWirelessChargeTip") { it.findMethod { matcher { - addUsingStringsEquals("key_is_connected_super_wls_tx") + usingEqStrings("key_is_connected_super_wls_tx") } - }.single().getMethodInstance(EzXHelper.classLoader) - }.toMethod() + }.single() + } } override fun init() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/beauty/BeautyLightAuto.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/beauty/BeautyLightAuto.kt index 8225fefa0c..5d5b30bb7a 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/beauty/BeautyLightAuto.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/beauty/BeautyLightAuto.kt @@ -21,18 +21,19 @@ package com.sevtinge.hyperceiler.module.hook.securitycenter.beauty import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHooks import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* +import java.lang.reflect.* object BeautyLightAuto : BaseHook() { - private val beautyAuto by lazy { - DexKit.getDexKitBridgeList("superWirelessCharge") { + private val beautyAuto by lazy> { + DexKit.findMemberList("superWirelessCharge") { it.findMethod { matcher { - addUsingStringsEquals("taoyao") + usingEqStrings("taoyao") paramCount = 0 returnType = "boolean" } - }.toElementList() - }.toMethodList() + } + } } override fun init() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/beauty/BeautyPc.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/beauty/BeautyPc.kt index 8e67508da3..7865d71e05 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/beauty/BeautyPc.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/beauty/BeautyPc.kt @@ -21,18 +21,19 @@ package com.sevtinge.hyperceiler.module.hook.securitycenter.beauty import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* +import java.lang.reflect.* object BeautyPc : BaseHook() { override fun init() { - DexKit.findMember("BeautyPc") { + DexKit.findMember("BeautyPc") { it.findMethod { matcher { - addUsingStringsEquals("persist.vendor.camera.facetracker.support") + usingEqStrings("persist.vendor.camera.facetracker.support") returnType = "boolean" } - }.single().getMethodInstance(lpparam.classLoader) - }.toMethod().createHook { + }.single() + }.createHook { returnConstant(true) } } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/beauty/BeautyPrivacy.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/beauty/BeautyPrivacy.kt index 4c4bc3938d..bd4b429866 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/beauty/BeautyPrivacy.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/beauty/BeautyPrivacy.kt @@ -18,42 +18,42 @@ */ package com.sevtinge.hyperceiler.module.hook.securitycenter.beauty -import com.github.kyuubiran.ezxhelper.* import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHooks import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* +import java.lang.reflect.* object BeautyPrivacy : BaseHook() { - private val R0 by lazy { + private val R0 by lazy { DexKit.findMember("BeautyPrivacy") { it.findMethod { matcher { - addUsingStringsEquals("persist.sys.privacy_camera") + usingEqStrings("persist.sys.privacy_camera") } - }.single().getMethodInstance(EzXHelper.safeClassLoader) - }.toMethod() + }.single() + } } - private val invokeMethod by lazy { - DexKit.getDexKitBridgeList("BeautyPrivacyList") { + private val invokeMethod by lazy> { + DexKit.findMemberList("BeautyPrivacyList") { it.findMethod { matcher { declaredClass { - addUsingStringsEquals("persist.sys.privacy_camera") + usingEqStrings("persist.sys.privacy_camera") } paramTypes = emptyList() returnType = "boolean" addInvoke { declaredClass { - addUsingStringsEquals("persist.sys.privacy_camera") + usingEqStrings("persist.sys.privacy_camera") } returnType = R0.returnType.name paramTypes = listOf(R0.parameterTypes[0].name) } } - }.toElementList() - }.toMethodList() + } + } } override fun init() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/lab/LabUtilsClass.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/lab/LabUtilsClass.kt index 903607c4a7..faf3b1fb4f 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/lab/LabUtilsClass.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/lab/LabUtilsClass.kt @@ -21,13 +21,13 @@ package com.sevtinge.hyperceiler.module.hook.securitycenter.lab import com.sevtinge.hyperceiler.module.base.dexkit.* object LabUtilsClass { - val labUtilClass: MutableList> by lazy { - DexKit.getDexKitBridgeList("labUtilClass") { + val labUtilClass by lazy>> { + DexKit.findMemberList("labUtilClass") { it.findClass { matcher { - addUsingStringsEquals("mi_lab_ai_clipboard_enable", "mi_lab_blur_location_enable") + usingEqStrings("mi_lab_ai_clipboard_enable", "mi_lab_blur_location_enable") } - }.toElementList() - }.toClassList() + } + } } } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/other/BypassSimLockMiAccountAuth.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/other/BypassSimLockMiAccountAuth.kt index 7f557ebd4d..ad82424cea 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/other/BypassSimLockMiAccountAuth.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/other/BypassSimLockMiAccountAuth.kt @@ -22,10 +22,11 @@ import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* import org.luckypray.dexkit.query.enums.* +import java.lang.reflect.* object BypassSimLockMiAccountAuth : BaseHook() { - private val findMethod by lazy { - DexKit.getDexKitBridgeList("BypassSimLockMiAccountAuth") { + private val findMethod by lazy> { + DexKit.findMemberList("BypassSimLockMiAccountAuth") { it.findMethod { matcher { declaredClass { @@ -38,8 +39,8 @@ object BypassSimLockMiAccountAuth : BaseHook() { paramTypes("android.content.Context") returnType = "boolean" } - }.toElementList() - }.toMethodList() + } + } } override fun init() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/other/DisableRootCheck.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/other/DisableRootCheck.kt index 2fc1124733..21c14336f5 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/other/DisableRootCheck.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/other/DisableRootCheck.kt @@ -21,17 +21,18 @@ package com.sevtinge.hyperceiler.module.hook.securitycenter.other import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* +import java.lang.reflect.* object DisableRootCheck : BaseHook() { override fun init() { - DexKit.findMember("DisableRootCheck") { + DexKit.findMember("DisableRootCheck") { it.findMethod { matcher { - addUsingStringsEquals("key_check_item_root") + usingEqStrings("key_check_item_root") returnType = "boolean" } - }.single().getMethodInstance(lpparam.classLoader) - }.toMethod().createHook { + }.single() + }.createHook { returnConstant(false) } } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/other/FuckRiskPkg.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/other/FuckRiskPkg.kt index 91a4d38e31..411543e772 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/other/FuckRiskPkg.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/other/FuckRiskPkg.kt @@ -21,18 +21,19 @@ package com.sevtinge.hyperceiler.module.hook.securitycenter.other import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHooks import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* +import java.lang.reflect.* object FuckRiskPkg : BaseHook() { - private val pkg by lazy { - DexKit.getDexKitBridgeList("FuckRiskPkg") { + private val pkg by lazy> { + DexKit.findMemberList("FuckRiskPkg") { it.findMethod { matcher { - addUsingStringsEquals( + usingEqStrings( "riskPkgList", "key_virus_pkg_list", "show_virus_notification" ) } - }.toElementList() - }.toMethodList() + } + } } override fun init() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/other/LockOneHundredPoints.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/other/LockOneHundredPoints.kt index 70f3d27e25..2c76b86da5 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/other/LockOneHundredPoints.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/other/LockOneHundredPoints.kt @@ -19,16 +19,16 @@ package com.sevtinge.hyperceiler.module.hook.securitycenter.other import android.view.* -import com.github.kyuubiran.ezxhelper.ClassLoaderProvider.safeClassLoader import com.github.kyuubiran.ezxhelper.ClassUtils.loadClass import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinder import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* import org.luckypray.dexkit.query.enums.* +import java.lang.reflect.* object LockOneHundredPoints : BaseHook() { - private val score by lazy { + private val score by lazy { DexKit.findMember("LockOneHundredPoints1N") { it.findMethod { matcher { @@ -36,18 +36,18 @@ object LockOneHundredPoints : BaseHook() { addUsingString("getMinusPredictScore", StringMatchType.Contains) returnType = "int" } - }.single().getMethodInstance(safeClassLoader) - }.toMethod() + }.single() + } } - private val scoreOld by lazy { + private val scoreOld by lazy { DexKit.findMember("LockOneHundredPoints2") { it.findMethod { matcher { addUsingString("getMinusPredictScore", StringMatchType.Contains) } - }.single().getMethodInstance(safeClassLoader) - }.toMethod() + }.single() + } } override fun init() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/other/SkipCountDownLimit.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/other/SkipCountDownLimit.java index 07dbf320ed..61388fddb5 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/other/SkipCountDownLimit.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/other/SkipCountDownLimit.java @@ -33,22 +33,22 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; public class SkipCountDownLimit extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("SkipCountDownLimitFragment", new IDexKit() { + Method method = DexKit.findMember("SkipCountDownLimitFragment", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .declaredClass("com.miui.permcenter.privacymanager.InterceptBaseFragment") .usingNumbers(-1, 0) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); if (mPrefsMap.getBoolean("security_center_skip_count_down_limit_direct")){ diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/BlurSecurity.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/BlurSecurity.kt index b1d3880edd..52f9a31c09 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/BlurSecurity.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/BlurSecurity.kt @@ -24,8 +24,6 @@ import android.graphics.drawable.* import android.util.* import android.view.* import android.widget.* -import com.github.kyuubiran.ezxhelper.* -import com.github.kyuubiran.ezxhelper.EzXHelper.safeClassLoader import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createAfterHook import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.sevtinge.hyperceiler.module.base.* @@ -38,6 +36,7 @@ import com.sevtinge.hyperceiler.utils.blur.MiBlurUtilsKt.setMiBackgroundBlurRadi import com.sevtinge.hyperceiler.utils.blur.MiBlurUtilsKt.setMiViewBlurMode import com.sevtinge.hyperceiler.utils.color.* import de.robv.android.xposed.* +import java.lang.reflect.* object BlurSecurity : BaseHook() { private val blurRadius by lazy { @@ -75,14 +74,14 @@ object BlurSecurity : BaseHook() { // keepList 列表内元素及其子元素不会反色 private val keepColorList = arrayOf("rv_information") - private val lottieAnimation by lazy { + private val lottieAnimation by lazy { DexKit.findMember("BlurSecurity1") { it.findMethod { matcher { addUsingString("game_turbo_box_mode_change") } - }.single().getMethodInstance(ClassLoaderProvider.safeClassLoader) - }.toMethod() + }.single() + } } override fun init() { @@ -254,14 +253,14 @@ object BlurSecurity : BaseHook() { "seekbar_text_speed" ) - val gameManagerMethod = DexKit.findMember("BlurSecurity2") { + val gameManagerMethod = DexKit.findMember("BlurSecurity2") { it.findMethod { searchPackages = listOf("com.miui.gamebooster.windowmanager.newbox") matcher { usingStrings = listOf("addView error") } - }.single().getMethodInstance(safeClassLoader) - }.toMethod() + }.single() + } gameManagerMethod.createAfterHook { val view = it.args[0] as View diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/DockSuggest.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/DockSuggest.java index 18a98fa5e1..b3e8106ceb 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/DockSuggest.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/DockSuggest.java @@ -26,21 +26,21 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; public class DockSuggest extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("Freeform", new IDexKit() { + Method method = DexKit.findMember("Freeform", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("supportFreeform") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method, new MethodHook() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/game/GamePerformanceWildMode.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/game/GamePerformanceWildMode.kt index 99fd893c1b..cdd71ec1da 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/game/GamePerformanceWildMode.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/game/GamePerformanceWildMode.kt @@ -18,21 +18,21 @@ */ package com.sevtinge.hyperceiler.module.hook.securitycenter.sidebar.game -import com.github.kyuubiran.ezxhelper.EzXHelper.safeClassLoader import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* +import java.lang.reflect.* class GamePerformanceWildMode : BaseHook() { override fun init() { // 开放均衡/狂暴模式 - DexKit.findMember("GamePerformanceWildMode") { + DexKit.findMember("GamePerformanceWildMode") { it.findMethod { matcher { addEqString("support_wild_boost") } - }.single().getMethodInstance(safeClassLoader) - }.toMethod().createHook { + }.single() + }.createHook { returnConstant(true) } } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/game/RemoveMacroBlackList.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/game/RemoveMacroBlackList.kt index c440841a96..5bf5c72693 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/game/RemoveMacroBlackList.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/game/RemoveMacroBlackList.kt @@ -18,27 +18,27 @@ */ package com.sevtinge.hyperceiler.module.hook.securitycenter.sidebar.game -import com.github.kyuubiran.ezxhelper.EzXHelper.safeClassLoader import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHooks import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinder import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* +import java.lang.reflect.* class RemoveMacroBlackList : BaseHook() { override fun init() { - DexKit.findMember("RemoveMacroBlackList1") { + DexKit.findMember("RemoveMacroBlackList1") { it.findMethod { matcher { addEqString("pref_gb_unsupport_macro_apps") paramCount = 0 } - }.single().getMethodInstance(safeClassLoader) - }.toMethod().createHook { + }.single() + }.createHook { returnConstant(ArrayList()) } - DexKit.findMember("RemoveMacroBlackList2") { + DexKit.findMember("RemoveMacroBlackList2") { it.findMethod { matcher { returnType = "boolean" @@ -47,19 +47,19 @@ class RemoveMacroBlackList : BaseHook() { paramCount = 0 } } - }.single().getMethodInstance(safeClassLoader) - }.toMethod().createHook { + }.single() + }.createHook { returnConstant(false) } - DexKit.findMember("RemoveMacroBlackList3") { + DexKit.findMember>("RemoveMacroBlackList3") { it.findClass { matcher { usingStrings = listOf("content://com.xiaomi.macro.MacroStatusProvider/game_macro_change") } - }.single().getInstance(safeClassLoader) - }.toClass().apply { + }.single() + }.apply { methodFinder().filterByParamCount(2) .toList().createHooks { returnConstant(true) diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/game/UnlockGunService.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/game/UnlockGunService.kt index bf80e6e64c..b3ad9fda4e 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/game/UnlockGunService.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/game/UnlockGunService.kt @@ -18,14 +18,14 @@ */ package com.sevtinge.hyperceiler.module.hook.securitycenter.sidebar.game -import com.github.kyuubiran.ezxhelper.* import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* +import java.lang.reflect.* object UnlockGunService : BaseHook() { override fun init() { - DexKit.findMember("UnlockGunService") { + DexKit.findMember("UnlockGunService") { it.findMethod { matcher { declaredClass { @@ -34,8 +34,8 @@ object UnlockGunService : BaseHook() { returnType = "boolean" paramTypes = listOf("java.lang.String") } - }.single().getMethodInstance(EzXHelper.safeClassLoader) - }.toMethod().createHook { + }.single() + }.createHook { returnConstant(true) } } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/video/DisableRemoveScreenHoldOn.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/video/DisableRemoveScreenHoldOn.kt index 6dea643f36..d84916e5a9 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/video/DisableRemoveScreenHoldOn.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/video/DisableRemoveScreenHoldOn.kt @@ -18,21 +18,21 @@ */ package com.sevtinge.hyperceiler.module.hook.securitycenter.sidebar.video -import com.github.kyuubiran.ezxhelper.* import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* +import java.lang.reflect.* object DisableRemoveScreenHoldOn : BaseHook() { - private val screen by lazy { + private val screen by lazy { DexKit.findMember("DisableRemoveScreenHoldOn") { it.findMethod { matcher { addEqString("remove_screen_off_hold_on") returnType = "boolean" } - }.single().getMethodInstance(EzXHelper.safeClassLoader) - }.toMethod() + }.single() + } } override fun init() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/video/UnlockVideoSomeFunc.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/video/UnlockVideoSomeFunc.kt index 458647bd9d..1d4ed2778d 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/video/UnlockVideoSomeFunc.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/video/UnlockVideoSomeFunc.kt @@ -18,7 +18,6 @@ */ package com.sevtinge.hyperceiler.module.hook.securitycenter.sidebar.video -import com.github.kyuubiran.ezxhelper.EzXHelper.classLoader import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinder import com.sevtinge.hyperceiler.module.base.* @@ -27,8 +26,8 @@ import org.luckypray.dexkit.query.enums.* import java.lang.reflect.* object UnlockVideoSomeFunc : BaseHook() { - private val findFrc by lazy { - DexKit.useDexkitIfNoCache(arrayOf("findFrcA", "findFrcB")) { + private val findFrc by lazy> { + DexKit.findMemberList("findFrcA") { it.findMethod { matcher { declaredClass { @@ -40,7 +39,8 @@ object UnlockVideoSomeFunc : BaseHook() { } } } - private val findTat by lazy { + + private val findTat by lazy { DexKit.findMember("findTat") { it.findMethod { matcher { @@ -49,8 +49,8 @@ object UnlockVideoSomeFunc : BaseHook() { } addUsingString("debug.config.media.video.ais.support", StringMatchType.Equals) } - }.single().getMethodInstance(classLoader) - }.toMethod() + }.single() + } } private val memc by lazy { @@ -67,17 +67,21 @@ object UnlockVideoSomeFunc : BaseHook() { } override fun init() { - val orderedB = DexKit.getDexKitBridgeList("findFrcB") { _ -> - findFrc?.toMethodDataList()?.filter { methodData -> - methodData.usingFields.any { - it.field.typeName == "java.util.List" + val ordered = DexKit.findMemberList("findFrcB") { + it.findMethod { + matcher { + findFrc.forEach { a -> + name = a.name + } + usingFields { + add { + type = "java.util.List" + } + } } - }?.toElementList() - }.toMethodList() - val orderedA = DexKit.getDexKitBridgeList("findFrcA") { _ -> - findFrc?.toElementList() - }.toMethodList() - val differentItems = orderedA.subtract(orderedB.toSet()) + } + } + val differentItems = findFrc.subtract(ordered.toSet()) if (memc) { differentItems.forEach { methods -> @@ -87,7 +91,7 @@ object UnlockVideoSomeFunc : BaseHook() { } var counter = 0 - orderedA.forEach { methods -> + findFrc.forEach { methods -> counter++ if ((resolution || enhance) && counter == 1) { logD(TAG, lpparam.packageName, "find Tat Method is $findTat") diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/video/VBVideoMode.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/video/VBVideoMode.kt index b3cc4a431d..4384fbfa50 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/video/VBVideoMode.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/video/VBVideoMode.kt @@ -18,22 +18,22 @@ */ package com.sevtinge.hyperceiler.module.hook.securitycenter.sidebar.video -import com.github.kyuubiran.ezxhelper.EzXHelper.safeClassLoader import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* +import java.lang.reflect.* class VBVideoMode : BaseHook() { override fun init() { // 开放影院/自定义模式 - DexKit.findMember("VBVideoMode") { + DexKit.findMember("VBVideoMode") { it.findMethod { matcher { usingStrings = listOf("TheatreModeUtils") usingNumbers = listOf(32) } - }.single().getMethodInstance(safeClassLoader) - }.toMethod().createHook { + }.single() + }.createHook { returnConstant(true) } } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/video/VideoDolbyOpen.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/video/VideoDolbyOpen.java index c2da17c414..c515dd703c 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/video/VideoDolbyOpen.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/video/VideoDolbyOpen.java @@ -28,8 +28,8 @@ import org.luckypray.dexkit.query.matchers.ClassMatcher; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; public class VideoDolbyOpen extends BaseHook { @@ -59,16 +59,16 @@ public void init() { // List list = Collections.singletonList(data); // 查找方法 - Method method = (Method) DexKit.findMember("Dolby", new IDexKit() { + Method method = DexKit.findMember("Dolby", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .declaredClass(ClassMatcher.create() .usingStrings("checkMiGamePermission error")) .usingStrings("dolby") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); HookFactory.createMethodHook(method, hookFactory -> hookFactory.before( diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/plugin/ShowDeviceName.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/plugin/ShowDeviceName.java index 7fb948aa4a..6c5e968fc0 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/plugin/ShowDeviceName.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/plugin/ShowDeviceName.java @@ -11,8 +11,8 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import de.robv.android.xposed.XC_MethodHook; @@ -22,14 +22,14 @@ public class ShowDeviceName { static String deviceName = getProp("persist.sys.device_name"); public static void initShowDeviceName(ClassLoader classLoader) { - Method method = (Method) DexKit.findMember("OnCarrierTextChanged", new IDexKit() { + Method method = DexKit.findMember("OnCarrierTextChanged", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .name("onCarrierTextChanged") )).singleOrNull(); - return methodData.getMethodInstance(classLoader); + return methodData; } }); hookMethod(method, new HookTool.MethodHook() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/thememanager/AllowDownloadMore.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/thememanager/AllowDownloadMore.java index 54325212b5..3a5fbdd4ad 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/thememanager/AllowDownloadMore.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/thememanager/AllowDownloadMore.java @@ -31,39 +31,39 @@ import org.luckypray.dexkit.result.ClassData; import org.luckypray.dexkit.result.MethodData; import org.luckypray.dexkit.result.MethodDataList; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; public class AllowDownloadMore extends BaseHook { @Override public void init() throws NoSuchMethodException { - Class clazz = (Class) DexKit.findMember("DownloadCounter", new IDexKit() { + Class clazz = DexKit.findMember("DownloadCounter", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { ClassData clazzData = bridge.findClass(FindClass.create() .matcher(ClassMatcher.create() .usingStrings("anonymous_use_resources") )).singleOrNull(); - return clazzData.getInstance(lpparam.classLoader); + return clazzData; } }); - Method method1 = (Method) DexKit.findMember("DownloadList", new IDexKit() { + Method method1 = DexKit.findMember("DownloadList", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .declaredClass(clazz) .returnType(clazz) )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); - Method method2 = (Method) DexKit.findMember("DownloadListSize", new IDexKit() { + Method method2 = DexKit.findMember("DownloadListSize", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData1 = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .declaredClass(clazz) @@ -79,7 +79,7 @@ public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationEx methodData2.remove(methodData1); if (methodData2.size() == 1) { for (MethodData method : methodData2) { - return method.getMethodInstance(lpparam.classLoader); + return method; } } return null; diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/thememanager/AllowThirdTheme.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/thememanager/AllowThirdTheme.java index 59449aabdd..5cf8d5b304 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/thememanager/AllowThirdTheme.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/thememanager/AllowThirdTheme.java @@ -26,8 +26,8 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import miui.drm.DrmManager; @@ -35,14 +35,14 @@ public class AllowThirdTheme extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("CheckRightsIsLegal", new IDexKit() { + Method method = DexKit.findMember("CheckRightsIsLegal", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("theme", "ThemeManagerTag", "/system", "check rights isLegal: ") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method, new MethodHook() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/updater/AutoUpdateDialog.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/updater/AutoUpdateDialog.kt index 4222cee7b1..49da2e04ee 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/updater/AutoUpdateDialog.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/updater/AutoUpdateDialog.kt @@ -18,14 +18,14 @@ */ package com.sevtinge.hyperceiler.module.hook.updater -import com.github.kyuubiran.ezxhelper.* import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* import com.sevtinge.hyperceiler.utils.* import org.luckypray.dexkit.query.enums.* +import java.lang.reflect.* object AutoUpdateDialog : BaseHook() { - private val find1 by lazy { + private val find1 by lazy { DexKit.findMember("AutoUpdateDialog1") { it.findMethod { matcher { @@ -34,11 +34,11 @@ object AutoUpdateDialog : BaseHook() { } paramTypes("boolean", "boolean") } - }.single().getMethodInstance(EzXHelper.safeClassLoader) - }.toMethod() + }.single() + } } - private val find2 by lazy { + private val find2 by lazy { DexKit.findMember("AutoUpdateDialog2") { it.findMethod { matcher { @@ -47,8 +47,8 @@ object AutoUpdateDialog : BaseHook() { } paramTypes("long", "int") } - }.single().getMethodInstance(EzXHelper.safeClassLoader) - }.toMethod() + }.single() + } } override fun init() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/updater/DeviceModify.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/updater/DeviceModify.kt index 5eb479e357..38f3d4ad9c 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/updater/DeviceModify.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/updater/DeviceModify.kt @@ -21,6 +21,7 @@ package com.sevtinge.hyperceiler.module.hook.updater import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* import com.sevtinge.hyperceiler.utils.* +import java.lang.reflect.* object DeviceModify : BaseHook() { @@ -48,13 +49,13 @@ object DeviceModify : BaseHook() { e ) } - DexKit.getDexKitBridgeList("DeviceModify") { + DexKit.findMemberList("DeviceModify") { it.findMethod { matcher { - addUsingStringsEquals("android.os.SystemProperties", "get", "get e") + usingEqStrings("android.os.SystemProperties", "get", "get e") } - }.toElementList() - }.toMethodList().forEach { method -> + } + }.forEach { method -> method.hookBeforeMethod { if (it.args[0] == "ro.product.mod_device") it.result = deviceName } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/updater/VersionCodeNew.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/updater/VersionCodeNew.kt index 940694acf7..23cd365684 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/updater/VersionCodeNew.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/updater/VersionCodeNew.kt @@ -20,40 +20,40 @@ package com.sevtinge.hyperceiler.module.hook.updater import android.os.* import android.text.* -import com.github.kyuubiran.ezxhelper.* import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHooks import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* import de.robv.android.xposed.* +import java.lang.reflect.* object VersionCodeNew : BaseHook() { - private val mBigMethod by lazy { + private val mBigMethod by lazy { DexKit.findMember("VersionCodeNew1") { it.findMethod { matcher { - addUsingStringsEquals("ro.miui.ui.version.name") + usingEqStrings("ro.miui.ui.version.name") } - }.single().getMethodInstance(EzXHelper.safeClassLoader) - }.toMethod() + }.single() + } } - private val mOSMethod by lazy { - DexKit.getDexKitBridgeList("VersionCodeNew2") { + private val mOSMethod by lazy> { + DexKit.findMemberList("VersionCodeNew2") { it.findMethod { matcher { - addUsingStringsEquals("ro.mi.os.version.incremental") + usingEqStrings("ro.mi.os.version.incremental") } - }.toElementList() - }.toMethodList() + } + } } - private val mOSCode by lazy { + private val mOSCode by lazy { DexKit.findMember("VersionCodeNew3") { it.findMethod { matcher { - addUsingStringsEquals("ro.mi.os.version.name", "OS") + usingEqStrings("ro.mi.os.version.name", "OS") } - }.single().getMethodInstance(EzXHelper.safeClassLoader) - }.toMethod() + }.single() + } } private val mOldVersionCode = diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/various/UnlockSuperClipboard.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/various/UnlockSuperClipboard.kt index 9b1075efda..16de9f1101 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/various/UnlockSuperClipboard.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/various/UnlockSuperClipboard.kt @@ -20,12 +20,12 @@ package com.sevtinge.hyperceiler.module.hook.various import com.github.kyuubiran.ezxhelper.* import com.github.kyuubiran.ezxhelper.ClassUtils.loadClass -import com.github.kyuubiran.ezxhelper.EzXHelper.safeClassLoader import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHooks import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinder import com.sevtinge.hyperceiler.module.base.* import com.sevtinge.hyperceiler.module.base.dexkit.* +import java.lang.reflect.* object UnlockSuperClipboard : BaseHook() { // by StarVoyager @@ -91,26 +91,26 @@ object UnlockSuperClipboard : BaseHook() { } private fun dexKitSuperClipboard(switch: Boolean) { - val ro by lazy { + val ro by lazy { DexKit.findMember("dexKitSuperClipboardRo") { it.findMethod { matcher { - addUsingStringsEquals("ro.miui.support_super_clipboard") + usingEqStrings("ro.miui.support_super_clipboard") returnType = "boolean" } - }.singleOrNull()?.getMethodInstance(safeClassLoader) - }.toMethod() + }.singleOrNull() + } } - val sys by lazy { + val sys by lazy { DexKit.findMember("dexKitSuperClipboardSys") { it.findMethod { matcher { - addUsingStringsEquals("persist.sys.support_super_clipboard") + usingEqStrings("persist.sys.support_super_clipboard") returnType = "boolean" } - }.singleOrNull()?.getMethodInstance(safeClassLoader) - }.toMethod() + }.singleOrNull() + } } setOf(ro, sys).toSet().createHooks { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/voiceassist/DisableChatWatermark.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/voiceassist/DisableChatWatermark.java index 48cb60ffee..7875266ffb 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/voiceassist/DisableChatWatermark.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/voiceassist/DisableChatWatermark.java @@ -26,21 +26,21 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; public class DisableChatWatermark extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("AddWatermark", new IDexKit() { + Method method = DexKit.findMember("AddWatermark", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("add watermark") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method, new MethodHook() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/voiceassist/UseThirdPartyBrowser.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/voiceassist/UseThirdPartyBrowser.java index 9d5895f8c0..7988141f3e 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/voiceassist/UseThirdPartyBrowser.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/voiceassist/UseThirdPartyBrowser.java @@ -26,21 +26,21 @@ import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; public class UseThirdPartyBrowser extends BaseHook { @Override public void init() throws NoSuchMethodException { - Method method = (Method) DexKit.findMember("StartActivityWithIntent", new IDexKit() { + Method method = DexKit.findMember("StartActivityWithIntent", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(MethodMatcher.create() .usingStrings("IntentUtils", "permission click No Application can handle your intent") )).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); hookMethod(method, new MethodHook() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/voicetrigger/BypassUDKWordLegalCheck.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/voicetrigger/BypassUDKWordLegalCheck.kt index b4934162a8..53561e312b 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/voicetrigger/BypassUDKWordLegalCheck.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/voicetrigger/BypassUDKWordLegalCheck.kt @@ -27,46 +27,46 @@ object BypassUDKWordLegalCheck : BaseHook() { override fun init() { try { // Pangaea引擎录入时的联网检查 - DexKit.findMember("BypassPangaeaWordCheck") { + DexKit.findMember("BypassPangaeaWordCheck") { it.findMethod { matcher { - addUsingStringsEquals("PangaeaTrainingSession", "onlineQuery=") + usingEqStrings("PangaeaTrainingSession", "onlineQuery=") returnType = "java.lang.Boolean" } - }.single().getMethodInstance(lpparam.classLoader) - }.toMethod().createHook { + }.single() + }.createHook { returnConstant(true) } } catch (_: Throwable) { } // 默认引擎录入时的联网检查 try { - DexKit.findMember("BypassLegacyTrainingCheck") { + DexKit.findMember("BypassLegacyTrainingCheck") { it.findMethod { matcher { - addUsingStringsEquals("LegacyTrainingSession", "onlineQuery=") + usingEqStrings("LegacyTrainingSession", "onlineQuery=") returnType = "java.lang.Boolean" } - }.single().getMethodInstance(lpparam.classLoader) - }.toMethod().createHook { + }.single() + }.createHook { returnConstant(true) } } catch (_: Throwable) { } // 判断唤醒词是否合规 try { - DexKit.findMember("BypassDefineWordCheck") { + DexKit.findMember("BypassDefineWordCheck") { it.findMethod { matcher { - addUsingStringsEquals( + usingEqStrings( "https://i.ai.mi.com/api/skillstore/assistant/store/visitors/checkWakeUpWord", "NetUtils", "checkUDKWordLegal, callResult=" ) returnType = "boolean" } - }.single().getMethodInstance(lpparam.classLoader) - }.toMethod().createHook { + }.single() + }.createHook { returnConstant(true) } } catch (_: Throwable) { @@ -74,18 +74,18 @@ object BypassUDKWordLegalCheck : BaseHook() { // 根据对应的唤醒词得到其精度,并返回其是否可用 val accUser = mPrefsMap.getInt("voicetrigger_accuracy_percent", 70).toFloat() / 100 try { - DexKit.findMember("BypassOnlineAccuracyResult") { + DexKit.findMember("BypassOnlineAccuracyResult") { it.findMethod { matcher { - addUsingStringsEquals( + usingEqStrings( "https://i.ai.mi.com/api/skillstore/assistant/store/visitors/checkWakeUpWord", "NetUtils", "getUDKEnrollWordLegal can't get result" ) returnType = "java.lang.String" } - }.single().getMethodInstance(lpparam.classLoader) - }.toMethod().createHook { + }.single() + }.createHook { returnConstant( "{\"data\":{\"status\":0,\"msg\":\"\",\"accuracy\":\"" + String.format( "%.1f", @@ -97,10 +97,10 @@ object BypassUDKWordLegalCheck : BaseHook() { } try { // 禁止判断当前系统网络状态 - DexKit.findMember("BypassNetworkStateCheckForUdkEnroll") { + DexKit.findMember("BypassNetworkStateCheckForUdkEnroll") { it.findMethod { matcher { - addUsingStringsEquals("connectivity") + usingEqStrings("connectivity") paramCount = 1 paramTypes("android.content.Context") modifiers = Modifier.STATIC @@ -117,8 +117,8 @@ object BypassUDKWordLegalCheck : BaseHook() { ) } - }.single().getMethodInstance(lpparam.classLoader) - }.toMethod().createHook { + }.single() + }.createHook { returnConstant(true) } } catch (_: Throwable) { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/weather/SetCardLightDarkMode.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/weather/SetCardLightDarkMode.java index 583e3098ea..11667b2e04 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/weather/SetCardLightDarkMode.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/weather/SetCardLightDarkMode.java @@ -30,8 +30,8 @@ import org.luckypray.dexkit.query.matchers.MethodMatcher; import org.luckypray.dexkit.result.FieldData; import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.base.BaseData; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -43,17 +43,17 @@ public class SetCardLightDarkMode extends BaseHook { @Override public void init() { - Method method = (Method) DexKit.findMember("LightDarkMode", new IDexKit() { + Method method = DexKit.findMember("LightDarkMode", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { MethodData methodData = bridge.findMethod(FindMethod.create() .matcher(METHOD_MATCHER)).singleOrNull(); - return methodData.getMethodInstance(lpparam.classLoader); + return methodData; } }); - Field field = (Field) DexKit.findMember("LightDarkModeField", new IDexKit() { + Field field = DexKit.findMember("LightDarkModeField", new IDexKit() { @Override - public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + public BaseData dexkit(DexKitBridge bridge) throws ReflectiveOperationException { FieldData fieldData = bridge.findField(FindField.create() .matcher(FieldMatcher.create() .declaredClass(ClassMatcher.create() @@ -62,7 +62,7 @@ public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationEx .addReadMethod(METHOD_MATCHER) .type(int.class) )).singleOrNull(); - return fieldData.getFieldInstance(lpparam.classLoader); + return fieldData; } }); hookMethod(method, new MethodHook() { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/utils/api/miuiStringToast/MiuiStringToast.kt b/app/src/main/java/com/sevtinge/hyperceiler/utils/api/miuiStringToast/MiuiStringToast.kt index 3ab2687ff0..d582ba08e6 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/utils/api/miuiStringToast/MiuiStringToast.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/utils/api/miuiStringToast/MiuiStringToast.kt @@ -80,7 +80,7 @@ object MiuiStringToast { .setParam(str) .setStatusBarStrongToast("show_custom_strong_toast") .onCreate() - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && isMoreHyperOSVersion(1f)) { + if (isMoreHyperOSVersion(1f)) { val service = context.getSystemService(Context.STATUS_BAR_SERVICE) service.javaClass.getMethod( "setStatus", @@ -101,7 +101,7 @@ object MiuiStringToast { } } - fun colorToInt(color: String?): Int { + private fun colorToInt(color: String?): Int { val color1 = Color.parseColor(color) val color2 = Color.parseColor("#FFFFFF") val color3 = color1 xor color2 diff --git a/app/src/main/java/com/sevtinge/hyperceiler/utils/search/SearchHelper.java b/app/src/main/java/com/sevtinge/hyperceiler/utils/search/SearchHelper.java index bffe2e7349..b362070404 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/utils/search/SearchHelper.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/utils/search/SearchHelper.java @@ -372,93 +372,93 @@ private static void parsePrefXml(Context context, Class catPrefsFragment, int parsePrefXml(context, catPrefsFragment.getName(), xmlResId, internalId); } - private static void parsePrefXml(Context context, String catPrefsFragment, int xmlResId, int... internalId) { - Resources res = context.getResources(); - try (XmlResourceParser xml = res.getXml(xmlResId)) { - int order = 0; - String location = null; - String locationHyper = null; - String locationPad = null; - int locationId = 0; - int locationHyperId = 0; - int locationPadId = 0; - boolean isPad = isPad(); - StringBuilder internalName = null; - int eventType = xml.getEventType(); - if (internalId.length != 0) { - for (int id : internalId) { - String getString = res.getString(id); - if (internalName == null) { - internalName = new StringBuilder(getString); - } else { - internalName.append("/").append(getString); - } +private static void parsePrefXml(Context context, String catPrefsFragment, int xmlResId, int... internalId) { + Resources res = context.getResources(); + try (XmlResourceParser xml = res.getXml(xmlResId)) { + int order = 0; + String location = null, locationHyper = null, locationPad = null; + int locationId = 0, locationHyperId = 0, locationPadId = 0; + boolean isPad = isPad(); + StringBuilder internalName = null; + int eventType = xml.getEventType(); + + if (internalId.length != 0) { + internalName = new StringBuilder(); + for (int id : internalId) { + if (internalName.length() > 0) { + internalName.append("/"); } + internalName.append(res.getString(id)); } - while (eventType != XmlPullParser.END_DOCUMENT) { - if (eventType == XmlPullParser.START_TAG && !xml.getName().equals("PreferenceCategory")) { - try { - ModData modData = new ModData(); - modData.title = getModTitle(res, xml.getAttributeValue(ANDROID_NS, "title")); - boolean isPreferenceVisible = Boolean.parseBoolean(xml.getAttributeValue(APP_NS, "isPreferenceVisible")); - if (locationHyper == null) { - locationHyper = getModTitle(res, xml.getAttributeValue(APP_NS, "myLocationHyper")); - locationHyperId = getModId(xml.getAttributeValue(APP_NS, "myLocationHyper")); - } - if (locationPad == null) { - locationPad = getModTitle(res, xml.getAttributeValue(APP_NS, "myLocationPad")); - locationPadId = getModId(xml.getAttributeValue(APP_NS, "myLocationPad")); - } - if (location == null) { - location = getModTitle(res, xml.getAttributeValue(APP_NS, "myLocation")); - locationId = getModId(xml.getAttributeValue(APP_NS, "myLocation")); - } - if (!TextUtils.isEmpty(modData.title) && !isPreferenceVisible) { - String internalHyper = internalName == null ? locationHyper : internalName + "/" + locationHyper; - String internalPad = internalName == null ? locationPad : internalName + "/" + locationPad; - String internalMiui = internalName == null ? location : internalName + "/" + location; - if (locationHyper == null || location == null || (isPad && locationPad == null)) { - if (location != null) { - modData.breadcrumbs = internalMiui; - modData.catTitleResId = locationId; - } else if (locationHyper != null) { + } + + while (eventType != XmlPullParser.END_DOCUMENT) { + if (eventType == XmlPullParser.START_TAG && !xml.getName().equals("PreferenceCategory")) { + try { + ModData modData = new ModData(); + modData.title = getModTitle(res, xml.getAttributeValue(ANDROID_NS, "title")); + boolean isPreferenceVisible = Boolean.parseBoolean(xml.getAttributeValue(APP_NS, "isPreferenceVisible")); + + if (locationHyper == null) { + locationHyper = getModTitle(res, xml.getAttributeValue(APP_NS, "myLocationHyper")); + locationHyperId = getModId(xml.getAttributeValue(APP_NS, "myLocationHyper")); + } + if (locationPad == null) { + locationPad = getModTitle(res, xml.getAttributeValue(APP_NS, "myLocationPad")); + locationPadId = getModId(xml.getAttributeValue(APP_NS, "myLocationPad")); + } + if (location == null) { + location = getModTitle(res, xml.getAttributeValue(APP_NS, "myLocation")); + locationId = getModId(xml.getAttributeValue(APP_NS, "myLocation")); + } + + if (!TextUtils.isEmpty(modData.title) && !isPreferenceVisible) { + String internalHyper = internalName == null ? locationHyper : internalName + "/" + locationHyper; + String internalPad = internalName == null ? locationPad : internalName + "/" + locationPad; + String internalMiui = internalName == null ? location : internalName + "/" + location; + + if (locationHyper == null || location == null || (isPad && locationPad == null)) { + if (location != null) { + modData.breadcrumbs = internalMiui; + modData.catTitleResId = locationId; + } else if (locationHyper != null) { + modData.breadcrumbs = internalHyper; + modData.catTitleResId = locationHyperId; + } else if (locationPad != null) { + modData.breadcrumbs = internalPad; + modData.catTitleResId = locationPadId; + } + } else { + if (!isPad) { + if (isMoreHyperOSVersion(1f)) { modData.breadcrumbs = internalHyper; modData.catTitleResId = locationHyperId; - } else if (locationPad != null) { - modData.breadcrumbs = internalPad; - modData.catTitleResId = locationPadId; - } - } else { - if (!isPad) { - if (isMoreHyperOSVersion(1f)) { - modData.breadcrumbs = internalHyper; - modData.catTitleResId = locationHyperId; - } else { - modData.breadcrumbs = internalMiui; - modData.catTitleResId = locationId; - } } else { - modData.breadcrumbs = internalPad; - modData.catTitleResId = locationPadId; + modData.breadcrumbs = internalMiui; + modData.catTitleResId = locationId; } + } else { + modData.breadcrumbs = internalPad; + modData.catTitleResId = locationPadId; } - modData.key = xml.getAttributeValue(ANDROID_NS, "key"); - modData.order = order; - - modData.fragment = catPrefsFragment; - allModsList.add(modData); } - order++; - } catch (Throwable t) { - AndroidLogUtils.logE(TAG, "Failed to get xml keyword object!", t); + + modData.key = xml.getAttributeValue(ANDROID_NS, "key"); + modData.order = order; + modData.fragment = catPrefsFragment; + allModsList.add(modData); } + order++; + } catch (Throwable t) { + AndroidLogUtils.logE(TAG, "Failed to get xml keyword object!", t); } - eventType = xml.next(); } - } catch (Throwable t) { - AndroidLogUtils.logE(TAG, "Failed to access XML resource!", t); + eventType = xml.next(); } + } catch (Throwable t) { + AndroidLogUtils.logE(TAG, "Failed to access XML resource!", t); } +} private static int getModId(String title) { if (title == null) {