From 56939c3dbc01094bb244f856231d318bed5be148 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=BB=80=E6=BC=93=E4=B8=A8Sevtinge?=
<89193494+Sevtinge@users.noreply.github.com>
Date: Wed, 4 Dec 2024 20:38:48 +0800
Subject: [PATCH] feat: community - FUCK DETECTION
---
.../hyperceiler/module/app/Community.java | 2 +
.../module/hook/community/FuckDetection.java | 56 +++++++++++++++++++
app/src/main/res/values-zh-rCN/strings.xml | 2 +
app/src/main/res/values/strings.xml | 2 +
app/src/main/res/xml/community.xml | 6 ++
5 files changed, 68 insertions(+)
create mode 100644 app/src/main/java/com/sevtinge/hyperceiler/module/hook/community/FuckDetection.java
diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/app/Community.java b/app/src/main/java/com/sevtinge/hyperceiler/module/app/Community.java
index 34c09593d7..a9d1ff37d3 100644
--- a/app/src/main/java/com/sevtinge/hyperceiler/module/app/Community.java
+++ b/app/src/main/java/com/sevtinge/hyperceiler/module/app/Community.java
@@ -22,6 +22,7 @@
import com.hchen.database.HookBase;
import com.sevtinge.hyperceiler.module.base.BaseModule;
import com.sevtinge.hyperceiler.module.hook.community.DeviceModify;
+import com.sevtinge.hyperceiler.module.hook.community.FuckDetection;
@HookBase(targetPackage = "com.xiaomi.vipaccount", isPad = false)
public class Community extends BaseModule {
@@ -29,5 +30,6 @@ public class Community extends BaseModule {
@Override
public void handleLoadPackage() {
initHook(new DeviceModify(), mPrefsMap.getBoolean("community_device_modify"));
+ initHook(new FuckDetection(), mPrefsMap.getBoolean("community_fuck_detection"));
}
}
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
new file mode 100644
index 0000000000..29ee0335e8
--- /dev/null
+++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/community/FuckDetection.java
@@ -0,0 +1,56 @@
+/*
+ * 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 .
+ *
+ * Copyright (C) 2023-2024 HyperCeiler Contributions
+ */
+
+package com.sevtinge.hyperceiler.module.hook.community;
+
+import static com.sevtinge.hyperceiler.BuildConfig.APPLICATION_ID;
+
+import com.sevtinge.hyperceiler.module.base.BaseHook;
+import com.sevtinge.hyperceiler.module.base.dexkit.DexKit;
+import com.sevtinge.hyperceiler.module.base.dexkit.IDexKit;
+
+import org.luckypray.dexkit.DexKitBridge;
+import org.luckypray.dexkit.query.FindMethod;
+import org.luckypray.dexkit.query.matchers.MethodMatcher;
+import org.luckypray.dexkit.result.MethodData;
+
+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.getDexKitBridge("GetPackageVersionName", new IDexKit() {
+ @Override
+ public AnnotatedElement 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);
+ }
+ });
+ hookMethod(method, new MethodHook() {
+ @Override
+ protected void before(MethodHookParam param) throws Throwable {
+ if (param.args[0].equals(APPLICATION_ID)) param.args[0] = null;
+ }
+ });
+ }
+}
diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml
index 455d7701b4..5c07c96537 100644
--- a/app/src/main/res/values-zh-rCN/strings.xml
+++ b/app/src/main/res/values-zh-rCN/strings.xml
@@ -639,6 +639,8 @@
小米社区
机型伪装
+ 禁止检测
+ 禁止在反馈时检测 HyperCeiler 并上传。请确保问题不是由自身引起,而是确实的系统问题,再进行反馈,以免带来不必要的麻烦
文件管理
文件夹名称允许长按选择操作
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index a973a0f72e..11486d380e 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -631,6 +631,8 @@
Xiaomi Community
Model guise
+ Fuck detection
+ It is forbidden to detect HyperCeiler and upload it while giving feedback. Please make sure that the problem is not caused by yourself, but a real system problem, and then give feedback to avoid unnecessary trouble.
File Manager
File Manager can be selectable
diff --git a/app/src/main/res/xml/community.xml b/app/src/main/res/xml/community.xml
index 1a38b7ce66..2cb69ce687 100644
--- a/app/src/main/res/xml/community.xml
+++ b/app/src/main/res/xml/community.xml
@@ -23,6 +23,12 @@
+
+