Merge "PhoneAccount -> SubId for use in TelephonyManager#line1Number" into lmp-mr1-dev
diff --git a/res/values-my-rMM/strings.xml b/res/values-my-rMM/strings.xml
index 4e96799..b028ed5 100644
--- a/res/values-my-rMM/strings.xml
+++ b/res/values-my-rMM/strings.xml
@@ -35,8 +35,8 @@
<string name="respond_via_sms_setting_summary" msgid="9150281183930613065"></string>
<string name="respond_via_sms_edittext_dialog_title" msgid="20379890418289778">"အမြန်တုံ့ပြန်ချက်"</string>
<string name="respond_via_sms_confirmation_format" msgid="7229149977515784269">"<xliff:g id="PHONE_NUMBER">%s</xliff:g> ထံ စာတိုပို့လိုက်ပါပြီ"</string>
- <string name="outgoing_call_not_allowed" msgid="1435394568102165287">"အရေးပေါ်ဖုန်းများကိုသာ ခေါ်ဆိုနိုင်ရန် စက်ကိရိယာပိုင်ရှင်က ခွင့်ပြုထား၏"</string>
- <string name="outgoing_call_error_no_phone_number_supplied" msgid="1940125199802007505">"ဖုန်းခေါ်ရန်အတွက်၊ သင့်လျော်သည့်နံပါတ် ရိုက်ထည့်ပါ။"</string>
+ <string name="outgoing_call_not_allowed" msgid="1435394568102165287">"အရေးပေါ်ဖုန်းများကိုသာ ခေါ်ဆိုနိုင်ရန် စက်ကိရိယာပိုင်ရှင်က ခွင့်ပြုထား၏"</string>
+ <string name="outgoing_call_error_no_phone_number_supplied" msgid="1940125199802007505">"ဖုန်းခေါ်ရန်အတွက်၊ သင့်လျော်သည့်နံပါတ် ရိုက်ထည့်ပါ။"</string>
<string name="duplicate_video_call_not_allowed" msgid="3749211605014548386">"ဗွီဒီယိုခေါ်နေစဉ် ထပ်ခေါ်မရပါ။"</string>
<string name="no_vm_number" msgid="4164780423805688336">"အသံစာပို့စနစ် နံပါတ် ပျောက်နေပါသည်"</string>
<string name="no_vm_number_msg" msgid="1300729501030053828">"ဆင်းမ်ကဒ်ပေါ်တွင် အသံစာပို့စနစ် နံပါတ် သိမ်းဆည်ထားခြင်း မရှိပါ"</string>
diff --git a/src/com/android/server/telecom/CallAudioManager.java b/src/com/android/server/telecom/CallAudioManager.java
index cc948e4..9daf815 100644
--- a/src/com/android/server/telecom/CallAudioManager.java
+++ b/src/com/android/server/telecom/CallAudioManager.java
@@ -131,16 +131,35 @@
return;
}
- int newRoute = AudioState.ROUTE_EARPIECE;
+ boolean isCurrentlyWiredHeadset = mAudioState.getRoute() == AudioState.ROUTE_WIRED_HEADSET;
+
+ int newRoute = mAudioState.getRoute(); // start out with existing route
if (newIsPluggedIn) {
newRoute = AudioState.ROUTE_WIRED_HEADSET;
- } else if (mWasSpeakerOn) {
+ } else if (isCurrentlyWiredHeadset) {
Call call = getForegroundCall();
- if (call != null && call.isAlive()) {
- // Restore the speaker state.
- newRoute = AudioState.ROUTE_SPEAKER;
+ boolean hasLiveCall = call != null && call.isAlive();
+
+ if (hasLiveCall) {
+ // In order of preference when a wireless headset is unplugged.
+ if (mWasSpeakerOn) {
+ newRoute = AudioState.ROUTE_SPEAKER;
+ } else {
+ newRoute = AudioState.ROUTE_EARPIECE;
+ }
+
+ // We don't automatically connect to bluetooth when user unplugs their wired headset
+ // and they were previously using the wired. Wired and earpiece are effectively the
+ // same choice in that they replace each other as an option when wired headsets
+ // are plugged in and out. This means that keeping it earpiece is a bit more
+ // consistent with the status quo. Bluetooth also has more danger associated with
+ // choosing it in the wrong curcumstance because bluetooth devices can be
+ // semi-public (like in a very-occupied car) where earpiece doesn't carry that risk.
}
}
+
+ // We need to call this every time even if we do not change the route because the supported
+ // routes changed either to include or not include WIRED_HEADSET.
setSystemAudioState(mAudioState.isMuted(), newRoute, calculateSupportedRoutes());
}
diff --git a/src/com/android/server/telecom/InCallController.java b/src/com/android/server/telecom/InCallController.java
index b77dd14..eef75e3 100644
--- a/src/com/android/server/telecom/InCallController.java
+++ b/src/com/android/server/telecom/InCallController.java
@@ -462,6 +462,7 @@
int state = call.getState();
int capabilities = convertConnectionToCallCapabilities(call.getConnectionCapabilities());
+ // If this is a single-SIM device, the "default SIM" will always be the only SIM.
boolean isDefaultSmsAccount =
CallsManager.getInstance().getPhoneAccountRegistrar().isUserSelectedSmsPhoneAccount(
call.getTargetPhoneAccount());
@@ -469,10 +470,6 @@
capabilities |= android.telecom.Call.Details.CAPABILITY_RESPOND_VIA_TEXT;
}
- if (call.isRespondViaSmsCapable()) {
- capabilities |= android.telecom.Call.Details.CAPABILITY_RESPOND_VIA_TEXT;
- }
-
if (call.isEmergencyCall()) {
capabilities = removeCapability(
capabilities, android.telecom.Call.Details.CAPABILITY_MUTE);