Fix NPE on phone boot and SIM removal
In some cases TelecomManager.getCallCapablePhoneAccounts() might return
a PhoneAccountHandle with a invalid subId on boot, which will cause
a NPE when trying to convert the subId back to a PhoneAccountHandle
in SimChangeReceiver.processSubId().
SimChangeReceiver also might be triggered with a invalid subId that
is not SubscriptionManager.INVALID_SUBSCRIPTION_ID.
SubscriptionManager.isValidSubscriptionId() should be used instead of
comparing with the constant.
In this CL the subId is validated on the above events.
PhoneAccountHandleConverter.fromSubId() will also handle invalid subId
gracefully and return null. The null return value is checked in all
usages.
Change-Id: Ie703b1a2a826a2951e8cc90fccc6badd76928bd3
Fixes: 30474294
10 files changed