Use SystemApi to broadcast to background receivers
Bug: 144108192
Test: manually verify that new API call succeeds
Change-Id: I4bcac6e635bd2303bc4f9f82425984fefc85a793
diff --git a/src/com/android/cellbroadcastservice/CellBroadcastHandler.java b/src/com/android/cellbroadcastservice/CellBroadcastHandler.java
index 7eb1e16..28e56b5 100644
--- a/src/com/android/cellbroadcastservice/CellBroadcastHandler.java
+++ b/src/com/android/cellbroadcastservice/CellBroadcastHandler.java
@@ -49,6 +49,7 @@
import android.provider.Telephony.CellBroadcasts;
import android.telephony.CbGeoUtils.Geometry;
import android.telephony.CbGeoUtils.LatLng;
+import android.telephony.CellBroadcastIntents;
import android.telephony.Rlog;
import android.telephony.SmsCbMessage;
import android.telephony.SubscriptionManager;
@@ -517,10 +518,9 @@
msg = "Dispatching SMS CB, SmsCbMessage is: " + message;
log(msg);
mLocalLog.log(msg);
- intent = new Intent(Telephony.Sms.Intents.SMS_CB_RECEIVED_ACTION);
// Send implicit intent since there are various 3rd party carrier apps listen to
// this intent.
- intent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
+ intent = new Intent(Telephony.Sms.Intents.SMS_CB_RECEIVED_ACTION);
receiverPermission = Manifest.permission.RECEIVE_SMS;
appOp = AppOpsManager.OPSTR_RECEIVE_SMS;
@@ -528,9 +528,10 @@
putPhoneIdAndSubIdExtra(mContext, intent, slotIndex);
mReceiverCount.incrementAndGet();
- mContext.createContextAsUser(UserHandle.ALL, 0).sendOrderedBroadcast(
- intent, receiverPermission, appOp, mReceiver, getHandler(),
- Activity.RESULT_OK, null, null);
+ CellBroadcastIntents.sendOrderedBroadcastForBackgroundReceivers(
+ mContext, UserHandle.ALL, intent,
+ receiverPermission, appOp, mReceiver, getHandler(), Activity.RESULT_OK,
+ null, null);
}
if (messageUri != null) {