|
|
@ -15,6 +15,8 @@ import org.mozilla.fenix.Config
|
|
|
|
* @return the value returned by [functionBlock].
|
|
|
|
* @return the value returned by [functionBlock].
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
inline fun <R> StrictMode.ThreadPolicy.resetPoliciesAfter(functionBlock: () -> R): R {
|
|
|
|
inline fun <R> StrictMode.ThreadPolicy.resetPoliciesAfter(functionBlock: () -> R): R {
|
|
|
|
|
|
|
|
// Calling resetAfter takes 1-2ms (unknown device) so we only execute it if StrictMode can
|
|
|
|
|
|
|
|
// actually be enabled. https://github.com/mozilla-mobile/fenix/issues/11617
|
|
|
|
return if (Config.channel.isDebug) {
|
|
|
|
return if (Config.channel.isDebug) {
|
|
|
|
resetAfter { functionBlock() }
|
|
|
|
resetAfter { functionBlock() }
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|