Merge "Import translations. DO NOT MERGE ANYWHERE" into sc-dev
diff --git a/src/com/android/phone/ImsRcsController.java b/src/com/android/phone/ImsRcsController.java
index bcc312c..90c9df4 100644
--- a/src/com/android/phone/ImsRcsController.java
+++ b/src/com/android/phone/ImsRcsController.java
@@ -94,7 +94,7 @@
mApp = app;
TelephonyFrameworkInitializer
.getTelephonyServiceManager().getTelephonyImsServiceRegisterer().register(this);
- mImsResolver = mApp.getImsResolver();
+ mImsResolver = ImsResolver.getInstance();
}
/**
diff --git a/src/com/android/phone/PhoneGlobals.java b/src/com/android/phone/PhoneGlobals.java
index da3b08d..130c775 100644
--- a/src/com/android/phone/PhoneGlobals.java
+++ b/src/com/android/phone/PhoneGlobals.java
@@ -157,7 +157,6 @@
CallNotifier notifier;
CallerInfoCache callerInfoCache;
NotificationMgr notificationMgr;
- ImsResolver mImsResolver;
TelephonyRcsService mTelephonyRcsService;
public PhoneInterfaceManager phoneMgr;
public ImsRcsController imsRcsController;
@@ -408,10 +407,10 @@
R.string.config_ims_mmtel_package);
String defaultImsRcsPackage = getResources().getString(
R.string.config_ims_rcs_package);
- mImsResolver = new ImsResolver(this, defaultImsMmtelPackage,
+ ImsResolver.make(this, defaultImsMmtelPackage,
defaultImsRcsPackage, PhoneFactory.getPhones().length,
new ImsFeatureBinderRepository());
- mImsResolver.initialize();
+ ImsResolver.getInstance().initialize();
// With the IMS phone created, load static config.xml values from the phone process
// so that it can be provided to the ImsPhoneCallTracker.
@@ -564,10 +563,6 @@
return PhoneFactory.getPhone(SubscriptionManager.getPhoneId(subId));
}
- public ImsResolver getImsResolver() {
- return mImsResolver;
- }
-
/* package */ CallManager getCallManager() {
return mCM;
}
@@ -1033,7 +1028,7 @@
pw.println("ImsResolver:");
pw.increaseIndent();
try {
- if (mImsResolver != null) mImsResolver.dump(fd, pw, args);
+ if (ImsResolver.getInstance() != null) ImsResolver.getInstance().dump(fd, pw, args);
} catch (Exception e) {
e.printStackTrace();
}
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 65b8e1f..f3a0a26 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -140,6 +140,7 @@
import com.android.internal.telephony.CallForwardInfo;
import com.android.internal.telephony.CallManager;
import com.android.internal.telephony.CallStateException;
+import com.android.internal.telephony.CallTracker;
import com.android.internal.telephony.CarrierResolver;
import com.android.internal.telephony.CellNetworkScanResult;
import com.android.internal.telephony.CommandException;
@@ -2163,7 +2164,7 @@
private PhoneInterfaceManager(PhoneGlobals app) {
mApp = app;
mCM = PhoneGlobals.getInstance().mCM;
- mImsResolver = PhoneGlobals.getInstance().getImsResolver();
+ mImsResolver = ImsResolver.getInstance();
mUserManager = (UserManager) app.getSystemService(Context.USER_SERVICE);
mAppOps = (AppOpsManager)app.getSystemService(Context.APP_OPS_SERVICE);
mPm = app.getSystemService(PackageManager.class);
@@ -10254,6 +10255,32 @@
}
}
+ @Override
+ public void setDeviceToDeviceForceEnabled(boolean isForceEnabled) {
+ TelephonyPermissions.enforceShellOnly(Binder.getCallingUid(),
+ "setDeviceToDeviceForceEnabled");
+
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ Arrays.stream(PhoneFactory.getPhones()).forEach(
+ p -> {
+ Phone thePhone = p.getImsPhone();
+ if (thePhone != null && thePhone instanceof ImsPhone) {
+ ImsPhone imsPhone = (ImsPhone) thePhone;
+ CallTracker tracker = imsPhone.getCallTracker();
+ if (tracker != null && tracker instanceof ImsPhoneCallTracker) {
+ ImsPhoneCallTracker imsPhoneCallTracker =
+ (ImsPhoneCallTracker) tracker;
+ imsPhoneCallTracker.setDeviceToDeviceForceEnabled(isForceEnabled);
+ }
+ }
+ }
+ );
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ }
+
/**
* Gets the config of RCS VoLTE single registration enabled for the device.
*/
diff --git a/src/com/android/phone/SimPhonebookProvider.java b/src/com/android/phone/SimPhonebookProvider.java
index 4a15950..b921398 100644
--- a/src/com/android/phone/SimPhonebookProvider.java
+++ b/src/com/android/phone/SimPhonebookProvider.java
@@ -16,6 +16,9 @@
package com.android.phone;
+import static com.android.internal.telephony.IccProvider.STR_NEW_TAG;
+import static com.android.internal.telephony.IccProvider.STR_NEW_NUMBER;
+
import android.Manifest;
import android.annotation.TestApi;
import android.content.ContentProvider;
@@ -662,8 +665,11 @@
private boolean updateRecord(PhonebookArgs args, AdnRecord existingRecord, String pin2,
String newName, String newPhone) {
try {
+ ContentValues values = new ContentValues();
+ values.put(STR_NEW_TAG, newName);
+ values.put(STR_NEW_NUMBER, newPhone);
return mIccPhoneBookSupplier.get().updateAdnRecordsInEfByIndexForSubscriber(
- args.subscriptionId, existingRecord.getEfid(), newName, newPhone,
+ args.subscriptionId, existingRecord.getEfid(), values,
existingRecord.getRecId(),
pin2);
} catch (RemoteException e) {
diff --git a/src/com/android/phone/TelephonyShellCommand.java b/src/com/android/phone/TelephonyShellCommand.java
index d2a3c40..c83ea64 100644
--- a/src/com/android/phone/TelephonyShellCommand.java
+++ b/src/com/android/phone/TelephonyShellCommand.java
@@ -133,6 +133,7 @@
private static final String D2D_SUBCOMMAND = "d2d";
private static final String D2D_SEND = "send";
private static final String D2D_TRANSPORT = "transport";
+ private static final String D2D_SET_DEVICE_SUPPORT = "set-device-support";
private static final String BARRING_SUBCOMMAND = "barring";
private static final String BARRING_SEND_INFO = "send";
@@ -383,6 +384,10 @@
pw.println(" d2d transport TYPE");
pw.println(" Forces the specified D2D transport TYPE to be active. Use the");
pw.println(" short class name of the transport; i.e. DtmfTransport or RtpTransport.");
+ pw.println(" d2d set-device-support true/default");
+ pw.println(" true - forces device support to be enabled for D2D.");
+ pw.println(" default - clear any previously set force-enable of D2D, reverting to ");
+ pw.println(" the current device's configuration.");
}
private void onHelpBarring() {
@@ -916,6 +921,9 @@
case D2D_TRANSPORT: {
return handleD2dTransportCommand();
}
+ case D2D_SET_DEVICE_SUPPORT: {
+ return handleD2dDeviceSupportedCommand();
+ }
}
return -1;
@@ -1067,6 +1075,26 @@
return 0;
}
+ private int handleD2dDeviceSupportedCommand() {
+ PrintWriter errPw = getErrPrintWriter();
+
+ String arg = getNextArg();
+ if (arg == null) {
+ onHelpD2D();
+ return 0;
+ }
+
+ boolean isEnabled = "true".equals(arg.toLowerCase());
+ try {
+ mInterface.setDeviceToDeviceForceEnabled(isEnabled);
+ } catch (RemoteException e) {
+ Log.w(LOG_TAG, "Error forcing D2D enabled: " + e.getMessage());
+ errPw.println("Exception: " + e.getMessage());
+ return -1;
+ }
+ return 0;
+ }
+
// ims set-ims-service
private int handleImsSetServiceCommand() {
PrintWriter errPw = getErrPrintWriter();
diff --git a/tests/src/com/android/phone/SimPhonebookProviderTest.java b/tests/src/com/android/phone/SimPhonebookProviderTest.java
index 4ab92a7..f897fac 100644
--- a/tests/src/com/android/phone/SimPhonebookProviderTest.java
+++ b/tests/src/com/android/phone/SimPhonebookProviderTest.java
@@ -51,6 +51,7 @@
import androidx.test.rule.provider.ProviderTestRule;
import com.android.internal.telephony.IIccPhoneBook;
+import com.android.internal.telephony.uicc.AdnCapacity;
import com.android.internal.telephony.uicc.AdnRecord;
import com.android.internal.telephony.uicc.IccConstants;
@@ -1394,15 +1395,18 @@
}
@Override
- public boolean updateAdnRecordsInEfBySearch(int efid, String oldTag, String oldPhoneNumber,
- String newTag, String newPhoneNumber, String pin2) {
- return updateAdnRecordsInEfBySearchForSubscriber(
- mDefaultSubscriptionId, efid,
- oldTag, oldPhoneNumber, newTag, newPhoneNumber, pin2);
+ public boolean updateAdnRecordsInEfBySearchForSubscriber(int subId, int efid,
+ ContentValues values, String pin2) {
+ final String oldTag = values.getAsString(IccProvider.STR_TAG);
+ final String oldPhoneNumber = values.getAsString(IccProvider.STR_NUMBER);
+ final String newTag = values.getAsString(IccProvider.STR_NEW_TAG);
+ final String newPhoneNumber = values.getAsString(IccProvider.STR_NEW_NUMBER);
+ return updateAdnRecordsInEfBySearchForSubscriber(subId, efid, oldTag, oldPhoneNumber,
+ newTag, newPhoneNumber, pin2);
+
}
- @Override
- public boolean updateAdnRecordsInEfBySearchForSubscriber(int subId, int efid, String oldTag,
+ private boolean updateAdnRecordsInEfBySearchForSubscriber(int subId, int efid, String oldTag,
String oldPhoneNumber, String newTag, String newPhoneNumber, String pin2) {
if (!oldTag.isEmpty() || !oldPhoneNumber.isEmpty()) {
throw new IllegalArgumentException(
@@ -1413,14 +1417,16 @@
}
@Override
- public boolean updateAdnRecordsInEfByIndex(int efid, String newTag, String newPhoneNumber,
- int index, String pin2) {
- return updateAdnRecordsInEfByIndexForSubscriber(mDefaultSubscriptionId,
- efid, newTag, newPhoneNumber, index, pin2);
+ public boolean updateAdnRecordsInEfByIndexForSubscriber(int subId, int efid,
+ ContentValues values, int index, String pin2) {
+ final String newTag = values.getAsString(IccProvider.STR_NEW_TAG);
+ final String newPhoneNumber = values.getAsString(IccProvider.STR_NEW_NUMBER);
+ return updateAdnRecordsInEfByIndexForSubscriber(subId, efid, newTag, newPhoneNumber,
+ index, pin2);
+
}
- @Override
- public boolean updateAdnRecordsInEfByIndexForSubscriber(int subId, int efid, String newTag,
+ private boolean updateAdnRecordsInEfByIndexForSubscriber(int subId, int efid, String newTag,
String newPhoneNumber, int index, String pin2) {
AdnRecord[] records = mRecords.computeIfAbsent(Pair.create(subId, efid), unused ->
createEmptyRecords(efid, 100));
@@ -1443,6 +1449,11 @@
int count = mRecords.get(key).length;
return new int[]{recordSize, recordSize * count, count};
}
+
+ @Override
+ public AdnCapacity getAdnRecordsCapacityForSubscriber(int subId) {
+ return new AdnCapacity(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+ }
}
/**