Do not use sendOrderedBroadcastAsUser
am: d4c7af359b
Change-Id: I7a9ea3d4d25904e09e6f6f9c99afde492ce64c08
diff --git a/src/com/android/cellbroadcastservice/CellBroadcastHandler.java b/src/com/android/cellbroadcastservice/CellBroadcastHandler.java
index 7507386..d8579dc 100644
--- a/src/com/android/cellbroadcastservice/CellBroadcastHandler.java
+++ b/src/com/android/cellbroadcastservice/CellBroadcastHandler.java
@@ -37,7 +37,6 @@
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
-import android.os.HandlerExecutor;
import android.os.Looper;
import android.os.Message;
import android.os.Process;
@@ -467,7 +466,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()) {
@@ -478,7 +477,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);
@@ -497,9 +496,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);
}
}
@@ -509,8 +508,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;
@@ -521,14 +521,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);
}
}