Skip CARRIER_CONFIG_CHANGED broadcast if SIM not loaded.

Context: App listens to CARRIER_CONFIG_CHANGED broadcast to detect SIM swap.
If a valid subId is in the broadcast intent extras and the subId has changed
for the same slotId, this is a SIM swap and should start entitlement check.

Issue: In case of SIM PIN, CARRIER_CONFIG_CHANGED is sent before SIM PIN
unlocked. And if the entitlement check happens before unlock (timing is
related), it will read null mccmnc from SIM, causing EAP_ID=null and
entitlement check failure. Even though another CARRIER_CONFIG_CHANGED is
sent after PIN locked, since the subId doesn't change, no entitlement check
is redone.

Fix: Check the SIM state on CARRIER_CONFIG_CHANGED, and skip the
broadcast if it's not SIM_STATE_LOADED.

Bug: 200836877
Test: manual, SIM swap with SIM PIN
Test: unit test
Merged-In: I555382fdd5eafb25bbfe428e66de403b0314b155
Change-Id: I555382fdd5eafb25bbfe428e66de403b0314b155
3 files changed