From 1ec45f33a20a751dfb0c586b4a5130c8a7d3ab0b Mon Sep 17 00:00:00 2001 From: Michael Comella Date: Tue, 22 Sep 2020 14:52:31 -0700 Subject: [PATCH] [fenix] For https://github.com/mozilla-mobile/fenix/issues/13959: remove unused penaltyDialog parameter. Additional branching introduces complexity so we should avoid it when possible. This branch was also unused so it's more likely to have bugs if we tried to use it after some refactor. --- .../main/java/org/mozilla/fenix/StrictModeManager.kt | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/StrictModeManager.kt b/app/src/main/java/org/mozilla/fenix/StrictModeManager.kt index a9e6947fff..e0dd864ad9 100644 --- a/app/src/main/java/org/mozilla/fenix/StrictModeManager.kt +++ b/app/src/main/java/org/mozilla/fenix/StrictModeManager.kt @@ -17,10 +17,8 @@ object StrictModeManager { /*** * Enables strict mode for debug purposes. meant to be run only in the main process. * @param setPenaltyDeath boolean value to decide setting the penaltyDeath as a penalty. - * @param setPenaltyDialog boolean value to decide setting the dialog box as a penalty. - * Note: dialog penalty cannot be set with penaltyDeath */ - fun enableStrictMode(setPenaltyDeath: Boolean, setPenaltyDialog: Boolean = false) { + fun enableStrictMode(setPenaltyDeath: Boolean) { if (Config.channel.isDebug) { val threadPolicy = StrictMode.ThreadPolicy.Builder() .detectAll() @@ -28,12 +26,6 @@ object StrictModeManager { if (setPenaltyDeath && Build.MANUFACTURER !in strictModeExceptionList) { threadPolicy.penaltyDeath() } - - // dialog penalty cannot be set with penaltyDeath - if (!setPenaltyDeath && setPenaltyDialog) { - threadPolicy.penaltyDialog() - } - StrictMode.setThreadPolicy(threadPolicy.build()) val builder = StrictMode.VmPolicy.Builder() @@ -62,7 +54,7 @@ object StrictModeManager { fragmentManager.registerFragmentLifecycleCallbacks(object : FragmentManager.FragmentLifecycleCallbacks() { override fun onFragmentResumed(fm: FragmentManager, f: Fragment) { - enableStrictMode(setPenaltyDeath = false, setPenaltyDialog = false) + enableStrictMode(setPenaltyDeath = false) fm.unregisterFragmentLifecycleCallbacks(this) } }, false)