21
21
import androidx .annotation .VisibleForTesting ;
22
22
import com .google .android .gms .tasks .Continuation ;
23
23
import com .google .android .gms .tasks .Task ;
24
- import com .google .android .gms .tasks .Tasks ;
25
24
import com .google .firebase .FirebaseApp ;
26
25
import com .google .firebase .analytics .connector .AnalyticsConnector ;
26
+ import com .google .firebase .annotations .concurrent .Background ;
27
+ import com .google .firebase .annotations .concurrent .Blocking ;
27
28
import com .google .firebase .crashlytics .internal .CrashlyticsNativeComponent ;
28
29
import com .google .firebase .crashlytics .internal .CrashlyticsNativeComponentDeferredProxy ;
29
30
import com .google .firebase .crashlytics .internal .DevelopmentPlatformProvider ;
45
46
import com .google .firebase .remoteconfig .interop .FirebaseRemoteConfigInterop ;
46
47
import com .google .firebase .sessions .api .FirebaseSessionsDependencies ;
47
48
import java .util .List ;
48
- import java .util .concurrent .Callable ;
49
+ import java .util .concurrent .Executor ;
49
50
import java .util .concurrent .ExecutorService ;
50
51
51
52
/**
@@ -68,7 +69,9 @@ public class FirebaseCrashlytics {
68
69
@ NonNull FirebaseInstallationsApi firebaseInstallationsApi ,
69
70
@ NonNull Deferred <CrashlyticsNativeComponent > nativeComponent ,
70
71
@ NonNull Deferred <AnalyticsConnector > analyticsConnector ,
71
- @ NonNull Deferred <FirebaseRemoteConfigInterop > remoteConfigInteropDeferred ) {
72
+ @ NonNull Deferred <FirebaseRemoteConfigInterop > remoteConfigInteropDeferred ,
73
+ @ Background ExecutorService backgroundExecutorService ,
74
+ @ Blocking ExecutorService blockingExecutorService ) {
72
75
73
76
Context context = app .getApplicationContext ();
74
77
final String appIdentifier = context .getPackageName ();
@@ -147,8 +150,8 @@ public class FirebaseCrashlytics {
147
150
148
151
Logger .getLogger ().v ("Installer package name is: " + appData .installerPackageName );
149
152
150
- final ExecutorService threadPoolExecutor =
151
- ExecutorUtils .buildSingleThreadExecutorService ( "com.google.firebase.crashlytics.startup" );
153
+ final Executor threadPoolExecutor =
154
+ ExecutorUtils .buildSequentialExecutor ( backgroundExecutorService );
152
155
153
156
final SettingsController settingsController =
154
157
SettingsController .create (
@@ -178,17 +181,9 @@ public Object then(@NonNull Task<Void> task) throws Exception {
178
181
179
182
final boolean finishCoreInBackground = core .onPreExecute (appData , settingsController );
180
183
181
- Tasks .call (
182
- threadPoolExecutor ,
183
- new Callable <Void >() {
184
- @ Override
185
- public Void call () throws Exception {
186
- if (finishCoreInBackground ) {
187
- core .doBackgroundInitializationAsync (settingsController );
188
- }
189
- return null ;
190
- }
191
- });
184
+ if (finishCoreInBackground ) {
185
+ core .doBackgroundInitializationAsync (settingsController );
186
+ }
192
187
193
188
return new FirebaseCrashlytics (core );
194
189
}
0 commit comments