Skip to content

Commit

Permalink
适配安卓13
Browse files Browse the repository at this point in the history
  • Loading branch information
kooritea committed Aug 18, 2022
1 parent da68127 commit ac65052
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# fcmfix(Android 10 & 11 & 12 & 12L )
# fcmfix(Android 10以上 )

使用xposed让被完全停止的应用响应fcm,让fcm送达率达到100%,不错过任何通知

Expand Down Expand Up @@ -44,7 +44,7 @@ SafetyNet不通过请检查有没有科学上网
### 1、重启之后配置文件被复原
> 一般是你用了mt管理器那个编辑器的问题,可以尝试修改完后删除那个.bak后缀的文件,或者在设置中关闭生成bak文件,或者换一个编辑器 https://play.google.com/store/apps/details?id=in.mfile
### 2、遇到国内版锁屏后连接自动断开的问题请尝试使用针对国内版开发的版本
### 2、遇到国内版锁屏后连接自动断开的问题请

> 请用0.4.7或以上版本
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
42 changes: 42 additions & 0 deletions app/src/main/java/com/kooritea/fcmfix/xposed/BroadcastFix.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit ac65052

Please sign in to comment.