From 4387353227dc0a3ab7ea6cb648f40dd6381001fa Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Mon, 5 Oct 2020 11:05:09 -0300 Subject: [PATCH] Enable StrictMode for userdebug builds --- .../main/java/com/stevesoltys/seedvault/App.kt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/src/main/java/com/stevesoltys/seedvault/App.kt b/app/src/main/java/com/stevesoltys/seedvault/App.kt index 47a279a1..d369d523 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/App.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/App.kt @@ -6,6 +6,7 @@ import android.app.backup.IBackupManager import android.content.Context.BACKUP_SERVICE import android.os.Build import android.os.ServiceManager.getService +import android.os.StrictMode import com.stevesoltys.seedvault.crypto.cryptoModule import com.stevesoltys.seedvault.header.headerModule import com.stevesoltys.seedvault.metadata.MetadataManager @@ -63,6 +64,21 @@ class App : Application() { ) ) } + if (isDebugBuild()) { + StrictMode.setThreadPolicy( + StrictMode.ThreadPolicy.Builder() + .detectAll() + .penaltyLog() + .penaltyFlashScreen() + .build() + ) + StrictMode.setVmPolicy( + StrictMode.VmPolicy.Builder() + .detectAll() + .penaltyLog() + .build() + ) + } migrateTokenFromMetadataToSettingsManager() }