mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
do not start foreground service in foreground
the foreground service was introduced unconditionally in #3312, however turns out to be annoying and flickering if the app is actually in foreground. the service _might_ be needed in this case only if the app is about going to background during fetch, but in this case, we assume, that we have some 10 seconds time still. in any case, this is still an improvement to the released apps, that _never_ show a foreground service.
This commit is contained in:
@@ -13,6 +13,7 @@ import androidx.core.content.ContextCompat;
|
||||
|
||||
import org.thoughtcrime.securesms.ApplicationContext;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.connect.ForegroundDetector;
|
||||
import org.thoughtcrime.securesms.notifications.FcmReceiveService;
|
||||
import org.thoughtcrime.securesms.notifications.NotificationCenter;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
@@ -23,6 +24,11 @@ public final class FetchForegroundService extends Service {
|
||||
private static Intent service;
|
||||
|
||||
public static void start(Context context) {
|
||||
ForegroundDetector foregroundDetector = ForegroundDetector.getInstance();
|
||||
if (foregroundDetector != null && foregroundDetector.isForeground()) {
|
||||
return;
|
||||
}
|
||||
|
||||
GenericForegroundService.createFgNotificationChannel(context);
|
||||
synchronized (SERVICE_LOCK) {
|
||||
if (service == null) {
|
||||
|
||||
Reference in New Issue
Block a user