Skip to content

Commit

Permalink
添加对intent.action的判空
Browse files Browse the repository at this point in the history
  • Loading branch information
kooritea committed Jun 24, 2024
1 parent 68a5c9c commit 47c031e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
12 changes: 6 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 @@ -29,7 +29,7 @@ protected void startHook(){
@Override
protected void beforeHookedMethod(MethodHookParam methodHookParam) {
Intent intent = (Intent) XposedHelpers.getObjectField(methodHookParam.args[2], "intent");
if(intent.getAction().endsWith(FCM_RECEIVE)){
if(isFCMIntent(intent)){
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 @@ -49,7 +49,7 @@ protected void beforeHookedMethod(MethodHookParam methodHookParam) {
@Override
protected void beforeHookedMethod(MethodHookParam methodHookParam) {
Intent intent = (Intent) XposedHelpers.getObjectField(methodHookParam.args[1], "intent");
if(intent.getAction().endsWith(FCM_RECEIVE)){
if(isFCMIntent(intent)){
String target = intent.getComponent() == null ? intent.getPackage() : intent.getComponent().getPackageName();
if(targetIsAllow(target)){
XposedHelpers.callMethod(methodHookParam.thisObject, "checkAbnormalBroadcastInQueueLocked", methodHookParam.args[0]);
Expand All @@ -76,7 +76,7 @@ protected void beforeHookedMethod(MethodHookParam methodHookParam) {
// 无日志,先放了
printLog("[" + intent.getAction() + "]checkApplicationAutoStart package_name: " + target, true);
methodHookParam.setResult(true);
// if(intent.getAction().endsWith(FCM_RECEIVE)){
// if(isFCMIntent(intent)){
// printLog("checkApplicationAutoStart package_name: " + target, true);
// methodHookParam.setResult(true);
// }else{
Expand All @@ -94,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(intent.getAction().endsWith(FCM_RECEIVE)){
if(isFCMIntent(intent)){
printLog("BroadcastQueueModernStubImpl.checkReceiverIfRestricted package_name: " + target, true);
methodHookParam.setResult(false);
}
Expand All @@ -116,7 +116,7 @@ protected void beforeHookedMethod(MethodHookParam methodHookParam) {
// 拿不到action,先放了
printLog("[" + intent.getAction() + "]AutoStartManagerServiceStubImpl.isAllowStartService package_name: " + target, true);
methodHookParam.setResult(true);
// if(intent.getAction().endsWith(FCM_RECEIVE)){
// if(isFCMIntent(intent)){
// printLog("AutoStartManagerServiceStubImpl.isAllowStartService package_name: " + target, true);
// methodHookParam.setResult(true);
// }else{
Expand Down Expand Up @@ -146,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(intent.getAction().endsWith(FCM_RECEIVE)){
if(isFCMIntent(intent)){
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 && intent.getAction().endsWith(".android.c2dm.intent.RECEIVE")){
if(intent != null && intent.getPackage() != null && intent.getFlags() != Intent.FLAG_INCLUDE_STOPPED_PACKAGES && isFCMIntent(intent)){
String target;
if (intent.getComponent() != null) {
target = intent.getComponent().getPackageName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,4 +279,13 @@ protected void createFcmfixChannel(NotificationManager notificationManager) {
notificationManager.createNotificationChannel(channel);
}
}

protected boolean isFCMIntent(Intent intent) {
String action = intent.getAction();
if (action != null && action.endsWith(".android.c2dm.intent.RECEIVE")) {
return true;
} else {
return false;
}
}
}

0 comments on commit 47c031e

Please sign in to comment.