mirror of
https://github.com/awfixers-stuff/OwnDroid.git
synced 2026-03-23 11:05:59 +00:00
Refactor network logging
This commit is contained in:
@@ -1753,6 +1753,28 @@ class MyViewModel(application: Application): AndroidViewModel(application) {
|
||||
fun removeApnConfig(id: Int): Boolean {
|
||||
return DPM.removeOverrideApn(DAR, id)
|
||||
}
|
||||
@RequiresApi(26)
|
||||
fun getNetworkLoggingEnabled(): Boolean {
|
||||
return DPM.isNetworkLoggingEnabled(DAR)
|
||||
}
|
||||
@RequiresApi(26)
|
||||
fun setNetworkLoggingEnabled(enabled: Boolean) {
|
||||
DPM.setNetworkLoggingEnabled(DAR, enabled)
|
||||
}
|
||||
fun getNetworkLogsCount(): Int {
|
||||
return myRepo.getNetworkLogsCount().toInt()
|
||||
}
|
||||
fun exportNetworkLogs(uri: Uri, callback: () -> Unit) {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
application.contentResolver.openOutputStream(uri)?.use {
|
||||
myRepo.exportNetworkLogs(it)
|
||||
}
|
||||
withContext(Dispatchers.Main) { callback() }
|
||||
}
|
||||
}
|
||||
fun deleteNetworkLogs() {
|
||||
myRepo.deleteNetworkLogs()
|
||||
}
|
||||
|
||||
@RequiresApi(29)
|
||||
fun getPasswordComplexity(): PasswordComplexity {
|
||||
|
||||
Reference in New Issue
Block a user