From ac650521a47652ad309bd3f55d41ddb9a370eb93 Mon Sep 17 00:00:00 2001 From: kooritea Date: Thu, 18 Aug 2022 13:33:46 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8D=E5=AE=89=E5=8D=9313?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +- app/build.gradle | 4 +- .../kooritea/fcmfix/xposed/BroadcastFix.java | 42 +++++++++++++++++++ 3 files changed, 46 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 011d816..3d02571 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# fcmfix(Android 10 & 11 & 12 & 12L ) +# fcmfix(Android 10以上 ) 使用xposed让被完全停止的应用响应fcm,让fcm送达率达到100%,不错过任何通知 @@ -44,7 +44,7 @@ SafetyNet不通过请检查有没有科学上网 ### 1、重启之后配置文件被复原 > 一般是你用了mt管理器那个编辑器的问题,可以尝试修改完后删除那个.bak后缀的文件,或者在设置中关闭生成bak文件,或者换一个编辑器 https://play.google.com/store/apps/details?id=in.mfile -### 2、遇到国内版锁屏后连接自动断开的问题请尝试使用针对国内版开发的版本 +### 2、遇到国内版锁屏后连接自动断开的问题请 > 请用0.4.7或以上版本 diff --git a/app/build.gradle b/app/build.gradle index 8521549..27373be 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "com.kooritea.fcmfix" minSdkVersion 28 targetSdkVersion 30 - versionCode 30 - versionName "0.4.10" + versionCode 31 + versionName "0.4.11" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/com/kooritea/fcmfix/xposed/BroadcastFix.java b/app/src/main/java/com/kooritea/fcmfix/xposed/BroadcastFix.java index adf3bf0..9c64483 100644 --- a/app/src/main/java/com/kooritea/fcmfix/xposed/BroadcastFix.java +++ b/app/src/main/java/com/kooritea/fcmfix/xposed/BroadcastFix.java @@ -32,6 +32,10 @@ protected void startHook(){ } } if(targetMethod != null){ + if(Build.VERSION.SDK_INT < Build.VERSION_CODES.P){ + printLog("不支持的安卓版本(<9),fcmfix将不会工作。"); + return; + } int intent_args_index = 0; int appOp_args_index = 0; Parameter[] parameters = targetMethod.getParameters(); @@ -60,8 +64,14 @@ protected void startHook(){ if(parameters[12].getType() == int.class){ appOp_args_index = 12; } + }else if(Build.VERSION.SDK_INT == 33){ + intent_args_index = 3; + appOp_args_index = 12; } if(intent_args_index == 0 || appOp_args_index == 0){ + intent_args_index = 0; + appOp_args_index = 0; + // 根据参数名称查找,部分经过混淆的系统无效 for(int i = 0; i < parameters.length; i++){ if(parameters[i].getName() == "appOp" && parameters[i].getType() == int.class){ appOp_args_index = i; @@ -71,6 +81,38 @@ protected void startHook(){ } } } + if(intent_args_index == 0 || appOp_args_index == 0){ + intent_args_index = 0; + appOp_args_index = 0; + // 尝试用最后一个版本 + if(parameters[3].getType() == Intent.class && parameters[12].getType() == int.class){ + intent_args_index = 3; + appOp_args_index = 12; + printLog("未适配的安卓版本,正在使用最后一个适配的安卓版本的配置,可能会出现工作异常。"); + } + } + if(intent_args_index == 0 || appOp_args_index == 0){ + intent_args_index = 0; + appOp_args_index = 0; + for(int i = 0; i < parameters.length; i++){ + // 从最后一个适配的版本的位置左右查找appOp的位置 + if(Math.abs(12-i) < 2 && parameters[i].getType() == int.class){ + appOp_args_index = i; + } + // 唯一一个Intent参数的位置 + if(parameters[i].getType() == Intent.class){ + if(intent_args_index != 0){ + printLog("查找到多个Intent,停止查找hook位置。"); + intent_args_index = 0; + break; + } + intent_args_index = i; + } + } + if(intent_args_index != 0 && appOp_args_index != 0){ + printLog("当前hook位置通过模糊查找得出,fcmfix可能不会正常工作。"); + } + } printLog("Android API: " + Build.VERSION.SDK_INT); printLog("appOp_args_index: " + appOp_args_index); printLog("intent_args_index: " + intent_args_index);