Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c54ff43b authored by Jack Yu's avatar Jack Yu
Browse files

Made non-emergency cell broadcast intents implicit

This allows carriers to send non-emergency cell
broadcasts to the 3rd party apps.

Test: Telephony unit tests
bug: 62256244
Change-Id: Ie1120a77d228ca24cc619cdd661420a3aa132bc4
parent 7d0d3d17
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -86,11 +86,17 @@ public class CellBroadcastHandler extends WakeLockStateMachine {
        if (message.isEmergencyMessage()) {
            log("Dispatching emergency SMS CB, SmsCbMessage is: " + message);
            intent = new Intent(Telephony.Sms.Intents.SMS_EMERGENCY_CB_RECEIVED_ACTION);
            // Explicitly send the intent to the default cell broadcast receiver.
            intent.setPackage(mContext.getResources().getString(
                    com.android.internal.R.string.config_defaultCellBroadcastReceiverPkg));
            receiverPermission = Manifest.permission.RECEIVE_EMERGENCY_BROADCAST;
            appOp = AppOpsManager.OP_RECEIVE_EMERGECY_SMS;
        } else {
            log("Dispatching SMS CB, SmsCbMessage is: " + message);
            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);
            receiverPermission = Manifest.permission.RECEIVE_SMS;
            appOp = AppOpsManager.OP_RECEIVE_SMS;
        }
@@ -112,8 +118,6 @@ public class CellBroadcastHandler extends WakeLockStateMachine {
            }
        }

        intent.setPackage(mContext.getResources().getString(
                com.android.internal.R.string.config_defaultCellBroadcastReceiverPkg));
        mContext.sendOrderedBroadcastAsUser(intent, UserHandle.ALL, receiverPermission, appOp,
                mReceiver, getHandler(), Activity.RESULT_OK, null, null);
    }