Use new SmsController API for sending vvm sms.
Test: manual
Bug: 131312125
Merged-in: Ibf5d8e1f4060b38a719a0f9403c2299f1b71d6b2
Change-Id: Ibf5d8e1f4060b38a719a0f9403c2299f1b71d6b2
(cherry picked from commit dccb3f1fbaa184636f4fa327ed69bf3db7e9ff97)
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 2cd63ae..f32bf02 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -79,7 +79,6 @@
import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
-import android.telephony.SmsManager;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyHistogram;
@@ -140,6 +139,7 @@
import com.android.internal.telephony.ServiceStateTracker;
import com.android.internal.telephony.SmsApplication;
import com.android.internal.telephony.SmsApplication.SmsApplicationData;
+import com.android.internal.telephony.SmsController;
import com.android.internal.telephony.SubscriptionController;
import com.android.internal.telephony.TelephonyPermissions;
import com.android.internal.telephony.dataconnection.ApnSettingUtils;
@@ -164,7 +164,6 @@
import java.io.FileDescriptor;
import java.io.PrintWriter;
-import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -2655,22 +2654,11 @@
mAppOps.checkPackage(Binder.getCallingUid(), callingPackage);
enforceVisualVoicemailPackage(callingPackage, subId);
enforceSendSmsPermission();
- // Make the calls as the phone process.
- final long identity = Binder.clearCallingIdentity();
- try {
- SmsManager smsManager = SmsManager.getSmsManagerForSubscriptionId(subId);
- if (port == 0) {
- smsManager.sendTextMessageWithSelfPermissions(number, null, text,
- sentIntent, null, false);
- } else {
- byte[] data = text.getBytes(StandardCharsets.UTF_8);
- smsManager.sendDataMessageWithSelfPermissions(number, null,
- (short) port, data, sentIntent, null);
- }
- } finally {
- Binder.restoreCallingIdentity(identity);
- }
+ SmsController smsController = PhoneFactory.getSmsController();
+ smsController.sendVisualVoicemailSmsForSubscriber(callingPackage, subId, number, port, text,
+ sentIntent);
}
+
/**
* Sets the voice activation state of a given subId.
*/