Merge "Import translations. DO NOT MERGE"
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml
index 713063c..c1f3332 100644
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -441,7 +441,7 @@
<string name="deleting_fdn_contact" msgid="5669163206349319969">"正在删除固定拨号联系人..."</string>
<string name="fdn_contact_deleted" msgid="7154162327112259569">"已删除固定拨号联系人。"</string>
<string name="pin2_invalid" msgid="5470854099230755944">"固定拨号未更新,因为输入的 PIN 码有误。"</string>
- <string name="fdn_invalid_number" msgid="2062898833049589309">"未能更新 FDN,因为号码超过 20 位数。"</string>
+ <string name="fdn_invalid_number" msgid="2062898833049589309">"未能更新 FDN,因为号码超过 <xliff:g id="FDN_NUMBER_LIMIT_LENGTH">%d</xliff:g> 位数。"</string>
<string name="pin2_or_fdn_invalid" msgid="6025144083384701197">"固定拨号未更新。PIN2 码有误,或电话号码遭拒。"</string>
<string name="fdn_failed" msgid="540018079008319747">"固定拨号操作失败。"</string>
<string name="simContacts_emptyLoading" msgid="2203331234764498011">"正在从SIM卡读取..."</string>
diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml
index 606f059..679ecdd 100644
--- a/res/values-zh-rTW/strings.xml
+++ b/res/values-zh-rTW/strings.xml
@@ -443,7 +443,7 @@
<string name="deleting_fdn_contact" msgid="5669163206349319969">"正在刪除固定撥號…"</string>
<string name="fdn_contact_deleted" msgid="7154162327112259569">"已刪除固定撥號。"</string>
<string name="pin2_invalid" msgid="5470854099230755944">"您所輸入的 PIN 不正確,因此未更新 FDN。"</string>
- <string name="fdn_invalid_number" msgid="2062898833049589309">"固定撥號的號碼超過 20 位數,因此無法更新。"</string>
+ <string name="fdn_invalid_number" msgid="2062898833049589309">"固定撥號的號碼超過 <xliff:g id="FDN_NUMBER_LIMIT_LENGTH">%d</xliff:g> 位數,因此無法更新。"</string>
<string name="pin2_or_fdn_invalid" msgid="6025144083384701197">"未更新 FDN。可能是因為 PIN2 碼不正確或電話號碼遭拒。"</string>
<string name="fdn_failed" msgid="540018079008319747">"FDN 操作失敗。"</string>
<string name="simContacts_emptyLoading" msgid="2203331234764498011">"正在從 SIM 卡讀取…"</string>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1fc2d6f..dfec1d8 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -977,7 +977,7 @@
<!-- FDN settings: error message displayed in a popup (toast) -->
<string name="pin2_invalid">FDN wasn\'t updated because you typed an incorrect PIN.</string>
<!-- FDN settings: error message displayed in a popup (toast) -->
- <string name="fdn_invalid_number">FDN wasn\'t updated because the number exceeds 20 digits.</string>
+ <string name="fdn_invalid_number">FDN wasn\'t updated because the number exceeds <xliff:g id="FDN_NUMBER_LIMIT_LENGTH">%d</xliff:g> digits.</string>
<!-- FDN settings: error message displayed in a popup (toast), when the entered
FDN number was inappropriate, OR, PIN2 the user entered was incorrect.
Because of API restriction, there's no way to determine which is the exact
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 8847e17..b122743 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -99,6 +99,7 @@
import android.telephony.gsm.GsmCellLocation;
import android.telephony.ims.ImsException;
import android.telephony.ims.ProvisioningManager;
+import android.telephony.ims.RegistrationManager;
import android.telephony.ims.aidl.IImsCapabilityCallback;
import android.telephony.ims.aidl.IImsConfig;
import android.telephony.ims.aidl.IImsConfigCallback;
@@ -2951,6 +2952,74 @@
}
}
+ /**
+ * Get the IMS service registration state for the MmTelFeature associated with this sub id.
+ */
+ @Override
+ public void getImsMmTelRegistrationState(int subId, IIntegerConsumer consumer) {
+ enforceReadPrivilegedPermission("getImsMmTelRegistrationState");
+ if (!ImsManager.isImsSupportedOnDevice(mApp)) {
+ throw new ServiceSpecificException(ImsException.CODE_ERROR_UNSUPPORTED_OPERATION,
+ "IMS not available on device.");
+ }
+ final long token = Binder.clearCallingIdentity();
+ try {
+ Phone phone = getPhone(subId);
+ if (phone == null) {
+ Log.w(LOG_TAG, "getImsMmTelRegistrationState: called with an invalid subscription '"
+ + subId + "'");
+ throw new ServiceSpecificException(ImsException.CODE_ERROR_INVALID_SUBSCRIPTION);
+ }
+ phone.getImsRegistrationState(regState -> {
+ try {
+ consumer.accept((regState == null)
+ ? RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED : regState);
+ } catch (RemoteException e) {
+ // Ignore if the remote process is no longer available to call back.
+ Log.w(LOG_TAG, "getImsMmTelRegistrationState: callback not available.");
+ }
+ });
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ }
+
+ /**
+ * Get the transport type for the IMS service registration state.
+ */
+ @Override
+ public void getImsMmTelRegistrationTransportType(int subId, IIntegerConsumer consumer) {
+ enforceReadPrivilegedPermission("getImsMmTelRegistrationTransportType");
+ if (!ImsManager.isImsSupportedOnDevice(mApp)) {
+ throw new ServiceSpecificException(ImsException.CODE_ERROR_UNSUPPORTED_OPERATION,
+ "IMS not available on device.");
+ }
+ final long token = Binder.clearCallingIdentity();
+ try {
+ Phone phone = getPhone(subId);
+ if (phone == null) {
+ Log.w(LOG_TAG, "getImsMmTelRegistrationState: called with an invalid subscription '"
+ + subId + "'");
+ throw new ServiceSpecificException(ImsException.CODE_ERROR_INVALID_SUBSCRIPTION);
+ }
+ phone.getImsRegistrationTech(regTech -> {
+ // Convert registration tech from ImsRegistrationImplBase -> RegistrationManager
+ int regTechConverted = (regTech == null)
+ ? ImsRegistrationImplBase.REGISTRATION_TECH_NONE : regTech;
+ regTechConverted = RegistrationManager.IMS_REG_TO_ACCESS_TYPE_MAP.get(
+ regTechConverted);
+ try {
+ consumer.accept(regTechConverted);
+ } catch (RemoteException e) {
+ // Ignore if the remote process is no longer available to call back.
+ Log.w(LOG_TAG, "getImsMmTelRegistrationState: callback not available.");
+ }
+ });
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ }
+
@Override
public void registerMmTelCapabilityCallback(int subId, IImsCapabilityCallback c)
throws RemoteException {
diff --git a/src/com/android/phone/settings/fdn/EditFdnContactScreen.java b/src/com/android/phone/settings/fdn/EditFdnContactScreen.java
index c358e27..0eda140 100644
--- a/src/com/android/phone/settings/fdn/EditFdnContactScreen.java
+++ b/src/com/android/phone/settings/fdn/EditFdnContactScreen.java
@@ -29,6 +29,7 @@
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
+import android.os.PersistableBundle;
import android.provider.ContactsContract.CommonDataKinds;
import android.telephony.PhoneNumberUtils;
import android.text.Editable;
@@ -52,6 +53,7 @@
import com.android.phone.PhoneGlobals;
import com.android.phone.R;
import com.android.phone.SubscriptionInfoHelper;
+import android.telephony.CarrierConfigManager;
/**
* Activity to let the user add or edit an FDN contact.
@@ -100,6 +102,7 @@
}
/** flag to track saving state */
private boolean mDataBusy;
+ private int mFdnNumberLimitLength = 20;
@Override
protected void onCreate(Bundle icicle) {
@@ -111,6 +114,17 @@
setContentView(R.layout.edit_fdn_contact_screen);
setupView();
setTitle(mAddContact ? R.string.add_fdn_contact : R.string.edit_fdn_contact);
+ PersistableBundle b = null;
+ if (mSubscriptionInfoHelper.hasSubId()) {
+ b = PhoneGlobals.getInstance().getCarrierConfigForSubId(
+ mSubscriptionInfoHelper.getSubId());
+ } else {
+ b = PhoneGlobals.getInstance().getCarrierConfig();
+ }
+ if (b != null) {
+ mFdnNumberLimitLength = b.getInt(
+ CarrierConfigManager.KEY_FDN_NUMBER_LENGTH_LIMIT_INT);
+ }
displayProgress(false);
}
@@ -294,7 +308,7 @@
* TODO: Fix this logic.
*/
private boolean isValidNumber(String number) {
- return (number.length() <= 20) && (number.length() > 0);
+ return (number.length() <= mFdnNumberLimitLength) && (number.length() > 0);
}
@@ -397,7 +411,8 @@
} else {
if (DBG) log("handleResult: failed!");
if (invalidNumber) {
- showStatus(getResources().getText(R.string.fdn_invalid_number));
+ showStatus(getResources().getString(R.string.fdn_invalid_number,
+ mFdnNumberLimitLength));
} else {
if (PhoneFactory.getDefaultPhone().getIccCard().getIccPin2Blocked()) {
showStatus(getResources().getText(R.string.fdn_enable_puk2_requested));
diff --git a/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/ImsRegistrationActivity.java b/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/ImsRegistrationActivity.java
index 4ee9355..139f8ac 100644
--- a/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/ImsRegistrationActivity.java
+++ b/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/ImsRegistrationActivity.java
@@ -24,6 +24,7 @@
import android.telephony.ims.ImsException;
import android.telephony.ims.ImsMmTelManager;
import android.telephony.ims.ImsReasonInfo;
+import android.telephony.ims.RegistrationManager;
import android.telephony.ims.stub.ImsRegistrationImplBase;
import android.util.ArrayMap;
import android.util.Log;
@@ -103,8 +104,8 @@
}
- private final ImsMmTelManager.RegistrationCallback mRegistrationCallback =
- new ImsMmTelManager.RegistrationCallback() {
+ private final RegistrationManager.RegistrationCallback mRegistrationCallback =
+ new RegistrationManager.RegistrationCallback() {
@Override
public void onRegistered(int imsRadioTech) {
@@ -181,7 +182,7 @@
try {
mImsManager = ImsMmTelManager.createForSubscriptionId(
SubscriptionManager.getDefaultVoiceSubscriptionId());
- mImsManager.registerImsRegistrationCallback(getMainExecutor(), mRegistrationCallback);
+ mImsManager.registerImsRegistrationCallback(mRegistrationCallback, getMainExecutor());
} catch (IllegalArgumentException | ImsException e) {
Log.w("ImsCallingActivity", "illegal subscription ID.");
}