Skip to content

Commit

Permalink
hyperos自启动hook添加对fcm广播过滤
Browse files Browse the repository at this point in the history
  • Loading branch information
kooritea committed May 24, 2024
1 parent 44b5374 commit ff116bf
Showing 1 changed file with 27 additions and 10 deletions.
37 changes: 27 additions & 10 deletions app/src/main/java/com/kooritea/fcmfix/xposed/AutoStartFix.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,16 @@ protected void beforeHookedMethod(MethodHookParam methodHookParam) {
Intent intent = (Intent) XposedHelpers.getObjectField(methodHookParam.args[1], "intent");
String target = intent.getComponent() == null ? intent.getPackage() : intent.getComponent().getPackageName();
if (targetIsAllow(target)) {
printLog("Allow Auto Start: " + target, true);
// 无日志,先放了
printLog("[" + intent.getAction() + "]checkApplicationAutoStart package_name: " + target, true);
methodHookParam.setResult(true);
// if ("com.google.android.c2dm.intent.RECEIVE".equals(intent.getAction())) {
// printLog("checkApplicationAutoStart package_name: " + target, true);
// methodHookParam.setResult(true);
// }else{
// printLog("[skip][" + intent.getAction() + "]checkApplicationAutoStart package_name: " + target, true);
// }

}
}
});
Expand All @@ -81,9 +89,10 @@ protected void beforeHookedMethod(MethodHookParam methodHookParam) {
Intent intent = (Intent) XposedHelpers.getObjectField(methodHookParam.args[1], "intent");
String target = intent.getComponent() == null ? intent.getPackage() : intent.getComponent().getPackageName();
if(targetIsAllow(target)){
//XposedHelpers.callMethod(methodHookParam.thisObject, "checkAbnormalBroadcastInQueueLocked", methodHookParam.args[0]);
printLog("BroadcastQueueModernStubImpl.checkReceiverIfRestricted: " + target, true);
methodHookParam.setResult(false);
if("com.google.android.c2dm.intent.RECEIVE".equals(intent.getAction())){
printLog("BroadcastQueueModernStubImpl.checkReceiverIfRestricted package_name: " + target, true);
methodHookParam.setResult(false);
}
}
}
});
Expand All @@ -96,11 +105,18 @@ protected void beforeHookedMethod(MethodHookParam methodHookParam) {
XC_MethodHook methodHook = new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam methodHookParam) {
Intent service = (Intent) methodHookParam.args[1];
String target = service.getComponent().getPackageName();
Intent intent = (Intent) methodHookParam.args[1];
String target = intent.getComponent().getPackageName();
if(targetIsAllow(target)) {
printLog("AutoStartManagerServiceStubImpl.isAllowStartService package_name: " + target, true);
// 拿不到action,先放了
printLog("[" + intent.getAction() + "]AutoStartManagerServiceStubImpl.isAllowStartService package_name: " + target, true);
methodHookParam.setResult(true);
// if("com.google.android.c2dm.intent.RECEIVE".equals(intent.getAction())){
// printLog("AutoStartManagerServiceStubImpl.isAllowStartService package_name: " + target, true);
// methodHookParam.setResult(true);
// }else{
// printLog("[skip][" + intent.getAction() + "]AutoStartManagerServiceStubImpl.isAllowStartService package_name: " + target, true);
// }
}
}
};
Expand All @@ -121,7 +137,6 @@ protected void beforeHookedMethod(MethodHookParam methodHookParam) {
protected void beforeHookedMethod(MethodHookParam methodHookParam) {
String target = (String)methodHookParam.args[1];
if(targetIsAllow(target)) {
printLog("SmartPowerService.isProcessWhiteList package_name: " + target, true);
methodHookParam.setResult(true);
}
}
Expand All @@ -134,8 +149,10 @@ protected void beforeHookedMethod(MethodHookParam methodHookParam) {
Intent intent = (Intent) XposedHelpers.getObjectField(methodHookParam.args[1], "intent");
String target = intent.getComponent() == null ? intent.getPackage() : intent.getComponent().getPackageName();
if(targetIsAllow(target)) {
printLog("SmartPowerService.shouldInterceptBroadcast package_name: " + target, true);
methodHookParam.setResult(false);
if("com.google.android.c2dm.intent.RECEIVE".equals(intent.getAction())){
printLog("SmartPowerService.shouldInterceptBroadcast package_name: " + target, true);
methodHookParam.setResult(false);
}
}
}
});
Expand Down

0 comments on commit ff116bf

Please sign in to comment.