Skip to content

Commit ffea280

Browse files
committed
Unify native logging styles of LOGD and LOGV
We now only include source file name and line number for LOGD. Moreover, we remove some debugging logs, which contain a typo `creat`.
1 parent 4b8f069 commit ffea280

4 files changed

Lines changed: 14 additions & 15 deletions

File tree

daemon/src/main/jni/logging.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@
3636
#define LOGE(...) 0
3737
#else
3838
#ifndef NDEBUG
39-
#define LOGD(fmt, ...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, "%s:%d#%s" ": " fmt, __FILE_NAME__, __LINE__, __PRETTY_FUNCTION__ __VA_OPT__(,) __VA_ARGS__)
40-
#define LOGV(fmt, ...) __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "%s:%d#%s" ": " fmt, __FILE_NAME__, __LINE__, __PRETTY_FUNCTION__ __VA_OPT__(,) __VA_ARGS__)
39+
#define LOGD(fmt, ...) \
40+
__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, \
41+
"%s:%d#%s" \
42+
": " fmt, \
43+
__FILE_NAME__, __LINE__, __PRETTY_FUNCTION__ __VA_OPT__(, ) __VA_ARGS__)
44+
#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__)
4145
#else
4246
#define LOGD(...) 0
4347
#define LOGV(...) 0

dex2oat/src/main/cpp/include/logging.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
#define LOGE(...) 0
1616
#else
1717
#ifndef NDEBUG
18-
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
19-
#define LOGV(fmt, ...) \
20-
__android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, \
18+
#define LOGD(fmt, ...) \
19+
__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, \
2120
"%s:%d#%s" \
2221
": " fmt, \
2322
__FILE_NAME__, __LINE__, __PRETTY_FUNCTION__ __VA_OPT__(, ) __VA_ARGS__)
23+
#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__)
2424
#else
2525
#define LOGD(...) 0
2626
#define LOGV(...) 0

native/include/common/logging.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,13 @@ inline void LogToAndroid(int prio, const char *tag, fmt::format_string<T...> fmt
7777
} // namespace vector::native::detail
7878

7979
#ifndef NDEBUG
80-
#define LOGV(fmt, ...) \
81-
::vector::native::detail::LogToAndroid(ANDROID_LOG_VERBOSE, LOG_TAG, "{}:{} ({}): " fmt, \
82-
__FILE_NAME__, __LINE__, \
83-
__PRETTY_FUNCTION__ __VA_OPT__(, ) __VA_ARGS__)
8480
#define LOGD(fmt, ...) \
8581
::vector::native::detail::LogToAndroid(ANDROID_LOG_DEBUG, LOG_TAG, "{}:{} ({}): " fmt, \
8682
__FILE_NAME__, __LINE__, \
8783
__PRETTY_FUNCTION__ __VA_OPT__(, ) __VA_ARGS__)
84+
#define LOGV(fmt, ...) \
85+
::vector::native::detail::LogToAndroid(ANDROID_LOG_VERBOSE, LOG_TAG, \
86+
fmt __VA_OPT__(, ) __VA_ARGS__)
8887
#else
8988
#define LOGV(...) ((void)0)
9089
#define LOGD(...) ((void)0)

zygisk/src/main/kotlin/org/matrix/vector/ParasiticManagerSystemHooker.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,12 @@ class ParasiticManagerSystemHooker : HandleSystemServerProcessHooker.Callback {
6464

6565
// Hook the resolution method to inject our redirection logic
6666
VectorHookBuilder(resolveMethod).intercept { chain ->
67-
Utils.logD("inside resolveMethod, calling proceed")
68-
// 1. Execute the original resolution first
67+
// Execute the original resolution first
6968
val result = chain.proceed()
7069

7170
val intent = chain.args[0] as? Intent ?: return@intercept result
72-
Utils.logD("proceed called, intent ${intent}")
7371

74-
// Check if this intent is meant for the LSPosed Manager
72+
// Check if this intent is meant for the Vector Manager
7573
if (!intent.hasCategory(BuildConfig.ManagerPackageName + ".LAUNCH_MANAGER"))
7674
return@intercept result
7775

@@ -88,7 +86,6 @@ class ParasiticManagerSystemHooker : HandleSystemServerProcessHooker.Callback {
8886
if (originalActivityInfo.packageName != BuildConfig.InjectedPackageName)
8987
return@intercept result
9088

91-
Utils.logD("creat redirectedInfo")
9289
// --- Redirection Logic ---
9390
// We create a copy of the ActivityInfo to avoid polluting the system's cache.
9491
val redirectedInfo =
@@ -110,7 +107,6 @@ class ParasiticManagerSystemHooker : HandleSystemServerProcessHooker.Callback {
110107
// Notify the bridge service that we are about to start the manager
111108
BridgeService.getService()?.preStartManager()
112109

113-
Utils.logD("returning redirectedInfo ${redirectedInfo}")
114110
redirectedInfo
115111
}
116112

0 commit comments

Comments
 (0)