Skip to content

Commit d14b9c5

Browse files
authored
Remove unnecessary -keep rules for services (#3263)
Fixes #3111
1 parent 155868f commit d14b9c5

File tree

6 files changed

+15
-16
lines changed

6 files changed

+15
-16
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# When editing this file, update the following files as well:
2-
# - META-INF/com.android.tools/r8-upto-1.6.0/coroutines.pro
2+
# - META-INF/com.android.tools/r8-upto-3.0.0/coroutines.pro
33
# - META-INF/proguard/coroutines.pro
44

55
-keep class kotlinx.coroutines.android.AndroidDispatcherFactory {*;}
6+
-keep class kotlinx.coroutines.android.AndroidExceptionPreHandler {*;}

ui/kotlinx-coroutines-android/resources/META-INF/com.android.tools/r8-from-1.6.0/coroutines.pro

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
boolean ANDROID_DETECTED return true;
1010
}
1111

12-
-keep class kotlinx.coroutines.android.AndroidDispatcherFactory {*;}
13-
1412
# Disable support for "Missing Main Dispatcher", since we always have Android main dispatcher
1513
-assumenosideeffects class kotlinx.coroutines.internal.MainDispatchersKt {
1614
boolean SUPPORT_MISSING return false;
@@ -21,4 +19,4 @@
2119
boolean getASSERTIONS_ENABLED() return false;
2220
boolean getDEBUG() return false;
2321
boolean getRECOVER_STACK_TRACES() return false;
24-
}
22+
}

ui/kotlinx-coroutines-android/resources/META-INF/com.android.tools/r8-upto-1.6.0/coroutines.pro

-9
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# When editing this file, update the following files as well for AGP 3.6.0+:
2+
# - META-INF/com.android.tools/proguard/coroutines.pro
3+
# - META-INF/proguard/coroutines.pro
4+
5+
# After R8 3.0.0 (or probably sometime before that), R8 learned how to optimize
6+
# classes mentioned in META-INF/services files, and explicitly -keeping them
7+
# disables these optimizations.
8+
# https://github.com/Kotlin/kotlinx.coroutines/issues/3111
9+
-keep class kotlinx.coroutines.android.AndroidDispatcherFactory {*;}
10+
-keep class kotlinx.coroutines.android.AndroidExceptionPreHandler {*;}

ui/kotlinx-coroutines-android/resources/META-INF/proguard/coroutines.pro

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# When editing this file, update the following files as well for AGP 3.6.0+:
44
# - META-INF/com.android.tools/proguard/coroutines.pro
5-
# - META-INF/com.android.tools/r8-upto-1.6.0/coroutines.pro
5+
# - META-INF/com.android.tools/r8-upto-3.0.0/coroutines.pro
66

77
-keep class kotlinx.coroutines.android.AndroidDispatcherFactory {*;}
8+
-keep class kotlinx.coroutines.android.AndroidExceptionPreHandler {*;}

ui/kotlinx-coroutines-android/src/AndroidExceptionPreHandler.kt

-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@
55
package kotlinx.coroutines.android
66

77
import android.os.*
8-
import androidx.annotation.*
98
import kotlinx.coroutines.*
109
import java.lang.reflect.*
1110
import kotlin.coroutines.*
1211

13-
@Keep
1412
internal class AndroidExceptionPreHandler :
1513
AbstractCoroutineContextElement(CoroutineExceptionHandler), CoroutineExceptionHandler
1614
{

0 commit comments

Comments
 (0)