mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-09-01 06:45:19 +00:00
fix(app): control LeakCanary lifecycle more explicitly
This commit is contained in:
@@ -46,15 +46,19 @@ class Application : android.app.Application(), SharedPreferences.OnSharedPrefere
|
|||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
instance = this
|
instance = this
|
||||||
LeakCanary.config =
|
val eventListeners = LeakCanary.config.eventListeners + SentryLeakUploader
|
||||||
LeakCanary.config.copy(eventListeners = LeakCanary.config.eventListeners + SentryLeakUploader)
|
|
||||||
if (
|
if (
|
||||||
BuildConfig.ENABLE_DEBUG_FEATURES ||
|
BuildConfig.ENABLE_DEBUG_FEATURES ||
|
||||||
prefs.getBoolean(PreferenceKeys.ENABLE_DEBUG_LOGGING, false)
|
prefs.getBoolean(PreferenceKeys.ENABLE_DEBUG_LOGGING, false)
|
||||||
) {
|
) {
|
||||||
LogcatLogger.install(AndroidLogcatLogger(DEBUG))
|
LogcatLogger.install(AndroidLogcatLogger(DEBUG))
|
||||||
AppWatcher.manualInstall(this)
|
|
||||||
setVmPolicy()
|
setVmPolicy()
|
||||||
|
LeakCanary.config.copy(dumpHeap = true, eventListeners = eventListeners)
|
||||||
|
LeakCanary.showLeakDisplayActivityLauncherIcon(true)
|
||||||
|
AppWatcher.manualInstall(this)
|
||||||
|
} else {
|
||||||
|
LeakCanary.config.copy(dumpHeap = false, eventListeners = eventListeners)
|
||||||
|
LeakCanary.showLeakDisplayActivityLauncherIcon(false)
|
||||||
}
|
}
|
||||||
prefs.registerOnSharedPreferenceChangeListener(this)
|
prefs.registerOnSharedPreferenceChangeListener(this)
|
||||||
setNightMode()
|
setNightMode()
|
||||||
|
@@ -5,5 +5,6 @@
|
|||||||
|
|
||||||
<resources>
|
<resources>
|
||||||
<bool name="leak_canary_allow_in_non_debuggable_build">true</bool>
|
<bool name="leak_canary_allow_in_non_debuggable_build">true</bool>
|
||||||
|
<bool name="leak_canary_watcher_auto_install">false</bool>
|
||||||
<bool name="light_status_bar">true</bool>
|
<bool name="light_status_bar">true</bool>
|
||||||
</resources>
|
</resources>
|
||||||
|
Reference in New Issue
Block a user