Skip to content

Commit

Permalink
Optimization: MicroG FCM Intent (#153)
Browse files Browse the repository at this point in the history
* Update AutoStartFix.java

* Update BroadcastFix.java
  • Loading branch information
Nep-Timeline authored Jun 24, 2024
1 parent ed86a76 commit 68a5c9c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions app/src/main/java/com/kooritea/fcmfix/xposed/AutoStartFix.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import de.robv.android.xposed.callbacks.XC_LoadPackage;

public class AutoStartFix extends XposedModule {
private final String FCM_RECEIVE = ".android.c2dm.intent.RECEIVE";

public AutoStartFix(XC_LoadPackage.LoadPackageParam loadPackageParam){
super(loadPackageParam);
Expand All @@ -28,7 +29,7 @@ protected void startHook(){
@Override
protected void beforeHookedMethod(MethodHookParam methodHookParam) {
Intent intent = (Intent) XposedHelpers.getObjectField(methodHookParam.args[2], "intent");
if("com.google.android.c2dm.intent.RECEIVE".equals(intent.getAction())){
if(intent.getAction().endsWith(FCM_RECEIVE)){
String target = intent.getComponent() == null ? intent.getPackage() : intent.getComponent().getPackageName();
if(targetIsAllow(target)){
XposedHelpers.callStaticMethod(BroadcastQueueInjector,"checkAbnormalBroadcastInQueueLocked", methodHookParam.args[1], methodHookParam.args[0]);
Expand All @@ -48,7 +49,7 @@ protected void beforeHookedMethod(MethodHookParam methodHookParam) {
@Override
protected void beforeHookedMethod(MethodHookParam methodHookParam) {
Intent intent = (Intent) XposedHelpers.getObjectField(methodHookParam.args[1], "intent");
if("com.google.android.c2dm.intent.RECEIVE".equals(intent.getAction())){
if(intent.getAction().endsWith(FCM_RECEIVE)){
String target = intent.getComponent() == null ? intent.getPackage() : intent.getComponent().getPackageName();
if(targetIsAllow(target)){
XposedHelpers.callMethod(methodHookParam.thisObject, "checkAbnormalBroadcastInQueueLocked", methodHookParam.args[0]);
Expand All @@ -75,7 +76,7 @@ protected void beforeHookedMethod(MethodHookParam methodHookParam) {
// 无日志,先放了
printLog("[" + intent.getAction() + "]checkApplicationAutoStart package_name: " + target, true);
methodHookParam.setResult(true);
// if ("com.google.android.c2dm.intent.RECEIVE".equals(intent.getAction())) {
// if(intent.getAction().endsWith(FCM_RECEIVE)){
// printLog("checkApplicationAutoStart package_name: " + target, true);
// methodHookParam.setResult(true);
// }else{
Expand All @@ -93,7 +94,7 @@ 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)){
if("com.google.android.c2dm.intent.RECEIVE".equals(intent.getAction())){
if(intent.getAction().endsWith(FCM_RECEIVE)){
printLog("BroadcastQueueModernStubImpl.checkReceiverIfRestricted package_name: " + target, true);
methodHookParam.setResult(false);
}
Expand All @@ -115,7 +116,7 @@ protected void beforeHookedMethod(MethodHookParam methodHookParam) {
// 拿不到action,先放了
printLog("[" + intent.getAction() + "]AutoStartManagerServiceStubImpl.isAllowStartService package_name: " + target, true);
methodHookParam.setResult(true);
// if("com.google.android.c2dm.intent.RECEIVE".equals(intent.getAction())){
// if(intent.getAction().endsWith(FCM_RECEIVE)){
// printLog("AutoStartManagerServiceStubImpl.isAllowStartService package_name: " + target, true);
// methodHookParam.setResult(true);
// }else{
Expand Down Expand Up @@ -145,7 +146,7 @@ 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)) {
if("com.google.android.c2dm.intent.RECEIVE".equals(intent.getAction())){
if(intent.getAction().endsWith(FCM_RECEIVE)){
printLog("SmartPowerService.shouldInterceptBroadcast package_name: " + target, true);
methodHookParam.setResult(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ protected void startHook(){
@Override
protected void beforeHookedMethod(MethodHookParam methodHookParam) {
Intent intent = (Intent) methodHookParam.args[finalIntent_args_index];
if(intent != null && intent.getPackage() != null && intent.getFlags() != Intent.FLAG_INCLUDE_STOPPED_PACKAGES && "com.google.android.c2dm.intent.RECEIVE".equals(intent.getAction())){
if(intent != null && intent.getPackage() != null && intent.getFlags() != Intent.FLAG_INCLUDE_STOPPED_PACKAGES && intent.getAction().endsWith(".android.c2dm.intent.RECEIVE")){
String target;
if (intent.getComponent() != null) {
target = intent.getComponent().getPackageName();
Expand Down

0 comments on commit 68a5c9c

Please sign in to comment.