Skip to content

Commit

Permalink
opt: AntiQues
Browse files Browse the repository at this point in the history
  • Loading branch information
Sevtinge committed Aug 13, 2024
1 parent beb078e commit 47a5b66
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import com.sevtinge.hyperceiler.module.hook.systemframework.SpeedInstall;
import com.sevtinge.hyperceiler.module.hook.systemframework.StickyFloatingWindows;
import com.sevtinge.hyperceiler.module.hook.systemframework.SystemLockApp;
import com.sevtinge.hyperceiler.module.hook.systemframework.AntiQues;
import com.sevtinge.hyperceiler.module.hook.systemframework.ThermalBrightness;
import com.sevtinge.hyperceiler.module.hook.systemframework.UseOriginalAnimation;
import com.sevtinge.hyperceiler.module.hook.systemframework.VolumeDefaultStream;
Expand Down Expand Up @@ -90,6 +91,7 @@ public class SystemFrameworkT extends BaseModule {

@Override
public void handleLoadPackage() {
initHook(new AntiQues());
// 小窗
initHook(new AllowAutoStart(), mPrefsMap.getBoolean("system_framework_auto_start_apps_enable"));
initHook(new FreeFormCount(), mPrefsMap.getBoolean("system_framework_freeform_count"));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* This file is part of HyperCeiler.
*
* HyperCeiler is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Copyright (C) 2023-2024 HyperCeiler Contributions
*/

package com.sevtinge.hyperceiler.module.hook.systemframework;

import android.content.Context;

import com.sevtinge.hyperceiler.module.base.BaseHook;

import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XposedHelpers;

public class AntiQues extends BaseHook {
@Override
public void init() throws NoSuchMethodException {
XposedHelpers.findAndHookMethod("com.android.server.SystemServiceManager", lpparam.classLoader,
"loadClassFromLoader", String.class, ClassLoader.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
try {
String clzName = (String) param.args[0];
ClassLoader cl = (ClassLoader) param.args[1];
if (clzName.equals("com.android.server.wifi.WifiService")) {
XposedHelpers.findAndHookMethod("com.android.server.wifi.Utils", cl, "checkDeviceNameIsIllegalSync", Context.class, int.class, String.class,
new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
param.setResult(false);
}
});
}
} catch (Throwable t) {
}
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@ protected void after(MethodHookParam param) throws Throwable {
setStaticBooleanField(findClassIfExists("miui.os.Build"), "IS_INTERNATIONAL_BUILD", originalValue);
}
});
findAndHookMethod("com.android.settings.wifi.EditTetherFragment", "onSave", new MethodHook(){
@Override
protected void before(MethodHookParam param) throws Throwable {
boolean originalValue = getStaticBooleanField(findClassIfExists("miui.os.Build"), "IS_INTERNATIONAL_BUILD");
setStaticBooleanField(findClassIfExists("miui.os.Build"), "IS_INTERNATIONAL_BUILD", true);
param.setObjectExtra("originalValue", originalValue);
}
@Override
protected void after(MethodHookParam param) throws Throwable {
boolean originalValue = (boolean) param.getObjectExtra("originalValue");
setStaticBooleanField(findClassIfExists("miui.os.Build"), "IS_INTERNATIONAL_BUILD", originalValue);
}
});
findAndHookMethod("com.android.settings.DeviceNameCheckManager", "getDeviceNameCheckResult", Context.class, String.class, int.class, "com.android.settings.DeviceNameCheckManager$GetResultSuccessCallback", new MethodHook(){
@Override
protected void before(MethodHookParam param) throws Throwable {
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/xml/framework_other.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
android:summary="@string/system_framework_quick_screenshot_desc"
android:title="@string/system_framework_quick_screenshot" />

<SwitchPreference
android:defaultValue="false"
android:key="prefs_key_system_settings_anti_ques"
android:summary="@string/system_settings_anti_ques_desc"
android:title="@string/system_settings_anti_ques" />

<SwitchPreference
android:defaultValue="false"
android:key="prefs_key_system_framework_disable_72h_verify"
Expand Down
6 changes: 0 additions & 6 deletions app/src/main/res/xml/system_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@
android:key="prefs_key_system_settings_unlock_ui_mode"
android:title="@string/system_settings_unlock_ui_mode" />

<SwitchPreference
android:defaultValue="false"
android:key="prefs_key_system_settings_anti_ques"
android:summary="@string/system_settings_anti_ques_desc"
android:title="@string/system_settings_anti_ques" />

<SwitchPreference
android:defaultValue="false"
android:key="prefs_key_system_settings_lang_menu_shouw_all_app"
Expand Down

0 comments on commit 47a5b66

Please sign in to comment.