summaryrefslogtreecommitdiffhomepage
path: root/android/src
diff options
context:
space:
mode:
Diffstat (limited to 'android/src')
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/MullvadProblemReport.kt16
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt6
2 files changed, 16 insertions, 6 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/MullvadProblemReport.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/MullvadProblemReport.kt
index 40e93ff882..2e8b89642f 100644
--- a/android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/MullvadProblemReport.kt
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/MullvadProblemReport.kt
@@ -7,9 +7,11 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.async
-const val PROBLEM_REPORT_PATH = "/data/data/net.mullvad.mullvadvpn/problem_report.txt"
+const val PROBLEM_REPORT_FILE = "problem_report.txt"
+
+class MullvadProblemReport(val logDirectory: File) {
+ private val problemReportPath = File(logDirectory, PROBLEM_REPORT_FILE)
-class MullvadProblemReport {
private var collectJob: Deferred<Boolean>? = null
private var sendJob: Deferred<Boolean>? = null
@@ -38,7 +40,7 @@ class MullvadProblemReport {
if (!isActive) {
collectJob = GlobalScope.async(Dispatchers.Default) {
deleteReportFile()
- collectReport(PROBLEM_REPORT_PATH)
+ collectReport(problemReportPath.absolutePath)
}
}
}
@@ -51,7 +53,11 @@ class MullvadProblemReport {
if (currentJob == null || currentJob.isCompleted) {
currentJob = GlobalScope.async(Dispatchers.Default) {
val result = (collectJob?.await() ?: false) &&
- sendProblemReport(userEmail, userMessage, PROBLEM_REPORT_PATH)
+ sendProblemReport(
+ userEmail,
+ userMessage,
+ problemReportPath.absolutePath
+ )
if (result) {
deleteReportFile()
@@ -68,7 +74,7 @@ class MullvadProblemReport {
}
fun deleteReportFile() {
- File(PROBLEM_REPORT_PATH).delete()
+ problemReportPath.delete()
}
private external fun collectReport(reportPath: String): Boolean
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt
index 93b85c001b..524d4ab00d 100644
--- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt
@@ -19,9 +19,10 @@ class MainActivity : FragmentActivity() {
val KEY_SHOULD_CONNECT = "should_connect"
}
- val problemReport = MullvadProblemReport()
val serviceNotifier = EventNotifier<ServiceConnection?>(null)
+ lateinit var problemReport: MullvadProblemReport
+
private var service: MullvadVpnService.LocalBinder? = null
private var serviceConnection: ServiceConnection? = null
private var serviceConnectionSubscription: Int? = null
@@ -64,6 +65,9 @@ class MainActivity : FragmentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
+
+ problemReport = MullvadProblemReport(filesDir)
+
setContentView(R.layout.main)
if (savedInstanceState == null) {