Skip to content

Commit

Permalink
Disable full logcat logging for non-rooted operation mode.
Browse files Browse the repository at this point in the history
By now, full logcat logging only supports operation modes that are included in our PrivilegedService, which adb isn't one of them.
  • Loading branch information
VegaBobo committed Apr 29, 2023
1 parent 6b4d19f commit 864af35
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import vegabobo.dsusideloader.ui.components.PreferenceItem
import vegabobo.dsusideloader.ui.components.Title
import vegabobo.dsusideloader.ui.components.TopBar
import vegabobo.dsusideloader.ui.screen.Destinations
import vegabobo.dsusideloader.util.OperationMode
import vegabobo.dsusideloader.util.collectAsStateWithLifecycle

@OptIn(ExperimentalMaterial3Api::class)
Expand Down Expand Up @@ -89,13 +90,15 @@ fun Settings(
settingsViewModel.togglePreference(AppPrefs.DISABLE_STORAGE_CHECK, !it)
},
)
PreferenceItem(
title = stringResource(id = R.string.full_logcat_logging_title),
description = stringResource(id = R.string.full_logcat_logging_description),
showToggle = true,
isChecked = uiState.preferences[AppPrefs.FULL_LOGCAT_LOGGING]!!,
onClick = { settingsViewModel.togglePreference(AppPrefs.FULL_LOGCAT_LOGGING, !it) },
)
if (settingsViewModel.getOperationMode() != OperationMode.ADB) {
PreferenceItem(
title = stringResource(id = R.string.full_logcat_logging_title),
description = stringResource(id = R.string.full_logcat_logging_description),
showToggle = true,
isChecked = uiState.preferences[AppPrefs.FULL_LOGCAT_LOGGING]!!,
onClick = { settingsViewModel.togglePreference(AppPrefs.FULL_LOGCAT_LOGGING, !it) },
)
}
}

Title(title = stringResource(id = R.string.other))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import kotlinx.coroutines.launch
import vegabobo.dsusideloader.core.BaseViewModel
import vegabobo.dsusideloader.model.Session
import vegabobo.dsusideloader.preferences.AppPrefs
import vegabobo.dsusideloader.util.OperationMode
import vegabobo.dsusideloader.util.OperationModeUtils

@HiltViewModel
Expand Down Expand Up @@ -71,6 +72,10 @@ class SettingsViewModel @Inject constructor(
return OperationModeUtils.getOperationModeAsString(session.getOperationMode())
}

fun getOperationMode(): OperationMode {
return session.getOperationMode()
}

fun checkDevOpt() {
viewModelScope.launch {
val isDevOptEnabled = readBoolPref(AppPrefs.DEVELOPER_OPTIONS)
Expand Down

0 comments on commit 864af35

Please sign in to comment.