/** * When a voicemail source is removed, we don't always know which one was removed. Check the list * of registered phone accounts against the active subscriptions list and remove the inactive * sources. */ public void removeInactiveSources() { for (PhoneAccountHandle phoneAccount : mActiveVvmSources) { if (!PhoneUtils.isPhoneAccountActive(mSubscriptionManager, phoneAccount)) { removeSource(phoneAccount); } } // Remove any orphaned phone state listeners as well. for (PhoneAccountHandle phoneAccount : mPhoneStateListenerMap.keySet()) { if (!PhoneUtils.isPhoneAccountActive(mSubscriptionManager, phoneAccount)) { removePhoneStateListener(phoneAccount); } } }
public void removeSource(Phone phone) { removeSource(PhoneUtils.makePstnPhoneAccountHandle(phone)); }