Merge "Do not use sendOrderedBroadcastAsUser"
diff --git a/src/com/android/cellbroadcastservice/CellBroadcastHandler.java b/src/com/android/cellbroadcastservice/CellBroadcastHandler.java
index fa6978f..466ae94 100644
--- a/src/com/android/cellbroadcastservice/CellBroadcastHandler.java
+++ b/src/com/android/cellbroadcastservice/CellBroadcastHandler.java
@@ -463,7 +463,7 @@
protected void broadcastMessage(@NonNull SmsCbMessage message, @Nullable Uri messageUri,
int slotIndex) {
String receiverPermission;
- int appOp;
+ String appOp;
String msg;
Intent intent;
if (message.isEmergencyMessage()) {
@@ -474,7 +474,7 @@
//Emergency alerts need to be delivered with high priority
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
receiverPermission = Manifest.permission.RECEIVE_EMERGENCY_BROADCAST;
- appOp = AppOpsManager.OP_RECEIVE_EMERGECY_SMS;
+ appOp = AppOpsManager.OPSTR_RECEIVE_EMERGENCY_BROADCAST;
intent.putExtra(EXTRA_MESSAGE, message);
int subId = getSubIdForPhone(slotIndex);
@@ -493,9 +493,9 @@
if (additionalPackage != null) {
Intent additionalIntent = new Intent(intent);
additionalIntent.setPackage(additionalPackage);
- mContext.sendOrderedBroadcastAsUser(additionalIntent, UserHandle.ALL,
- receiverPermission, appOp, null, getHandler(), Activity.RESULT_OK,
- null, null);
+ mContext.createContextAsUser(UserHandle.ALL, 0).sendOrderedBroadcast(
+ additionalIntent, receiverPermission, appOp, null, getHandler(),
+ Activity.RESULT_OK, null, null);
}
}
@@ -505,8 +505,9 @@
for (String pkg : pkgs) {
// Explicitly send the intent to all the configured cell broadcast receivers.
intent.setPackage(pkg);
- mContext.sendOrderedBroadcastAsUser(intent, UserHandle.ALL, receiverPermission,
- appOp, null, mReceiver, getHandler(), Activity.RESULT_OK, null, null);
+ mContext.createContextAsUser(UserHandle.ALL, 0).sendOrderedBroadcast(
+ intent, receiverPermission, appOp, null, getHandler(),
+ Activity.RESULT_OK, null, null);
}
} else {
msg = "Dispatching SMS CB, SmsCbMessage is: " + message;
@@ -517,14 +518,15 @@
// this intent.
intent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
receiverPermission = Manifest.permission.RECEIVE_SMS;
- appOp = AppOpsManager.OP_RECEIVE_SMS;
+ appOp = AppOpsManager.OPSTR_RECEIVE_SMS;
intent.putExtra(EXTRA_MESSAGE, message);
SubscriptionManager.putPhoneIdAndSubIdExtra(intent, slotIndex);
mReceiverCount.incrementAndGet();
- mContext.sendOrderedBroadcastAsUser(intent, UserHandle.ALL, receiverPermission,
- appOp, null, mReceiver, getHandler(), Activity.RESULT_OK, null, null);
+ mContext.createContextAsUser(UserHandle.ALL, 0).sendOrderedBroadcast(
+ intent, receiverPermission, appOp, mReceiver, getHandler(),
+ Activity.RESULT_OK, null, null);
}
if (messageUri != null) {
diff --git a/src/com/android/cellbroadcastservice/GsmSmsCbMessage.java b/src/com/android/cellbroadcastservice/GsmSmsCbMessage.java
index 0d51a00..b8b6f5a 100644
--- a/src/com/android/cellbroadcastservice/GsmSmsCbMessage.java
+++ b/src/com/android/cellbroadcastservice/GsmSmsCbMessage.java
@@ -103,7 +103,7 @@
header.getSerialNumber(), location, header.getServiceCategory(), null,
getEtwsPrimaryMessage(context, header.getEtwsInfo().getWarningType()),
SmsCbMessage.MESSAGE_PRIORITY_EMERGENCY, header.getEtwsInfo(),
- header.getCmasInfo(), 0, null /* geometries */, receivedTimeMillis, slotIndex);
+ header.getCmasInfo(), slotIndex);
} else if (header.isUmtsFormat()) {
// UMTS format has only 1 PDU
byte[] pdu = pdus[0];
@@ -152,8 +152,7 @@
return new SmsCbMessage(SmsCbMessage.MESSAGE_FORMAT_3GPP,
header.getGeographicalScope(), header.getSerialNumber(), location,
header.getServiceCategory(), language, sb.toString(), priority,
- header.getEtwsInfo(), header.getCmasInfo(), 0, null /* geometries */,
- receivedTimeMillis, slotIndex);
+ header.getEtwsInfo(), header.getCmasInfo(), slotIndex);
}
}