-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Record debug logs without foreground service
Some overhaul of log recording to get rid of the `FOREGROUND_SERVICE_SPECIAL_USE` which is a headache with Google
- Loading branch information
Showing
44 changed files
with
97 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 0 additions & 115 deletions
115
app/src/main/java/eu/darken/capod/common/debug/recording/core/RecorderService.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
app/src/main/java/eu/darken/capod/common/debug/recording/ui/RecorderConsentDialog.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package eu.darken.capod.common.debug.recording.ui | ||
|
||
import android.content.Context | ||
import com.google.android.material.dialog.MaterialAlertDialogBuilder | ||
import eu.darken.capod.R | ||
import eu.darken.capod.common.PrivacyPolicy | ||
import eu.darken.capod.common.WebpageTool | ||
|
||
class RecorderConsentDialog( | ||
private val context: Context, | ||
private val webpageTool: WebpageTool | ||
) { | ||
fun showDialog(onStartRecord: () -> Unit) { | ||
MaterialAlertDialogBuilder(context).apply { | ||
setTitle(R.string.support_debuglog_label) | ||
setMessage(R.string.settings_debuglog_explanation) | ||
setPositiveButton(R.string.debug_debuglog_record_action) { _, _ -> onStartRecord() } | ||
setNegativeButton(R.string.general_cancel_action) { _, _ -> } | ||
setNeutralButton(R.string.settings_privacy_policy_label) { _, _ -> | ||
webpageTool.open(PrivacyPolicy.URL) | ||
} | ||
}.show() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 12 additions & 8 deletions
20
app/src/main/java/eu/darken/capod/main/ui/settings/support/SupportFragmentVM.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,27 @@ | ||
package eu.darken.capod.main.ui.settings.support | ||
|
||
import androidx.lifecycle.SavedStateHandle | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import eu.darken.capod.common.InstallId | ||
import eu.darken.capod.common.coroutine.DispatcherProvider | ||
import eu.darken.capod.common.livedata.SingleLiveEvent | ||
import eu.darken.capod.common.debug.logging.log | ||
import eu.darken.capod.common.debug.recording.core.RecorderModule | ||
import eu.darken.capod.common.uix.ViewModel3 | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class SupportFragmentVM @Inject constructor( | ||
private val handle: SavedStateHandle, | ||
private val dispatcherProvider: DispatcherProvider, | ||
private val installId: InstallId, | ||
private val recorderModule: RecorderModule, | ||
) : ViewModel3(dispatcherProvider) { | ||
|
||
val clipboardEvent = SingleLiveEvent<String>() | ||
val recorderState = recorderModule.state.asLiveData2() | ||
|
||
fun copyInstallID() = launch { | ||
clipboardEvent.postValue(installId.id) | ||
fun startDebugLog() = launch { | ||
log(TAG) { "startDebugLog()" } | ||
recorderModule.startRecorder() | ||
} | ||
|
||
fun stopDebugLog() = launch { | ||
log(TAG) { "stopDebugLog()" } | ||
recorderModule.stopRecorder() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:tint="?attr/colorControlNormal" | ||
android:viewportWidth="24.0" | ||
android:viewportHeight="24.0"> | ||
<path | ||
android:fillColor="@android:color/white" | ||
android:pathData="M12,2C6.47,2 2,6.47 2,12s4.47,10 10,10 10,-4.47 10,-10S17.53,2 12,2zM17,15.59L15.59,17 12,13.41 8.41,17 7,15.59 10.59,12 7,8.41 8.41,7 12,10.59 15.59,7 17,8.41 13.41,12 17,15.59z" /> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.