Merge "am cffac94..b7cdece from mirror-m-wireless-internal-release"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index e3a6dcd..dd6593b 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -533,12 +533,6 @@
android:uiOptions="splitActionBarWhenNarrow">
</activity>
- <activity android:name="ImsEditor"
- android:theme="@style/DialerSettingsLight"
- android:configChanges="orientation|screenSize|keyboardHidden"
- android:uiOptions="splitActionBarWhenNarrow">
- </activity>
-
<!-- End SIP -->
<activity android:name="ErrorDialogActivity"
diff --git a/res/values-mcc310-mnc410/config.xml b/res/values-mcc310-mnc410/config.xml
new file mode 100644
index 0000000..bf89c34
--- /dev/null
+++ b/res/values-mcc310-mnc410/config.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+
+<resources>
+ <bool name="support_pause_ims_video_calls" translatable="false">false</bool>
+</resources>
\ No newline at end of file
diff --git a/res/values-mcc311-mnc480/config.xml b/res/values-mcc311-mnc480/config.xml
index 5cae0bc..b7d0d6e 100755
--- a/res/values-mcc311-mnc480/config.xml
+++ b/res/values-mcc311-mnc480/config.xml
@@ -23,4 +23,5 @@
<!-- Determine whether the voicemail notification is persistent in the notification bar.
If true, the voicemail notifications cannot be dismissed from the notification bar. -->
<bool name="voicemail_notification_persistent">true</bool>
+ <bool name="support_pause_ims_video_calls" translatable="false">true</bool>
</resources>
diff --git a/res/values/array.xml b/res/values/array.xml
deleted file mode 100644
index 79b6034..0000000
--- a/res/values/array.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- Array resources for the Phone app. -->
-<resources>
- <!-- Array resource for IMS VT call quality entries-->
- <string-array translatable="true" name="ims_vt_call_quality_entries">
- <item>@string/ims_vt_call_quality_low</item>
- <item>@string/ims_vt_call_quality_high</item>
- </string-array>
-
- <!-- Array resource for IMS VT call quality values-->
- <string-array translatable="false" name="ims_vt_call_quality_values">
- <item>0</item>
- <item>1</item>
- </string-array>
-</resources>
diff --git a/res/values/config.xml b/res/values/config.xml
index b7e3208..1f32b2d 100755
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -156,4 +156,7 @@
<!-- Determine whether the voicemail notification is persistent in the notification bar.
If true, the voicemail notifications cannot be dismissed from the notification bar. -->
<bool name="voicemail_notification_persistent">false</bool>
+
+ <!-- For IMS video over LTE calls, determines whether video pause signalling is supported. -->
+ <bool name="support_pause_ims_video_calls" translatable="false">true</bool>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 408d570..3a101bf 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -184,7 +184,7 @@
<!-- GSM Call settings screen, setting option name -->
<string name="additional_gsm_call_settings">Additional settings</string>
<!-- GSM Call settings screen, setting option name, with label identifying the SIM the settings are for. -->
- <string name="additional_gsm_call_settings_with_label">Additional settings (<xliff:g id="subscriptionlabel" example="Mock Carrier">%s</xliff:g>)</string>
+ <string name="additional_gsm_call_settings_with_label">Additional settings (<xliff:g id="subscriptionlabel" example="Verizon">%s</xliff:g>)</string>
<!-- GSM-only Call settings screen, setting option name-->
<string name="sum_gsm_call_settings">Additional GSM only call settings</string>
<!-- CDMA Call settings screen, setting option name -->
@@ -212,7 +212,7 @@
<!-- Call forwarding settings screen, section heading -->
<string name="call_forwarding_settings">Call forwarding settings</string>
<!-- Call forwarding settings screen, section heading, with a label identifying the SIM the settings are for. -->
- <string name="call_forwarding_settings_with_label">Call forwarding settings (<xliff:g id="subscriptionlabel" example="Mock Carrier">%s</xliff:g>)</string>
+ <string name="call_forwarding_settings_with_label">Call forwarding settings (<xliff:g id="subscriptionlabel" example="Verizon">%s</xliff:g>)</string>
<!-- Call settings screen, setting option name -->
<string name="labelCF">Call forwarding</string>
@@ -257,9 +257,8 @@
<string name="messageCFNRc">Number when unreachable</string>
<!-- Call forwarding settings screen, setting summary text when forwarding to a specific number when unreachable-->
<string name="sum_cfnrc_enabled">Forwarding to <xliff:g id="phonenumber" example="555-1212">{0}</xliff:g></string>
- <!-- Call forwarding settings screen, setting summary text when "Forward when unreachable" is
- disabled. [CHAR LIMIT=40] -->
- <string name="sum_cfnrc_disabled">Off</string>
+ <!-- Call forwarding settings screen, setting summary text when Forward when unreachable is disabled -->
+ <string name="sum_cfnrc_disabled">Disabled</string>
<!-- Error message displayed after failing to disable forwarding calls when the phone is unreachable -->
<string name="disable_cfnrc_forbidden">Your carrier doesn\'t support disabling call forwarding when your phone is unreachable.</string>
@@ -268,7 +267,7 @@
<!-- Toast in Call settings when asked to launch settings for a secondary user -->
<string name="call_settings_primary_user_only">Call settings can only be changed by the primary user.</string>
<!-- Title of the "Call settings" settings screen, with a text label identifying which SIM the settings are for. -->
- <string name="call_settings_with_label">Call settings (<xliff:g id="subscriptionlabel" example="Mock Carrier">%s</xliff:g>)</string>
+ <string name="call_settings_with_label">Call settings (<xliff:g id="subscriptionlabel" example="Verizon">%s</xliff:g>)</string>
<!-- Title of the alert dialog displayed if an error occurs while updating Call settings -->
<string name="error_updating_title">Call settings error</string>
<!-- Toast in Call settings dialog while settings are being read -->
@@ -722,13 +721,13 @@
<string name="fdn">Fixed Dialing Numbers</string>
<!-- Title for "Fixed Dialing Number" settings, with a label to identify the SIM the settings
apply to. -->
- <string name="fdn_with_label">Fixed Dialing Numbers (<xliff:g id="subscriptionlabel" example="Mock Carrier">%s</xliff:g>)</string>
+ <string name="fdn_with_label">Fixed Dialing Numbers (<xliff:g id="subscriptionlabel" example="Verizon">%s</xliff:g>)</string>
<!-- Call settings screen, button label that takes you to the Fixed Dialing Number management screen -->
<string name="manage_fdn_list">FDN list</string>
<!-- Title for settings screen to manage Fixed Dialing Number contacts, with a label to identify
the SIM the settings apply to. -->
- <string name="fdn_list_with_label">FDN list (<xliff:g id="subscriptionlabel" example="Mock Carrier">%s</xliff:g>)</string>
+ <string name="fdn_list_with_label">FDN list (<xliff:g id="subscriptionlabel" example="Verizon">%s</xliff:g>)</string>
<!-- Call settings screen, preference item label -->
<string name="fdn_activation">FDN activation</string>
<!-- Call settings setting option name when FDN is enabled -->
@@ -1077,6 +1076,22 @@
<item>3</item>
</string-array>
+ <!-- Dtmf tones settings -->
+ <!-- Title for the DTMF Tones options displayed in Call Settings -->
+ <string name="dtmf_tones_title">DTMF tones</string>
+ <!-- Summary for the DTMF Tones options displayed in Call Settings -->
+ <string name="dtmf_tones_summary">Set the length of DTMF tones</string>
+ <!-- Options displayed as part of DTMF Tones in Call Settings -->
+ <string-array name="dtmf_tone_entries">
+ <item>Normal</item>
+ <item>Long</item>
+ </string-array>
+ <!-- Do not translate. -->
+ <string-array name="dtmf_tone_values" translatable="false">
+ <item>0</item>
+ <item>1</item>
+ </string-array>
+
<!-- Title for the dialog used to display CDMA DisplayInfo -->
<string name="network_info_message">Network message</string>
<!-- Title for the dialog used to display a network error message to the user -->
diff --git a/res/xml/call_feature_setting.xml b/res/xml/call_feature_setting.xml
index 52a8815..f6b8eca 100644
--- a/res/xml/call_feature_setting.xml
+++ b/res/xml/call_feature_setting.xml
@@ -81,15 +81,4 @@
android:targetClass="com.android.phone.CdmaCallOptions"/>
</PreferenceScreen>
-
- <PreferenceScreen
- android:key="ims_account_settings_key"
- android:title="@string/ims_accounts_title"
- android:persistent="false">
-
- <intent android:action="android.intent.action.MAIN"
- android:targetPackage="com.android.phone"
- android:targetClass="com.android.phone.ImsEditor" />
- </PreferenceScreen>
-
</PreferenceScreen>
diff --git a/res/xml/ims_edit.xml b/res/xml/ims_edit.xml
deleted file mode 100644
index f16e2f5..0000000
--- a/res/xml/ims_edit.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
- android:title="@string/ims_edit_title"
- android:persistent="false">
-
- <ListPreference
- android:key="@string/ims_vt_call_quality"
- android:title="@string/ims_vt_call_quality_title"
- android:entries="@array/ims_vt_call_quality_entries"
- android:entryValues="@array/ims_vt_call_quality_values"
- android:summary="@string/ims_vt_call_quality_unknown"
- android:persistent="false"
- android:enabled="true"
- android:dialogTitle="@string/ims_vt_call_quality_title"/>
-
-</PreferenceScreen>
diff --git a/src/com/android/phone/ims/ImsEditor.java b/src/com/android/phone/ims/ImsEditor.java
deleted file mode 100644
index bbd4526..0000000
--- a/src/com/android/phone/ims/ImsEditor.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/* Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.phone;
-
-import android.os.Bundle;
-import android.preference.ListPreference;
-import android.preference.Preference;
-import android.preference.PreferenceActivity;
-import android.preference.PreferenceScreen;
-import android.telephony.SubscriptionManager;
-import android.util.Log;
-import android.widget.Toast;
-
-import com.android.ims.ImsConfig;
-import com.android.ims.ImsConfigListener;
-import com.android.ims.ImsException;
-import com.android.ims.ImsManager;
-import com.android.phone.R;
-
-/**
- * The activity class for editing a new or existing IMS profile.
- */
-public class ImsEditor extends PreferenceActivity
- implements Preference.OnPreferenceChangeListener {
-
- private static final String TAG = ImsEditor.class.getSimpleName();
-
- private ListPreference mVideoCallQuality;
- private ImsConfig mImsConfig;
-
- @Override
- public void onResume() {
- super.onResume();
- Log.d(TAG, "onResume");
- getVideoQuality();
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- Log.v(TAG, "start profile editor");
- super.onCreate(savedInstanceState);
-
- addPreferencesFromResource(R.xml.ims_edit);
- PreferenceScreen screen = getPreferenceScreen();
-
- mVideoCallQuality = (ListPreference) screen
- .findPreference(getString(R.string.ims_vt_call_quality));
- mVideoCallQuality.setOnPreferenceChangeListener(this);
-
- try {
- ImsManager imsManager = ImsManager.getInstance(getBaseContext(),
- SubscriptionManager.getDefaultVoiceSubId());
- mImsConfig = imsManager.getConfigInterface();
- } catch (ImsException e) {
- mImsConfig = null;
- Log.e(TAG, "ImsService is not running");
- }
- }
-
- private ImsConfigListener imsConfigListener = new ImsConfigListener.Stub() {
- public void onGetVideoQuality(int status, int quality) {
- if (hasRequestFailed(status)) {
- quality = ImsConfig.OperationValuesConstants.VIDEO_QUALITY_UNKNOWN;
- Log.e(TAG, "onGetVideoQuality: failed. errorCode = " + status);
- }
- Log.d(TAG, "onGetVideoQuality: value = " + quality);
- loadVideoCallQualityPrefs(quality);
- }
-
- public void onSetVideoQuality(int status) {
- if (hasRequestFailed(status)) {
- Log.e(TAG, "onSetVideoQuality: set failed. errorCode = " + status);
- Toast.makeText(getApplicationContext(), R.string.ims_vt_call_quality_set_failed,
- Toast.LENGTH_SHORT).show();
- getVideoQuality(); // Set request failed, get current value.
- } else {
- Log.d(TAG, "onSetVideoQuality: set succeeded.");
- }
- }
-
- public void onGetFeatureResponse(int feature, int network, int value, int status) {
- //TODO not required as of now
- }
-
- public void onSetFeatureResponse(int feature, int network, int value, int status) {
- //TODO not required as of now
- }
- };
-
- @Override
- public boolean onPreferenceChange(Preference pref, Object newValue) {
- if (pref.equals(mVideoCallQuality)) {
- if (newValue == null) {
- Log.e(TAG, "onPreferenceChange invalid value received");
- } else {
- final int quality = Integer.parseInt(newValue.toString());
- boolean result = setVideoQuality(quality);
- if (result) {
- loadVideoCallQualityPrefs(quality);
- }
- return result;
- }
- }
- return true;
- }
-
- private void loadVideoCallQualityPrefs(int vqValue) {
- Log.d(TAG, "loadVideoCallQualityPrefs, vqValue = " + vqValue);
- final String videoQuality = videoQualityToString(vqValue);
- mVideoCallQuality.setValue(String.valueOf(vqValue));
- mVideoCallQuality.setSummary(videoQuality);
- }
-
- private void getVideoQuality() {
- try {
- if (mImsConfig != null) {
- mImsConfig.getVideoQuality(imsConfigListener);
- } else {
- loadVideoCallQualityPrefs(ImsConfig.OperationValuesConstants.VIDEO_QUALITY_UNKNOWN);
- Log.e(TAG, "getVideoQuality failed. mImsConfig is null");
- }
- } catch (ImsException e) {
- Log.e(TAG, "getVideoQuality failed. Exception = " + e);
- }
- }
-
- private boolean setVideoQuality(int quality) {
- try {
- if (mImsConfig != null) {
- mImsConfig.setVideoQuality(quality, imsConfigListener);
- } else {
- Log.e(TAG, "setVideoQuality failed. mImsConfig is null");
- return false;
- }
- } catch (ImsException e) {
- Log.e(TAG, "setVideoQuality failed. Exception = " + e);
- return false;
- }
- return true;
- }
-
- private boolean hasRequestFailed(int result) {
- return (result != ImsConfig.OperationStatusConstants.SUCCESS);
- }
-
- private String videoQualityToString(int quality) {
- switch (quality) {
- case ImsConfig.OperationValuesConstants.VIDEO_QUALITY_HIGH:
- return getString(R.string.ims_vt_call_quality_high);
- case ImsConfig.OperationValuesConstants.VIDEO_QUALITY_LOW:
- return getString(R.string.ims_vt_call_quality_low);
- case ImsConfig.OperationValuesConstants.VIDEO_QUALITY_UNKNOWN:
- default:
- return getString(R.string.ims_vt_call_quality_unknown);
- }
- }
-}
diff --git a/src/com/android/services/telephony/PstnPhoneCapabilitiesNotifier.java b/src/com/android/services/telephony/PstnPhoneCapabilitiesNotifier.java
index 48568d3..7a2adf1 100644
--- a/src/com/android/services/telephony/PstnPhoneCapabilitiesNotifier.java
+++ b/src/com/android/services/telephony/PstnPhoneCapabilitiesNotifier.java
@@ -20,7 +20,6 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.net.Uri;
import android.os.AsyncResult;
import android.os.Handler;
import android.os.Message;
@@ -42,7 +41,15 @@
final class PstnPhoneCapabilitiesNotifier {
private static final int EVENT_VIDEO_CAPABILITIES_CHANGED = 1;
+ /**
+ * Listener called when video capabilities have changed.
+ */
+ public interface Listener {
+ public void onVideoCapabilitiesChanged(boolean isVideoCapable);
+ }
+
private final PhoneProxy mPhoneProxy;
+ private final Listener mListener;
private Phone mPhoneBase;
private final Handler mHandler = new Handler() {
@@ -72,10 +79,11 @@
};
/*package*/
- PstnPhoneCapabilitiesNotifier(PhoneProxy phoneProxy) {
+ PstnPhoneCapabilitiesNotifier(PhoneProxy phoneProxy, Listener listener) {
Preconditions.checkNotNull(phoneProxy);
mPhoneProxy = phoneProxy;
+ mListener = listener;
registerForNotifications();
@@ -117,14 +125,17 @@
Log.d(this, "handleVideoCapabilitesChanged. Video capability - " + isVideoCapable);
PhoneAccountHandle accountHandle =
PhoneUtils.makePstnPhoneAccountHandle(mPhoneProxy);
+
TelecomManager telecomMgr = TelecomManager.from(mPhoneProxy.getContext());
PhoneAccount oldPhoneAccount = telecomMgr.getPhoneAccount(accountHandle);
PhoneAccount.Builder builder = new PhoneAccount.Builder(oldPhoneAccount);
int capabilites = newCapabilities(oldPhoneAccount.getCapabilities(),
PhoneAccount.CAPABILITY_VIDEO_CALLING, isVideoCapable);
+
builder.setCapabilities(capabilites);
telecomMgr.registerPhoneAccount(builder.build());
+ mListener.onVideoCapabilitiesChanged(isVideoCapable);
} catch (Exception e) {
Log.d(this, "handleVideoCapabilitesChanged. Exception=" + e);
}
diff --git a/src/com/android/services/telephony/TelecomAccountRegistry.java b/src/com/android/services/telephony/TelecomAccountRegistry.java
index 866118c..0a78180 100644
--- a/src/com/android/services/telephony/TelecomAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecomAccountRegistry.java
@@ -18,6 +18,7 @@
import android.content.ComponentName;
import android.content.Context;
+import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
@@ -53,11 +54,13 @@
// is not supported, i.e. SubscriptionManager.INVALID_SLOT_ID or the 5th SIM in a phone.
private final static int defaultPhoneAccountIcon = R.drawable.ic_multi_sim;
- private final class AccountEntry {
+ final class AccountEntry implements PstnPhoneCapabilitiesNotifier.Listener {
private final Phone mPhone;
private final PhoneAccount mAccount;
private final PstnIncomingCallNotifier mIncomingCallNotifier;
private final PstnPhoneCapabilitiesNotifier mPhoneCapabilitiesNotifier;
+ private boolean mIsVideoCapable;
+ private boolean mIsVideoPauseSupported;
AccountEntry(Phone phone, boolean isEmergency, boolean isDummy) {
mPhone = phone;
@@ -65,7 +68,8 @@
Log.d(this, "Registered phoneAccount: %s with handle: %s",
mAccount, mAccount.getAccountHandle());
mIncomingCallNotifier = new PstnIncomingCallNotifier((PhoneProxy) mPhone);
- mPhoneCapabilitiesNotifier = new PstnPhoneCapabilitiesNotifier((PhoneProxy) mPhone);
+ mPhoneCapabilitiesNotifier = new PstnPhoneCapabilitiesNotifier((PhoneProxy) mPhone,
+ this);
}
void teardown() {
@@ -101,6 +105,11 @@
String description;
Bitmap iconBitmap = null;
+ // We can only get the real slotId from the SubInfoRecord, we can't calculate the
+ // slotId from the subId or the phoneId in all instances.
+ SubscriptionInfo record =
+ mSubscriptionManager.getActiveSubscriptionInfo(subId);
+
if (isEmergency) {
label = mContext.getResources().getString(R.string.sim_label_emergency_calls);
description =
@@ -111,10 +120,7 @@
description = label = mTelephonyManager.getNetworkOperatorName();
} else {
CharSequence subDisplayName = null;
- // We can only get the real slotId from the SubInfoRecord, we can't calculate the
- // slotId from the subId or the phoneId in all instances.
- SubscriptionInfo record =
- mSubscriptionManager.getActiveSubscriptionInfo(subId);
+
if (record != null) {
subDisplayName = record.getDisplayName();
slotId = record.getSimSlotIndex();
@@ -149,9 +155,13 @@
PhoneAccount.CAPABILITY_PLACE_EMERGENCY_CALLS |
PhoneAccount.CAPABILITY_MULTI_USER;
- if (mPhone.isVideoEnabled()) {
+ mIsVideoCapable = mPhone.isVideoEnabled();
+ if (mIsVideoCapable) {
capabilities |= PhoneAccount.CAPABILITY_VIDEO_CALLING;
}
+ if (record != null) {
+ updateVideoPauseSupport(record);
+ }
if (iconBitmap == null) {
iconBitmap = BitmapFactory.decodeResource(
@@ -179,6 +189,56 @@
public PhoneAccountHandle getPhoneAccountHandle() {
return mAccount != null ? mAccount.getAccountHandle() : null;
}
+
+ /**
+ * Updates indicator for this {@link AccountEntry} to determine if the carrier supports
+ * pause/resume signalling for IMS video calls. The carrier setting is stored in MNC/MCC
+ * configuration files.
+ *
+ * @param subscriptionInfo The subscription info.
+ */
+ private void updateVideoPauseSupport(SubscriptionInfo subscriptionInfo) {
+ // Get the configuration for the MNC/MCC specified in the current subscription info.
+ Configuration configuration = new Configuration();
+ if (subscriptionInfo.getMcc() == 0 && subscriptionInfo.getMnc() == 0) {
+ Configuration config = mContext.getResources().getConfiguration();
+ configuration.mcc = config.mcc;
+ configuration.mnc = config.mnc;
+ Log.i(this, "updateVideoPauseSupport -- no mcc/mnc for sub: " + subscriptionInfo +
+ " using mcc/mnc from main context: " + configuration.mcc + "/" +
+ configuration.mnc);
+ } else {
+ Log.i(this, "updateVideoPauseSupport -- mcc/mnc for sub: " + subscriptionInfo);
+
+ configuration.mcc = subscriptionInfo.getMcc();
+ configuration.mnc = subscriptionInfo.getMnc();
+ }
+
+ // Load the MNC/MCC specific configuration.
+ Context subContext = mContext.createConfigurationContext(configuration);
+ mIsVideoPauseSupported = subContext.getResources().getBoolean(
+ R.bool.support_pause_ims_video_calls);
+ }
+
+ /**
+ * Receives callback from {@link PstnPhoneCapabilitiesNotifier} when the video capabilities
+ * have changed.
+ *
+ * @param isVideoCapable {@code true} if video is capable.
+ */
+ @Override
+ public void onVideoCapabilitiesChanged(boolean isVideoCapable) {
+ mIsVideoCapable = isVideoCapable;
+ }
+
+ /**
+ * Indicates whether this account supports pausing video calls.
+ * @return {@code true} if the account supports pausing video calls, {@code false}
+ * otherwise.
+ */
+ public boolean isVideoPauseSupported() {
+ return mIsVideoCapable && mIsVideoPauseSupported;
+ }
}
private OnSubscriptionsChangedListener mOnSubscriptionsChangedListener =
@@ -238,6 +298,22 @@
}
/**
+ * Determines if the {@link AccountEntry} associated with a {@link PhoneAccountHandle} supports
+ * pausing video calls.
+ *
+ * @param handle The {@link PhoneAccountHandle}.
+ * @return {@code True} if video pausing is supported.
+ */
+ boolean isVideoPauseSupported(PhoneAccountHandle handle) {
+ for (AccountEntry entry : mAccounts) {
+ if (entry.getPhoneAccountHandle().equals(handle)) {
+ return entry.isVideoPauseSupported();
+ }
+ }
+ return false;
+ }
+
+ /**
* Sets up all the phone accounts for SIMs on first boot.
*/
void setupOnBoot() {
@@ -255,6 +331,7 @@
// because this could signal a removal or addition of a SIM in a single SIM phone.
mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_SERVICE_STATE);
}
+
/**
* Determines if the list of {@link AccountEntry}(s) contains an {@link AccountEntry} with a
* specified {@link PhoneAccountHandle}.
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 1df63e7..10c5e4a 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -249,6 +249,12 @@
private boolean mHasHighDefAudio;
/**
+ * For video calls, indicates whether the outgoing video for the call can be paused using
+ * the {@link android.telecom.VideoProfile.VideoState#PAUSED} VideoState.
+ */
+ private boolean mIsVideoPauseSupported;
+
+ /**
* Listeners to our TelephonyConnection specific callbacks
*/
private final Set<TelephonyConnectionListener> mTelephonyListeners = Collections.newSetFromMap(
@@ -481,6 +487,8 @@
newCapabilities = changeCapability(newCapabilities,
CAPABILITY_HIGH_DEF_AUDIO, mHasHighDefAudio);
newCapabilities = changeCapability(newCapabilities, CAPABILITY_WIFI, mIsWifi);
+ newCapabilities = changeCapability(newCapabilities, CAPABILITY_CAN_PAUSE_VIDEO,
+ mIsVideoPauseSupported && mRemoteVideoCapable && mLocalVideoCapable);
newCapabilities = applyConferenceTerminationCapabilities(newCapabilities);
@@ -848,6 +856,16 @@
}
/**
+ * For video calls, sets whether this connection supports pausing the outgoing video for the
+ * call using the {@link android.telecom.VideoProfile.VideoState#PAUSED} VideoState.
+ *
+ * @param isVideoPauseSupported {@code true} if pause state supported, {@code false} otherwise.
+ */
+ public void setVideoPauseSupported(boolean isVideoPauseSupported) {
+ mIsVideoPauseSupported = isVideoPauseSupported;
+ }
+
+ /**
* Whether the original connection is an IMS connection.
* @return {@code True} if the original connection is an IMS connection, {@code false}
* otherwise.
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 39dbfc1..eba3461 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -184,7 +184,7 @@
}
final TelephonyConnection connection =
- createConnectionFor(phone, null, true /* isOutgoing */);
+ createConnectionFor(phone, null, true /* isOutgoing */, request.getAccountHandle());
if (connection == null) {
return Connection.createFailedConnection(
DisconnectCauseUtil.toTelecomDisconnectCause(
@@ -257,9 +257,9 @@
}
Connection connection =
- createConnectionFor(phone, originalConnection, false /* isOutgoing */);
+ createConnectionFor(phone, originalConnection, false /* isOutgoing */,
+ request.getAccountHandle());
if (connection == null) {
- connection = Connection.createCanceledConnection();
return Connection.createCanceledConnection();
} else {
return connection;
@@ -307,7 +307,8 @@
TelephonyConnection connection =
createConnectionFor(phone, unknownConnection,
- !unknownConnection.isIncoming() /* isOutgoing */);
+ !unknownConnection.isIncoming() /* isOutgoing */,
+ request.getAccountHandle());
if (connection == null) {
return Connection.createCanceledConnection();
@@ -367,7 +368,8 @@
private TelephonyConnection createConnectionFor(
Phone phone,
com.android.internal.telephony.Connection originalConnection,
- boolean isOutgoing) {
+ boolean isOutgoing,
+ PhoneAccountHandle phoneAccountHandle) {
TelephonyConnection returnConnection = null;
int phoneType = phone.getPhoneType();
if (phoneType == TelephonyManager.PHONE_TYPE_GSM) {
@@ -380,6 +382,9 @@
if (returnConnection != null) {
// Listen to Telephony specific callbacks from the connection
returnConnection.addTelephonyConnectionListener(mTelephonyConnectionListener);
+ returnConnection.setVideoPauseSupported(
+ TelecomAccountRegistry.getInstance(this).isVideoPauseSupported(
+ phoneAccountHandle));
}
return returnConnection;
}