Improve reliability of launching FCM foreground service.

We were getting weird errors around the service not calling
startForeground() that I couldn't reproduce. I figure it must be
something with how we only sometimes start the FcmFetchService in the
foreground. So I think the safest thing to do is to just use
GenericForegroundService.
This commit is contained in:
Greyson Parrelli
2022-04-26 11:22:01 -04:00
committed by GitHub
parent 65372e547a
commit 797c02e893
4 changed files with 38 additions and 30 deletions

View File

@@ -96,6 +96,7 @@ public final class FeatureFlags {
private static final String USE_AEC3 = "android.calling.useAec3";
private static final String PAYMENTS_COUNTRY_BLOCKLIST = "android.payments.blocklist";
private static final String PNP_CDS = "android.pnp.cds";
private static final String USE_FCM_FOREGROUND_SERVICE = "android.useFcmForegroundService";
/**
* We will only store remote values for flags in this set. If you want a flag to be controllable
@@ -143,7 +144,8 @@ public final class FeatureFlags {
SOFTWARE_AEC_BLOCKLIST_MODELS,
USE_HARDWARE_AEC_IF_OLD,
USE_AEC3,
PAYMENTS_COUNTRY_BLOCKLIST
PAYMENTS_COUNTRY_BLOCKLIST,
USE_FCM_FOREGROUND_SERVICE
);
@VisibleForTesting
@@ -203,7 +205,8 @@ public final class FeatureFlags {
SOFTWARE_AEC_BLOCKLIST_MODELS,
USE_HARDWARE_AEC_IF_OLD,
USE_AEC3,
PAYMENTS_COUNTRY_BLOCKLIST
PAYMENTS_COUNTRY_BLOCKLIST,
USE_FCM_FOREGROUND_SERVICE
);
/**
@@ -505,6 +508,10 @@ public final class FeatureFlags {
return Environment.IS_STAGING && getBoolean(PNP_CDS, false);
}
public static boolean useFcmForegroundService() {
return getBoolean(USE_FCM_FOREGROUND_SERVICE, false);
}
/** Only for rendering debug info. */
public static synchronized @NonNull Map<String, Object> getMemoryValues() {
return new TreeMap<>(REMOTE_VALUES);