summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2021-04-21 13:36:47 +0530
committerGitHub <noreply@github.com>2021-04-21 08:06:47 +0000
commit53c3431ef0d1d5cacadf2ae0d540a6b8189029d4 (patch)
treef67d4dd5d98e3871a391b3eeaa1e7178228b485a /app
parent213778122c76e8ed3ff2ba57edfbc1ba6e11ab0a (diff)
Enable StrictMode in debug logging builds (#1391)
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/Application.kt5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/src/main/java/dev/msfjarvis/aps/Application.kt b/app/src/main/java/dev/msfjarvis/aps/Application.kt
index 013b6b21..8194019c 100644
--- a/app/src/main/java/dev/msfjarvis/aps/Application.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/Application.kt
@@ -5,6 +5,9 @@
package dev.msfjarvis.aps
import android.content.SharedPreferences
+import android.os.StrictMode
+import android.os.StrictMode.ThreadPolicy
+import android.os.StrictMode.VmPolicy
import androidx.appcompat.app.AppCompatDelegate
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
@@ -31,6 +34,8 @@ class Application : android.app.Application(), SharedPreferences.OnSharedPrefere
instance = this
if (BuildConfig.ENABLE_DEBUG_FEATURES || prefs.getBoolean(PreferenceKeys.ENABLE_DEBUG_LOGGING, false)) {
plant(DebugTree())
+ StrictMode.setVmPolicy(VmPolicy.Builder().detectAll().penaltyLog().build())
+ StrictMode.setThreadPolicy(ThreadPolicy.Builder().detectAll().penaltyLog().build())
}
prefs.registerOnSharedPreferenceChangeListener(this)
setNightMode()