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:
parent
b2c01e442f
commit
c1aa8d396a
@ -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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user