2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-19 09:25:34 +00:00

[fenix] For https://github.com/mozilla-mobile/fenix/issues/13959: use ac StrictMode.resetAfter rather than duplicating functionality.

This commit is contained in:
Michael Comella 2020-09-22 15:04:06 -07:00 committed by Michael Comella
parent b2c01e442f
commit c1aa8d396a

View File

@ -5,6 +5,7 @@
package org.mozilla.fenix.ext
import android.os.StrictMode
import mozilla.components.support.ktx.android.os.resetAfter
import org.mozilla.fenix.Config
/**
@ -15,11 +16,7 @@ import org.mozilla.fenix.Config
*/
inline fun <R> StrictMode.ThreadPolicy.resetPoliciesAfter(functionBlock: () -> R): R {
return if (Config.channel.isDebug) {
try {
functionBlock()
} finally {
StrictMode.setThreadPolicy(this)
}
resetAfter { functionBlock() }
} else {
functionBlock()
}