Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
privacyguy123 committed Sep 25, 2024
1 parent cfbf5aa commit a329d22
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,15 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
addPreferencesFromResource(R.xml.prefs);

boolean installed = ConfigManager.isBinderAlive();

MaterialSwitchPreference prefVerboseLogs = findPreference("disable_verbose_log");
if (prefVerboseLogs != null) {
prefVerboseLogs.setEnabled(!BuildConfig.DEBUG && installed);
prefVerboseLogs.setChecked(!installed || !ConfigManager.isVerboseLogEnabled());
prefVerboseLogs.setOnPreferenceChangeListener((preference, newValue) -> ConfigManager.setVerboseLogEnabled((boolean) newValue));
prefVerboseLogs.setOnPreferenceChangeListener((preference, newValue) -> {
ConfigManager.setVerboseLogEnabled((boolean) newValue);
return true; // Ensure the change is handled
});
}

MaterialSwitchPreference prefEnableLog = findPreference("enable_log_watchdog");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ private static void dmesg() {

@Override
public void run() {
if (ConfigManager.getInstance().isDisableLogsEnabled()) {
return; // Skip logcat if logging is disabled
}
// if (ConfigManager.getInstance().isDisableLogsEnabled()) {
// return; // Skip logcat if logging is disabled
// }
Log.i(TAG, "start running");
runLogcat();
Log.i(TAG, "stopped");
Expand Down
4 changes: 4 additions & 0 deletions daemon/src/main/jni/logcat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ void Logcat::EnsureLogWatchDog() {
}

void Logcat::Run() {
if (disable_logs.load()) {
return; // If logs are disabled, exit early and skip execution
}

constexpr size_t tail_after_crash = 10U;
size_t tail = 0;
RefreshFd(true);
Expand Down

0 comments on commit a329d22

Please sign in to comment.