Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
Avoid running scheduled FcmJobService when app is locked
Browse files Browse the repository at this point in the history
  • Loading branch information
valldrac committed Sep 20, 2024
1 parent c5034db commit fb29780
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

import org.signal.core.util.concurrent.SignalExecutors;
import org.signal.core.util.logging.Log;
import org.thoughtcrime.securesms.dependencies.AppDependencies;
import org.thoughtcrime.securesms.messages.WebSocketDrainer;
import org.thoughtcrime.securesms.service.KeyCachingService;
import org.thoughtcrime.securesms.util.AppForegroundObserver;
import org.thoughtcrime.securesms.util.ServiceUtil;

Expand Down Expand Up @@ -40,8 +40,8 @@ public static void schedule(@NonNull Context context) {
public boolean onStartJob(JobParameters params) {
Log.d(TAG, "onStartJob()");

if (AppForegroundObserver.isForegrounded()) {
Log.i(TAG, "App is foregrounded. No need to run.");
if (KeyCachingService.isLocked() || AppForegroundObserver.isForegrounded()) {
Log.i(TAG, "App is locked or foregrounded. No need to run.");
return false;
}

Expand Down

0 comments on commit fb29780

Please sign in to comment.