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

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

Fixed device crash on automation setup

This is a regression introduced by
https://android-review.googlesource.com/#/c/342381/
Sending the broadcast intent twice (extra one is for sl4a) causes
EVENT_BROADCAST_COMPLETE got sent twice, which brought the wake lock
state machine into the bad state.

Fixed by changing the first result receiver to null so only one
EVENT_BROADCAST_COMPLETE will be broadcasted.

Test: Telephony sanity tests
bug: 36107224
Change-Id: I02b4b4b9fa7a3106ad83e0200cf1e6dc5924c771
parent 93fc20f2
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -94,22 +94,23 @@ public class CellBroadcastHandler extends WakeLockStateMachine {
            receiverPermission = Manifest.permission.RECEIVE_SMS;
            appOp = AppOpsManager.OP_RECEIVE_SMS;
        }
        // explicitly send it to the default cell broadcast receiver only.
        intent.setPackage(mContext.getResources().getString(
                com.android.internal.R.string.config_defaultCellBroadcastReceiverPkg));

        intent.putExtra("message", message);
        SubscriptionManager.putPhoneIdAndSubIdExtra(intent, mPhone.getPhoneId());
        mContext.sendOrderedBroadcastAsUser(intent, UserHandle.ALL, receiverPermission, appOp,
                mReceiver, getHandler(), Activity.RESULT_OK, null, null);

        if (Build.IS_DEBUGGABLE) {
            String additionalPackage = Settings.Secure.getString(mContext.getContentResolver(),
                    CMAS_ADDITIONAL_BROADCAST_PKG);
            final String additionalPackage = Settings.Secure.getString(
                    mContext.getContentResolver(), CMAS_ADDITIONAL_BROADCAST_PKG);
            if (additionalPackage != null) {
                intent.setPackage(additionalPackage);
                mContext.sendOrderedBroadcastAsUser(intent, UserHandle.ALL, receiverPermission,
                        appOp, mReceiver, getHandler(), Activity.RESULT_OK, null, null);
                        appOp, null, getHandler(), Activity.RESULT_OK, null, null);
            }
        }

        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);
    }
}