Skip to content

Commit

Permalink
feat: mms - >Prohibition of identification as a new device
Browse files Browse the repository at this point in the history
  • Loading branch information
Sevtinge committed Dec 6, 2024
1 parent ecf4a49 commit 5d8b5c0
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.sevtinge.hyperceiler.module.base.BaseModule;
import com.sevtinge.hyperceiler.module.hook.mms.DisableAd;
import com.sevtinge.hyperceiler.module.hook.mms.DisableRiskTip;
import com.sevtinge.hyperceiler.module.hook.mms.ImOldDevice;
import com.sevtinge.hyperceiler.module.hook.various.UnlockSuperClipboard;

@HookBase(targetPackage = "com.android.mms", isPad = false)
Expand All @@ -31,5 +32,6 @@ public void handleLoadPackage() {
initHook(new DisableRiskTip(), mPrefsMap.getBoolean("mms_disable_fraud_risk_tip") || mPrefsMap.getBoolean("mms_disable_overseas_risk_tip"));
initHook(new DisableAd(), mPrefsMap.getBoolean("mms_disable_ad"));
initHook(UnlockSuperClipboard.INSTANCE, mPrefsMap.getStringAsInt("various_super_clipboard_e", 0) != 0);
initHook(new ImOldDevice(), mPrefsMap.getBoolean("mms_im_old_device"));
}
}
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*
* Copyright (C) 2023-2024 HyperCeiler Contributions
*/

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

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;

import de.robv.android.xposed.XC_MethodHook;

public class ImOldDevice extends BaseHook {
@Override
public void init() throws NoSuchMethodException {
Method method = (Method) DexKit.getDexKitBridge("IsOld", new IDexKit() {
@Override
public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException {
MethodData methodData = bridge.findMethod(FindMethod.create()
.matcher(MethodMatcher.create()
.usingStrings("isOld")
)).singleOrNull();
return methodData.getMethodInstance(lpparam.classLoader);
}
});
hookMethod(method, new MethodHook() {
@Override
protected void before(XC_MethodHook.MethodHookParam param) throws Throwable {
param.setResult(false);
}
});
}
}
1 change: 1 addition & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@
<string name="mms_disable_fraud_risk_tip_desc">禁止展示 \"疑似诈骗 注意风险\" 提示</string>
<string name="mms_disable_overseas_risk_tip">禁用境外短信风险提示</string>
<string name="mms_disable_overseas_risk_tip_desc">禁止展示 \"境外短信 注意风险\" 提示</string>
<string name="mms_im_old_device">禁止识别为新设备</string>
<!--电话服务-->
<string name="phone">电话服务</string>
<string name="phone_smart_dual_sim">解锁智能双卡切换</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@
<string name="mms_disable_fraud_risk_tip_desc">Disable \"Possible scam\" tip</string>
<string name="mms_disable_overseas_risk_tip">Disable overseas risk tip</string>
<string name="mms_disable_overseas_risk_tip_desc">Disable \"Might be overseas fraud\" tip</string>
<string name="mms_im_old_device">Prohibition of identification as a new device</string>
<!--Phone Service-->
<string name="phone">Phone Service</string>
<string name="phone_smart_dual_sim">Unlock Smart dual SIM</string>
Expand Down
35 changes: 20 additions & 15 deletions app/src/main/res/xml/mms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,28 @@
app:myLocation="@string/mms"
app:quick_restart="com.android.mms">
<PreferenceCategory>
<SwitchPreference
android:title="@string/mms_disable_ad"
android:summary="@string/mms_disable_ad_desc"
android:key="prefs_key_mms_disable_ad"
android:defaultValue="false" />
<SwitchPreference
android:defaultValue="false"
android:key="prefs_key_mms_disable_ad"
android:summary="@string/mms_disable_ad_desc"
android:title="@string/mms_disable_ad" />

<SwitchPreference
android:title="@string/mms_disable_fraud_risk_tip"
android:summary="@string/mms_disable_fraud_risk_tip_desc"
android:key="prefs_key_mms_disable_fraud_risk_tip"
android:defaultValue="false" />
<SwitchPreference
android:defaultValue="false"
android:key="prefs_key_mms_disable_fraud_risk_tip"
android:summary="@string/mms_disable_fraud_risk_tip_desc"
android:title="@string/mms_disable_fraud_risk_tip" />

<SwitchPreference
android:title="@string/mms_disable_overseas_risk_tip"
android:summary="@string/mms_disable_overseas_risk_tip_desc"
android:key="prefs_key_mms_disable_overseas_risk_tip"
android:defaultValue="false" />
<SwitchPreference
android:defaultValue="false"
android:key="prefs_key_mms_disable_overseas_risk_tip"
android:summary="@string/mms_disable_overseas_risk_tip_desc"
android:title="@string/mms_disable_overseas_risk_tip" />

<SwitchPreference
android:defaultValue="false"
android:key="prefs_key_mms_im_old_device"
android:title="@string/mms_im_old_device" />

</PreferenceCategory>

Expand Down

0 comments on commit 5d8b5c0

Please sign in to comment.