-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
from gykkuo/MIUI_NoGuard #818
- Loading branch information
Showing
11 changed files
with
245 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
app/src/main/java/com/sevtinge/hyperceiler/module/app/Analytics.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* 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.app; | ||
|
||
import com.sevtinge.hyperceiler.module.base.BaseModule; | ||
import com.sevtinge.hyperceiler.module.base.HookExpand; | ||
import com.sevtinge.hyperceiler.module.hook.analytics.FuckMiuiUpload; | ||
|
||
@HookExpand(pkg = "com.miui.analytics", isPad = false, tarAndroid = 33) | ||
public class Analytics extends BaseModule { | ||
@Override | ||
public void handleLoadPackage() { | ||
initHook(new FuckMiuiUpload(), mPrefsMap.getBoolean("analytics_fuck_guard")); | ||
} | ||
} |
110 changes: 110 additions & 0 deletions
110
app/src/main/java/com/sevtinge/hyperceiler/module/hook/analytics/FuckMiuiUpload.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
/* | ||
* 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.analytics; | ||
|
||
import android.content.Context; | ||
|
||
import com.sevtinge.hyperceiler.module.base.BaseHook; | ||
|
||
import de.robv.android.xposed.XC_MethodHook; | ||
import de.robv.android.xposed.XposedHelpers; | ||
|
||
// from https://github.com/gykkuo/MIUI_NoGuard/blob/master/app/src/main/java/cn/fyyr/noguardpls/MainHook.java | ||
public class FuckMiuiUpload extends BaseHook { | ||
@Override | ||
public void init() throws NoSuchMethodException { | ||
int needmod = 0; | ||
Class<?> classs = null; | ||
// com.miui.analytics.onetrack.p.u.w | ||
try { | ||
classs = XposedHelpers.findClass("com.miui.analytics.onetrack.p.u", lpparam.classLoader); | ||
XposedHelpers.findAndHookMethod(classs, "w", long.class, long.class, new XC_MethodHook() { | ||
@Override | ||
protected void beforeHookedMethod(MethodHookParam param) throws Throwable { | ||
// XposedBridge.log("com.miui.analytics:执行拦截! --- 1"); | ||
param.setResult(null); | ||
} | ||
}); | ||
|
||
needmod++; | ||
} catch (XposedHelpers.ClassNotFoundError | NoSuchMethodError err) { | ||
logD(TAG, lpparam.packageName, err.toString()); | ||
} | ||
// com.miui.analytics.c.f.k.y | ||
try { | ||
classs = XposedHelpers.findClass("com.miui.analytics.c.f.k", lpparam.classLoader); | ||
XposedHelpers.findAndHookMethod(classs, "y", long.class, long.class, new XC_MethodHook() { | ||
@Override | ||
protected void beforeHookedMethod(MethodHookParam param) throws Throwable { | ||
// XposedBridge.log("com.miui.analytics:执行拦截! --- 2"); | ||
param.setResult(null); | ||
} | ||
}); | ||
needmod++; | ||
} catch (XposedHelpers.ClassNotFoundError | NoSuchMethodError err) { | ||
logD(TAG, lpparam.packageName, err.toString()); | ||
} | ||
try { | ||
classs = XposedHelpers.findClass("com.miui.analytics.onetrack.q.c", lpparam.classLoader); | ||
// com.miui.analytics.onetrack.q.c.a | ||
try { | ||
XposedHelpers.findAndHookMethod(classs, "a", Context.class, new XC_MethodHook() { | ||
@Override | ||
protected void beforeHookedMethod(MethodHookParam param) throws Throwable { | ||
// XposedBridge.log("com.miui.analytics:执行拦截! --- 3"); | ||
param.setResult(0); | ||
} | ||
}); | ||
needmod++; | ||
} catch (XposedHelpers.ClassNotFoundError | NoSuchMethodError err) { | ||
logD(TAG, lpparam.packageName, err.toString()); | ||
} | ||
// com.miui.analytics.onetrack.q.c.b | ||
try { | ||
XposedHelpers.findAndHookMethod(classs, "b", Context.class, new XC_MethodHook() { | ||
@Override | ||
protected void beforeHookedMethod(MethodHookParam param) throws Throwable { | ||
// XposedBridge.log("com.miui.analytics:执行拦截! --- 4"); | ||
param.setResult("NONE"); | ||
} | ||
}); | ||
needmod++; | ||
} catch (XposedHelpers.ClassNotFoundError | NoSuchMethodError err) { | ||
logD(TAG, lpparam.packageName, err.toString()); | ||
} | ||
// com.miui.analytics.onetrack.q.c.c | ||
try { | ||
XposedHelpers.findAndHookMethod(classs, "c", new XC_MethodHook() { | ||
@Override | ||
protected void beforeHookedMethod(MethodHookParam param) throws Throwable { | ||
// XposedBridge.log("com.miui.analytics:执行拦截! --- 5"); | ||
param.setResult(false); | ||
} | ||
}); | ||
needmod++; | ||
} catch (XposedHelpers.ClassNotFoundError | NoSuchMethodError err) { | ||
logD(TAG, lpparam.packageName, err.toString()); | ||
} | ||
} catch (XposedHelpers.ClassNotFoundError | NoSuchMethodError err) { | ||
logD(TAG, lpparam.packageName, err.toString()); | ||
} | ||
} | ||
} | ||
|
41 changes: 41 additions & 0 deletions
41
app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/AnalyticsFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* 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.ui.fragment; | ||
|
||
import android.view.View; | ||
|
||
import com.sevtinge.hyperceiler.R; | ||
import com.sevtinge.hyperceiler.ui.base.BaseSettingsActivity; | ||
import com.sevtinge.hyperceiler.ui.fragment.base.SettingsPreferenceFragment; | ||
|
||
public class AnalyticsFragment extends SettingsPreferenceFragment { | ||
@Override | ||
public int getContentResId() { | ||
return R.xml.analytics; | ||
} | ||
|
||
@Override | ||
public View.OnClickListener addRestartListener() { | ||
return view -> ((BaseSettingsActivity)getActivity()).showRestartDialog( | ||
getResources().getString(R.string.analytics), | ||
"com.miui.analytics" | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="utf-8"?><!-- | ||
~ 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 | ||
--> | ||
|
||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
app:myLocation="@string/analytics"> | ||
<PreferenceCategory> | ||
<SwitchPreference | ||
android:defaultValue="false" | ||
android:key="prefs_key_analytics_fuck_guard" | ||
android:title="@string/analytics_fuck_guard" /> | ||
</PreferenceCategory> | ||
|
||
</PreferenceScreen> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters