Skip to content

Commit

Permalink
Merge pull request #86 from TigerBeanst/master
Browse files Browse the repository at this point in the history
控制输出日志情况(#84)
  • Loading branch information
kooritea authored Sep 23, 2022
2 parents 1141ecd + a4bfd84 commit a498fac
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected void beforeHookedMethod(MethodHookParam methodHookParam) throws Throwa
}
});
}catch (XposedHelpers.ClassNotFoundError | NoSuchMethodError e){
printLog("No Such Method com.android.server.am.BroadcastQueueInjector.checkApplicationAutoStart");
printLog("No Such Method com.android.server.am.BroadcastQueueInjector.checkApplicationAutoStart", false);
}
try{
// miui13
Expand All @@ -73,7 +73,7 @@ protected void beforeHookedMethod(MethodHookParam methodHookParam) throws Throwa
}
});
}catch (XposedHelpers.ClassNotFoundError | NoSuchMethodError e){
printLog("No Such Method com.android.server.am.BroadcastQueueImpl.checkApplicationAutoStart");
printLog("No Such Method com.android.server.am.BroadcastQueueImpl.checkApplicationAutoStart", false);
}
}

Expand All @@ -94,7 +94,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
}
});
} catch (XposedHelpers.ClassNotFoundError | NoSuchMethodError e) {
printLog("No Such Method com.miui.server.smartpower.SmartPowerPolicyManager.shouldInterceptService");
printLog("No Such Method com.miui.server.smartpower.SmartPowerPolicyManager.shouldInterceptService", false);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,14 @@ protected void startHook(){
protected void afterHookedMethod(MethodHookParam methodHookParam) throws Throwable {
if(targetIsAllow((String)methodHookParam.args[3])){
methodHookParam.setResult(finalTargetMethod.getName().equals("isAllowLocalNotification"));
printLog("Allow LocalNotification " + methodHookParam.args[3]);
}
}
});
}else{
printLog("Not found [isAllowLocalNotification/isDeniedLocalNotification] in com.android.server.notification.[NotificationManagerServiceInjector/NotificationManagerServiceImpl]");
printLog("Not found [isAllowLocalNotification/isDeniedLocalNotification] in com.android.server.notification.[NotificationManagerServiceInjector/NotificationManagerServiceImpl]", false);
}
}catch (XposedHelpers.ClassNotFoundError e){
printLog("Not found [isAllowLocalNotification/isDeniedLocalNotification] in com.android.server.notification.[NotificationManagerServiceInjector/NotificationManagerServiceImpl]");
printLog("Not found [isAllowLocalNotification/isDeniedLocalNotification] in com.android.server.notification.[NotificationManagerServiceInjector/NotificationManagerServiceImpl]", false);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
XposedHelpers.setStaticBooleanField(XposedHelpers.findClass("miui.os.Build",loadPackageParam.classLoader), "IS_INTERNATIONAL_BUILD", true);
XposedHelpers.setStaticBooleanField(XposedHelpers.findClass("miui.os.Build",loadPackageParam.classLoader), "IS_GLOBAL_BUILD", true);
}catch (XposedHelpers.ClassNotFoundError | NoSuchMethodError e){
printLog("No Such Method com.android.server.am.BroadcastQueueInjector.checkApplicationAutoStart");
printLog("No Such Method com.android.server.am.BroadcastQueueInjector.checkApplicationAutoStart", false);
}
}
}
28 changes: 18 additions & 10 deletions app/src/main/java/com/kooritea/fcmfix/xposed/XposedModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected XposedModule(final XC_LoadPackage.LoadPackageParam loadPackageParam) {
try{
onCanReadConfig();
}catch (Exception e){
printLog(e.getMessage());
printLog(e.getMessage(), false);
}
}
}
Expand Down Expand Up @@ -74,21 +74,29 @@ private static void callAllOnCanReadConfig(){
try{
instance.onCanReadConfig();
}catch (Exception e){
printLog(e.getMessage());
printLog(e.getMessage(), false);
}
}
}

protected void onCanReadConfig() throws Exception{};

protected static void printLog(String text){
Intent log = new Intent("com.kooritea.fcmfix.log");
log.putExtra("text",text);
XposedBridge.log("[fcmfix] "+ text);
try{
context.sendBroadcast(log);
}catch (Exception e){
XposedBridge.log("[fcmfix] "+ text);
printLog(text, true);
}

protected static void printLog(String text, Boolean isDiagnosticsLog) {
if (!isDiagnosticsLog) {
XposedBridge.log("[fcmfix] " + text);
} else {
Intent log = new Intent("com.kooritea.fcmfix.log");
log.putExtra("text", text);

try {
context.sendBroadcast(log);
} catch (Exception e) {
XposedBridge.log("[fcmfix] " + text);
}
}
}

Expand Down Expand Up @@ -174,7 +182,7 @@ protected void sendUpdateNotification(String title) {
}

protected void sendUpdateNotification(String title, String content) {
printLog(title);
printLog(title, false);
title = "[fcmfix]" + title;
NotificationManager notificationManager = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE);
this.createFcmfixChannel(notificationManager);
Expand Down

0 comments on commit a498fac

Please sign in to comment.