Skip to content

Commit

Permalink
Verbose
Browse files Browse the repository at this point in the history
Verbose 2

Verbose 3

Verbose wtf

Verbose 4
  • Loading branch information
privacyguy123 committed Sep 25, 2024
1 parent 5735796 commit 72fca1e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public class LogcatService implements Runnable {

private native void enableLogsNative();
private native void disableLogsNative();
private native void enableVerboseLogsNative();
private native void disableVerboseLogsNative();

static class LogLRU extends LinkedHashMap<File, Object> {
private static final int MAX_ENTRIES = 10;
Expand Down Expand Up @@ -179,10 +181,12 @@ public void start() {

public void startVerbose() {
Log.i(TAG, "!!start_verbose!!");
enableVerboseLogsNative();
}

public void stopVerbose() {
Log.i(TAG, "!!stop_verbose!!");
disableVerboseLogsNative();
}

public void enableWatchdog() {
Expand Down
15 changes: 14 additions & 1 deletion daemon/src/main/jni/logcat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ constexpr size_t kMaxLogSize = 4 * 1024 * 1024;
constexpr size_t kLogBufferSize = 64 * 1024;

std::atomic<bool> disable_logs = std::atomic<bool>(false);
std::atomic<bool> verbose_ = std::atomic<bool>(false);

namespace {
constexpr std::array<char, ANDROID_LOG_SILENT + 1> kLogChar = {
Expand Down Expand Up @@ -131,7 +132,7 @@ class Logcat {

pid_t my_pid_ = getpid();

bool verbose_ = true;
// bool verbose_ = false;
std::atomic<bool> enable_watchdog = std::atomic<bool>(false);
};

Expand Down Expand Up @@ -345,6 +346,18 @@ Java_org_lsposed_lspd_service_LogcatService_runLogcat(JNIEnv *env, jobject thiz)
logcat.Run();
}

extern "C"
JNIEXPORT void JNICALL
Java_org_lsposed_lspd_service_LogcatService_enableVerboseLogsNative(JNIEnv *env, jobject thiz) {
verbose_.store(true); // Enable logs
}

extern "C"
JNIEXPORT void JNICALL
Java_org_lsposed_lspd_service_LogcatService_disableVerboseLogsNative(JNIEnv *env, jobject thiz) {
verbose_.store(false); // Disable logs
}

extern "C"
JNIEXPORT void JNICALL
Java_org_lsposed_lspd_service_LogcatService_enableLogsNative(JNIEnv *env, jobject thiz) {
Expand Down

0 comments on commit 72fca1e

Please sign in to comment.