Remove CellServiceConstraint in favor of NetworkOrCellServiceConstraint.

If a job was enqueued with a CellServiceConstraint (which is currently
only SMS jobs), then it'll never run until it gets service, even if you
flip the "enable SMS sending over wifi" toggle.

This has created bad situations in the past, where SMS jobs just get
stuck on devices that never report having cell service (like VM's or
wifi only devices).

This fixes it by *always* using NetworkOrCellServiceConstraint, and then
deciding whether a constraint is met by checking the "wifi SMS" setting
at decision-time.
This commit is contained in:
Greyson Parrelli
2020-05-01 12:44:53 -04:00
parent 0c2afa9438
commit 310ec8f296
7 changed files with 32 additions and 78 deletions

View File

@@ -380,7 +380,7 @@ public class MessageSender {
} else if (!forceSms && isPushTextSend(context, recipient, keyExchange)) {
sendTextPush(recipient, messageId);
} else {
sendSms(context, recipient, messageId);
sendSms(recipient, messageId);
}
}
@@ -411,9 +411,9 @@ public class MessageSender {
}
}
private static void sendSms(Context context, Recipient recipient, long messageId) {
private static void sendSms(Recipient recipient, long messageId) {
JobManager jobManager = ApplicationDependencies.getJobManager();
jobManager.add(new SmsSendJob(context, messageId, recipient));
jobManager.add(new SmsSendJob(messageId, recipient));
}
private static void sendMms(Context context, long messageId) {