Skip to content

Commit

Permalink
优化 日志输出
Browse files Browse the repository at this point in the history
  • Loading branch information
Sevtinge committed Oct 27, 2023
1 parent 82e97a8 commit fe837fd
Show file tree
Hide file tree
Showing 86 changed files with 287 additions and 264 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class SystemFrameworkForCorePatch implements IXposedHookLoadPackage, IXpo
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
if (("android".equals(lpparam.packageName)) && (lpparam.processName.equals("android"))) {
XposedLogUtils.logI(TAG, "Current sdk version " + Build.VERSION.SDK_INT);
XposedLogUtils.logI(TAG, "android", "Current sdk version " + Build.VERSION.SDK_INT);
switch (Build.VERSION.SDK_INT) {
case Build.VERSION_CODES.UPSIDE_DOWN_CAKE -> // 34
new CorePatchForU().handleLoadPackage(lpparam);
Expand All @@ -30,15 +30,15 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Th
new CorePatchForS().handleLoadPackage(lpparam);
case Build.VERSION_CODES.R -> // 30
new CorePatchForR().handleLoadPackage(lpparam);
default -> XposedLogUtils.logW(TAG, "Unsupported Version of Android " + Build.VERSION.SDK_INT);
default -> XposedLogUtils.logW(TAG, "android","Unsupported Version of Android " + Build.VERSION.SDK_INT);
}
}
}

@Override
public void initZygote(StartupParam startupParam) throws Throwable {
if (startupParam.startsSystemServer) {
XposedLogUtils.logI(TAG, "Current sdk version " + Build.VERSION.SDK_INT);
XposedLogUtils.logI(TAG, "android", "Current sdk version " + Build.VERSION.SDK_INT);
switch (Build.VERSION.SDK_INT) {
case Build.VERSION_CODES.UPSIDE_DOWN_CAKE -> // 34
new CorePatchForU().initZygote(startupParam);
Expand All @@ -50,7 +50,7 @@ public void initZygote(StartupParam startupParam) throws Throwable {
new CorePatchForS().initZygote(startupParam);
case Build.VERSION_CODES.R -> // 30
new CorePatchForR().initZygote(startupParam);
default -> XposedLogUtils.logW(TAG, "Unsupported Version of Android " + Build.VERSION.SDK_INT);
default -> XposedLogUtils.logW(TAG, "android","Unsupported Version of Android " + Build.VERSION.SDK_INT);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.sevtinge.hyperceiler.utils.PrefsMap;
import com.sevtinge.hyperceiler.utils.ResourcesHook;
import com.sevtinge.hyperceiler.utils.log.XposedLogUtils;
import com.sevtinge.hyperceiler.utils.log.XposedLogUtils.*;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
Expand Down Expand Up @@ -36,10 +35,10 @@ public void onCreate(LoadPackageParam lpparam) {
setLoadPackageParam(lpparam);
init();
if (detailLog && isNotReleaseVersion) {
XposedLogUtils.logI(TAG, "Hook Success.");
XposedLogUtils.logI(TAG, lpparam.packageName, "Hook Success.");
}
} catch (Throwable t) {
XposedLogUtils.logE(TAG, "Hook Failed", t);
XposedLogUtils.logE(TAG, lpparam.packageName, "Hook Failed", t);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ object DebugMode : BaseHook() {
}.forEach {
val debugMode = it.getMethodInstance(lpparam.classLoader)
if (debugMode.toString().contains("getDebugMode")) {
XposedLogUtils.logI("DebugMode method is $debugMode")
XposedLogUtils.logI(TAG, this.lpparam.packageName, "DebugMode method is $debugMode")
found = true
XposedBridge.hookMethod(
debugMode,
Expand All @@ -87,7 +87,7 @@ object DebugMode : BaseHook() {
}.forEach {
val debugMode1 = it.getMethodInstance(safeClassLoader)
if (debugMode1.toString().contains("getDebugMode")) {
XposedLogUtils.logI("DebugMode1 method is $debugMode1")
XposedLogUtils.logI(TAG, this.lpparam.packageName, "DebugMode1 method is $debugMode1")
found = true
XposedBridge.hookMethod(
debugMode1,
Expand All @@ -106,7 +106,7 @@ object DebugMode : BaseHook() {
}.forEach {
val debugMode2 = it.getMethodInstance(lpparam.classLoader)
if (debugMode2.toString().contains("getDebugMode")) {
XposedLogUtils.logI("DebugMode2 method is $debugMode2")
XposedLogUtils.logI(TAG, this.lpparam.packageName, "DebugMode2 method is $debugMode2")
found = true
XposedBridge.hookMethod(
debugMode2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ object EnableLabOptions : BaseHook() {
if (it.args[0] == "camera.lab.options") it.result = true
}
} catch (e: Exception) {
XposedLogUtils.logE(TAG, e)
XposedLogUtils.logE(TAG, this.lpparam.packageName, e)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected void before(MethodHookParam param) {
}
});
} catch (Exception e) {
XposedLogUtils.logI("try to hook CvLensVersion failed!\n" + e);
XposedLogUtils.logE(TAG, this.lpparam.packageName, "try to hook CvLensVersion failed" + e);
throw new RuntimeException(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ protected void before(MethodHookParam param) {
if (appVersionCode <= 130206400) {
param.setResult(true);
} else {
XposedLogUtils.logI("Your clock versionCode is " + appVersionCode);
XposedLogUtils.logI("Please revert to a supported version yourself");
XposedLogUtils.logI(TAG, EnableHourGlass.this.lpparam.packageName, "Your clock versionCode is " + appVersionCode);
XposedLogUtils.logI(TAG, EnableHourGlass.this.lpparam.packageName, "Please revert to a supported version yourself");
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void init() {
XposedHelpers.findAndHookMethod(clazz, "getIntentWithBrowser", String.class, new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
XposedLogUtils.logI("com.miui.contentextension hooked url " + param.args[0].toString());
XposedLogUtils.logI(TAG, UseThirdPartyBrowser.this.lpparam.packageName, "hooked url " + param.args[0].toString());
Uri uri = Uri.parse(param.args[0].toString());
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
Expand All @@ -36,15 +36,15 @@ protected Object replaceHookedMethod(XC_MethodHook.MethodHookParam param) throws
XposedHelpers.findAndHookMethod(clazz, "openGlobalSearch", Context.class, String.class, String.class, new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
XposedLogUtils.logI("com.miui.contentextension hooked all-search on, word is " + param.args[1].toString() + ", from " + param.args[2].toString());
XposedLogUtils.logI(TAG, UseThirdPartyBrowser.this.lpparam.packageName, "hooked all-search on, word is " + param.args[1].toString() + ", from " + param.args[2].toString());
try {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_WEB_SEARCH);
intent.putExtra(SearchManager.QUERY, param.args[1].toString());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
((Context) param.args[0]).startActivity(intent);
} catch (Exception e) {
XposedLogUtils.logE(TAG, e);
XposedLogUtils.logE(TAG, UseThirdPartyBrowser.this.lpparam.packageName, e);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ public class FuckXlDownload extends BaseHook {
@Override
public void init() {
if (!TARGET_PACKAGE.equals(lpparam.packageName)) return;
XposedLogUtils.logI("Target path = " + TARGET_PATH);
XposedLogUtils.logI(TAG, this.lpparam.packageName, "Target path = " + TARGET_PATH);
XposedHelpers.findAndHookMethod(File.class, "mkdirs", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) {
final boolean isXlDownload = ((File) param.thisObject).getAbsoluteFile().equals(TARGET_PATH);
if (isXlDownload) {
XposedLogUtils.logI("blocked");
XposedLogUtils.logI(TAG, FuckXlDownload.this.lpparam.packageName, "blocked");
param.setThrowable(new FileNotFoundException("blocked"));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class DisableUploadAppList extends BaseHook {
@Override
public void init(/*final XC_LoadPackage.LoadPackageParam lpparam*/) {
if (lpparam.packageName.equals("com.miui.guardprovider")) {
XposedLogUtils.logI("Start to hook package " + lpparam.packageName);
XposedLogUtils.logI(TAG, this.lpparam.packageName, "Start to hook package " + lpparam.packageName);

// Debug mode flag process
final Class<?> guardApplication = XposedHelpers.findClass("com.miui.guardprovider.GuardApplication", lpparam.classLoader);
Expand All @@ -28,21 +28,21 @@ public void init(/*final XC_LoadPackage.LoadPackageParam lpparam*/) {
for (Field field : guardApplicationFields) {
if (field.getName().equals("c")) {
XposedHelpers.setStaticBooleanField(guardApplication, "c", true);
XposedLogUtils.logI("Info: GuardProvider will work as debug mode!");
XposedLogUtils.logI(TAG, this.lpparam.packageName, "GuardProvider will work as debug mode!");
}
XposedLogUtils.logI("Warning: GuardProvider debug mode flag not found!");
XposedLogUtils.logW(TAG, this.lpparam.packageName, "GuardProvider debug mode flag not found!");
}
} else {
XposedLogUtils.logI("Warning: GuardApplication class not found. GuardProvider will not work as debug mode! ");
XposedLogUtils.logW(TAG, this.lpparam.packageName, "GuardApplication class not found. GuardProvider will not work as debug mode! ");
}

// Prevent miui from uploading app list
final Class<?> antiDefraudAppManager = XposedHelpers.findClassIfExists("com.miui.guardprovider.engine.mi.antidefraud.AntiDefraudAppManager", lpparam.classLoader);
if (antiDefraudAppManager == null) {
XposedLogUtils.logI("Skip: AntiDefraudAppManager class not found.");
XposedLogUtils.logI(TAG, this.lpparam.packageName, "Skip: AntiDefraudAppManager class not found.");
return;
} else {
XposedLogUtils.logI("Info: AntiDefraudAppManager class found.");
XposedLogUtils.logI(TAG, this.lpparam.packageName, "AntiDefraudAppManager class found.");
}

final Method[] methods = antiDefraudAppManager.getDeclaredMethods();
Expand All @@ -54,10 +54,10 @@ public void init(/*final XC_LoadPackage.LoadPackageParam lpparam*/) {
}
}
if (getAllUnSystemAppsStatus == null) {
XposedLogUtils.logI("Skip: getAllUnSystemAppsStatus method not found.");
XposedLogUtils.logI(TAG, this.lpparam.packageName, "Skip: getAllUnSystemAppsStatus method not found.");
return;
} else {
XposedLogUtils.logI("Info: getAllUnSystemAppsStatus method found.");
XposedLogUtils.logI(TAG, this.lpparam.packageName, "getAllUnSystemAppsStatus method found.");
}

XposedBridge.hookMethod(getAllUnSystemAppsStatus, new XC_MethodHook() {
Expand All @@ -73,7 +73,7 @@ protected void beforeHookedMethod(MethodHookParam methodHookParam) throws Throwa
}
}
if (MIUI_VERSION == null) {
XposedLogUtils.logI("Warning: Can't get MIUI_VERSION.");
XposedLogUtils.logW(TAG, DisableUploadAppList.this.lpparam.packageName, "Can't get MIUI_VERSION.");
}

String uuid = null;
Expand All @@ -91,10 +91,10 @@ protected void beforeHookedMethod(MethodHookParam methodHookParam) throws Throwa
getUUID.setAccessible(true);
uuid = (String) getUUID.invoke(methodHookParam);
} else {
XposedLogUtils.logI("Warning: getUUID method not found.");
XposedLogUtils.logW(TAG, DisableUploadAppList.this.lpparam.packageName, "getUUID method not found.");
}
} else {
XposedLogUtils.logI("Warning: uuidHelper class not found.");
XposedLogUtils.logW(TAG, DisableUploadAppList.this.lpparam.packageName, "uuidHelper class not found.");
}

JSONObject jSONObject = new JSONObject();
Expand Down Expand Up @@ -137,7 +137,7 @@ protected void beforeHookedMethod(MethodHookParam methodHookParam) throws Throwa
}
jSONObject.put("content", jSONArray);

XposedLogUtils.logI("Info: Intercept=" + jSONObject.toString());
XposedLogUtils.logI(TAG, DisableUploadAppList.this.lpparam.packageName, "Info: Intercept=" + jSONObject.toString());

methodHookParam.setResult(null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,6 @@ protected void before(final MethodHookParam param) {
param.setResult(false);
}
})) if (lpparam.packageName.equals("com.miui.home"))
XposedLogUtils.logI(TAG, "Cannot disable swipe up search");
XposedLogUtils.logI(TAG, this.lpparam.packageName, "Cannot disable swipe up search");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private void showSeekBar(View workspace) {
boolean isInEditingMode = (boolean) XposedHelpers.callMethod(workspace, "isInNormalEditingMode");
View mScreenSeekBar = (View) XposedHelpers.getObjectField(workspace, "mScreenSeekBar");
if (mScreenSeekBar == null) {
XposedLogUtils.logI("showSeekBar", "HideSeekPointsHook Cannot find seekbar");
XposedLogUtils.logI(TAG, this.lpparam.packageName, "showSeekBar HideSeekPointsHook Cannot find seekbar");
return;
}
Context mContext = workspace.getContext();
Expand All @@ -72,7 +72,7 @@ public void run() {
XposedHelpers.setAdditionalInstanceField(workspace, "mHandlerEx", mHandler);
}
if (mHandler == null) {
XposedLogUtils.logI("showSeekBar", "HideSeekPointsHook Cannot create handler");
XposedLogUtils.logI(TAG, this.lpparam.packageName, "showSeekBar HideSeekPointsHook Cannot create handler");
return;
}
if (mHandler.hasMessages(666)) mHandler.removeMessages(666);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void onReceive(Context context, Intent intent) {
XposedHelpers.callMethod(param.thisObject, "dismissRecentsToLaunchTargetTaskOrHome", pkgName, true);
}
} catch (Throwable t) {
XposedLogUtils.logW(TAG, t);
XposedLogUtils.logW(TAG, StickyFloatingWindowsForHome.this.lpparam.packageName, t);
}
}
}, new IntentFilter(ACTION_PREFIX + "dismissRecentsWhenFreeWindowOpen"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void init() {
protected void before(MethodHookParam param) throws Throwable {

mRealPvChildCount = (int) XposedHelpers.callMethod(param.thisObject, "getMRealPvChildCount");
XposedLogUtils.logI(TAG, "getMRealPvChildCount1:" + mRealPvChildCount);
XposedLogUtils.logI(TAG, BigFolderItemMaxCount.this.lpparam.packageName, "getMRealPvChildCount1:" + mRealPvChildCount);

if (mRealPvChildCount < 10) {
XposedHelpers.callMethod(param.thisObject, "setMItemsMaxCount", 9);
Expand All @@ -43,7 +43,7 @@ protected void before(MethodHookParam param) throws Throwable {
protected void before(MethodHookParam param) throws Throwable {

mRealPvChildCount = (int) XposedHelpers.callMethod(param.thisObject, "getMRealPvChildCount");
XposedLogUtils.logI(TAG, "getMRealPvChildCount1:" + mRealPvChildCount);
XposedLogUtils.logI(TAG, BigFolderItemMaxCount.this.lpparam.packageName, "getMRealPvChildCount1:" + mRealPvChildCount);

if (mRealPvChildCount < 5) {
XposedHelpers.callMethod(param.thisObject, "setMItemsMaxCount", 4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ object FolderBlur : BaseHook() {
it.result = null
}
} catch (e: Exception) {
XposedLogUtils.logE(TAG, e)
XposedLogUtils.logE(TAG, this.lpparam.packageName, e)
}
var isShouldBlur = false

Expand Down
Loading

0 comments on commit fe837fd

Please sign in to comment.