From 883b5abc7b2a770146683e7e27bf275bd4064511 Mon Sep 17 00:00:00 2001 From: pacien Date: Mon, 20 Jan 2020 17:07:12 +0100 Subject: pass network device fd via unix socket instead of inheritance Workaround for new shared memory restrictions added in Android 10 preventing file descriptor leakage to sub-processes. This change set BREAKS ENCRYPTED PRIVATE KEYS SUPPORT. GitHub: https://github.com/pacien/tincapp/issues/92 --- app/src/main/java/org/pacien/tincapp/context/App.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'app/src/main/java/org/pacien/tincapp/context/App.kt') diff --git a/app/src/main/java/org/pacien/tincapp/context/App.kt b/app/src/main/java/org/pacien/tincapp/context/App.kt index a877929..4d8d5d0 100644 --- a/app/src/main/java/org/pacien/tincapp/context/App.kt +++ b/app/src/main/java/org/pacien/tincapp/context/App.kt @@ -1,6 +1,6 @@ /* * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon - * Copyright (C) 2017-2019 Pacien TRAN-GIRARD + * Copyright (C) 2017-2020 Pacien TRAN-GIRARD * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,6 +21,7 @@ package org.pacien.tincapp.context import android.app.Application import android.content.Context import android.content.Intent +import android.content.pm.ApplicationInfo import android.net.Uri import android.os.Build import android.os.Handler @@ -47,7 +48,7 @@ class App : Application() { private fun setupCrashHandler() { val logger = LoggerFactory.getLogger(this.javaClass) - val systemCrashHandler = Thread.getDefaultUncaughtExceptionHandler() + val systemCrashHandler = Thread.getDefaultUncaughtExceptionHandler()!! val crashRecorder = CrashRecorder(logger, systemCrashHandler) Thread.setDefaultUncaughtExceptionHandler(crashRecorder) } @@ -61,6 +62,11 @@ class App : Application() { fun getContext() = appContext!! fun getResources() = getContext().resources!! + fun getApplicationInfo(): ApplicationInfo = + getContext() + .packageManager + .getApplicationInfo(BuildConfig.APPLICATION_ID, 0) + fun alert(@StringRes title: Int, msg: String, manualLink: String? = null) = notificationManager.notifyError(appContext!!.getString(title), msg, manualLink) -- cgit v1.2.3