Merge "Treat the call as personal call if no work dialer is installed"
diff --git a/src/com/android/server/telecom/PhoneAccountRegistrar.java b/src/com/android/server/telecom/PhoneAccountRegistrar.java
index 604aed9..4558583 100644
--- a/src/com/android/server/telecom/PhoneAccountRegistrar.java
+++ b/src/com/android/server/telecom/PhoneAccountRegistrar.java
@@ -406,12 +406,27 @@
if (account.isEnabled() != isEnabled) {
account.setIsEnabled(isEnabled);
+ if (!isEnabled) {
+ // If the disabled account is the default, remove it.
+ removeDefaultPhoneAccountHandle(accountHandle);
+ }
write();
fireAccountsChanged();
}
return true;
}
+ private void removeDefaultPhoneAccountHandle(PhoneAccountHandle phoneAccountHandle) {
+ Iterator<Map.Entry<UserHandle, DefaultPhoneAccountHandle>> iterator =
+ mState.defaultOutgoingAccountHandles.entrySet().iterator();
+ while (iterator.hasNext()) {
+ Map.Entry<UserHandle, DefaultPhoneAccountHandle> entry = iterator.next();
+ if (phoneAccountHandle.equals(entry.getValue().phoneAccountHandle)) {
+ iterator.remove();
+ }
+ }
+ }
+
private boolean isVisibleForUser(PhoneAccount account, UserHandle userHandle,
boolean acrossProfiles) {
if (account == null) {