diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/CoronaWarnApplication.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/CoronaWarnApplication.kt index df08fb1f66612dcac7a871d222e95d8fc4012678..922c0ab30e5db8e345fe228a722d3b54ff73a9af 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/CoronaWarnApplication.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/CoronaWarnApplication.kt @@ -5,6 +5,7 @@ import android.app.Application import android.content.Context import android.content.IntentFilter import android.os.Bundle +import android.view.WindowManager import androidx.localbroadcastmanager.content.LocalBroadcastManager import androidx.work.Configuration import androidx.work.WorkManager @@ -82,10 +83,11 @@ class CoronaWarnApplication : Application(), HasAndroidInjector { localBM.unregisterReceiver(it) errorReceiver = null } + disableAppLauncherPreviewAndScreenshots(activity) } override fun onActivityStarted(activity: Activity) { - // NOOP + enableAppLauncherPreviewAndScreenshots(activity) } override fun onActivityDestroyed(activity: Activity) { @@ -97,7 +99,7 @@ class CoronaWarnApplication : Application(), HasAndroidInjector { } override fun onActivityStopped(activity: Activity) { - // NOOP + disableAppLauncherPreviewAndScreenshots(activity) } override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) { @@ -113,9 +115,18 @@ class CoronaWarnApplication : Application(), HasAndroidInjector { errorReceiver = ErrorReportReceiver(activity).also { localBM.registerReceiver(it, IntentFilter(ERROR_REPORT_LOCAL_BROADCAST_CHANNEL)) } + enableAppLauncherPreviewAndScreenshots(activity) } } + private fun enableAppLauncherPreviewAndScreenshots(activity: Activity) { + activity.window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE) + } + + private fun disableAppLauncherPreviewAndScreenshots(activity: Activity) { + activity.window.addFlags(WindowManager.LayoutParams.FLAG_SECURE) + } + companion object { private lateinit var instance: CoronaWarnApplication