-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
57 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
app/src/main/java/com/kooritea/fcmfix/xposed/MiuiLocalNotificationFix.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.kooritea.fcmfix.xposed; | ||
|
||
import android.app.AndroidAppHelper; | ||
import android.content.Intent; | ||
import android.os.Build; | ||
|
||
import com.kooritea.fcmfix.util.ContentProviderHelper; | ||
|
||
import java.lang.reflect.Method; | ||
|
||
import de.robv.android.xposed.XC_MethodHook; | ||
import de.robv.android.xposed.XposedBridge; | ||
import de.robv.android.xposed.XposedHelpers; | ||
import de.robv.android.xposed.callbacks.XC_LoadPackage; | ||
|
||
public class MiuiLocalNotificationFix extends XposedModule { | ||
public MiuiLocalNotificationFix(XC_LoadPackage.LoadPackageParam loadPackageParam) { | ||
super(loadPackageParam); | ||
this.startHook(); | ||
} | ||
|
||
protected void startHook(){ | ||
Class<?> clazz = XposedHelpers.findClass("com.android.server.notification.NotificationManagerServiceInjector",loadPackageParam.classLoader); | ||
final Method[] declareMethods = clazz.getDeclaredMethods(); | ||
Method targetMethod = null; | ||
for(Method method : declareMethods){ | ||
if(method.getName().equals("isAllowLocalNotification")){ | ||
targetMethod = method; | ||
break; | ||
} | ||
} | ||
if(targetMethod != null){ | ||
XposedBridge.hookMethod(targetMethod,new XC_MethodHook() { | ||
@Override | ||
protected void afterHookedMethod(MethodHookParam methodHookParam) throws Throwable { | ||
methodHookParam.setResult(true); | ||
printLog("Allow LocalNotification " + methodHookParam.args[3]); | ||
} | ||
}); | ||
}else{ | ||
printLog("Not found isAllowLocalNotification in com.android.server.notification.NotificationManagerServiceInjector"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters