From c0b9ad77be1e79c8958fc21bbb31e291b68593f5 Mon Sep 17 00:00:00 2001 From: Colin Lee Date: Tue, 17 Dec 2019 10:41:54 -0600 Subject: [PATCH] For #4064: Update R8/ProGuard config for new Kotlin coroutines library (#7218) --- app/proguard-rules.pro | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 5131ad636..77510c5ba 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -33,14 +33,17 @@ #################################################################################################### # Force removal of slow Dispatchers.Main ServiceLoader -# -# Please remove these rules when Android Gradle Plugin 3.6+ & coroutines 1.3.0+ are both in use #################################################################################################### -# Ensure the custom, fast service loader implementation is removed. --assumevalues class kotlinx.coroutines.internal.MainDispatcherLoader { - boolean FAST_SERVICE_LOADER_ENABLED return false; +# Allow R8 to optimize away the FastServiceLoader. +# Together with ServiceLoader optimization in R8 +# this results in direct instantiation when loading Dispatchers.Main +-assumenosideeffects class kotlinx.coroutines.internal.MainDispatcherLoader { + boolean FAST_SERVICE_LOADER_ENABLED return false; +} + +-assumenosideeffects class kotlinx.coroutines.internal.FastServiceLoader { + boolean ANDROID_DETECTED return true; } --checkdiscard class kotlinx.coroutines.internal.FastServiceLoader #################################################################################################### # Mozilla Application Services