Merge "clean up USER_OWNER in telephony service"
diff --git a/res/values-ne-rNP/strings.xml b/res/values-ne-rNP/strings.xml
index ccea74b..89403e0 100644
--- a/res/values-ne-rNP/strings.xml
+++ b/res/values-ne-rNP/strings.xml
@@ -488,7 +488,7 @@
<string name="ota_hfa_activation_title" msgid="2234246934160473981">"सक्रिय गर्दै…"</string>
<string name="ota_hfa_activation_dialog_message" msgid="8092479227918463415">"फोनले तपाईँको मोबाइल डेटा सेवा सक्रिय पार्दै छ। \n\nयसले ५ मिनेटसम्म समय लिन सक्छ।"</string>
<string name="ota_skip_activation_dialog_title" msgid="2943366608272261306">"सक्रिया गर्ने काम छोड्ने हो?"</string>
- <string name="ota_skip_activation_dialog_message" msgid="2440770373498870550">"यदि तपाईं सक्रियता छोड्नुहुन्छ भने तपाईं कल वा मोबाइल डेटा नेटवर्क (तपाईं वाइफाइ नेटवर्क जडान गर्न सक्नु हुन्छ) बाट जडान गर्न सक्नु हुन्छ। तपाईंले आफ्नो फोनलाई सक्रिय गर्ने बेलासम्म तपाईं यसलाई हरेक पटक खोल्ने गर्नुहोस्।"</string>
+ <string name="ota_skip_activation_dialog_message" msgid="2440770373498870550">"यदि तपाईँ सक्रियता छोड्नुहुन्छ भने तपाईँ कल वा मोबाइल डेटा नेटवर्क (तपाईँ वाइफाइ नेटवर्क जडान गर्न सक्नु हुन्छ) बाट जडान गर्न सक्नु हुन्छ। तपाईँले आफ्नो फोनलाई सक्रिय गर्ने बेलासम्म तपाईँ यसलाई हरेक पटक खोल्ने गर्नुहोस्।"</string>
<string name="ota_skip_activation_dialog_skip_label" msgid="3458532775091563208">"छोड्नुहोस्"</string>
<string name="ota_activate" msgid="1368528132525626264">"सक्रिय बनाउनुहोस्"</string>
<string name="ota_title_activate_success" msgid="6570240212263372046">"फोन सक्रिय भएको छ।"</string>
@@ -512,12 +512,12 @@
<item quantity="one"> <xliff:g id="COUNT_0">%s</xliff:g> मिनेटको लागि कुनै डेटा जडान छैन</item>
</plurals>
<plurals name="alert_dialog_exit_ecm" formatted="false" msgid="7179911675595441201">
- <item quantity="other"> फोन आपतकालीन कलब्याक मोडमा <xliff:g id="COUNT_1">%s</xliff:g> मिनेटको लागि हुनेछ। यस मोडको अवस्थामा एक डेटा जडान प्रयोग गरेर कुनै पनि अनुप्रयोगहरू प्रयोग गर्न सकिँदैन। के तपाईं अहिले निस्कन चाहनुहुन्छ?</item>
- <item quantity="one"> फोन आपतकालीन कलब्याक मोडमा <xliff:g id="COUNT_0">%s</xliff:g> मिनेटको लागि हुनेछ। यस मोडको समयमा एक डेटा जडान प्रयोग गरेर कुनै पनि अनुप्रयोगहरू प्रयोग गर्न सकिँदैन। के तपाईं अहिले निस्कन चाहनुहुन्छ?</item>
+ <item quantity="other"> फोन आपतकालीन कलब्याक मोडमा <xliff:g id="COUNT_1">%s</xliff:g> मिनेटको लागि हुनेछ। यस मोडको अवस्थामा एक डेटा जडान प्रयोग गरेर कुनै पनि अनुप्रयोगहरू प्रयोग गर्न सकिँदैन। के तपाईँ अहिले निस्कन चाहनुहुन्छ?</item>
+ <item quantity="one"> फोन आपतकालीन कलब्याक मोडमा <xliff:g id="COUNT_0">%s</xliff:g> मिनेटको लागि हुनेछ। यस मोडको समयमा एक डेटा जडान प्रयोग गरेर कुनै पनि अनुप्रयोगहरू प्रयोग गर्न सकिँदैन। के तपाईँ अहिले निस्कन चाहनुहुन्छ?</item>
</plurals>
<plurals name="alert_dialog_not_avaialble_in_ecm" formatted="false" msgid="8042973425225093895">
- <item quantity="other"> आपतकालीन कलब्याक मोडको समयमा चयनित कार्य उपलब्ध छैन। फोन यस मोडमा <xliff:g id="COUNT_1">%s</xliff:g> मिनेटको लागि हुनेछ। के तपाईं अहिले निस्कन चाहनुहुन्छ?</item>
- <item quantity="one"> आपतकालीन कलब्याक मोडको समयमा चयनित कार्य उपलब्ध छैन। फोन यस मोडमा <xliff:g id="COUNT_0">%s</xliff:g> मिनेटको लागि हुनेछ। के तपाईं अहिले निस्कन चाहनुहुन्छ?</item>
+ <item quantity="other"> आपतकालीन कलब्याक मोडको समयमा चयनित कार्य उपलब्ध छैन। फोन यस मोडमा <xliff:g id="COUNT_1">%s</xliff:g> मिनेटको लागि हुनेछ। के तपाईँ अहिले निस्कन चाहनुहुन्छ?</item>
+ <item quantity="one"> आपतकालीन कलब्याक मोडको समयमा चयनित कार्य उपलब्ध छैन। फोन यस मोडमा <xliff:g id="COUNT_0">%s</xliff:g> मिनेटको लागि हुनेछ। के तपाईँ अहिले निस्कन चाहनुहुन्छ?</item>
</plurals>
<string name="alert_dialog_in_ecm_call" msgid="1886723687211887104">"आपतकालीन कल हुँदा चयन भएको कार्य उपलब्ध हुँदैन।"</string>
<string name="progress_dialog_exiting_ecm" msgid="4835734101617817074">"आपतकालीन कलब्याक मोडबाट निस्कदै"</string>
diff --git a/res/values-pt/strings.xml b/res/values-pt/strings.xml
index 35d9804..b3392ff 100644
--- a/res/values-pt/strings.xml
+++ b/res/values-pt/strings.xml
@@ -352,7 +352,7 @@
<string name="tty_mode_option_summary" msgid="1073835131534808732">"Definir modo TTD"</string>
<string name="auto_retry_mode_title" msgid="4073265511427813322">"Repetir automaticamente"</string>
<string name="auto_retry_mode_summary" msgid="4973886004067532288">"Ativar modo Repetir automaticamente"</string>
- <string name="tty_mode_not_allowed_video_call" msgid="3795846787901909176">"Não é permitida a alteração do modo TTD durante uma vídeo chamada"</string>
+ <string name="tty_mode_not_allowed_video_call" msgid="3795846787901909176">"Não é permitida a alteração do modo TTD durante uma videochamada"</string>
<string name="menu_add" msgid="1882023737425114762">"Adicionar contato"</string>
<string name="menu_edit" msgid="7143003705504672374">"Editar contato"</string>
<string name="menu_delete" msgid="3977150783449642851">"Excluir contato"</string>
@@ -460,7 +460,7 @@
<string name="onscreenManageCallsText" msgid="5473231160123254154">"Gerenciar chamadas"</string>
<string name="onscreenManageConferenceText" msgid="6485935856534311346">"Gerenciar conferência"</string>
<string name="onscreenAudioText" msgid="1710087112800041743">"Áudio"</string>
- <string name="onscreenVideoCallText" msgid="4800924186056115442">"Vídeo ch."</string>
+ <string name="onscreenVideoCallText" msgid="4800924186056115442">"Videocham."</string>
<string name="importSimEntry" msgid="6614358325359736031">"Importar"</string>
<string name="importAllSimEntries" msgid="1503181169636198673">"Importar tudo"</string>
<string name="importingSimContacts" msgid="7374056215462575769">"Importando contatos do SIM"</string>
@@ -541,7 +541,7 @@
<string name="preference_category_ringtone" msgid="5197960752529332721">"Toque e vibração"</string>
<string name="pstn_connection_service_label" msgid="1743245930577325900">"Cartões SIM integrados"</string>
<string name="enable_video_calling_title" msgid="7237253660669000899">"Ativar chamadas de vídeo"</string>
- <string name="enable_video_calling_dialog_msg" msgid="8948186136957417948">"Para ativar a chamada de vídeo, ative o modo 4G LTE avançado nas configurações de rede."</string>
+ <string name="enable_video_calling_dialog_msg" msgid="8948186136957417948">"Para ativar a videochamada, ative o modo 4G LTE avançado nas configurações de rede."</string>
<string name="enable_video_calling_dialog_settings" msgid="576528473599603249">"Configurações de rede"</string>
<string name="enable_video_calling_dialog_close" msgid="7411471282167927991">"Fechar"</string>
<string name="sim_label_emergency_calls" msgid="4847699229529306397">"Chamadas de emergência"</string>
diff --git a/res/values/config.xml b/res/values/config.xml
index fa730d4..0b1f93c 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -212,4 +212,10 @@
<!-- Flag indicating whether to allow pstn phone accounts [DO NOT TRANSLATE] -->
<bool name="config_pstn_phone_accounts_enabled">true</bool>
+
+ <!-- Flag indicating whether the the emergency phone account should be emergency calls only -->
+ <bool name="config_emergency_account_emergency_calls_only">false</bool>
+
+ <!-- Whether the emergency only account can make emergency calls -->
+ <bool name="config_pstnCanPlaceEmergencyCalls">true</bool>
</resources>
diff --git a/src/com/android/phone/NotificationMgr.java b/src/com/android/phone/NotificationMgr.java
index 100a38c..e6f28e9 100644
--- a/src/com/android/phone/NotificationMgr.java
+++ b/src/com/android/phone/NotificationMgr.java
@@ -557,7 +557,7 @@
continue;
}
UserHandle userHandle = user.getUserHandle();
- builder.setContentIntent(userHandle.isOwner() ? contentIntent : null);
+ builder.setContentIntent(user.isAdmin() ? contentIntent : null);
mNotificationManager.notifyAsUser(
Integer.toString(subId) /* tag */,
CALL_FORWARD_NOTIFICATION,
@@ -599,7 +599,7 @@
continue;
}
UserHandle userHandle = user.getUserHandle();
- builder.setContentIntent(userHandle.isOwner() ? contentIntent : null);
+ builder.setContentIntent(user.isAdmin() ? contentIntent : null);
final Notification notif =
new Notification.BigTextStyle(builder).bigText(contentText).build();
mNotificationManager.notifyAsUser(
@@ -648,7 +648,7 @@
continue;
}
UserHandle userHandle = user.getUserHandle();
- builder.setContentIntent(userHandle.isOwner() ? contentIntent : null);
+ builder.setContentIntent(user.isAdmin() ? contentIntent : null);
mNotificationManager.notifyAsUser(
null /* tag */,
SELECTED_OPERATOR_FAIL_NOTIFICATION,
diff --git a/src/com/android/phone/PhoneUtils.java b/src/com/android/phone/PhoneUtils.java
index e1f8036..1fa886c 100644
--- a/src/com/android/phone/PhoneUtils.java
+++ b/src/com/android/phone/PhoneUtils.java
@@ -863,7 +863,7 @@
if (DBG) log("running USSD code, displaying indeterminate progress.");
// create the indeterminate progress dialog and display it.
- ProgressDialog pd = new ProgressDialog(context);
+ ProgressDialog pd = new ProgressDialog(context, THEME);
pd.setMessage(context.getText(R.string.ussdRunning));
pd.setCancelable(false);
pd.setIndeterminate(true);
@@ -934,7 +934,7 @@
// create the progress dialog, make sure the flags and type are
// set correctly.
- ProgressDialog pd = new ProgressDialog(app);
+ ProgressDialog pd = new ProgressDialog(app, THEME);
pd.setTitle(title);
pd.setMessage(text);
pd.setCancelable(false);
diff --git a/src/com/android/services/telephony/CdmaConnection.java b/src/com/android/services/telephony/CdmaConnection.java
index 7d88234..bfb0d23 100644
--- a/src/com/android/services/telephony/CdmaConnection.java
+++ b/src/com/android/services/telephony/CdmaConnection.java
@@ -63,7 +63,7 @@
/**
* {@code True} if the CDMA connection should allow mute.
*/
- private final boolean mAllowMute;
+ private boolean mAllowMute;
private final boolean mIsOutgoing;
// Queue of pending short-DTMF characters.
private final Queue<Character> mDtmfQueue = new LinkedList<>();
@@ -286,4 +286,15 @@
PhoneNumberUtils.isLocalEmergencyNumber(
phone.getContext(), getAddress().getSchemeSpecificPart());
}
+
+ /**
+ * Called when ECM mode is exited; set the connection to allow mute and update the connection
+ * capabilities.
+ */
+ @Override
+ protected void handleExitedEcmMode() {
+ // We allow mute upon existing ECM mode and rebuild the capabilities.
+ mAllowMute = true;
+ super.handleExitedEcmMode();
+ }
}
diff --git a/src/com/android/services/telephony/PstnIncomingCallNotifier.java b/src/com/android/services/telephony/PstnIncomingCallNotifier.java
index 21a39c8..5f64f6d 100644
--- a/src/com/android/services/telephony/PstnIncomingCallNotifier.java
+++ b/src/com/android/services/telephony/PstnIncomingCallNotifier.java
@@ -202,6 +202,15 @@
}
Connection connection = (Connection) asyncResult.result;
if (connection != null) {
+ // Because there is a handler between telephony and here, it causes this action to be
+ // asynchronous which means that the call can switch to DISCONNECTED by the time it gets
+ // to this code. Check here to ensure we are not adding a disconnected or IDLE call.
+ Call.State state = connection.getState();
+ if (state == Call.State.DISCONNECTED || state == Call.State.IDLE) {
+ Log.i(this, "Skipping new unknown connection because it is idle. " + connection);
+ return;
+ }
+
Call call = connection.getCall();
if (call != null && call.getState().isAlive()) {
addNewUnknownCall(connection);
@@ -211,6 +220,7 @@
private void addNewUnknownCall(Connection connection) {
Log.i(this, "addNewUnknownCall, connection is: %s", connection);
+
if (!maybeSwapAnyWithUnknownConnection(connection)) {
Log.i(this, "determined new connection is: %s", connection);
Bundle extras = null;
diff --git a/src/com/android/services/telephony/TelecomAccountRegistry.java b/src/com/android/services/telephony/TelecomAccountRegistry.java
index d452a7a..c1224fc 100644
--- a/src/com/android/services/telephony/TelecomAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecomAccountRegistry.java
@@ -26,6 +26,7 @@
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.net.Uri;
+import android.os.Bundle;
import android.os.PersistableBundle;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
@@ -161,22 +162,26 @@
// By default all SIM phone accounts can place emergency calls.
int capabilities = PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION |
PhoneAccount.CAPABILITY_CALL_PROVIDER |
- PhoneAccount.CAPABILITY_PLACE_EMERGENCY_CALLS |
PhoneAccount.CAPABILITY_MULTI_USER;
+ if (mContext.getResources().getBoolean(R.bool.config_pstnCanPlaceEmergencyCalls)) {
+ capabilities |= PhoneAccount.CAPABILITY_PLACE_EMERGENCY_CALLS;
+ }
+
mIsVideoCapable = mPhone.isVideoEnabled();
if (mIsVideoCapable) {
capabilities |= PhoneAccount.CAPABILITY_VIDEO_CALLING;
}
mIsVideoPauseSupported = isCarrierVideoPauseSupported();
+ Bundle instantLetteringExtras = null;
if (isCarrierInstantLetteringSupported()) {
capabilities |= PhoneAccount.CAPABILITY_CALL_SUBJECT;
+ instantLetteringExtras = getPhoneAccountExtras();
}
mIsMergeCallSupported = isCarrierMergeCallSupported();
- if (isEmergency && mContext.getPackageManager().hasSystemFeature(
- PackageManager.FEATURE_WATCH)) {
- // For Wear, we mark the emergency phone account as emergency calls only.
+ if (isEmergency && mContext.getResources().getBoolean(
+ R.bool.config_emergency_account_emergency_calls_only)) {
capabilities |= PhoneAccount.CAPABILITY_EMERGENCY_CALLS_ONLY;
}
@@ -207,6 +212,7 @@
.setShortDescription(description)
.setSupportedUriSchemes(Arrays.asList(
PhoneAccount.SCHEME_TEL, PhoneAccount.SCHEME_VOICEMAIL))
+ .setExtras(instantLetteringExtras)
.build();
// Register with Telecom and put into the account entry.
@@ -254,6 +260,26 @@
}
/**
+ * @return The {@linke PhoneAccount} extras associated with the current subscription.
+ */
+ private Bundle getPhoneAccountExtras() {
+ PersistableBundle b =
+ PhoneGlobals.getInstance().getCarrierConfigForSubId(mPhone.getSubId());
+
+ int instantLetteringMaxLength = b.getInt(
+ CarrierConfigManager.KEY_CARRIER_INSTANT_LETTERING_LENGTH_LIMIT_INT);
+ String instantLetteringEncoding = b.getString(
+ CarrierConfigManager.KEY_CARRIER_INSTANT_LETTERING_ENCODING_STRING);
+
+ Bundle phoneAccountExtras = new Bundle();
+ phoneAccountExtras.putInt(PhoneAccount.EXTRA_CALL_SUBJECT_MAX_LENGTH,
+ instantLetteringMaxLength);
+ phoneAccountExtras.putString(PhoneAccount.EXTRA_CALL_SUBJECT_CHARACTER_ENCODING,
+ instantLetteringEncoding);
+ return phoneAccountExtras;
+ }
+
+ /**
* Receives callback from {@link PstnPhoneCapabilitiesNotifier} when the video capabilities
* have changed.
*
@@ -434,8 +460,14 @@
private void cleanupPhoneAccounts() {
ComponentName telephonyComponentName =
new ComponentName(mContext, TelephonyConnectionService.class);
- List<PhoneAccountHandle> accountHandles =
- mTelecomManager.getCallCapablePhoneAccounts(true /* includeDisabled */);
+ // This config indicates whether the emergency account was flagged as emergency calls only
+ // in which case we need to consider all phone accounts, not just the call capable ones.
+ final boolean emergencyCallsOnlyEmergencyAccount = mContext.getResources().getBoolean(
+ R.bool.config_emergency_account_emergency_calls_only);
+ List<PhoneAccountHandle> accountHandles = emergencyCallsOnlyEmergencyAccount
+ ? mTelecomManager.getAllPhoneAccountHandles()
+ : mTelecomManager.getCallCapablePhoneAccounts(true /* includeDisabled */);
+
for (PhoneAccountHandle handle : accountHandles) {
if (telephonyComponentName.equals(handle.getComponentName()) &&
!hasAccountEntryForPhoneAccount(handle)) {
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 996b938..22f1e19 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -315,6 +315,15 @@
public void onExtrasChanged(Bundle extras) {
mHandler.obtainMessage(MSG_CONNECTION_EXTRAS_CHANGED, extras).sendToTarget();
}
+
+ /**
+ * Handles the phone exiting ECM mode by updating the connection capabilities. During an
+ * ongoing call, if ECM mode is exited, we will re-enable mute for CDMA calls.
+ */
+ @Override
+ public void onExitedEcmMode() {
+ handleExitedEcmMode();
+ }
};
private com.android.internal.telephony.Connection mOriginalConnection;
@@ -663,7 +672,6 @@
// Set video state and capabilities
setVideoState(mOriginalConnection.getVideoState());
- updateState();
setLocalVideoCapable(mOriginalConnection.isLocalVideoCapable());
setRemoteVideoCapable(mOriginalConnection.isRemoteVideoCapable());
setWifi(mOriginalConnection.isWifi());
@@ -675,8 +683,15 @@
}
mIsMultiParty = mOriginalConnection.isMultiparty();
+ // updateState can set mOriginalConnection to null if its state is DISCONNECTED, so this
+ // should be executed *after* the above setters have run.
+ updateState();
+ if (mOriginalConnection == null) {
+ Log.w(this, "original Connection was nulled out as part of setOriginalConnection. " +
+ originalConnection);
+ }
+
fireOnOriginalConnectionConfigured();
- updateAddress();
}
/**
@@ -1239,6 +1254,12 @@
}
}
+ /**
+ * Handles exiting ECM mode.
+ */
+ protected void handleExitedEcmMode() {
+ updateConnectionCapabilities();
+ }
/**
* Provides a mapping from extras keys which may be found in the