Merge "Enable modem with SatelliteModemEnableRequestAttributes" into main
diff --git a/flags/calling.aconfig b/flags/calling.aconfig
index 3bce279..550340f 100644
--- a/flags/calling.aconfig
+++ b/flags/calling.aconfig
@@ -4,7 +4,6 @@
# OWNER=breadley TARGET=24Q3
flag {
name: "simultaneous_calling_indications"
- is_exported: true
namespace: "telephony"
description: "APIs that are used to notify simultaneous calling changes to other applications."
bug: "297446980"
@@ -50,4 +49,5 @@
metadata {
purpose: PURPOSE_BUGFIX
}
+ is_exported: true
}
diff --git a/flags/data.aconfig b/flags/data.aconfig
index 97b1229..a993d51 100644
--- a/flags/data.aconfig
+++ b/flags/data.aconfig
@@ -34,45 +34,6 @@
}
}
-# OWNER=linggm TARGET=24Q2
-flag {
- name: "use_alarm_callback"
- namespace: "telephony"
- description: "Use alarm callback instead of broadcast."
- bug: "311476875"
-}
-
-# OWNER=linggm TARGET=24Q2
-flag {
- name: "refine_preferred_data_profile_selection"
- namespace: "telephony"
- description: "Upon internet network connect, refine selection of preferred data profile."
- bug: "311476883"
-}
-
-# OWNER=linggm TARGET=24Q2
-flag {
- name: "unthrottle_check_transport"
- namespace: "telephony"
- description: "Check transport when unthrottle."
- bug: "303922311"
-}
-
-# OWNER=linggm TARGET=24Q2
-flag {
- name: "allow_mmtel_in_non_vops"
- namespace: "telephony"
- description: "Allow bring up MMTEL in nonVops area specified by carrier config."
- bug: "241198464"
-}
-
-# OWNER=jackyu TARGET=24Q2
-flag {
- name: "metered_embb_urlcc"
- namespace: "telephony"
- description: "Force networks that have PRIORITIZE_BANDWIDTH or PRIORITIZE_LATENCY to be metered."
- bug: "301310451"
- }
# OWNER=sarahchin TARGET=24Q3
flag {
@@ -101,14 +62,6 @@
bug:"286171724"
}
-# OWNER=nagendranb TARGET=24Q2
-flag {
- name: "notify_data_activity_changed_with_slot"
- namespace: "telephony"
- description: "notify data activity changed for slot id"
- bug: "309896936"
-}
-
# OWNER=qingqi TARGET=24Q3
flag {
name: "vonr_enabled_metric"
@@ -117,14 +70,6 @@
bug:"288449751"
}
-# OWNER=willycwhu TARGET=24Q2
-flag {
- name: "ignore_existing_networks_for_internet_allowed_checking"
- namespace: "telephony"
- description: "Ignore existing networks when checking if internet is allowed"
- bug: "284420611"
-}
-
# OWNER=apsankar TARGET=24Q3
flag {
name: "data_call_session_stats_captures_cross_sim_calling"
@@ -133,14 +78,6 @@
bug: "313956117"
}
-# OWNER=jackyu TARGET=24Q2
-flag {
- name: "force_iwlan_mms"
- namespace: "telephony"
- description: "When QNS prefers MMS on IWLAN, MMS will be attempted on IWLAN if it can, even though if existing cellular network already supports MMS."
- bug: "316211526"
-}
-
# OWNER=sewook TARGET=24Q3
flag {
name: "reconnect_qualified_network"
diff --git a/src/java/com/android/internal/telephony/DefaultPhoneNotifier.java b/src/java/com/android/internal/telephony/DefaultPhoneNotifier.java
index a6d24f2..da17f60 100644
--- a/src/java/com/android/internal/telephony/DefaultPhoneNotifier.java
+++ b/src/java/com/android/internal/telephony/DefaultPhoneNotifier.java
@@ -135,13 +135,9 @@
int subId = sender.getSubId();
- if (mFeatureFlags.notifyDataActivityChangedWithSlot()) {
- int phoneId = sender.getPhoneId();
- mTelephonyRegistryMgr.notifyDataActivityChanged(phoneId, subId,
- sender.getDataActivityState());
- } else {
- mTelephonyRegistryMgr.notifyDataActivityChanged(subId, sender.getDataActivityState());
- }
+ int phoneId = sender.getPhoneId();
+ mTelephonyRegistryMgr.notifyDataActivityChanged(phoneId, subId,
+ sender.getDataActivityState());
}
@Override
diff --git a/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java b/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java
index bb772ab..3141406 100644
--- a/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java
+++ b/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java
@@ -406,15 +406,15 @@
* A permissions check before passing to {@link IccSmsInterfaceManager#sendDataInternal}.
* This method checks if the calling package or itself has the permission to send the data sms.
*/
- public void sendDataWithSelfPermissions(String callingPackage, String callingAttributionTag,
- String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent,
- PendingIntent deliveryIntent, boolean isForVvm) {
+ public void sendDataWithSelfPermissions(String callingPackage, int callingUser,
+ String callingAttributionTag, String destAddr, String scAddr, int destPort, byte[] data,
+ PendingIntent sentIntent, PendingIntent deliveryIntent, boolean isForVvm) {
if (!mSmsPermissions.checkCallingOrSelfCanSendSms(callingPackage, callingAttributionTag,
"Sending SMS message")) {
returnUnspecifiedFailure(sentIntent);
return;
}
- sendDataInternal(callingPackage, destAddr, scAddr, destPort, data, sentIntent,
+ sendDataInternal(callingPackage, callingUser, destAddr, scAddr, destPort, data, sentIntent,
deliveryIntent, isForVvm);
}
@@ -424,9 +424,9 @@
*/
@Deprecated
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
- public void sendData(String callingPackage, String destAddr, String scAddr, int destPort,
- byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent) {
- sendData(callingPackage, null, destAddr, scAddr, destPort, data,
+ public void sendData(String callingPackage, int callingUser, String destAddr, String scAddr,
+ int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent) {
+ sendData(callingPackage, callingUser, null, destAddr, scAddr, destPort, data,
sentIntent, deliveryIntent);
}
@@ -434,7 +434,7 @@
* A permissions check before passing to {@link IccSmsInterfaceManager#sendDataInternal}.
* This method checks only if the calling package has the permission to send the data sms.
*/
- public void sendData(String callingPackage, String callingAttributionTag,
+ public void sendData(String callingPackage, int callingUser, String callingAttributionTag,
String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent,
PendingIntent deliveryIntent) {
if (!mSmsPermissions.checkCallingCanSendSms(callingPackage, callingAttributionTag,
@@ -442,7 +442,7 @@
returnUnspecifiedFailure(sentIntent);
return;
}
- sendDataInternal(callingPackage, destAddr, scAddr, destPort, data, sentIntent,
+ sendDataInternal(callingPackage, callingUser, destAddr, scAddr, destPort, data, sentIntent,
deliveryIntent, false /* isForVvm */);
}
@@ -473,17 +473,17 @@
* raw pdu of the status report is in the extended data ("pdu").
*/
- private void sendDataInternal(String callingPackage, String destAddr, String scAddr,
- int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent,
- boolean isForVvm) {
+ private void sendDataInternal(String callingPackage, int callinUser, String destAddr,
+ String scAddr, int destPort, byte[] data, PendingIntent sentIntent,
+ PendingIntent deliveryIntent, boolean isForVvm) {
if (Rlog.isLoggable("SMS", Log.VERBOSE)) {
log("sendData: destAddr=" + destAddr + " scAddr=" + scAddr + " destPort="
+ destPort + " data='" + HexDump.toHexString(data) + "' sentIntent="
+ sentIntent + " deliveryIntent=" + deliveryIntent + " isForVVM=" + isForVvm);
}
destAddr = filterDestAddress(destAddr);
- mDispatchersController.sendData(callingPackage, destAddr, scAddr, destPort, data,
- sentIntent, deliveryIntent, isForVvm);
+ mDispatchersController.sendData(callingPackage, callinUser, destAddr, scAddr,
+ destPort, data, sentIntent, deliveryIntent, isForVvm);
}
/**
@@ -491,12 +491,13 @@
* This method checks only if the calling package has the permission to send the sms.
* Note: SEND_SMS permission should be checked by the caller of this method
*/
- public void sendText(String callingPackage, String destAddr, String scAddr,
+ public void sendText(String callingPackage, int callingUser, String destAddr, String scAddr,
String text, PendingIntent sentIntent, PendingIntent deliveryIntent,
boolean persistMessageForNonDefaultSmsApp, long messageId, boolean skipShortCodeCheck) {
- sendTextInternal(callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent,
- persistMessageForNonDefaultSmsApp, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED,
- false /* expectMore */, SMS_MESSAGE_PERIOD_NOT_SPECIFIED, false /* isForVvm */,
+ sendTextInternal(callingPackage, callingUser, destAddr, scAddr, text, sentIntent,
+ deliveryIntent, persistMessageForNonDefaultSmsApp,
+ SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /* expectMore */,
+ SMS_MESSAGE_PERIOD_NOT_SPECIFIED, false /* isForVvm */,
messageId, skipShortCodeCheck);
}
@@ -504,27 +505,29 @@
* A permissions check before passing to {@link IccSmsInterfaceManager#sendTextInternal}.
* This method checks if the calling package or itself has the permission to send the sms.
*/
- public void sendTextWithSelfPermissions(String callingPackage, String callingAttributeTag,
- String destAddr, String scAddr, String text, PendingIntent sentIntent,
- PendingIntent deliveryIntent, boolean persistMessage, boolean isForVvm) {
+ public void sendTextWithSelfPermissions(String callingPackage, int callingUser,
+ String callingAttributeTag, String destAddr, String scAddr, String text,
+ PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessage,
+ boolean isForVvm) {
if (!mSmsPermissions.checkCallingOrSelfCanSendSms(callingPackage, callingAttributeTag,
"Sending SMS message")) {
returnUnspecifiedFailure(sentIntent);
return;
}
- sendTextInternal(callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent,
- persistMessage, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /* expectMore */,
- SMS_MESSAGE_PERIOD_NOT_SPECIFIED, isForVvm, 0L /* messageId */);
+ sendTextInternal(callingPackage, callingUser, destAddr, scAddr, text, sentIntent,
+ deliveryIntent, persistMessage, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED,
+ false /* expectMore */, SMS_MESSAGE_PERIOD_NOT_SPECIFIED,
+ isForVvm, 0L /* messageId */);
}
- private void sendTextInternal(String callingPackage, String destAddr, String scAddr,
- String text, PendingIntent sentIntent, PendingIntent deliveryIntent,
+ private void sendTextInternal(String callingPackage, int callingUser, String destAddr,
+ String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent,
boolean persistMessageForNonDefaultSmsApp, int priority, boolean expectMore,
int validityPeriod, boolean isForVvm, long messageId) {
- sendTextInternal(callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent,
- persistMessageForNonDefaultSmsApp, priority, expectMore, validityPeriod, isForVvm,
- messageId, false);
+ sendTextInternal(callingPackage, callingUser, destAddr, scAddr, text, sentIntent,
+ deliveryIntent, persistMessageForNonDefaultSmsApp, priority, expectMore,
+ validityPeriod, isForVvm, messageId, false);
}
/**
@@ -576,8 +579,8 @@
* @param skipShortCodeCheck Skip check for short code type destination address.
*/
- private void sendTextInternal(String callingPackage, String destAddr, String scAddr,
- String text, PendingIntent sentIntent, PendingIntent deliveryIntent,
+ private void sendTextInternal(String callingPackage, int callingUser, String destAddr,
+ String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent,
boolean persistMessageForNonDefaultSmsApp, int priority, boolean expectMore,
int validityPeriod, boolean isForVvm, long messageId, boolean skipShortCodeCheck) {
if (Rlog.isLoggable("SMS", Log.VERBOSE)) {
@@ -590,7 +593,7 @@
notifyIfOutgoingEmergencySms(destAddr);
destAddr = filterDestAddress(destAddr);
mDispatchersController.sendText(destAddr, scAddr, text, sentIntent, deliveryIntent,
- null/*messageUri*/, callingPackage, persistMessageForNonDefaultSmsApp,
+ null/*messageUri*/, callingPackage, callingUser, persistMessageForNonDefaultSmsApp,
priority, expectMore, validityPeriod, isForVvm, messageId, skipShortCodeCheck);
}
@@ -640,18 +643,19 @@
* Any Other values including negative considered as Invalid Validity Period of the message.
*/
- public void sendTextWithOptions(String callingPackage, String callingAttributionTag,
- String destAddr, String scAddr, String text, PendingIntent sentIntent,
- PendingIntent deliveryIntent, boolean persistMessageForNonDefaultSmsApp, int priority,
+ public void sendTextWithOptions(String callingPackage, int callingUser,
+ String callingAttributionTag, String destAddr, String scAddr, String text,
+ PendingIntent sentIntent, PendingIntent deliveryIntent,
+ boolean persistMessageForNonDefaultSmsApp, int priority,
boolean expectMore, int validityPeriod) {
if (!mSmsPermissions.checkCallingCanSendText(persistMessageForNonDefaultSmsApp,
callingPackage, callingAttributionTag, "Sending SMS message")) {
returnUnspecifiedFailure(sentIntent);
return;
}
- sendTextInternal(callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent,
- persistMessageForNonDefaultSmsApp, priority, expectMore, validityPeriod,
- false /* isForVvm */, 0L /* messageId */);
+ sendTextInternal(callingPackage, callingUser, destAddr, scAddr, text, sentIntent,
+ deliveryIntent, persistMessageForNonDefaultSmsApp, priority, expectMore,
+ validityPeriod, false /* isForVvm */, 0L /* messageId */);
}
/**
@@ -717,12 +721,12 @@
* Used for logging and diagnostics purposes. The id may be 0.
*/
- public void sendMultipartText(String callingPackage, String callingAttributionTag,
- String destAddr, String scAddr, List<String> parts, List<PendingIntent> sentIntents,
- List<PendingIntent> deliveryIntents, boolean persistMessageForNonDefaultSmsApp,
- long messageId) {
- sendMultipartTextWithOptions(callingPackage, callingAttributionTag, destAddr, scAddr, parts,
- sentIntents, deliveryIntents, persistMessageForNonDefaultSmsApp,
+ public void sendMultipartText(String callingPackage, int callingUser,
+ String callingAttributionTag, String destAddr, String scAddr, List<String> parts,
+ List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents,
+ boolean persistMessageForNonDefaultSmsApp, long messageId) {
+ sendMultipartTextWithOptions(callingPackage, callingUser, callingAttributionTag, destAddr,
+ scAddr, parts, sentIntents, deliveryIntents, persistMessageForNonDefaultSmsApp,
SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /* expectMore */,
SMS_MESSAGE_PERIOD_NOT_SPECIFIED,
messageId);
@@ -777,10 +781,11 @@
* Used for logging and diagnostics purposes. The id may be 0.
*/
- public void sendMultipartTextWithOptions(String callingPackage, String callingAttributionTag,
- String destAddr, String scAddr, List<String> parts, List<PendingIntent> sentIntents,
- List<PendingIntent> deliveryIntents, boolean persistMessageForNonDefaultSmsApp,
- int priority, boolean expectMore, int validityPeriod, long messageId) {
+ public void sendMultipartTextWithOptions(String callingPackage, int callingUser,
+ String callingAttributionTag, String destAddr, String scAddr, List<String> parts,
+ List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents,
+ boolean persistMessageForNonDefaultSmsApp, int priority, boolean expectMore,
+ int validityPeriod, long messageId) {
if (!mSmsPermissions.checkCallingCanSendText(persistMessageForNonDefaultSmsApp,
callingPackage, callingAttributionTag, "Sending SMS message")) {
returnUnspecifiedFailure(sentIntents);
@@ -820,7 +825,7 @@
}
mDispatchersController.sendText(destAddr, scAddr, singlePart, singleSentIntent,
- singleDeliveryIntent, null /* messageUri */, callingPackage,
+ singleDeliveryIntent, null /* messageUri */, callingPackage, callingUser,
persistMessageForNonDefaultSmsApp, priority, expectMore, validityPeriod,
false /* isForVvm */, messageId);
}
@@ -828,12 +833,12 @@
}
mDispatchersController.sendMultipartText(destAddr,
- scAddr,
- (ArrayList<String>) parts,
- (ArrayList<PendingIntent>) sentIntents,
- (ArrayList<PendingIntent>) deliveryIntents,
- null, callingPackage, persistMessageForNonDefaultSmsApp,
- priority, expectMore, validityPeriod, messageId);
+ scAddr,
+ (ArrayList<String>) parts,
+ (ArrayList<PendingIntent>) sentIntents,
+ (ArrayList<PendingIntent>) deliveryIntents,
+ null, callingPackage, callingUser, persistMessageForNonDefaultSmsApp,
+ priority, expectMore, validityPeriod, messageId);
}
@@ -1291,12 +1296,13 @@
*/
@Deprecated
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
- public void sendStoredText(String callingPkg, Uri messageUri, String scAddress,
+ public void sendStoredText(String callingPkg, int callingUser, Uri messageUri, String scAddress,
PendingIntent sentIntent, PendingIntent deliveryIntent) {
- sendStoredText(callingPkg, null, messageUri, scAddress, sentIntent, deliveryIntent);
+ sendStoredText(callingPkg, callingUser, null, messageUri,
+ scAddress, sentIntent, deliveryIntent);
}
- public void sendStoredText(String callingPkg, String callingAttributionTag,
+ public void sendStoredText(String callingPkg, int callingUser, String callingAttributionTag,
Uri messageUri, String scAddress, PendingIntent sentIntent,
PendingIntent deliveryIntent) {
if (!mSmsPermissions.checkCallingCanSendSms(callingPkg, callingAttributionTag,
@@ -1323,7 +1329,7 @@
notifyIfOutgoingEmergencySms(textAndAddress[1]);
textAndAddress[1] = filterDestAddress(textAndAddress[1]);
mDispatchersController.sendText(textAndAddress[1], scAddress, textAndAddress[0],
- sentIntent, deliveryIntent, messageUri, callingPkg,
+ sentIntent, deliveryIntent, messageUri, callingPkg, callingUser,
true /* persistMessageForNonDefaultSmsApp */, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED,
false /* expectMore */, SMS_MESSAGE_PERIOD_NOT_SPECIFIED, false /* isForVvm */,
0L /* messageId */);
@@ -1335,13 +1341,14 @@
*/
@Deprecated
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
- public void sendStoredMultipartText(String callingPkg, Uri messageUri, String scAddress,
- List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents) {
- sendStoredMultipartText(callingPkg, null, messageUri, scAddress, sentIntents,
- deliveryIntents);
+ public void sendStoredMultipartText(String callingPkg, int callingUser,
+ Uri messageUri, String scAddress, List<PendingIntent> sentIntents,
+ List<PendingIntent> deliveryIntents) {
+ sendStoredMultipartText(callingPkg, callingUser, null,
+ messageUri, scAddress, sentIntents, deliveryIntents);
}
- public void sendStoredMultipartText(String callingPkg,
+ public void sendStoredMultipartText(String callingPkg, int callingUser,
String callingAttributionTag, Uri messageUri, String scAddress,
List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents) {
if (!mSmsPermissions.checkCallingCanSendSms(callingPkg, callingAttributionTag,
@@ -1394,7 +1401,7 @@
mDispatchersController.sendText(textAndAddress[1], scAddress, singlePart,
singleSentIntent, singleDeliveryIntent, messageUri, callingPkg,
- true /* persistMessageForNonDefaultSmsApp */,
+ callingUser, true /* persistMessageForNonDefaultSmsApp */,
SMS_MESSAGE_PRIORITY_NOT_SPECIFIED,
false /* expectMore */, SMS_MESSAGE_PERIOD_NOT_SPECIFIED,
false /* isForVvm */, 0L /* messageId */);
@@ -1409,7 +1416,7 @@
(ArrayList<PendingIntent>) sentIntents,
(ArrayList<PendingIntent>) deliveryIntents,
messageUri,
- callingPkg,
+ callingPkg, callingUser,
true /* persistMessageForNonDefaultSmsApp */,
SMS_MESSAGE_PRIORITY_NOT_SPECIFIED,
false /* expectMore */,
diff --git a/src/java/com/android/internal/telephony/SMSDispatcher.java b/src/java/com/android/internal/telephony/SMSDispatcher.java
index fc5ef97..3ae13f8 100644
--- a/src/java/com/android/internal/telephony/SMSDispatcher.java
+++ b/src/java/com/android/internal/telephony/SMSDispatcher.java
@@ -89,6 +89,7 @@
import com.android.internal.telephony.analytics.TelephonyAnalytics;
import com.android.internal.telephony.analytics.TelephonyAnalytics.SmsMmsAnalytics;
import com.android.internal.telephony.cdma.sms.UserData;
+import com.android.internal.telephony.flags.Flags;
import com.android.internal.telephony.subscription.SubscriptionInfoInternal;
import com.android.internal.telephony.subscription.SubscriptionManagerService;
import com.android.internal.telephony.uicc.IccRecords;
@@ -1398,15 +1399,16 @@
* raw pdu of the status report is in the extended data ("pdu").
*/
@UnsupportedAppUsage
- protected void sendData(String callingPackage, String destAddr, String scAddr, int destPort,
- byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean isForVvm) {
+ protected void sendData(String callingPackage, int callingUser, String destAddr, String scAddr,
+ int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent,
+ boolean isForVvm) {
int messageRef = nextMessageRef();
SmsMessageBase.SubmitPduBase pdu = getSubmitPdu(
scAddr, destAddr, destPort, data, (deliveryIntent != null), messageRef);
if (pdu != null) {
HashMap map = getSmsTrackerMap(destAddr, scAddr, destPort, data, pdu);
- SmsTracker tracker = getSmsTracker(callingPackage, map, sentIntent, deliveryIntent,
- getFormat(), null /*messageUri*/, false /*expectMore*/,
+ SmsTracker tracker = getSmsTracker(callingPackage, callingUser, map, sentIntent,
+ deliveryIntent, getFormat(), null /*messageUri*/, false /*expectMore*/,
null /*fullMessageText*/, false /*isText*/,
true /*persistMessage*/, isForVvm, 0L /* messageId */, messageRef);
@@ -1521,11 +1523,12 @@
*/
public void sendText(String destAddr, String scAddr, String text,
PendingIntent sentIntent, PendingIntent deliveryIntent, Uri messageUri,
- String callingPkg, boolean persistMessage, int priority,
+ String callingPkg, int callingUser, boolean persistMessage, int priority,
boolean expectMore, int validityPeriod, boolean isForVvm,
long messageId) {
sendText(destAddr, scAddr, text, sentIntent, deliveryIntent, messageUri, callingPkg,
- persistMessage, priority, expectMore, validityPeriod, isForVvm, messageId, false);
+ callingUser, persistMessage, priority, expectMore, validityPeriod, isForVvm,
+ messageId, false);
}
/**
@@ -1630,10 +1633,10 @@
* @param skipShortCodeCheck Skip check for short code type destination address.
*/
public void sendText(String destAddr, String scAddr, String text,
- PendingIntent sentIntent, PendingIntent deliveryIntent, Uri messageUri,
- String callingPkg, boolean persistMessage, int priority,
- boolean expectMore, int validityPeriod, boolean isForVvm,
- long messageId, boolean skipShortCodeCheck) {
+ PendingIntent sentIntent, PendingIntent deliveryIntent, Uri messageUri,
+ String callingPkg, int callingUser, boolean persistMessage, int priority,
+ boolean expectMore, int validityPeriod, boolean isForVvm,
+ long messageId, boolean skipShortCodeCheck) {
Rlog.d(TAG, "sendText id: " + SmsController.formatCrossStackMessageId(messageId));
int messageRef = nextMessageRef();
SmsMessageBase.SubmitPduBase pdu = getSubmitPdu(
@@ -1641,8 +1644,8 @@
messageRef);
if (pdu != null) {
HashMap map = getSmsTrackerMap(destAddr, scAddr, text, pdu);
- SmsTracker tracker = getSmsTracker(callingPkg, map, sentIntent, deliveryIntent,
- getFormat(), messageUri, expectMore, text, true /*isText*/,
+ SmsTracker tracker = getSmsTracker(callingPkg, callingUser, map, sentIntent,
+ deliveryIntent, getFormat(), messageUri, expectMore, text, true /*isText*/,
persistMessage, priority, validityPeriod, isForVvm, messageId, messageRef,
skipShortCodeCheck);
@@ -1825,8 +1828,8 @@
public void sendMultipartText(String destAddr, String scAddr,
ArrayList<String> parts, ArrayList<PendingIntent> sentIntents,
ArrayList<PendingIntent> deliveryIntents, Uri messageUri, String callingPkg,
- boolean persistMessage, int priority, boolean expectMore, int validityPeriod,
- long messageId) {
+ int callingUser, boolean persistMessage, int priority, boolean expectMore,
+ int validityPeriod, long messageId) {
final String fullMessageText = getMultipartMessageText(parts);
int refNumber = getNextConcatenatedRef() & 0x00FF;
int encoding = SmsConstants.ENCODING_UNKNOWN;
@@ -1885,8 +1888,8 @@
}
int messageRef = nextMessageRef();
trackers[i] =
- getNewSubmitPduTracker(callingPkg, destAddr, scAddr, parts.get(i), smsHeader,
- encoding, sentIntent, deliveryIntent, (i == (msgCount - 1)),
+ getNewSubmitPduTracker(callingPkg, callingUser, destAddr, scAddr, parts.get(i),
+ smsHeader, encoding, sentIntent, deliveryIntent, (i == (msgCount - 1)),
unsentPartCount, anyPartFailed, messageUri,
fullMessageText, priority, expectMore, validityPeriod, messageId,
messageRef);
@@ -1920,9 +1923,9 @@
/**
* Create a new SubmitPdu and return the SMS tracker.
*/
- private SmsTracker getNewSubmitPduTracker(String callingPackage, String destinationAddress,
- String scAddress, String message, SmsHeader smsHeader, int encoding,
- PendingIntent sentIntent, PendingIntent deliveryIntent, boolean lastPart,
+ private SmsTracker getNewSubmitPduTracker(String callingPackage, int callingUser,
+ String destinationAddress, String scAddress, String message, SmsHeader smsHeader,
+ int encoding, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean lastPart,
AtomicInteger unsentPartCount, AtomicBoolean anyPartFailed, Uri messageUri,
String fullMessageText, int priority, boolean expectMore, int validityPeriod,
long messageId, int messageRef) {
@@ -1951,11 +1954,11 @@
if (submitPdu != null) {
HashMap map = getSmsTrackerMap(destinationAddress, scAddress,
message, submitPdu);
- return getSmsTracker(callingPackage, map, sentIntent, deliveryIntent,
- getFormat(), unsentPartCount, anyPartFailed, messageUri, smsHeader,
- (!lastPart || expectMore), fullMessageText, true /*isText*/,
- true /*persistMessage*/, priority, validityPeriod, false /* isForVvm */,
- messageId, messageRef, false);
+ return getSmsTracker(callingPackage, callingUser, map, sentIntent,
+ deliveryIntent, getFormat(), unsentPartCount, anyPartFailed, messageUri,
+ smsHeader, (!lastPart || expectMore), fullMessageText, /*isText*/
+ true, /*persistMessage*/ true, priority, validityPeriod, /* isForVvm */
+ false, messageId, messageRef, false);
} else {
Rlog.e(TAG, "CdmaSMSDispatcher.getNewSubmitPduTracker(): getSubmitPdu() returned "
+ "null " + SmsController.formatCrossStackMessageId(messageId));
@@ -1969,11 +1972,12 @@
smsHeader.languageShiftTable, validityPeriod, messageRef);
if (pdu != null) {
HashMap map = getSmsTrackerMap(destinationAddress, scAddress, message, pdu);
- return getSmsTracker(callingPackage, map, sentIntent,
- deliveryIntent, getFormat(), unsentPartCount, anyPartFailed, messageUri,
- smsHeader, (!lastPart || expectMore), fullMessageText, true /*isText*/,
- false /*persistMessage*/, priority, validityPeriod, false /* isForVvm */,
- messageId, messageRef, false);
+ return getSmsTracker(callingPackage, callingUser, map,
+ sentIntent, deliveryIntent, getFormat(), unsentPartCount, anyPartFailed,
+ messageUri, smsHeader, (!lastPart || expectMore),
+ fullMessageText, /*isText*/
+ true, /*persistMessage*/ false, priority, validityPeriod, /* isForVvm */
+ false, messageId, messageRef, false);
} else {
Rlog.e(TAG, "GsmSMSDispatcher.getNewSubmitPduTracker(): getSubmitPdu() returned "
+ "null " + SmsController.formatCrossStackMessageId(messageId));
@@ -2812,16 +2816,20 @@
}
}
- protected SmsTracker getSmsTracker(String callingPackage, HashMap<String, Object> data,
+ protected SmsTracker getSmsTracker(String callingPackage, int callingUser,
+ HashMap<String, Object> data,
PendingIntent sentIntent, PendingIntent deliveryIntent, String format,
AtomicInteger unsentPartCount, AtomicBoolean anyPartFailed, Uri messageUri,
SmsHeader smsHeader, boolean expectMore, String fullMessageText, boolean isText,
boolean persistMessage, int priority, int validityPeriod, boolean isForVvm,
long messageId, int messageRef, boolean skipShortCodeCheck) {
+ if (!Flags.smsMmsDeliverBroadcastsRedirectToMainUser()) {
+ callingUser = UserHandle.getUserHandleForUid(Binder.getCallingUid()).getIdentifier();
+ }
+
// Get package info via packagemanager
- UserHandle callingUser = UserHandle.getUserHandleForUid(Binder.getCallingUid());
- final int userId = callingUser.getIdentifier();
- PackageManager pm = mContext.createContextAsUser(callingUser, 0).getPackageManager();
+ PackageManager pm = mContext.createContextAsUser(UserHandle.of(callingUser), 0)
+ .getPackageManager();
PackageInfo appInfo = null;
try {
appInfo = pm.getPackageInfo(callingPackage, PackageManager.GET_SIGNATURES);
@@ -2833,31 +2841,33 @@
String destAddr = PhoneNumberUtils.extractNetworkPortion((String) data.get("destAddr"));
return new SmsTracker(data, sentIntent, deliveryIntent, appInfo, destAddr, format,
unsentPartCount, anyPartFailed, messageUri, smsHeader, expectMore,
- fullMessageText, getSubId(), isText, persistMessage, userId, priority,
+ fullMessageText, getSubId(), isText, persistMessage, callingUser, priority,
validityPeriod, isForVvm, messageId, mPhone.getCarrierId(), messageRef,
skipShortCodeCheck);
}
- protected SmsTracker getSmsTracker(String callingPackage, HashMap<String, Object> data,
- PendingIntent sentIntent, PendingIntent deliveryIntent, String format, Uri messageUri,
- boolean expectMore, String fullMessageText, boolean isText, boolean persistMessage,
- boolean isForVvm, long messageId, int messageRef) {
- return getSmsTracker(callingPackage, data, sentIntent, deliveryIntent, format,
- null/*unsentPartCount*/, null/*anyPartFailed*/, messageUri, null/*smsHeader*/,
- expectMore, fullMessageText, isText, persistMessage,
- SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, SMS_MESSAGE_PERIOD_NOT_SPECIFIED, isForVvm,
- messageId, messageRef, false);
+ protected SmsTracker getSmsTracker(String callingPackage, int callingUser,
+ HashMap<String, Object> data, PendingIntent sentIntent, PendingIntent deliveryIntent,
+ String format, Uri messageUri, boolean expectMore, String fullMessageText,
+ boolean isText, boolean persistMessage, boolean isForVvm,
+ long messageId, int messageRef) {
+ return getSmsTracker(callingPackage, callingUser , data, sentIntent, deliveryIntent,
+ format, /*unsentPartCount*/ null, /*anyPartFailed*/ null, messageUri, /*smsHeader*/
+ null, expectMore, fullMessageText, isText,
+ persistMessage, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED,
+ SMS_MESSAGE_PERIOD_NOT_SPECIFIED,
+ isForVvm, messageId, messageRef, false);
}
- protected SmsTracker getSmsTracker(String callingPackage, HashMap<String, Object> data,
- PendingIntent sentIntent, PendingIntent deliveryIntent, String format, Uri messageUri,
- boolean expectMore, String fullMessageText, boolean isText, boolean persistMessage,
- int priority, int validityPeriod, boolean isForVvm, long messageId, int messageRef,
- boolean skipShortCodeCheck) {
- return getSmsTracker(callingPackage, data, sentIntent, deliveryIntent, format,
- null/*unsentPartCount*/, null/*anyPartFailed*/, messageUri, null/*smsHeader*/,
- expectMore, fullMessageText, isText, persistMessage, priority, validityPeriod,
- isForVvm, messageId, messageRef, skipShortCodeCheck);
+ protected SmsTracker getSmsTracker(String callingPackage, int callingUser,
+ HashMap<String, Object> data, PendingIntent sentIntent, PendingIntent deliveryIntent,
+ String format, Uri messageUri, boolean expectMore, String fullMessageText,
+ boolean isText, boolean persistMessage, int priority, int validityPeriod,
+ boolean isForVvm, long messageId, int messageRef, boolean skipShortCodeCheck) {
+ return getSmsTracker(callingPackage, callingUser, data, sentIntent, deliveryIntent,
+ format, /*unsentPartCount*/ null, /*anyPartFailed*/ null, messageUri, /*smsHeader*/
+ null, expectMore, fullMessageText, isText, persistMessage, priority,
+ validityPeriod, isForVvm, messageId, messageRef, skipShortCodeCheck);
}
protected HashMap<String, Object> getSmsTrackerMap(String destAddr, String scAddr,
diff --git a/src/java/com/android/internal/telephony/SmsController.java b/src/java/com/android/internal/telephony/SmsController.java
index 59184d8..1295f38 100644
--- a/src/java/com/android/internal/telephony/SmsController.java
+++ b/src/java/com/android/internal/telephony/SmsController.java
@@ -176,11 +176,13 @@
if (callingPackage == null) {
callingPackage = getCallingPackage();
}
+ UserHandle callingUser = Binder.getCallingUserHandle();
+
Rlog.d(LOG_TAG, "sendDataForSubscriber caller=" + callingPackage);
// Check if user is associated with the subscription
if (!TelephonyPermissions.checkSubscriptionAssociatedWithUser(mContext, subId,
- Binder.getCallingUserHandle(), destAddr)) {
+ callingUser, destAddr)) {
TelephonyUtils.showSwitchToManagedProfileDialogIfAppropriate(mContext, subId,
Binder.getCallingUid(), callingPackage);
sendErrorInPendingIntent(sentIntent, SmsManager.RESULT_USER_NOT_ALLOWED);
@@ -195,7 +197,8 @@
IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
if (iccSmsIntMgr != null) {
- iccSmsIntMgr.sendData(callingPackage, callingAttributionTag, destAddr, scAddr, destPort,
+ iccSmsIntMgr.sendData(callingPackage, callingUser.getIdentifier(),
+ callingAttributionTag, destAddr, scAddr, destPort,
data, sentIntent, deliveryIntent);
} else {
Rlog.e(LOG_TAG, "sendDataForSubscriber iccSmsIntMgr is null for"
@@ -206,12 +209,14 @@
}
private void sendDataForSubscriberWithSelfPermissionsInternal(int subId, String callingPackage,
- String callingAttributionTag, String destAddr, String scAddr, int destPort, byte[] data,
- PendingIntent sentIntent, PendingIntent deliveryIntent, boolean isForVvm) {
+ int callingUser, String callingAttributionTag, String destAddr, String scAddr,
+ int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent,
+ boolean isForVvm) {
IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
if (iccSmsIntMgr != null) {
- iccSmsIntMgr.sendDataWithSelfPermissions(callingPackage, callingAttributionTag,
- destAddr, scAddr, destPort, data, sentIntent, deliveryIntent, isForVvm);
+ iccSmsIntMgr.sendDataWithSelfPermissions(callingPackage, callingUser,
+ callingAttributionTag, destAddr, scAddr, destPort, data, sentIntent,
+ deliveryIntent, isForVvm);
} else {
Rlog.e(LOG_TAG, "sendText iccSmsIntMgr is null for"
+ " Subscription: " + subId);
@@ -261,6 +266,8 @@
if (callingPackage == null) {
callingPackage = getCallingPackage();
}
+ UserHandle callingUser = Binder.getCallingUserHandle();
+
Rlog.d(LOG_TAG, "sendTextForSubscriber caller=" + callingPackage);
if (skipFdnCheck || skipShortCodeCheck) {
@@ -306,9 +313,9 @@
if (isBluetoothSubscription(info)) {
sendBluetoothText(info, destAddr, text, sentIntent, deliveryIntent);
} else {
- sendIccText(subId, callingPackage, destAddr, scAddr, text, sentIntent,
- deliveryIntent, persistMessageForNonDefaultSmsApp, messageId,
- skipShortCodeCheck);
+ sendIccText(subId, callingPackage, callingUser.getIdentifier(), destAddr, scAddr,
+ text, sentIntent, deliveryIntent, persistMessageForNonDefaultSmsApp,
+ messageId, skipShortCodeCheck);
}
} finally {
Binder.restoreCallingIdentity(token);
@@ -326,14 +333,14 @@
btSmsInterfaceManager.sendText(mContext, destAddr, text, sentIntent, deliveryIntent, info);
}
- private void sendIccText(int subId, String callingPackage, String destAddr,
+ private void sendIccText(int subId, String callingPackage, int callingUser, String destAddr,
String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent,
boolean persistMessageForNonDefaultSmsApp, long messageId, boolean skipShortCodeCheck) {
Rlog.d(LOG_TAG, "sendTextForSubscriber iccSmsIntMgr"
+ " Subscription: " + subId + " " + formatCrossStackMessageId(messageId));
IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
if (iccSmsIntMgr != null) {
- iccSmsIntMgr.sendText(callingPackage, destAddr, scAddr, text, sentIntent,
+ iccSmsIntMgr.sendText(callingPackage, callingUser, destAddr, scAddr, text, sentIntent,
deliveryIntent, persistMessageForNonDefaultSmsApp, messageId,
skipShortCodeCheck);
} else {
@@ -344,13 +351,14 @@
}
private void sendTextForSubscriberWithSelfPermissionsInternal(int subId, String callingPackage,
- String callingAttributeTag, String destAddr, String scAddr, String text,
- PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessage,
- boolean isForVvm) {
+ int callingUser, String callingAttributeTag, String destAddr, String scAddr,
+ String text, PendingIntent sentIntent, PendingIntent deliveryIntent,
+ boolean persistMessage, boolean isForVvm) {
IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
if (iccSmsIntMgr != null) {
- iccSmsIntMgr.sendTextWithSelfPermissions(callingPackage, callingAttributeTag, destAddr,
- scAddr, text, sentIntent, deliveryIntent, persistMessage, isForVvm);
+ iccSmsIntMgr.sendTextWithSelfPermissions(callingPackage, callingUser,
+ callingAttributeTag, destAddr, scAddr, text, sentIntent, deliveryIntent,
+ persistMessage, isForVvm);
} else {
Rlog.e(LOG_TAG, "sendText iccSmsIntMgr is null for"
+ " Subscription: " + subId);
@@ -366,6 +374,8 @@
if (callingPackage == null) {
callingPackage = getCallingPackage();
}
+ UserHandle callingUser = Binder.getCallingUserHandle();
+
Rlog.d(LOG_TAG, "sendTextForSubscriberWithOptions caller=" + callingPackage);
// Check if user is associated with the subscription
@@ -385,9 +395,9 @@
IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
if (iccSmsIntMgr != null) {
- iccSmsIntMgr.sendTextWithOptions(callingPackage, callingAttributionTag, destAddr,
- scAddr, parts, sentIntent, deliveryIntent, persistMessage, priority, expectMore,
- validityPeriod);
+ iccSmsIntMgr.sendTextWithOptions(callingPackage, callingUser.getIdentifier(),
+ callingAttributionTag, destAddr, scAddr, parts, sentIntent, deliveryIntent,
+ persistMessage, priority, expectMore, validityPeriod);
} else {
Rlog.e(LOG_TAG, "sendTextWithOptions iccSmsIntMgr is null for"
+ " Subscription: " + subId);
@@ -405,6 +415,8 @@
if (getCallingPackage() != null) {
callingPackage = getCallingPackage();
}
+ UserHandle callingUser = Binder.getCallingUserHandle();
+
Rlog.d(LOG_TAG, "sendMultipartTextForSubscriber caller=" + callingPackage);
// Check if user is associated with the subscription
@@ -426,9 +438,9 @@
IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
if (iccSmsIntMgr != null) {
- iccSmsIntMgr.sendMultipartText(callingPackage, callingAttributionTag, destAddr, scAddr,
- parts, sentIntents, deliveryIntents, persistMessageForNonDefaultSmsApp,
- messageId);
+ iccSmsIntMgr.sendMultipartText(callingPackage, callingUser.getIdentifier(),
+ callingAttributionTag, destAddr, scAddr, parts, sentIntents, deliveryIntents,
+ persistMessageForNonDefaultSmsApp, messageId);
} else {
Rlog.e(LOG_TAG, "sendMultipartTextForSubscriber iccSmsIntMgr is null for"
+ " Subscription: " + subId + " " + formatCrossStackMessageId(messageId));
@@ -444,6 +456,8 @@
if (callingPackage == null) {
callingPackage = getCallingPackage();
}
+ UserHandle callingUser = Binder.getCallingUserHandle();
+
Rlog.d(LOG_TAG, "sendMultipartTextForSubscriberWithOptions caller=" + callingPackage);
// Check if user is associated with the subscription
@@ -463,9 +477,9 @@
IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
if (iccSmsIntMgr != null) {
- iccSmsIntMgr.sendMultipartTextWithOptions(callingPackage, callingAttributionTag,
- destAddr, scAddr, parts, sentIntents, deliveryIntents, persistMessage, priority,
- expectMore, validityPeriod, 0L /* messageId */);
+ iccSmsIntMgr.sendMultipartTextWithOptions(callingPackage, callingUser.getIdentifier(),
+ callingAttributionTag, destAddr, scAddr, parts, sentIntents, deliveryIntents,
+ persistMessage, priority, expectMore, validityPeriod, 0L /* messageId */);
} else {
Rlog.e(LOG_TAG, "sendMultipartTextWithOptions iccSmsIntMgr is null for"
+ " Subscription: " + subId);
@@ -717,6 +731,7 @@
Uri messageUri, String scAddress, PendingIntent sentIntent,
PendingIntent deliveryIntent) {
IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
+ UserHandle callingUser = Binder.getCallingUserHandle();
if (!getCallingPackage().equals(callingPkg)) {
throw new SecurityException("sendStoredText: Package " + callingPkg
+ "does not belong to " + Binder.getCallingUid());
@@ -724,8 +739,8 @@
Rlog.d(LOG_TAG, "sendStoredText caller=" + callingPkg);
if (iccSmsIntMgr != null) {
- iccSmsIntMgr.sendStoredText(callingPkg, callingAttributionTag, messageUri, scAddress,
- sentIntent, deliveryIntent);
+ iccSmsIntMgr.sendStoredText(callingPkg, callingUser.getIdentifier(),
+ callingAttributionTag, messageUri, scAddress, sentIntent, deliveryIntent);
} else {
Rlog.e(LOG_TAG, "sendStoredText iccSmsIntMgr is null for subscription: " + subId);
sendErrorInPendingIntent(sentIntent, SmsManager.RESULT_ERROR_GENERIC_FAILURE);
@@ -737,6 +752,8 @@
Uri messageUri, String scAddress, List<PendingIntent> sentIntents,
List<PendingIntent> deliveryIntents) {
IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
+ UserHandle callingUser = Binder.getCallingUserHandle();
+
if (!getCallingPackage().equals(callingPkg)) {
throw new SecurityException("sendStoredMultipartText: Package " + callingPkg
+ " does not belong to " + Binder.getCallingUid());
@@ -744,8 +761,8 @@
Rlog.d(LOG_TAG, "sendStoredMultipartText caller=" + callingPkg);
if (iccSmsIntMgr != null) {
- iccSmsIntMgr.sendStoredMultipartText(callingPkg, callingAttributionTag, messageUri,
- scAddress, sentIntents, deliveryIntents);
+ iccSmsIntMgr.sendStoredMultipartText(callingPkg, callingUser.getIdentifier(),
+ callingAttributionTag, messageUri, scAddress, sentIntents, deliveryIntents);
} else {
Rlog.e(LOG_TAG, "sendStoredMultipartText iccSmsIntMgr is null for subscription: "
+ subId);
@@ -979,7 +996,7 @@
* Internal API to send visual voicemail related SMS. This is not exposed outside the phone
* process, and should be called only after verifying that the caller is the default VVM app.
*/
- public void sendVisualVoicemailSmsForSubscriber(String callingPackage,
+ public void sendVisualVoicemailSmsForSubscriber(String callingPackage, int callingUser,
String callingAttributionTag, int subId, String number, int port, String text,
PendingIntent sentIntent) {
Rlog.d(LOG_TAG, "sendVisualVoicemailSmsForSubscriber caller=" + callingPackage);
@@ -1001,12 +1018,12 @@
}
if (port == 0) {
- sendTextForSubscriberWithSelfPermissionsInternal(subId, callingPackage,
+ sendTextForSubscriberWithSelfPermissionsInternal(subId, callingPackage, callingUser,
callingAttributionTag, number, null, text, sentIntent, null, false,
true /* isForVvm */);
} else {
byte[] data = text.getBytes(StandardCharsets.UTF_8);
- sendDataForSubscriberWithSelfPermissionsInternal(subId, callingPackage,
+ sendDataForSubscriberWithSelfPermissionsInternal(subId, callingPackage, callingUser,
callingAttributionTag, number, null, (short) port, data, sentIntent, null,
true /* isForVvm */);
}
diff --git a/src/java/com/android/internal/telephony/SmsDispatchersController.java b/src/java/com/android/internal/telephony/SmsDispatchersController.java
index e14613f..7795955 100644
--- a/src/java/com/android/internal/telephony/SmsDispatchersController.java
+++ b/src/java/com/android/internal/telephony/SmsDispatchersController.java
@@ -35,6 +35,7 @@
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
+import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Telephony.Sms;
import android.provider.Telephony.Sms.Intents;
@@ -223,6 +224,7 @@
public final int type;
public final SMSDispatcher.SmsTracker tracker;
public final String callingPackage;
+ public final int callingUser;
public final String destAddr;
public final String scAddr;
public final ArrayList<PendingIntent> sentIntents;
@@ -242,14 +244,15 @@
public final boolean skipShortCodeCheck;
public PendingRequest(int type, SMSDispatcher.SmsTracker tracker, String callingPackage,
- String destAddr, String scAddr, ArrayList<PendingIntent> sentIntents,
- ArrayList<PendingIntent> deliveryIntents, boolean isForVvm, byte[] data,
- int destPort, ArrayList<String> texts, Uri messageUri, boolean persistMessage,
- int priority, boolean expectMore, int validityPeriod, long messageId,
- boolean skipShortCodeCheck) {
+ int callingUser, String destAddr, String scAddr,
+ ArrayList<PendingIntent> sentIntents, ArrayList<PendingIntent> deliveryIntents,
+ boolean isForVvm, byte[] data, int destPort, ArrayList<String> texts,
+ Uri messageUri, boolean persistMessage, int priority, boolean expectMore,
+ int validityPeriod, long messageId, boolean skipShortCodeCheck) {
this.type = type;
this.tracker = tracker;
this.callingPackage = callingPackage;
+ this.callingUser = callingUser;
this.destAddr = destAddr;
this.scAddr = scAddr;
this.sentIntents = sentIntents;
@@ -815,7 +818,9 @@
SomeArgs args = SomeArgs.obtain();
args.arg1 = getDomainSelectionConnectionHolder(isEmergency);
args.arg2 = new PendingRequest(PendingRequest.TYPE_RETRY_SMS, tracker,
- null, null, null, null, null, false, null, 0, null, null, false,
+ null, UserHandle.USER_NULL, null, null,
+ null, null, false, null, 0,
+ null, null, false,
0, false, 0, 0L, false);
args.arg3 = "sendRetrySms";
sendMessage(obtainMessage(EVENT_REQUEST_DOMAIN_SELECTION, args));
@@ -1395,17 +1400,17 @@
private void sendData(@NetworkRegistrationInfo.Domain int domain,
@NonNull PendingRequest request) {
if (domain == NetworkRegistrationInfo.DOMAIN_PS) {
- mImsSmsDispatcher.sendData(request.callingPackage, request.destAddr, request.scAddr,
- request.destPort, request.data, request.sentIntents.get(0),
- request.deliveryIntents.get(0), request.isForVvm);
+ mImsSmsDispatcher.sendData(request.callingPackage, request.callingUser,
+ request.destAddr, request.scAddr, request.destPort, request.data,
+ request.sentIntents.get(0), request.deliveryIntents.get(0), request.isForVvm);
} else if (isCdmaMo(domain)) {
- mCdmaDispatcher.sendData(request.callingPackage, request.destAddr, request.scAddr,
- request.destPort, request.data, request.sentIntents.get(0),
- request.deliveryIntents.get(0), request.isForVvm);
+ mCdmaDispatcher.sendData(request.callingPackage, request.callingUser, request.destAddr,
+ request.scAddr, request.destPort, request.data,
+ request.sentIntents.get(0), request.deliveryIntents.get(0), request.isForVvm);
} else {
- mGsmDispatcher.sendData(request.callingPackage, request.destAddr, request.scAddr,
- request.destPort, request.data, request.sentIntents.get(0),
- request.deliveryIntents.get(0), request.isForVvm);
+ mGsmDispatcher.sendData(request.callingPackage, request.callingUser, request.destAddr,
+ request.scAddr, request.destPort, request.data,
+ request.sentIntents.get(0), request.deliveryIntents.get(0), request.isForVvm);
}
}
@@ -1422,22 +1427,25 @@
if (domain == NetworkRegistrationInfo.DOMAIN_PS) {
mImsSmsDispatcher.sendText(request.destAddr, request.scAddr, request.texts.get(0),
request.sentIntents.get(0), request.deliveryIntents.get(0),
- request.messageUri, request.callingPackage, request.persistMessage,
- request.priority, false /*request.expectMore*/, request.validityPeriod,
- request.isForVvm, request.messageId, request.skipShortCodeCheck);
+ request.messageUri, request.callingPackage, request.callingUser,
+ request.persistMessage, request.priority, /*request.expectMore*/ false,
+ request.validityPeriod, request.isForVvm, request.messageId,
+ request.skipShortCodeCheck);
} else {
if (isCdmaMo(domain)) {
mCdmaDispatcher.sendText(request.destAddr, request.scAddr, request.texts.get(0),
request.sentIntents.get(0), request.deliveryIntents.get(0),
- request.messageUri, request.callingPackage, request.persistMessage,
- request.priority, request.expectMore, request.validityPeriod,
- request.isForVvm, request.messageId, request.skipShortCodeCheck);
+ request.messageUri, request.callingPackage, request.callingUser,
+ request.persistMessage, request.priority, request.expectMore,
+ request.validityPeriod, request.isForVvm, request.messageId,
+ request.skipShortCodeCheck);
} else {
mGsmDispatcher.sendText(request.destAddr, request.scAddr, request.texts.get(0),
request.sentIntents.get(0), request.deliveryIntents.get(0),
- request.messageUri, request.callingPackage, request.persistMessage,
- request.priority, request.expectMore, request.validityPeriod,
- request.isForVvm, request.messageId, request.skipShortCodeCheck);
+ request.messageUri, request.callingPackage, request.callingUser,
+ request.persistMessage, request.priority, request.expectMore,
+ request.validityPeriod, request.isForVvm, request.messageId,
+ request.skipShortCodeCheck);
}
}
}
@@ -1455,19 +1463,22 @@
if (domain == NetworkRegistrationInfo.DOMAIN_PS) {
mImsSmsDispatcher.sendMultipartText(request.destAddr, request.scAddr, request.texts,
request.sentIntents, request.deliveryIntents, request.messageUri,
- request.callingPackage, request.persistMessage, request.priority,
- false /*request.expectMore*/, request.validityPeriod, request.messageId);
+ request.callingPackage, request.callingUser, request.persistMessage,
+ request.priority, false /*request.expectMore*/, request.validityPeriod,
+ request.messageId);
} else {
if (isCdmaMo(domain)) {
mCdmaDispatcher.sendMultipartText(request.destAddr, request.scAddr, request.texts,
request.sentIntents, request.deliveryIntents, request.messageUri,
- request.callingPackage, request.persistMessage, request.priority,
- request.expectMore, request.validityPeriod, request.messageId);
+ request.callingPackage, request.callingUser, request.persistMessage,
+ request.priority, request.expectMore, request.validityPeriod,
+ request.messageId);
} else {
mGsmDispatcher.sendMultipartText(request.destAddr, request.scAddr, request.texts,
request.sentIntents, request.deliveryIntents, request.messageUri,
- request.callingPackage, request.persistMessage, request.priority,
- request.expectMore, request.validityPeriod, request.messageId);
+ request.callingPackage, request.callingUser, request.persistMessage,
+ request.priority, request.expectMore, request.validityPeriod,
+ request.messageId);
}
}
}
@@ -1574,31 +1585,33 @@
* broadcast when the message is delivered to the recipient. The
* raw pdu of the status report is in the extended data ("pdu").
*/
- protected void sendData(String callingPackage, String destAddr, String scAddr, int destPort,
- byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent, boolean isForVvm) {
+ protected void sendData(String callingPackage, int callingUser, String destAddr, String scAddr,
+ int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent,
+ boolean isForVvm) {
if (TextUtils.isEmpty(scAddr)) {
scAddr = getSmscAddressFromUSIMWithPhoneIdentity(callingPackage);
}
if (isSmsDomainSelectionEnabled()) {
sendSmsUsingDomainSelection(getDomainSelectionConnectionHolder(false),
- new PendingRequest(PendingRequest.TYPE_DATA, null, callingPackage,
+ new PendingRequest(PendingRequest.TYPE_DATA, null, callingPackage, callingUser,
destAddr, scAddr, asArrayList(sentIntent),
- asArrayList(deliveryIntent), isForVvm, data, destPort, null, null,
- false, 0, false, 0, 0L, false),
+ asArrayList(deliveryIntent), isForVvm, data, destPort, null,
+ null, false, 0, false, 0,
+ 0L, false),
"sendData");
return;
}
if (mImsSmsDispatcher.isAvailable()) {
- mImsSmsDispatcher.sendData(callingPackage, destAddr, scAddr, destPort, data, sentIntent,
- deliveryIntent, isForVvm);
+ mImsSmsDispatcher.sendData(callingPackage, callingUser, destAddr, scAddr, destPort,
+ data, sentIntent, deliveryIntent, isForVvm);
} else if (isCdmaMo()) {
- mCdmaDispatcher.sendData(callingPackage, destAddr, scAddr, destPort, data, sentIntent,
- deliveryIntent, isForVvm);
+ mCdmaDispatcher.sendData(callingPackage, callingUser, destAddr, scAddr, destPort, data,
+ sentIntent, deliveryIntent, isForVvm);
} else {
- mGsmDispatcher.sendData(callingPackage, destAddr, scAddr, destPort, data, sentIntent,
- deliveryIntent, isForVvm);
+ mGsmDispatcher.sendData(callingPackage, callingUser, destAddr, scAddr, destPort, data,
+ sentIntent, deliveryIntent, isForVvm);
}
}
@@ -1700,11 +1713,12 @@
* Any Other values included Negative considered as Invalid Validity Period of the message.
*/
public void sendText(String destAddr, String scAddr, String text, PendingIntent sentIntent,
- PendingIntent deliveryIntent, Uri messageUri, String callingPkg, boolean persistMessage,
- int priority, boolean expectMore, int validityPeriod, boolean isForVvm,
- long messageId) {
+ PendingIntent deliveryIntent, Uri messageUri, String callingPkg, int callingUser,
+ boolean persistMessage, int priority, boolean expectMore, int validityPeriod,
+ boolean isForVvm, long messageId) {
sendText(destAddr, scAddr, text, sentIntent, deliveryIntent, messageUri, callingPkg,
- persistMessage, priority, expectMore, validityPeriod, isForVvm, messageId, false);
+ callingUser, persistMessage, priority, expectMore, validityPeriod, isForVvm,
+ messageId, false);
}
/**
@@ -1806,17 +1820,18 @@
* @param skipShortCodeCheck Skip check for short code type destination address.
*/
public void sendText(String destAddr, String scAddr, String text, PendingIntent sentIntent,
- PendingIntent deliveryIntent, Uri messageUri, String callingPkg, boolean persistMessage,
- int priority, boolean expectMore, int validityPeriod, boolean isForVvm,
- long messageId, boolean skipShortCodeCheck) {
+ PendingIntent deliveryIntent, Uri messageUri, String callingPkg, int callingUser,
+ boolean persistMessage, int priority, boolean expectMore, int validityPeriod,
+ boolean isForVvm, long messageId, boolean skipShortCodeCheck) {
if (TextUtils.isEmpty(scAddr)) {
scAddr = getSmscAddressFromUSIMWithPhoneIdentity(callingPkg);
}
PendingRequest pendingRequest = new PendingRequest(PendingRequest.TYPE_TEXT, null,
- callingPkg, destAddr, scAddr, asArrayList(sentIntent), asArrayList(deliveryIntent),
- isForVvm, null, 0, asArrayList(text), messageUri, persistMessage,
- priority, expectMore, validityPeriod, messageId, skipShortCodeCheck);
+ callingPkg, callingUser, destAddr, scAddr, asArrayList(sentIntent),
+ asArrayList(deliveryIntent), isForVvm, null, 0, asArrayList(text),
+ messageUri, persistMessage, priority, expectMore, validityPeriod, messageId,
+ skipShortCodeCheck);
if (SatelliteController.getInstance().isInCarrierRoamingNbIotNtn()) {
// Send P2P SMS using carrier roaming NB IOT NTN
@@ -1841,22 +1856,25 @@
request.destAddr)) {
mImsSmsDispatcher.sendText(request.destAddr, request.scAddr, request.texts.get(0),
request.sentIntents.get(0), request.deliveryIntents.get(0),
- request.messageUri, request.callingPackage, request.persistMessage,
- request.priority, false /*expectMore*/, request.validityPeriod,
- request.isForVvm, request.messageId, request.skipShortCodeCheck);
+ request.messageUri, request.callingPackage, request.callingUser,
+ request.persistMessage, request.priority, false /*expectMore*/,
+ request.validityPeriod, request.isForVvm, request.messageId,
+ request.skipShortCodeCheck);
} else {
if (isCdmaMo()) {
mCdmaDispatcher.sendText(request.destAddr, request.scAddr, request.texts.get(0),
request.sentIntents.get(0), request.deliveryIntents.get(0),
- request.messageUri, request.callingPackage, request.persistMessage,
- request.priority, request.expectMore, request.validityPeriod,
- request.isForVvm, request.messageId, request.skipShortCodeCheck);
+ request.messageUri, request.callingPackage, request.callingUser,
+ request.persistMessage, request.priority, request.expectMore,
+ request.validityPeriod, request.isForVvm, request.messageId,
+ request.skipShortCodeCheck);
} else {
mGsmDispatcher.sendText(request.destAddr, request.scAddr, request.texts.get(0),
request.sentIntents.get(0), request.deliveryIntents.get(0),
- request.messageUri, request.callingPackage, request.persistMessage,
- request.priority, request.expectMore, request.validityPeriod,
- request.isForVvm, request.messageId, request.skipShortCodeCheck);
+ request.messageUri, request.callingPackage, request.callingUser,
+ request.persistMessage, request.priority, request.expectMore,
+ request.validityPeriod, request.isForVvm, request.messageId,
+ request.skipShortCodeCheck);
}
}
}
@@ -1968,14 +1986,14 @@
protected void sendMultipartText(String destAddr, String scAddr,
ArrayList<String> parts, ArrayList<PendingIntent> sentIntents,
ArrayList<PendingIntent> deliveryIntents, Uri messageUri, String callingPkg,
- boolean persistMessage, int priority, boolean expectMore, int validityPeriod,
- long messageId) {
+ int callingUser, boolean persistMessage, int priority, boolean expectMore,
+ int validityPeriod, long messageId) {
if (TextUtils.isEmpty(scAddr)) {
scAddr = getSmscAddressFromUSIMWithPhoneIdentity(callingPkg);
}
PendingRequest pendingRequest = new PendingRequest(PendingRequest.TYPE_MULTIPART_TEXT, null,
- callingPkg, destAddr, scAddr, sentIntents, deliveryIntents, false,
+ callingPkg, callingUser, destAddr, scAddr, sentIntents, deliveryIntents, false,
null, 0, parts, messageUri, persistMessage, priority, expectMore,
validityPeriod, messageId, false);
@@ -2001,19 +2019,22 @@
if (mImsSmsDispatcher.isAvailable()) {
mImsSmsDispatcher.sendMultipartText(request.destAddr, request.scAddr, request.texts,
request.sentIntents, request.deliveryIntents, request.messageUri,
- request.callingPackage, request.persistMessage, request.priority,
- false /*expectMore*/, request.validityPeriod, request.messageId);
+ request.callingPackage, request.callingUser, request.persistMessage,
+ request.priority, false /*expectMore*/, request.validityPeriod,
+ request.messageId);
} else {
if (isCdmaMo()) {
mCdmaDispatcher.sendMultipartText(request.destAddr, request.scAddr, request.texts,
request.sentIntents, request.deliveryIntents, request.messageUri,
- request.callingPackage, request.persistMessage, request.priority,
- request.expectMore, request.validityPeriod, request.messageId);
+ request.callingPackage, request.callingUser, request.persistMessage,
+ request.priority, request.expectMore, request.validityPeriod,
+ request.messageId);
} else {
mGsmDispatcher.sendMultipartText(request.destAddr, request.scAddr, request.texts,
request.sentIntents, request.deliveryIntents, request.messageUri,
- request.callingPackage, request.persistMessage, request.priority,
- request.expectMore, request.validityPeriod, request.messageId);
+ request.callingPackage, request.callingUser, request.persistMessage,
+ request.priority, request.expectMore, request.validityPeriod,
+ request.messageId);
}
}
}
diff --git a/src/java/com/android/internal/telephony/data/DataConfigManager.java b/src/java/com/android/internal/telephony/data/DataConfigManager.java
index d9ddde0..89b0fec 100644
--- a/src/java/com/android/internal/telephony/data/DataConfigManager.java
+++ b/src/java/com/android/internal/telephony/data/DataConfigManager.java
@@ -643,10 +643,8 @@
// Consumer slices are the slices that are allowed to be accessed by regular application to
// get better performance. They should be metered. This can be turned into configurations in
// the future.
- if (mFeatureFlags.meteredEmbbUrlcc()) {
- meteredCapabilities.add(NetworkCapabilities.NET_CAPABILITY_PRIORITIZE_BANDWIDTH);
- meteredCapabilities.add(NetworkCapabilities.NET_CAPABILITY_PRIORITIZE_LATENCY);
- }
+ meteredCapabilities.add(NetworkCapabilities.NET_CAPABILITY_PRIORITIZE_BANDWIDTH);
+ meteredCapabilities.add(NetworkCapabilities.NET_CAPABILITY_PRIORITIZE_LATENCY);
return Collections.unmodifiableSet(meteredCapabilities);
}
@@ -761,7 +759,6 @@
*/
public boolean allowBringUpNetworkInNonVops(@NetworkRegistrationInfo.RegistrationState
int regState) {
- if (!mFeatureFlags.allowMmtelInNonVops()) return false;
int networkType = -1;
if (regState == NetworkRegistrationInfo.REGISTRATION_STATE_HOME) {
networkType = CarrierConfigManager.Ims.NETWORK_TYPE_HOME;
diff --git a/src/java/com/android/internal/telephony/data/DataNetwork.java b/src/java/com/android/internal/telephony/data/DataNetwork.java
index e66ea69..738c60f 100644
--- a/src/java/com/android/internal/telephony/data/DataNetwork.java
+++ b/src/java/com/android/internal/telephony/data/DataNetwork.java
@@ -1310,21 +1310,19 @@
getHandler(), EVENT_VOICE_CALL_ENDED, null);
}
- if (mFlags.forceIwlanMms()) {
- if (mDataProfile.canSatisfy(NetworkCapabilities.NET_CAPABILITY_MMS)) {
- mAccessNetworksManagerCallback = new AccessNetworksManagerCallback(
- getHandler()::post) {
- @Override
- public void onPreferredTransportChanged(
- @NetCapability int networkCapability, boolean forceReconnect) {
- if (networkCapability == NetworkCapabilities.NET_CAPABILITY_MMS) {
- log("MMS preference changed.");
- updateNetworkCapabilities();
- }
+ if (mDataProfile.canSatisfy(NetworkCapabilities.NET_CAPABILITY_MMS)) {
+ mAccessNetworksManagerCallback = new AccessNetworksManagerCallback(
+ getHandler()::post) {
+ @Override
+ public void onPreferredTransportChanged(
+ @NetCapability int networkCapability, boolean forceReconnect) {
+ if (networkCapability == NetworkCapabilities.NET_CAPABILITY_MMS) {
+ log("MMS preference changed.");
+ updateNetworkCapabilities();
}
- };
- mAccessNetworksManager.registerCallback(mAccessNetworksManagerCallback);
- }
+ }
+ };
+ mAccessNetworksManager.registerCallback(mAccessNetworksManagerCallback);
}
// Only add symmetric code here, for example, registering and unregistering.
@@ -1336,7 +1334,7 @@
@Override
public void exit() {
logv("Unregistering all events.");
- if (mFlags.forceIwlanMms() && mAccessNetworksManagerCallback != null) {
+ if (mAccessNetworksManagerCallback != null) {
mAccessNetworksManager.unregisterCallback(mAccessNetworksManagerCallback);
}
@@ -2408,14 +2406,7 @@
DataSpecificRegistrationInfo dsri = nri.getDataSpecificInfo();
// Check if the network is non-VoPS.
if (dsri != null && dsri.getVopsSupportInfo() != null
- && !dsri.getVopsSupportInfo().isVopsSupported()
- // Reflect the actual MMTEL if flag on.
- && (mFlags.allowMmtelInNonVops()
- // Deceive Connectivity service to satisfy an MMTEL request, this should
- // be useless because we reach here if no MMTEL request, then removing
- // MMTEL capability shouldn't have any impacts.
- || !mDataConfigManager.shouldKeepNetworkUpInNonVops(
- nri.getNetworkRegistrationState()))) {
+ && !dsri.getVopsSupportInfo().isVopsSupported()) {
builder.removeCapability(NetworkCapabilities.NET_CAPABILITY_MMTEL);
}
log("updateNetworkCapabilities: dsri=" + dsri);
@@ -2543,8 +2534,7 @@
// Check if the feature force MMS on IWLAN is enabled. When the feature is enabled, MMS
// will be attempted on IWLAN if possible, even if existing cellular networks already
// supports IWLAN.
- if (mFlags.forceIwlanMms() && builder.build()
- .hasCapability(NetworkCapabilities.NET_CAPABILITY_MMS)) {
+ if (builder.build().hasCapability(NetworkCapabilities.NET_CAPABILITY_MMS)) {
// If QNS sets MMS preferred on IWLAN, and it is possible to setup an MMS network on
// IWLAN, then we need to remove the MMS capability on the cellular network. This will
// allow the new MMS network to be brought up on IWLAN when MMS network request arrives.
diff --git a/src/java/com/android/internal/telephony/data/DataNetworkController.java b/src/java/com/android/internal/telephony/data/DataNetworkController.java
index 1e9f602..89153ab 100644
--- a/src/java/com/android/internal/telephony/data/DataNetworkController.java
+++ b/src/java/com/android/internal/telephony/data/DataNetworkController.java
@@ -1508,11 +1508,9 @@
.build(), mPhone, mFeatureFlags);
// If we don't skip checking existing network, then we should check If one of the
// existing networks can satisfy the internet request, then internet is allowed.
- if ((!mFeatureFlags.ignoreExistingNetworksForInternetAllowedChecking()
- || !ignoreExistingNetworks)
- && mDataNetworkList.stream().anyMatch(
- dataNetwork -> internetRequest.canBeSatisfiedBy(
- dataNetwork.getNetworkCapabilities()))) {
+ if (!ignoreExistingNetworks && mDataNetworkList.stream().anyMatch(
+ dataNetwork -> internetRequest.canBeSatisfiedBy(
+ dataNetwork.getNetworkCapabilities()))) {
return new DataEvaluation(DataEvaluationReason.EXTERNAL_QUERY);
}
diff --git a/src/java/com/android/internal/telephony/data/DataProfileManager.java b/src/java/com/android/internal/telephony/data/DataProfileManager.java
index c50d50a..28fe935 100644
--- a/src/java/com/android/internal/telephony/data/DataProfileManager.java
+++ b/src/java/com/android/internal/telephony/data/DataProfileManager.java
@@ -432,35 +432,18 @@
*/
private void onInternetDataNetworkConnected(@NonNull Set<DataNetwork> internetNetworks) {
DataProfile defaultProfile = null;
- if (mFeatureFlags.refinePreferredDataProfileSelection()) {
- // Most of the cases there should be only one.
- // but in case there are multiple, find the default internet network, and choose the
- // one which has longest life cycle.
- defaultProfile = internetNetworks.stream()
- .filter(network -> mPreferredDataProfile == null
- // Find the one most resembles the current preferred profile,
- // avoiding e.g. DUN default network.
- || canPreferredDataProfileSatisfy(
- network.getAttachedNetworkRequestList()))
- .map(DataNetwork::getDataProfile)
- .min(Comparator.comparingLong(DataProfile::getLastSetupTimestamp))
- .orElse(null);
- } else {
- if (internetNetworks.size() == 1) {
- // Most of the cases there should be only one.
- defaultProfile = internetNetworks.stream().findFirst().get().getDataProfile();
- } else if (internetNetworks.size() > 1) {
- // but in case there are multiple, find the default internet network, and choose the
- // one which has longest life cycle.
- defaultProfile = internetNetworks.stream()
- .filter(network -> mPreferredDataProfile == null
- || canPreferredDataProfileSatisfy(
- network.getAttachedNetworkRequestList()))
- .map(DataNetwork::getDataProfile)
- .min(Comparator.comparingLong(DataProfile::getLastSetupTimestamp))
- .orElse(null);
- }
- }
+ // Most of the cases there should be only one.
+ // but in case there are multiple, find the default internet network, and choose the
+ // one which has longest life cycle.
+ defaultProfile = internetNetworks.stream()
+ .filter(network -> mPreferredDataProfile == null
+ // Find the one most resembles the current preferred profile,
+ // avoiding e.g. DUN default network.
+ || canPreferredDataProfileSatisfy(
+ network.getAttachedNetworkRequestList()))
+ .map(DataNetwork::getDataProfile)
+ .min(Comparator.comparingLong(DataProfile::getLastSetupTimestamp))
+ .orElse(null);
// Update a working internet data profile by subid as a future candidate for preferred
// data profile after APNs are reset to default
diff --git a/src/java/com/android/internal/telephony/data/DataRetryManager.java b/src/java/com/android/internal/telephony/data/DataRetryManager.java
index 2a009c8..318c4b5 100644
--- a/src/java/com/android/internal/telephony/data/DataRetryManager.java
+++ b/src/java/com/android/internal/telephony/data/DataRetryManager.java
@@ -22,11 +22,6 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.AlarmManager;
-import android.app.PendingIntent;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
import android.net.NetworkCapabilities;
import android.os.AsyncResult;
import android.os.Handler;
@@ -79,11 +74,6 @@
public class DataRetryManager extends Handler {
private static final boolean VDBG = false;
- /** Intent of Alarm Manager for long retry timer. */
- private static final String ACTION_RETRY = "com.android.internal.telephony.data.ACTION_RETRY";
- /** The extra key for the hashcode of the retry entry for Alarm Manager. */
- private static final String ACTION_RETRY_EXTRA_HASHCODE = "extra_retry_hashcode";
-
/** Event for data setup retry. */
private static final int EVENT_DATA_SETUP_RETRY = 3;
@@ -1078,22 +1068,6 @@
mRil.registerForOn(this, EVENT_RADIO_ON, null);
mRil.registerForModemReset(this, EVENT_MODEM_RESET, null);
- if (!mFlags.useAlarmCallback()) {
- // Register intent of alarm manager for long retry timer
- IntentFilter intentFilter = new IntentFilter();
- intentFilter.addAction(ACTION_RETRY);
- mPhone.getContext().registerReceiver(new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- if (ACTION_RETRY.equals(intent.getAction())) {
- DataRetryManager.this.onAlarmIntentRetry(
- intent.getIntExtra(ACTION_RETRY_EXTRA_HASHCODE,
- -1 /*Bad hashcode*/));
- }
- }
- }, intentFilter);
- }
-
if (mDataConfigManager.shouldResetDataThrottlingWhenTacChanges()) {
mPhone.getServiceStateTracker().registerForAreaCodeChanged(this, EVENT_TAC_CHANGED,
null);
@@ -1531,32 +1505,19 @@
? EVENT_DATA_SETUP_RETRY : EVENT_DATA_HANDOVER_RETRY, dataRetryEntry),
dataRetryEntry.retryDelayMillis);
} else {
- if (mFlags.useAlarmCallback()) {
- // No need to wake up the device, the retry can wait util next time the device wake
- // up to save power.
- mAlarmManager.setExactAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME,
- dataRetryEntry.retryElapsedTime,
- "dataRetryHash-" + dataRetryEntry.hashCode() /*debug tag*/,
- Runnable::run,
- null /*worksource*/,
- () -> {
- logl("onAlarm retry " + dataRetryEntry);
- sendMessage(obtainMessage(dataRetryEntry instanceof DataSetupRetryEntry
- ? EVENT_DATA_SETUP_RETRY : EVENT_DATA_HANDOVER_RETRY,
- dataRetryEntry));
- });
- } else {
- Intent intent = new Intent(ACTION_RETRY);
- intent.putExtra(ACTION_RETRY_EXTRA_HASHCODE, dataRetryEntry.hashCode());
- // No need to wake up the device, the retry can wait util next time the device wake
- // up to save power.
- mAlarmManager.setAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME,
- dataRetryEntry.retryElapsedTime,
- PendingIntent.getBroadcast(mPhone.getContext(),
- dataRetryEntry.hashCode()/*Unique identifier of the retry attempt*/,
- intent,
- PendingIntent.FLAG_IMMUTABLE));
- }
+ // No need to wake up the device, the retry can wait util next time the device wake
+ // up to save power.
+ mAlarmManager.setExactAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME,
+ dataRetryEntry.retryElapsedTime,
+ "dataRetryHash-" + dataRetryEntry.hashCode() /*debug tag*/,
+ Runnable::run,
+ null /*worksource*/,
+ () -> {
+ logl("onAlarm retry " + dataRetryEntry);
+ sendMessage(obtainMessage(dataRetryEntry instanceof DataSetupRetryEntry
+ ? EVENT_DATA_SETUP_RETRY : EVENT_DATA_HANDOVER_RETRY,
+ dataRetryEntry));
+ });
}
}
@@ -1601,8 +1562,7 @@
// transport.
mDataThrottlingEntries.removeIf(
throttlingEntry -> dataProfile.equals(throttlingEntry.dataProfile)
- && (!mFlags.unthrottleCheckTransport()
- || throttlingEntry.transport == transport));
+ && (throttlingEntry.transport == transport));
if (mDataThrottlingEntries.size() >= MAXIMUM_HISTORICAL_ENTRIES) {
// If we don't see the anomaly report after U release, we should remove this check for
@@ -1651,7 +1611,7 @@
// profile manager.
Stream<DataThrottlingEntry> stream = mDataThrottlingEntries.stream();
stream = stream.filter(entry -> entry.expirationTimeMillis > now
- && (!mFlags.unthrottleCheckTransport() || entry.transport == transport));
+ && entry.transport == transport);
if (dataProfile.getApnSetting() != null) {
stream = stream
.filter(entry -> entry.dataProfile.getApnSetting() != null)
diff --git a/src/java/com/android/internal/telephony/emergency/EmergencyStateTracker.java b/src/java/com/android/internal/telephony/emergency/EmergencyStateTracker.java
index 167062f..f983108 100644
--- a/src/java/com/android/internal/telephony/emergency/EmergencyStateTracker.java
+++ b/src/java/com/android/internal/telephony/emergency/EmergencyStateTracker.java
@@ -1661,7 +1661,8 @@
return phone.getServiceStateTracker().isRadioOn()
&& !satelliteController.isSatelliteEnabled();
}
- }, !isTestEmergencyNumber, phone, isTestEmergencyNumber, waitForInServiceTimeout);
+ }, !isTestEmergencyNumber, phone, isTestEmergencyNumber, waitForInServiceTimeout,
+ /* forNormalRoutingEmergencyCall */ false);
} else {
switchDdsAndSetEmergencyMode(phone, emergencyType);
}
diff --git a/src/java/com/android/internal/telephony/emergency/RadioOnHelper.java b/src/java/com/android/internal/telephony/emergency/RadioOnHelper.java
index 306f6bb..0d1b625 100644
--- a/src/java/com/android/internal/telephony/emergency/RadioOnHelper.java
+++ b/src/java/com/android/internal/telephony/emergency/RadioOnHelper.java
@@ -85,7 +85,7 @@
*/
public void triggerRadioOnAndListen(RadioOnStateListener.Callback callback,
boolean forEmergencyCall, Phone phoneForEmergencyCall, boolean isTestEmergencyNumber,
- int emergencyTimeoutIntervalMillis) {
+ int emergencyTimeoutIntervalMillis, boolean forNormalRoutingEmergencyCall) {
setupListeners();
mCallback = callback;
mInProgressListeners.clear();
@@ -102,7 +102,8 @@
mListeners.get(i).waitForRadioOn(phone, this, forEmergencyCall, forEmergencyCall
&& phone == phoneForEmergencyCall, timeoutCallbackInterval);
}
- powerOnRadio(forEmergencyCall, phoneForEmergencyCall, isTestEmergencyNumber);
+ powerOnRadio(forEmergencyCall, phoneForEmergencyCall, isTestEmergencyNumber,
+ forNormalRoutingEmergencyCall);
if (SatelliteController.getInstance().isSatelliteEnabled()) {
powerOffSatellite(phoneForEmergencyCall);
}
@@ -113,17 +114,25 @@
* get an onServiceStateChanged() callback when the radio successfully comes up.
*/
private void powerOnRadio(boolean forEmergencyCall, Phone phoneForEmergencyCall,
- boolean isTestEmergencyNumber) {
+ boolean isTestEmergencyNumber, boolean forNormalRoutingEmergencyCall) {
// Always try to turn on the radio here independent of APM setting - if we got here in the
// first place, the radio is off independent of APM setting.
for (Phone phone : PhoneFactory.getPhones()) {
Rlog.d(TAG, "powerOnRadio, enabling Radio");
if (isTestEmergencyNumber) {
- phone.setRadioPowerOnForTestEmergencyCall(phone == phoneForEmergencyCall);
+ phone.setRadioPowerOnForTestEmergencyCall(
+ (phone == phoneForEmergencyCall) && !forNormalRoutingEmergencyCall);
} else {
- phone.setRadioPower(true, forEmergencyCall, phone == phoneForEmergencyCall,
- false);
+ if (forNormalRoutingEmergencyCall) {
+ if (phone.getServiceStateTracker() != null) {
+ // Clear all radio off reasons to ensure that the radio is turned on for
+ // normal routing emergency call.
+ phone.getServiceStateTracker().clearAllRadioOffReasons();
+ }
+ }
+ phone.setRadioPower(true, forEmergencyCall && !forNormalRoutingEmergencyCall,
+ (phone == phoneForEmergencyCall) && !forNormalRoutingEmergencyCall, false);
}
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/DefaultPhoneNotifierTest.java b/tests/telephonytests/src/com/android/internal/telephony/DefaultPhoneNotifierTest.java
index 749f190..8dad3ec 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/DefaultPhoneNotifierTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/DefaultPhoneNotifierTest.java
@@ -23,7 +23,6 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
import android.telephony.CellIdentityGsm;
import android.telephony.CellInfo;
@@ -101,23 +100,7 @@
}
@Test @SmallTest
- public void testNotifyDataActivity() throws Exception {
- when(mFeatureFlags.notifyDataActivityChangedWithSlot()).thenReturn(false);
- //mock data activity state
- doReturn(TelephonyManager.DATA_ACTIVITY_NONE).when(mPhone).getDataActivityState();
- mDefaultPhoneNotifierUT.notifyDataActivity(mPhone);
- verify(mTelephonyRegistryManager).notifyDataActivityChanged(eq(0),
- eq(TelephonyManager.DATA_ACTIVITY_NONE));
-
- doReturn(1).when(mPhone).getSubId();
- doReturn(TelephonyManager.DATA_ACTIVITY_IN).when(mPhone).getDataActivityState();
- mDefaultPhoneNotifierUT.notifyDataActivity(mPhone);
- verify(mTelephonyRegistryManager).notifyDataActivityChanged(eq(1),
- eq(TelephonyManager.DATA_ACTIVITY_IN));
- }
- @Test @SmallTest
public void testNotifyDataActivityWithSlot() throws Exception {
- when(mFeatureFlags.notifyDataActivityChangedWithSlot()).thenReturn(true);
//mock data activity state
doReturn(TelephonyManager.DATA_ACTIVITY_NONE).when(mPhone).getDataActivityState();
doReturn(PHONE_ID).when(mPhone).getPhoneId();
diff --git a/tests/telephonytests/src/com/android/internal/telephony/ImsSmsDispatcherTest.java b/tests/telephonytests/src/com/android/internal/telephony/ImsSmsDispatcherTest.java
index f64155c..6c84b08 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/ImsSmsDispatcherTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/ImsSmsDispatcherTest.java
@@ -34,6 +34,7 @@
import static org.mockito.Mockito.when;
import android.content.Context;
+import android.os.Binder;
import android.os.PersistableBundle;
import android.telephony.CarrierConfigManager;
import android.telephony.SmsMessage;
@@ -71,6 +72,7 @@
PersistableBundle mBundle = new PersistableBundle();
private static final int SUB_0 = 0;
private static final String TAG = "ImsSmsDispatcherTest";
+ private int mCallingUserId;
@Before
public void setUp() throws Exception {
@@ -94,6 +96,7 @@
mTrackerData = new HashMap<>(1);
when(mSmsTracker.getData()).thenReturn(mTrackerData);
verify(mSmsDispatchersController).setImsManager(mImsManager);
+ mCallingUserId = Binder.getCallingUserHandle().getIdentifier();
}
@After
@@ -333,8 +336,7 @@
doReturn(mSmsUsageMonitor).when(mSmsDispatchersController).getUsageMonitor();
mImsSmsDispatcher.sendText("+15555551212", null, "MessageRef test",
- null, null, null, null, false,
- -1, false, -1, false, 0);
+ null, null, null, null, mCallingUserId, false, -1, false, -1, false, 0);
verify(mImsManager).sendSms(eq(token + 1), eq(messageRef), eq(SmsMessage.FORMAT_3GPP),
nullable(String.class), eq(false), (byte[]) any());
}
@@ -349,8 +351,7 @@
doReturn(mSmsUsageMonitor).when(mSmsDispatchersController).getUsageMonitor();
mImsSmsDispatcher.sendText("+15555551212", null, "MessageRef test",
- null, null, null, null, false,
- -1, false, -1, false, 0);
+ null, null, null, null, mCallingUserId, false, -1, false, -1, false, 0);
verify(mImsManager).sendSms(eq(token + 1), eq(messageRef), eq(SmsMessage.FORMAT_3GPP),
nullable(String.class), eq(false), (byte[]) any());
@@ -384,8 +385,7 @@
doReturn(mSmsUsageMonitor).when(mSmsDispatchersController).getUsageMonitor();
mImsSmsDispatcher.sendText("+15555551212", null, "MessageRef test",
- null, null, null, null, false,
- -1, false, -1, false, 0);
+ null, null, null, null, mCallingUserId, false, -1, false, -1, false, 0);
verify(mImsManager).sendSms(eq(token + 1), eq(messageRef), eq(SmsMessage.FORMAT_3GPP),
nullable(String.class), eq(false), (byte[]) any());
@@ -423,8 +423,7 @@
when(mPhone.getPhoneType()).thenReturn(PhoneConstants.PHONE_TYPE_GSM);
doReturn(mSmsUsageMonitor).when(mSmsDispatchersController).getUsageMonitor();
mImsSmsDispatcher.sendText("+15555551212", null, "Retry test",
- null, null, null, null, false,
- -1, false, -1, false, 0);
+ null, null, null, null, mCallingUserId, false, -1, false, -1, false, 0);
verify(mImsManager).sendSms(eq(token + 1), eq(messageRef), eq(SmsMessage.FORMAT_3GPP),
nullable(String.class), eq(false), (byte[]) any());
assertEquals(2, mImsSmsDispatcher.getMaxRetryCountOverIms());
diff --git a/tests/telephonytests/src/com/android/internal/telephony/SmsControllerTest.java b/tests/telephonytests/src/com/android/internal/telephony/SmsControllerTest.java
index 06dbd0b..710f1ec 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/SmsControllerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/SmsControllerTest.java
@@ -31,6 +31,7 @@
import android.compat.testing.PlatformCompatChangeRule;
import android.content.pm.PackageManager;
+import android.os.Binder;
import android.os.Build;
import android.telephony.TelephonyManager;
import android.testing.AndroidTestingRunner;
@@ -67,6 +68,7 @@
private SmsController mSmsControllerUT;
private final String smscAddrStr = "+1206313004";
private String mCallingPackage;
+ private int mCallingUserId;
@Before
public void setUp() throws Exception {
@@ -74,6 +76,7 @@
mAdnRecordCache = Mockito.mock(AdnRecordCache.class);
mSmsControllerUT = new SmsController(mContext, mFeatureFlags);
mCallingPackage = mContext.getOpPackageName();
+ mCallingUserId = Binder.getCallingUserHandle().getIdentifier();
doReturn(true).when(mPackageManager).hasSystemFeature(
PackageManager.FEATURE_TELEPHONY_MESSAGING);
@@ -196,9 +199,9 @@
doReturn(true).when(mSubscriptionManager)
.isSubscriptionAssociatedWithUser(eq(subId), any());
- mSmsControllerUT.sendVisualVoicemailSmsForSubscriber(mCallingPackage,null ,
- subId, null, 0, null, null);
- verify(mIccSmsInterfaceManager).sendTextWithSelfPermissions(any(),
+ mSmsControllerUT.sendVisualVoicemailSmsForSubscriber(mCallingPackage, mCallingUserId,
+ null , subId, null, 0, null, null);
+ verify(mIccSmsInterfaceManager).sendTextWithSelfPermissions(any(), eq(mCallingUserId),
any(), any(), any(), any(), any(), any(), eq(false), eq(true));
}
@@ -206,10 +209,11 @@
public void sendVisualVoicemailSmsForSubscriber_phoneIsInEcm() {
doReturn(true).when(mPhone).isInEcm();
- mSmsControllerUT.sendVisualVoicemailSmsForSubscriber(mCallingPackage,null ,
- 1, null, 0, null, null);
+ mSmsControllerUT.sendVisualVoicemailSmsForSubscriber(mCallingPackage, mCallingUserId,
+ null , 1, null, 0, null, null);
verify(mIccSmsInterfaceManager, never()).sendTextWithSelfPermissions(any(),
- any(), any(), any(), any(), any(), any(), eq(false), eq(true));
+ eq(mCallingUserId), any(), any(), any(), any(), any(), any(),
+ eq(false), eq(true));
doReturn(false).when(mPhone).isInEcm();
}
@@ -223,7 +227,8 @@
mSmsControllerUT.sendTextForSubscriber(subId, mCallingPackage, null, "1234",
null, "text", null, null, false, 0L, true, true);
verify(mIccSmsInterfaceManager, Mockito.times(1))
- .sendText(mCallingPackage, "1234", null, "text", null, null, false, 0L, true);
+ .sendText(mCallingPackage, mCallingUserId,
+ "1234", null, "text", null, null, false, 0L, true);
}
@Test
@@ -239,7 +244,8 @@
mSmsControllerUT.sendTextForSubscriber(subId, mCallingPackage, null, "1234",
null, "text", null, null, false, 0L, true, true);
verify(mIccSmsInterfaceManager, Mockito.times(1))
- .sendText(mCallingPackage, "1234", null, "text", null, null, false, 0L, true);
+ .sendText(mCallingPackage, mCallingUserId,
+ "1234", null, "text", null, null, false, 0L, true);
}
@Test
@@ -255,7 +261,8 @@
mSmsControllerUT.sendTextForSubscriber(subId, mCallingPackage, null, "1234",
null, "text", null, null, false, 0L, true, true);
verify(mIccSmsInterfaceManager, Mockito.times(0))
- .sendText(mCallingPackage, "1234", null, "text", null, null, false, 0L, true);
+ .sendText(mCallingPackage, mCallingUserId,
+ "1234", null, "text", null, null, false, 0L, true);
}
@Test
@@ -320,6 +327,7 @@
mSmsControllerUT.sendTextForSubscriber(subId, mCallingPackage, null, "1234",
null, "text", null, null, false, 0L, true, true);
verify(mIccSmsInterfaceManager, Mockito.times(1))
- .sendText(mCallingPackage, "1234", null, "text", null, null, false, 0L, true);
+ .sendText(mCallingPackage, mCallingUserId,
+ "1234", null, "text", null, null, false, 0L, true);
}
}
\ No newline at end of file
diff --git a/tests/telephonytests/src/com/android/internal/telephony/SmsDispatchersControllerTest.java b/tests/telephonytests/src/com/android/internal/telephony/SmsDispatchersControllerTest.java
index 00d7a3c..12a119c 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/SmsDispatchersControllerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/SmsDispatchersControllerTest.java
@@ -97,20 +97,21 @@
return getDomainSelectionConnectionHolder(emergency);
}
- public void testSendData(String callingPackage, String destAddr, String scAddr,
- int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent,
- boolean isForVvm) {
- sendData(callingPackage, destAddr, scAddr,
+ public void testSendData(String callingPackage, int callingUser,
+ String destAddr, String scAddr, int destPort, byte[] data, PendingIntent sentIntent,
+ PendingIntent deliveryIntent, boolean isForVvm) {
+ sendData(callingPackage, callingUser, destAddr, scAddr,
destPort, data, sentIntent, deliveryIntent, isForVvm);
}
public void testSendMultipartText(String destAddr, String scAddr,
ArrayList<String> parts, ArrayList<PendingIntent> sentIntents,
ArrayList<PendingIntent> deliveryIntents, Uri messageUri, String callingPkg,
- boolean persistMessage, int priority, boolean expectMore, int validityPeriod,
- long messageId) {
+ int callingUser, boolean persistMessage, int priority, boolean expectMore,
+ int validityPeriod, long messageId) {
sendMultipartText(destAddr, scAddr, parts, sentIntents, deliveryIntents, messageUri,
- callingPkg, persistMessage, priority, expectMore, validityPeriod, messageId);
+ callingPkg, callingUser, persistMessage, priority, expectMore,
+ validityPeriod, messageId);
}
public void testNotifySmsSentToEmergencyStateTracker(String destAddr, long messageId,
@@ -137,10 +138,10 @@
}
@Override
- public void sendData(String callingPackage, String destAddr, String scAddr, int destPort,
- byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent,
- boolean isForVvm) {
- super.sendData(callingPackage, destAddr, scAddr, destPort,
+ public void sendData(String callingPackage, int callingUser, String destAddr,
+ String scAddr, int destPort, byte[] data, PendingIntent sentIntent,
+ PendingIntent deliveryIntent, boolean isForVvm) {
+ super.sendData(callingPackage, callingUser, destAddr, scAddr, destPort,
data, sentIntent, deliveryIntent, isForVvm);
}
@@ -164,10 +165,10 @@
}
@Override
- public void sendData(String callingPackage, String destAddr, String scAddr, int destPort,
- byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent,
+ public void sendData(String callingPackage, int callingUser, String destAddr, String scAddr,
+ int destPort, byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent,
boolean isForVvm) {
- super.sendData(callingPackage, destAddr, scAddr, destPort,
+ super.sendData(callingPackage, callingUser, destAddr, scAddr, destPort,
data, sentIntent, deliveryIntent, isForVvm);
}
@@ -195,6 +196,7 @@
private boolean mInjectionCallbackTriggered = false;
private CompletableFuture<Integer> mDscFuture;
private DatagramDispatcher mMockDatagramDispatcher;
+ private int mCallingUserId;
@Before
public void setUp() throws Exception {
@@ -207,6 +209,7 @@
setupMockPackagePermissionChecks();
mSmsDispatchersController = new TestSmsDispatchersController(mPhone, mSmsStorageMonitor,
mSmsUsageMonitor, mTestableLooper.getLooper(), mFeatureFlags);
+ mCallingUserId = mContext.getUserId();
processAllMessages();
}
@@ -266,7 +269,7 @@
public void testSendImsGmsTest() throws Exception {
switchImsSmsFormat(PhoneConstants.PHONE_TYPE_GSM);
mSmsDispatchersController.sendText("111"/* desAddr*/, "222" /*scAddr*/, TAG,
- null, null, null, null, false, -1, false, -1, false, 0L);
+ null, null, null, null, mCallingUserId, false, -1, false, -1, false, 0L);
verify(mSimulatedCommandsVerifier).sendImsGsmSms(eq("038122F2"),
eq("0100038111F100001CD3F69C989EC3C3F431BA2C9F0FDF6EBAFCCD6697E5D4F29C0E"), eq(0), eq(0),
any(Message.class));
@@ -276,7 +279,7 @@
public void testSendImsGmsTestWithOutDesAddr() throws Exception {
switchImsSmsFormat(PhoneConstants.PHONE_TYPE_GSM);
mSmsDispatchersController.sendText(null, "222" /*scAddr*/, TAG,
- null, null, null, null, false, -1, false, -1, false, 0L);
+ null, null, null, null, mCallingUserId, false, -1, false, -1, false, 0L);
verify(mSimulatedCommandsVerifier, times(0)).sendImsGsmSms(anyString(), anyString(),
anyInt(), anyInt(), any(Message.class));
}
@@ -285,7 +288,7 @@
public void testSendImsCdmaTest() throws Exception {
switchImsSmsFormat(PhoneConstants.PHONE_TYPE_CDMA);
mSmsDispatchersController.sendText("111"/* desAddr*/, "222" /*scAddr*/, TAG,
- null, null, null, null, false, -1, false, -1, false, 0L);
+ null, null, null, null, mCallingUserId, false, -1, false, -1, false, 0L);
verify(mSimulatedCommandsVerifier).sendImsCdmaSms((byte[])any(), eq(0), eq(0),
any(Message.class));
}
@@ -360,7 +363,8 @@
mSmsDispatchersController.sendText("111", null /*scAddr*/, TAG,
null, null, null, "com.android.messaging",
- false, -1, false, -1, false, 0L);
+ mContext.getUserId(), false, -1, false,
+ -1, false, 0L);
byte[] smscbyte = PhoneNumberUtils.networkPortionToCalledPartyBCDWithLength(
"222");
String smsc = IccUtils.bytesToHexString(smscbyte);
@@ -469,7 +473,7 @@
setUpEmergencyStateTracker(DisconnectCause.NOT_DISCONNECTED);
mSmsDispatchersController.sendText("911", "2222", "text", mSentIntent, null, null,
- "test-app", false, 0, false, 10, false, 1L, false);
+ "test-app", mCallingUserId, false, 0, false, 10, false, 1L, false);
processAllMessages();
SmsDispatchersController.DomainSelectionConnectionHolder holder =
@@ -486,8 +490,8 @@
verify(mEmergencySmsDsc).finishSelection();
verify(mImsSmsDispatcher).sendText(eq("911"), eq("2222"), eq("text"), eq(mSentIntent),
- any(), any(), eq("test-app"), eq(false), eq(0), eq(false), eq(10), eq(false),
- eq(1L), eq(false));
+ any(), any(), eq("test-app"), eq(mCallingUserId), eq(false),
+ eq(0), eq(false), eq(10), eq(false), eq(1L), eq(false));
assertNull(holder.getConnection());
assertFalse(holder.isDomainSelectionRequested());
assertEquals(0, holder.getPendingRequests().size());
@@ -501,7 +505,7 @@
setUpEmergencyStateTracker(DisconnectCause.OUT_OF_SERVICE);
mSmsDispatchersController.sendText("911", "2222", "text", mSentIntent, null, null,
- "test-app", false, 0, false, 10, false, 1L, false);
+ "test-app", mCallingUserId, false, 0, false, 10, false, 1L, false);
processAllMessages();
// Verify the domain selection requested regardless of the result of EmergencyStateTracker.
@@ -519,7 +523,7 @@
ArrayList<PendingIntent> sentIntents = new ArrayList<>();
ArrayList<PendingIntent> deliveryIntents = new ArrayList<>();
mSmsDispatchersController.testSendMultipartText("911", "2222", parts, sentIntents,
- deliveryIntents, null, "test-app", false, 0, false, 10, 1L);
+ deliveryIntents, null, "test-app", mCallingUserId, false, 0, false, 10, 1L);
processAllMessages();
SmsDispatchersController.DomainSelectionConnectionHolder holder =
@@ -536,8 +540,9 @@
verify(mEmergencySmsDsc).finishSelection();
verify(mImsSmsDispatcher).sendMultipartText(eq("911"), eq("2222"), eq(parts),
- eq(sentIntents), eq(deliveryIntents), any(), eq("test-app"), eq(false), eq(0),
- eq(false), eq(10), eq(1L));
+ eq(sentIntents), eq(deliveryIntents), any(), eq("test-app"),
+ eq(mCallingUserId), eq(false), eq(0), eq(false),
+ eq(10), eq(1L));
assertNull(holder.getConnection());
assertFalse(holder.isDomainSelectionRequested());
assertEquals(0, holder.getPendingRequests().size());
@@ -710,7 +715,7 @@
when(mImsSmsDispatcher.isAvailable()).thenReturn(true);
mSmsDispatchersController.sendText("1111", "2222", "text", mSentIntent, null, null,
- "test-app", false, 0, false, 10, false, 1L, false);
+ "test-app", mCallingUserId, false, 0, false, 10, false, 1L, false);
processAllMessages();
SmsDispatchersController.DomainSelectionConnectionHolder holder =
@@ -735,8 +740,8 @@
assertEquals(0, holder.getPendingRequests().size());
verify(mImsSmsDispatcher).sendText(eq("1111"), eq("2222"), eq("text"), eq(mSentIntent),
- any(), any(), eq("test-app"), eq(false), eq(0), eq(false), eq(10), eq(false),
- eq(1L), eq(false));
+ any(), any(), eq("test-app"), eq(mCallingUserId),
+ eq(false), eq(0), eq(false), eq(10), eq(false), eq(1L), eq(false));
}
@Test
@@ -750,7 +755,8 @@
when(mImsSmsDispatcher.isEmergencySmsSupport(anyString())).thenReturn(true);
mSmsDispatchersController.sendText("911", "2222", "text", mSentIntent, null, null,
- "test-app", false, 0, false, 10, false, 1L, false);
+ "test-app", mCallingUserId, false, 0, false,
+ 10, false, 1L, false);
processAllMessages();
SmsDispatchersController.DomainSelectionConnectionHolder holder =
@@ -775,8 +781,8 @@
assertEquals(0, holder.getPendingRequests().size());
verify(mImsSmsDispatcher).sendText(eq("911"), eq("2222"), eq("text"), eq(mSentIntent),
- any(), any(), eq("test-app"), eq(false), eq(0), eq(false), eq(10), eq(false),
- eq(1L), eq(false));
+ any(), any(), eq("test-app"), eq(0), eq(false), eq(0), eq(false), eq(10),
+ eq(false), eq(1L), eq(false));
}
@Test
@@ -786,7 +792,7 @@
setUpSmsDispatchers();
mSmsDispatchersController.sendText("1111", "2222", "text", mSentIntent, null, null,
- "test-app", false, 0, false, 10, false, 1L, false);
+ "test-app", mCallingUserId, false, 0, false, 10, false, 1L, false);
processAllMessages();
SmsDispatchersController.DomainSelectionConnectionHolder holder =
@@ -797,7 +803,7 @@
assertEquals(1, holder.getPendingRequests().size());
mSmsDispatchersController.sendText("1111", "2222", "text", mSentIntent, null, null,
- "test-app", false, 0, false, 10, false, 1L, false);
+ "test-app", mCallingUserId, false, 0, false, 10, false, 1L, false);
processAllMessages();
verify(mSmsDsc).requestDomainSelection(any(), any());
@@ -809,9 +815,10 @@
processAllMessages();
verify(mSmsDsc).finishSelection();
- verify(mImsSmsDispatcher, times(2)).sendText(eq("1111"), eq("2222"), eq("text"),
- eq(mSentIntent), any(), any(), eq("test-app"), eq(false), eq(0), eq(false), eq(10),
- eq(false), eq(1L), eq(false));
+ verify(mImsSmsDispatcher, times(2)).sendText(eq("1111"), eq("2222"),
+ eq("text"), eq(mSentIntent), any(), any(), eq("test-app"), eq(mCallingUserId),
+ eq(false), eq(0), eq(false), eq(10), eq(false), eq(1L),
+ eq(false));
assertNull(holder.getConnection());
assertFalse(holder.isDomainSelectionRequested());
assertEquals(0, holder.getPendingRequests().size());
@@ -826,13 +833,13 @@
when(mImsSmsDispatcher.isAvailable()).thenReturn(true);
mSmsDispatchersController.sendText("1111", "2222", "text", mSentIntent, null, null,
- "test-app", false, 0, false, 10, false, 1L, false);
+ "test-app", mCallingUserId, false, 0, false, 10, false, 1L, false);
// Expect that the domain selection is not executed and
// ImsSmsDispatcher handles this text directly.
verify(mImsSmsDispatcher).sendText(eq("1111"), eq("2222"), eq("text"),
- eq(mSentIntent), any(), any(), eq("test-app"), eq(false), eq(0), eq(false), eq(10),
- eq(false), eq(1L), eq(false));
+ eq(mSentIntent), any(), any(), eq("test-app"), eq(mCallingUserId), eq(false), eq(0),
+ eq(false), eq(10), eq(false), eq(1L), eq(false));
}
@Test
@@ -842,7 +849,7 @@
setUpSmsDispatchers();
mSmsDispatchersController.sendText("1111", "2222", "text", mSentIntent, null, null,
- "test-app", false, 0, false, 10, false, 1L, false);
+ "test-app", mCallingUserId, false, 0, false, 10, false, 1L, false);
processAllMessages();
SmsDispatchersController.DomainSelectionConnectionHolder holder =
@@ -880,7 +887,7 @@
// Expect that new domain selection connection is created and domain selection is performed.
mSmsDispatchersController.sendText("1111", "2222", "text", mSentIntent, null, null,
- "test-app", false, 0, false, 10, false, 1L, false);
+ "test-app", mCallingUserId, false, 0, false, 10, false, 1L, false);
processAllMessages();
verify(mSmsDsc).finishSelection();
@@ -895,8 +902,8 @@
verify(newSmsDsc).finishSelection();
verify(mImsSmsDispatcher, times(2)).sendText(eq("1111"), eq("2222"), eq("text"),
- eq(mSentIntent), any(), any(), eq("test-app"), eq(false), eq(0), eq(false), eq(10),
- eq(false), eq(1L), eq(false));
+ eq(mSentIntent), any(), any(), eq("test-app"), eq(mCallingUserId), eq(false), eq(0),
+ eq(false), eq(10), eq(false), eq(1L), eq(false));
assertNull(holder.getConnection());
assertFalse(holder.isDomainSelectionRequested());
assertEquals(0, holder.getPendingRequests().size());
@@ -911,7 +918,7 @@
setUpEmergencyStateTracker(DisconnectCause.NOT_DISCONNECTED);
mSmsDispatchersController.sendText("911", "2222", "text", mSentIntent, null, null,
- "test-app", false, 0, false, 10, false, 1L, false);
+ "test-app", mCallingUserId, false, 0, false, 10, false, 1L, false);
processAllMessages();
SmsDispatchersController.DomainSelectionConnectionHolder holder =
@@ -951,7 +958,7 @@
// Expect that new domain selection connection is created and domain selection is performed.
mSmsDispatchersController.sendText("911", "2222", "text", mSentIntent, null, null,
- "test-app", false, 0, false, 10, false, 1L, false);
+ "test-app", mCallingUserId, false, 0, false, 10, false, 1L, false);
processAllMessages();
verify(mEmergencySmsDsc).finishSelection();
@@ -966,8 +973,8 @@
verify(newEmergencySmsDsc).finishSelection();
verify(mImsSmsDispatcher, times(2)).sendText(eq("911"), eq("2222"), eq("text"),
- eq(mSentIntent), any(), any(), eq("test-app"), eq(false), eq(0), eq(false), eq(10),
- eq(false), eq(1L), eq(false));
+ eq(mSentIntent), any(), any(), eq("test-app"), eq(0), eq(false), eq(0), eq(false),
+ eq(10), eq(false), eq(1L), eq(false));
assertNull(holder.getConnection());
assertFalse(holder.isDomainSelectionRequested());
assertEquals(0, holder.getPendingRequests().size());
@@ -998,7 +1005,7 @@
// Expect that creating a domain selection connection is failed and
// fallback to the legacy implementation.
mSmsDispatchersController.sendText("1111", "2222", "text", mSentIntent, null, null,
- "test-app", false, 0, false, 10, false, 1L, false);
+ "test-app", mCallingUserId, false, 0, false, 10, false, 1L, false);
processAllMessages();
SmsDispatchersController.DomainSelectionConnectionHolder holder =
@@ -1009,8 +1016,8 @@
assertEquals(0, holder.getPendingRequests().size());
verify(mImsSmsDispatcher).sendText(eq("1111"), eq("2222"), eq("text"), eq(mSentIntent),
- any(), any(), eq("test-app"), eq(false), eq(0), eq(false), eq(10), eq(false),
- eq(1L), eq(false));
+ any(), any(), eq("test-app"), eq(mCallingUserId), eq(false), eq(0),
+ eq(false), eq(10), eq(false), eq(1L), eq(false));
}
@Test
@@ -1040,7 +1047,7 @@
// Expect that creating a domain selection connection is failed and
// fallback to the legacy implementation.
mSmsDispatchersController.sendText("911", "2222", "text", mSentIntent, null, null,
- "test-app", false, 0, false, 10, false, 1L, false);
+ "test-app", mCallingUserId, false, 0, false, 10, false, 1L, false);
processAllMessages();
SmsDispatchersController.DomainSelectionConnectionHolder holder =
@@ -1052,8 +1059,8 @@
assertEquals(0, holder.getPendingRequests().size());
verify(mImsSmsDispatcher).sendText(eq("911"), eq("2222"), eq("text"), eq(mSentIntent),
- any(), any(), eq("test-app"), eq(false), eq(0), eq(false), eq(10), eq(false),
- eq(1L), eq(false));
+ any(), any(), eq("test-app"), eq(mCallingUserId), eq(false), eq(0), eq(false),
+ eq(10), eq(false), eq(1L), eq(false));
}
private void switchImsSmsFormat(int phoneType) {
@@ -1074,7 +1081,7 @@
public void testSendSmsToDatagramDispatcher() {
when(mSatelliteController.isInCarrierRoamingNbIotNtn()).thenReturn(true);
mSmsDispatchersController.sendText("1111", "2222", "text", mSentIntent, null, null,
- "test-app", false, 0, false, 10, false, 1L, false);
+ "test-app", mCallingUserId, false, 0, false, 10, false, 1L, false);
processAllMessages();
verify(mMockDatagramDispatcher).sendSms(any());
@@ -1083,7 +1090,7 @@
ArrayList<PendingIntent> sentIntents = new ArrayList<>();
ArrayList<PendingIntent> deliveryIntents = new ArrayList<>();
mSmsDispatchersController.testSendMultipartText("1111", "2222", parts, sentIntents,
- deliveryIntents, null, "test-app", false, 0, false, 10, 1L);
+ deliveryIntents, null, "test-app", mCallingUserId, false, 0, false, 10, 1L);
processAllMessages();
verify(mMockDatagramDispatcher).sendSms(any());
}
@@ -1195,7 +1202,7 @@
byte[] data = new byte[] { 0x01 };
mSmsDispatchersController.testSendData(
- "test-app", "1111", "2222", 8080, data, mSentIntent, null, false);
+ "test-app", mCallingUserId, "1111", "2222", 8080, data, mSentIntent, null, false);
processAllMessages();
SmsDispatchersController.DomainSelectionConnectionHolder holder =
@@ -1211,14 +1218,14 @@
verify(mSmsDsc).finishSelection();
if (domain == NetworkRegistrationInfo.DOMAIN_PS) {
- verify(mImsSmsDispatcher).sendData(eq("test-app"), eq("1111"), eq("2222"), eq(8080),
- eq(data), eq(mSentIntent), any(), eq(false));
+ verify(mImsSmsDispatcher).sendData(eq("test-app"), eq(0), eq("1111"), eq("2222"),
+ eq(8080), eq(data), eq(mSentIntent), any(), eq(false));
} else if (isCdmaMo) {
- verify(mCdmaSmsDispatcher).sendData(eq("test-app"), eq("1111"), eq("2222"), eq(8080),
- eq(data), eq(mSentIntent), any(), eq(false));
+ verify(mCdmaSmsDispatcher).sendData(eq("test-app"), eq(0), eq("1111"), eq("2222"),
+ eq(8080), eq(data), eq(mSentIntent), any(), eq(false));
} else {
- verify(mGsmSmsDispatcher).sendData(eq("test-app"), eq("1111"), eq("2222"), eq(8080),
- eq(data), eq(mSentIntent), any(), eq(false));
+ verify(mGsmSmsDispatcher).sendData(eq("test-app"), eq(0), eq("1111"), eq("2222"),
+ eq(8080), eq(data), eq(mSentIntent), any(), eq(false));
}
assertNull(holder.getConnection());
assertFalse(holder.isDomainSelectionRequested());
@@ -1231,7 +1238,7 @@
setUpSmsDispatchers();
mSmsDispatchersController.sendText("1111", "2222", "text", mSentIntent, null, null,
- "test-app", false, 0, false, 10, false, 1L, false);
+ "test-app", mCallingUserId, false, 0, false, 10, false, 1L, false);
processAllMessages();
SmsDispatchersController.DomainSelectionConnectionHolder holder =
@@ -1248,16 +1255,16 @@
verify(mSmsDsc).finishSelection();
if (domain == NetworkRegistrationInfo.DOMAIN_PS) {
verify(mImsSmsDispatcher).sendText(eq("1111"), eq("2222"), eq("text"), eq(mSentIntent),
- any(), any(), eq("test-app"), eq(false), eq(0), eq(false), eq(10), eq(false),
- eq(1L), eq(false));
+ any(), any(), eq("test-app"), eq(0), eq(false), eq(0), eq(false), eq(10),
+ eq(false), eq(1L), eq(false));
} else if (isCdmaMo) {
verify(mCdmaSmsDispatcher).sendText(eq("1111"), eq("2222"), eq("text"), eq(mSentIntent),
- any(), any(), eq("test-app"), eq(false), eq(0), eq(false), eq(10), eq(false),
- eq(1L), eq(false));
+ any(), any(), eq("test-app"), eq(0), eq(false), eq(0), eq(false), eq(10),
+ eq(false), eq(1L), eq(false));
} else {
verify(mGsmSmsDispatcher).sendText(eq("1111"), eq("2222"), eq("text"), eq(mSentIntent),
- any(), any(), eq("test-app"), eq(false), eq(0), eq(false), eq(10), eq(false),
- eq(1L), eq(false));
+ any(), any(), eq("test-app"), eq(0), eq(false), eq(0), eq(false), eq(10),
+ eq(false), eq(1L), eq(false));
}
assertNull(holder.getConnection());
assertFalse(holder.isDomainSelectionRequested());
@@ -1273,7 +1280,7 @@
ArrayList<PendingIntent> sentIntents = new ArrayList<>();
ArrayList<PendingIntent> deliveryIntents = new ArrayList<>();
mSmsDispatchersController.testSendMultipartText("1111", "2222", parts, sentIntents,
- deliveryIntents, null, "test-app", false, 0, false, 10, 1L);
+ deliveryIntents, null, "test-app", mCallingUserId, false, 0, false, 10, 1L);
processAllMessages();
SmsDispatchersController.DomainSelectionConnectionHolder holder =
@@ -1290,16 +1297,17 @@
verify(mSmsDsc).finishSelection();
if (domain == NetworkRegistrationInfo.DOMAIN_PS) {
verify(mImsSmsDispatcher).sendMultipartText(eq("1111"), eq("2222"), eq(parts),
- eq(sentIntents), eq(deliveryIntents), any(), eq("test-app"), eq(false), eq(0),
- eq(false), eq(10), eq(1L));
+ eq(sentIntents), eq(deliveryIntents), any(), eq("test-app"), eq(mCallingUserId),
+ eq(false), eq(0), eq(false), eq(10), eq(1L));
} else if (isCdmaMo) {
verify(mCdmaSmsDispatcher).sendMultipartText(eq("1111"), eq("2222"), eq(parts),
- eq(sentIntents), eq(deliveryIntents), any(), eq("test-app"), eq(false), eq(0),
+ eq(sentIntents), eq(deliveryIntents), any(), eq("test-app"), eq(mCallingUserId),
+ eq(false), eq(0),
eq(false), eq(10), eq(1L));
} else {
verify(mGsmSmsDispatcher).sendMultipartText(eq("1111"), eq("2222"), eq(parts),
- eq(sentIntents), eq(deliveryIntents), any(), eq("test-app"), eq(false), eq(0),
- eq(false), eq(10), eq(1L));
+ eq(sentIntents), eq(deliveryIntents), any(), eq("test-app"), eq(mCallingUserId),
+ eq(false), eq(0), eq(false), eq(10), eq(1L));
}
assertNull(holder.getConnection());
assertFalse(holder.isDomainSelectionRequested());
@@ -1374,7 +1382,7 @@
private PendingRequest createPendingRequest() {
return new PendingRequest(
SmsDispatchersController.PendingRequest.TYPE_TEXT, null, "test-app",
- "1111", "2222", asArrayList(mSentIntent), asArrayList(null),
+ mCallingUserId, "1111", "2222", asArrayList(mSentIntent), asArrayList(null),
false, null, 0, asArrayList("text"), null,
false, 0, false, 10, 100L, false);
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/cdma/CdmaSmsDispatcherTest.java b/tests/telephonytests/src/com/android/internal/telephony/cdma/CdmaSmsDispatcherTest.java
index 1f52cea..118adbc 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/cdma/CdmaSmsDispatcherTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/cdma/CdmaSmsDispatcherTest.java
@@ -18,6 +18,7 @@
import static org.mockito.Mockito.*;
+import android.os.Binder;
import android.os.HandlerThread;
import android.os.Message;
@@ -38,6 +39,7 @@
private CdmaSMSDispatcher mCdmaSmsDispatcher;
private CdmaSmsDispatcherTestHandler mCdmaSmsDispatcherTestHandler;
+ private int mCallingUserId;
private class CdmaSmsDispatcherTestHandler extends HandlerThread {
@@ -63,6 +65,7 @@
mCdmaSmsDispatcherTestHandler = new CdmaSmsDispatcherTestHandler(TAG);
mCdmaSmsDispatcherTestHandler.start();
waitUntilReady();
+ mCallingUserId = Binder.getCallingUserHandle().getIdentifier();
}
@After
@@ -84,14 +87,14 @@
@Test @SmallTest
public void testSendText() {
mCdmaSmsDispatcher.sendText("111"/* desAddr*/, "222" /*scAddr*/, TAG,
- null, null, null, null, false, -1, false, -1, false, 0L);
+ null, null, null, null, mCallingUserId, false, -1, false, -1, false, 0L);
verify(mSimulatedCommandsVerifier).sendCdmaSms(any(byte[].class), any(Message.class));
}
@Test @SmallTest
public void testSendTextWithOutDesAddr() {
mCdmaSmsDispatcher.sendText(null, "222" /*scAddr*/, TAG,
- null, null, null, null, false, -1, false, -1, false, 0L);
+ null, null, null, null, mCallingUserId, false, -1, false, -1, false, 0L);
verify(mSimulatedCommandsVerifier, times(0)).sendImsGsmSms(anyString(), anyString(),
anyInt(), anyInt(), any(Message.class));
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/data/DataConfigManagerTest.java b/tests/telephonytests/src/com/android/internal/telephony/data/DataConfigManagerTest.java
index 005b312..95cefd8 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/data/DataConfigManagerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/data/DataConfigManagerTest.java
@@ -146,7 +146,6 @@
@Test
public void testMeteredNetworkCapabilities() {
- doReturn(true).when(mFeatureFlags).meteredEmbbUrlcc();
mBundle.putStringArray(CarrierConfigManager.KEY_CARRIER_METERED_APN_TYPES_STRINGS,
new String[] {ApnSetting.TYPE_MMS_STRING, ApnSetting.TYPE_DEFAULT_STRING});
mBundle.putStringArray(CarrierConfigManager.KEY_CARRIER_METERED_ROAMING_APN_TYPES_STRINGS,
diff --git a/tests/telephonytests/src/com/android/internal/telephony/data/DataNetworkControllerTest.java b/tests/telephonytests/src/com/android/internal/telephony/data/DataNetworkControllerTest.java
index 3da7c9d..5dce5c2 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/data/DataNetworkControllerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/data/DataNetworkControllerTest.java
@@ -890,8 +890,6 @@
.when(mSubscriptionManagerService).getSubscriptionInfoInternal(anyInt());
doReturn(true).when(mFeatureFlags).carrierEnabledSatelliteFlag();
doReturn(true).when(mFeatureFlags).satelliteInternet();
- doReturn(true).when(mFeatureFlags)
- .ignoreExistingNetworksForInternetAllowedChecking();
when(mContext.getPackageManager()).thenReturn(mMockPackageManager);
doReturn(true).when(mMockPackageManager).hasSystemFeature(anyString());
@@ -3897,7 +3895,6 @@
@Test
public void testNonVoPStoVoPSImsSetup() throws Exception {
- doReturn(true).when(mFeatureFlags).allowMmtelInNonVops();
mDataNetworkControllerUT.getDataSettingsManager().setDataRoamingEnabled(true);
// Config that allows non-vops bring up when Roaming
mCarrierConfig.putIntArray(CarrierConfigManager.Ims
diff --git a/tests/telephonytests/src/com/android/internal/telephony/data/DataNetworkTest.java b/tests/telephonytests/src/com/android/internal/telephony/data/DataNetworkTest.java
index 6539ca9..f832a6b 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/data/DataNetworkTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/data/DataNetworkTest.java
@@ -2419,7 +2419,6 @@
@Test
public void testMmsCapabilityRemovedWhenMmsPreferredOnIwlan() throws Exception {
- doReturn(true).when(mFeatureFlags).forceIwlanMms();
setupDataNetwork();
TelephonyNetworkAgent mockNetworkAgent = Mockito.mock(TelephonyNetworkAgent.class);
diff --git a/tests/telephonytests/src/com/android/internal/telephony/data/DataProfileManagerTest.java b/tests/telephonytests/src/com/android/internal/telephony/data/DataProfileManagerTest.java
index 30ce46f..96d0c8c 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/data/DataProfileManagerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/data/DataProfileManagerTest.java
@@ -1046,7 +1046,6 @@
@Test
public void testSetPreferredDataProfile() {
- doReturn(true).when(mFeatureFlags).refinePreferredDataProfileSelection();
TelephonyNetworkRequest tnr = new TelephonyNetworkRequest(
new NetworkRequest.Builder()
.addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
diff --git a/tests/telephonytests/src/com/android/internal/telephony/data/DataRetryManagerTest.java b/tests/telephonytests/src/com/android/internal/telephony/data/DataRetryManagerTest.java
index 89cdc47..78bb553 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/data/DataRetryManagerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/data/DataRetryManagerTest.java
@@ -341,7 +341,6 @@
@Test
public void testDataSetupUnthrottling() throws Exception {
- doReturn(true).when(mFeatureFlags).unthrottleCheckTransport();
NetworkRequest request = new NetworkRequest.Builder()
.addCapability(NetworkCapabilities.NET_CAPABILITY_IMS)
.build();
@@ -807,7 +806,6 @@
@Test
public void testDataRetryLongTimer() {
- doReturn(true).when(mFeatureFlags).useAlarmCallback();
// Rule requires a long timer
DataSetupRetryRule retryRule = new DataSetupRetryRule(
"capabilities=internet, retry_interval=120000, maximum_retries=2");
diff --git a/tests/telephonytests/src/com/android/internal/telephony/data/TelephonyNetworkProviderTest.java b/tests/telephonytests/src/com/android/internal/telephony/data/TelephonyNetworkProviderTest.java
index 2fdf9e6..d62ee2f 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/data/TelephonyNetworkProviderTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/data/TelephonyNetworkProviderTest.java
@@ -284,7 +284,7 @@
NetworkCapabilities caps = capsCaptor.getValue();
TelephonyNetworkRequest.getAllSupportedNetworkCapabilities().forEach(
- (cap) -> assertThat(caps.hasCapability(cap)));
+ (cap) -> assertThat(caps.hasCapability(cap)).isTrue());
assertThat(caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_IA)).isTrue();
assertThat(caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_MMTEL)).isTrue();
assertThat(caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED)).isTrue();
diff --git a/tests/telephonytests/src/com/android/internal/telephony/emergency/EmergencyStateTrackerTest.java b/tests/telephonytests/src/com/android/internal/telephony/emergency/EmergencyStateTrackerTest.java
index 0eb5c13..25e9715 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/emergency/EmergencyStateTrackerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/emergency/EmergencyStateTrackerTest.java
@@ -180,7 +180,7 @@
ArgumentCaptor<RadioOnStateListener.Callback> callback = ArgumentCaptor
.forClass(RadioOnStateListener.Callback.class);
verify(mRadioOnHelper).triggerRadioOnAndListen(callback.capture(), eq(true), eq(testPhone),
- eq(false), eq(DEFAULT_WAIT_FOR_IN_SERVICE_TIMEOUT_MS));
+ eq(false), eq(DEFAULT_WAIT_FOR_IN_SERVICE_TIMEOUT_MS), eq(false));
// isOkToCall() should return true when IN_SERVICE state
assertFalse(callback.getValue()
.isOkToCall(testPhone, ServiceState.STATE_OUT_OF_SERVICE, false));
@@ -239,7 +239,7 @@
ArgumentCaptor<RadioOnStateListener.Callback> callback = ArgumentCaptor
.forClass(RadioOnStateListener.Callback.class);
verify(mRadioOnHelper).triggerRadioOnAndListen(callback.capture(), eq(true), eq(testPhone),
- eq(false), eq(DEFAULT_WAIT_FOR_IN_SERVICE_TIMEOUT_MS));
+ eq(false), eq(DEFAULT_WAIT_FOR_IN_SERVICE_TIMEOUT_MS), eq(false));
// onTimeout should return true when radion on
assertFalse(callback.getValue()
.isOkToCall(testPhone, ServiceState.STATE_OUT_OF_SERVICE, false));
@@ -287,7 +287,7 @@
ArgumentCaptor<RadioOnStateListener.Callback> callback = ArgumentCaptor
.forClass(RadioOnStateListener.Callback.class);
verify(mRadioOnHelper).triggerRadioOnAndListen(callback.capture(), eq(true), eq(testPhone),
- eq(false), eq(DEFAULT_WAIT_FOR_IN_SERVICE_TIMEOUT_MS));
+ eq(false), eq(DEFAULT_WAIT_FOR_IN_SERVICE_TIMEOUT_MS), eq(false));
// Hangup the call
emergencyStateTracker.endCall(mTestConnection1);
@@ -323,7 +323,7 @@
ArgumentCaptor<RadioOnStateListener.Callback> callback = ArgumentCaptor
.forClass(RadioOnStateListener.Callback.class);
verify(mRadioOnHelper).triggerRadioOnAndListen(callback.capture(), eq(true), eq(testPhone),
- eq(false), eq(DEFAULT_WAIT_FOR_IN_SERVICE_TIMEOUT_MS));
+ eq(false), eq(DEFAULT_WAIT_FOR_IN_SERVICE_TIMEOUT_MS), eq(false));
// Verify future completes with DisconnectCause.POWER_OFF if radio not ready
CompletableFuture<Void> unused = future.thenAccept((result) -> {
assertEquals((Integer) result, (Integer) DisconnectCause.POWER_OFF);
@@ -359,7 +359,7 @@
ArgumentCaptor<RadioOnStateListener.Callback> callback = ArgumentCaptor
.forClass(RadioOnStateListener.Callback.class);
verify(mRadioOnHelper).triggerRadioOnAndListen(callback.capture(), eq(true), eq(testPhone),
- eq(false), eq(0));
+ eq(false), eq(0), eq(false));
// isOkToCall() should return true once satellite modem is off
assertFalse(callback.getValue()
.isOkToCall(testPhone, ServiceState.STATE_IN_SERVICE, false));
@@ -400,7 +400,7 @@
ArgumentCaptor<RadioOnStateListener.Callback> callback = ArgumentCaptor
.forClass(RadioOnStateListener.Callback.class);
verify(mRadioOnHelper).triggerRadioOnAndListen(callback.capture(), eq(true), eq(testPhone),
- eq(false), eq(0));
+ eq(false), eq(0), eq(false));
// Verify future completes with DisconnectCause.POWER_OFF if radio not ready
CompletableFuture<Void> unused = future.thenAccept((result) -> {
assertEquals((Integer) result, (Integer) DisconnectCause.SATELLITE_ENABLED);
@@ -428,7 +428,7 @@
// Radio already on so shouldn't trigger this
verify(mRadioOnHelper, never()).triggerRadioOnAndListen(any(), anyBoolean(), any(),
- anyBoolean(), eq(0));
+ anyBoolean(), eq(0), eq(false));
// Carrier supports control-plane fallback, so no DDS switch
verify(mPhoneSwitcher, never()).overrideDefaultDataForEmergency(anyInt(), anyInt(), any());
}
@@ -3168,7 +3168,7 @@
// Wait for the radio off for all phones
verify(mSST, times(2)).registerForVoiceRegStateOrRatChanged(any(), anyInt(), any());
verify(mRadioOnHelper, never()).triggerRadioOnAndListen(any(), anyBoolean(), any(),
- anyBoolean(), eq(0));
+ anyBoolean(), eq(0), eq(false));
}
/**
diff --git a/tests/telephonytests/src/com/android/internal/telephony/gsm/GsmSmsDispatcherTest.java b/tests/telephonytests/src/com/android/internal/telephony/gsm/GsmSmsDispatcherTest.java
index 8374daa..58cc261 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/gsm/GsmSmsDispatcherTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/gsm/GsmSmsDispatcherTest.java
@@ -45,6 +45,7 @@
import android.content.pm.ServiceInfo;
import android.location.Country;
import android.location.CountryDetector;
+import android.os.Binder;
import android.os.HandlerThread;
import android.os.Message;
import android.os.RemoteException;
@@ -114,6 +115,7 @@
private GsmSMSDispatcher mGsmSmsDispatcher;
private GsmSmsDispatcherTestHandler mGsmSmsDispatcherTestHandler;
+ private int mCallingUserId;
private class GsmSmsDispatcherTestHandler extends HandlerThread {
@@ -149,6 +151,7 @@
waitUntilReady();
mGsmSmsDispatcher = new GsmSMSDispatcher(mPhone, mSmsDispatchersController,
mGsmInboundSmsHandler);
+ mCallingUserId = Binder.getCallingUserHandle().getIdentifier();
processAllMessages();
}
@@ -177,7 +180,7 @@
.thenReturn(new Country("US", Country.COUNTRY_SOURCE_SIM));
mGsmSmsDispatcher.sendText("6501002000", "121" /*scAddr*/, "test sms",
- null, null, null, null, false, -1, false, -1, false, 0L);
+ null, null, null, null, mCallingUserId, false, -1, false, -1, false, 0L);
verify(mSimulatedCommandsVerifier).sendSMS(anyString(), anyString(), any(Message.class));
// Blocked number provider is notified about the emergency contact asynchronously.
@@ -197,7 +200,7 @@
mGsmSmsDispatcher.sendText(
getEmergencyNumberFromSystemPropertiesOrDefault(), "121" /*scAddr*/, "test sms",
- null, null, null, null, false, -1, false, -1, false, 0L);
+ null, null, null, null, mCallingUserId, false, -1, false, -1, false, 0L);
verify(mSimulatedCommandsVerifier).sendSMS(anyString(), anyString(), any(Message.class));
// Blocked number provider is notified about the emergency contact asynchronously.
@@ -245,7 +248,7 @@
// send invalid dest address: +
mReceivedTestIntent = false;
mGsmSmsDispatcher.sendText("+", "222" /*scAddr*/, TAG,
- pendingIntent, null, null, null, false, -1, false, -1, false, 0L);
+ pendingIntent, null, null, null, mCallingUserId, false, -1, false, -1, false, 0L);
waitForMs(500);
verify(mSimulatedCommandsVerifier, times(0)).sendSMS(anyString(), anyString(),
any(Message.class));
@@ -310,7 +313,7 @@
// send SMS and check sentIntent
mReceivedTestIntent = false;
mGsmSmsDispatcher.sendMultipartText("+123" /*destAddr*/, "222" /*scAddr*/, parts,
- sentIntents, null, null, null, false, -1, false, -1, 0L);
+ sentIntents, null, null, null, mCallingUserId, false, -1, false, -1, 0L);
waitForMs(500);
synchronized (mLock) {
@@ -390,7 +393,7 @@
mReceivedTestIntent = false;
mGsmSmsDispatcher.sendText("6501002000", "121" /*scAddr*/, "test sms",
- pendingIntent, null, null, null, false, -1, false, -1, false, 0L);
+ pendingIntent, null, null, null, mCallingUserId, false, -1, false, -1, false, 0L);
processAllMessages();
synchronized (mLock) {
if (!mReceivedTestIntent) {
@@ -414,7 +417,7 @@
mGsmSmsDispatcher.mCarrierMessagingTimeout = 100;
mGsmSmsDispatcher.sendText("6501002000", "121" /*scAddr*/, "test sms",
- null, null, null, null, false, -1, false, -1, false, 0L);
+ null, null, null, null, mCallingUserId, false, -1, false, -1, false, 0L);
// wait for timeout
waitForMs(150);
verify(mSimulatedCommandsVerifier).sendSMS(anyString(), anyString(), any(Message.class));
@@ -428,7 +431,7 @@
mockUiccWithCarrierApp();
mGsmSmsDispatcher.sendText("6501002000", "121" /*scAddr*/, "test sms",
- null, null, null, null, false, -1, false, -1, false, 0L);
+ null, null, null, null, mCallingUserId, false, -1, false, -1, false, 0L);
processAllMessages();
verify(mSimulatedCommandsVerifier).sendSMS(anyString(), anyString(), any(Message.class));
}
@@ -452,7 +455,8 @@
sentIntents.add(sentIntent2);
mGsmSmsDispatcher.sendMultipartText("6501002000" /*destAddr*/, "222" /*scAddr*/, parts,
- withSentIntents ? sentIntents : null, null, null, null, false, -1, false, -1, 0L);
+ withSentIntents ? sentIntents : null, null, null, null, mCallingUserId,
+ false, -1, false, -1, 0L);
}
@Test
@@ -524,7 +528,7 @@
}
mGsmSmsDispatcher.sendText("111", "222" /*scAddr*/, TAG,
- null, null, null, null, false, -1, false, -1, false, 0L);
+ null, null, null, null, mCallingUserId, false, -1, false, -1, false, 0L);
ArgumentCaptor<String> pduCaptor = ArgumentCaptor.forClass(String.class);
verify(mSimulatedCommandsVerifier).sendSMS(anyString(), pduCaptor.capture(),
@@ -545,7 +549,7 @@
messageRef += parts.size();
}
mGsmSmsDispatcher.sendMultipartText("6501002000" /*destAddr*/, "222" /*scAddr*/, parts,
- null, null, null, null, false, -1, false, -1, 0L);
+ null, null, null, null, mCallingUserId, false, -1, false, -1, 0L);
waitForMs(150);
ArgumentCaptor<String> pduCaptor = ArgumentCaptor.forClass(String.class);
@@ -568,7 +572,7 @@
mSubscriptionManagerService.setLastUsedTPMessageReference(mPhone.getSubId(), -1);
mGsmSmsDispatcher.sendText("111", "222" /*scAddr*/, TAG,
- null, null, null, null, false, -1, false, -1, false, 0L);
+ null, null, null, null, mCallingUserId, false, -1, false, -1, false, 0L);
ArgumentCaptor<String> pduCaptor = ArgumentCaptor.forClass(String.class);
verify(mSimulatedCommandsVerifier).sendSMS(anyString(), pduCaptor.capture(),
@@ -585,7 +589,7 @@
Message msg = mGsmSmsDispatcher.obtainMessage(17);
mPhone.getIccRecords().setSmssTpmrValue(255, msg);
mGsmSmsDispatcher.sendText("111", "222" /*scAddr*/, TAG,
- null, null, null, null, false, -1, false, -1, false, 0L);
+ null, null, null, null, mCallingUserId, false, -1, false, -1, false, 0L);
ArgumentCaptor<String> pduCaptor = ArgumentCaptor.forClass(String.class);
verify(mSimulatedCommandsVerifier).sendSMS(anyString(), pduCaptor.capture(),
diff --git a/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramDispatcherTest.java b/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramDispatcherTest.java
index 2dcb4cc..e4f9109 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramDispatcherTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramDispatcherTest.java
@@ -48,6 +48,7 @@
import android.annotation.Nullable;
import android.content.Context;
import android.os.AsyncResult;
+import android.os.Binder;
import android.os.Looper;
import android.os.Message;
import android.telephony.Rlog;
@@ -1196,8 +1197,8 @@
private PendingRequest createPendingRequest() {
return new PendingRequest(
SmsDispatchersController.PendingRequest.TYPE_TEXT, null, "test-app",
- "1111", "2222", asArrayList(null), asArrayList(null),
- false, null, 0, asArrayList("text"), null,
- false, 0, false, 10, 100L, false);
+ Binder.getCallingUserHandle().getIdentifier(), "1111", "2222", asArrayList(null),
+ asArrayList(null), false, null, 0, asArrayList("text"), null, false, 0, false,
+ 10, 100L, false);
}
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/uicc/euicc/EuiccCardTest.java b/tests/telephonytests/src/com/android/internal/telephony/uicc/euicc/EuiccCardTest.java
index c38be60..bcb5c4c 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/uicc/euicc/EuiccCardTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/uicc/euicc/EuiccCardTest.java
@@ -197,7 +197,7 @@
int channel = LogicalChannelMocker.mockOpenLogicalChannelResponse(mMockCi,
"E00582030200009000");
LogicalChannelMocker.mockSendToLogicalChannel(mMockCi, channel, responses);
- LogicalChannelMocker.mockCloseLogicalChannel(mMockCi, channel);
+ LogicalChannelMocker.mockCloseLogicalChannel(mMockCi, channel, /* error= */ null);
return channel;
}
}
\ No newline at end of file
diff --git a/tests/telephonytests/src/com/android/internal/telephony/uicc/euicc/EuiccPortTest.java b/tests/telephonytests/src/com/android/internal/telephony/uicc/euicc/EuiccPortTest.java
index d140ca8..2fef021 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/uicc/euicc/EuiccPortTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/uicc/euicc/EuiccPortTest.java
@@ -1202,7 +1202,7 @@
int channel = LogicalChannelMocker.mockOpenLogicalChannelResponse(mMockCi,
"E00582030200009000");
LogicalChannelMocker.mockSendToLogicalChannel(mMockCi, channel, responses);
- LogicalChannelMocker.mockCloseLogicalChannel(mMockCi, channel);
+ LogicalChannelMocker.mockCloseLogicalChannel(mMockCi, channel, /* error= */ null);
return channel;
}
@@ -1210,7 +1210,7 @@
int channel = LogicalChannelMocker.mockOpenLogicalChannelResponse(mMockCi,
"E00582030201009000");
LogicalChannelMocker.mockSendToLogicalChannel(mMockCi, channel, responses);
- LogicalChannelMocker.mockCloseLogicalChannel(mMockCi, channel);
+ LogicalChannelMocker.mockCloseLogicalChannel(mMockCi, channel, /* error= */ null);
return channel;
}
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/uicc/euicc/apdu/ApduSenderTest.java b/tests/telephonytests/src/com/android/internal/telephony/uicc/euicc/apdu/ApduSenderTest.java
index cffab68..5a07714 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/uicc/euicc/apdu/ApduSenderTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/uicc/euicc/apdu/ApduSenderTest.java
@@ -123,7 +123,7 @@
@Test
public void testSendEmptyCommands() throws InterruptedException {
int channel = LogicalChannelMocker.mockOpenLogicalChannelResponse(mMockCi, "A1A1A19000");
- LogicalChannelMocker.mockCloseLogicalChannel(mMockCi, channel);
+ LogicalChannelMocker.mockCloseLogicalChannel(mMockCi, channel, /* error= */ null);
mSender.send((selectResponse, requestBuilder) -> mSelectResponse = selectResponse,
mResponseCaptor, mHandler);
@@ -155,7 +155,7 @@
public void testSend() throws InterruptedException {
int channel = LogicalChannelMocker.mockOpenLogicalChannelResponse(mMockCi, "9000");
LogicalChannelMocker.mockSendToLogicalChannel(mMockCi, channel, "A1A1A19000");
- LogicalChannelMocker.mockCloseLogicalChannel(mMockCi, channel);
+ LogicalChannelMocker.mockCloseLogicalChannel(mMockCi, channel, /* error= */ null);
mSender.send((selectResponse, requestBuilder) -> requestBuilder.addApdu(
10, 1, 2, 3, 0, "a"), mResponseCaptor, mHandler);
@@ -171,7 +171,7 @@
int channel = LogicalChannelMocker.mockOpenLogicalChannelResponse(mMockCi, "9000");
LogicalChannelMocker.mockSendToLogicalChannel(mMockCi, channel, "A19000", "A29000",
"A39000", "A49000");
- LogicalChannelMocker.mockCloseLogicalChannel(mMockCi, channel);
+ LogicalChannelMocker.mockCloseLogicalChannel(mMockCi, channel, /* error= */ null);
mSender.send((selectResponse, requestBuilder) -> {
requestBuilder.addApdu(10, 1, 2, 3, 0, "a");
@@ -197,7 +197,7 @@
int channel = LogicalChannelMocker.mockOpenLogicalChannelResponse(mMockCi, "9000");
LogicalChannelMocker.mockSendToLogicalChannel(mMockCi, channel, "A19000", "A29000",
"A39000", "A49000");
- LogicalChannelMocker.mockCloseLogicalChannel(mMockCi, channel);
+ LogicalChannelMocker.mockCloseLogicalChannel(mMockCi, channel, /* error= */ null);
mResponseCaptor.stopApduIndex = 2;
mSender.send((selectResponse, requestBuilder) -> {
@@ -222,7 +222,7 @@
int channel = LogicalChannelMocker.mockOpenLogicalChannelResponse(mMockCi, "9000");
LogicalChannelMocker.mockSendToLogicalChannel(mMockCi, channel, "A1A1A16104",
"B2B2B2B26102", "C3C39000");
- LogicalChannelMocker.mockCloseLogicalChannel(mMockCi, channel);
+ LogicalChannelMocker.mockCloseLogicalChannel(mMockCi, channel, /* error= */ null);
mSender.send((selectResponse, requestBuilder) -> requestBuilder.addApdu(
10, 1, 2, 3, 0, "a"), mResponseCaptor, mHandler);
@@ -242,7 +242,7 @@
int channel = LogicalChannelMocker.mockOpenLogicalChannelResponse(mMockCi, "9000");
LogicalChannelMocker.mockSendToLogicalChannel(mMockCi, channel, "A19000", "9000", "9000",
"B22B6103", "B2222B9000", "C39000");
- LogicalChannelMocker.mockCloseLogicalChannel(mMockCi, channel);
+ LogicalChannelMocker.mockCloseLogicalChannel(mMockCi, channel, /* error= */ null);
// Each segment has 0xFF (the limit of a single command) bytes.
String s1 = new String(new char[0xFF]).replace("\0", "AA");
@@ -273,7 +273,7 @@
public void testSendStoreDataLongDataMod0() throws InterruptedException {
int channel = LogicalChannelMocker.mockOpenLogicalChannelResponse(mMockCi, "9000");
LogicalChannelMocker.mockSendToLogicalChannel(mMockCi, channel, "9000", "B2222B9000");
- LogicalChannelMocker.mockCloseLogicalChannel(mMockCi, channel);
+ LogicalChannelMocker.mockCloseLogicalChannel(mMockCi, channel, /* error= */ null);
// Each segment has 0xFF (the limit of a single command) bytes.
String s1 = new String(new char[0xFF]).replace("\0", "AA");
@@ -295,7 +295,7 @@
public void testSendStoreDataLen0() throws InterruptedException {
int channel = LogicalChannelMocker.mockOpenLogicalChannelResponse(mMockCi, "9000");
LogicalChannelMocker.mockSendToLogicalChannel(mMockCi, channel, "B2222B9000");
- LogicalChannelMocker.mockCloseLogicalChannel(mMockCi, channel);
+ LogicalChannelMocker.mockCloseLogicalChannel(mMockCi, channel, /* error= */ null);
mSender.send((selectResponse, requestBuilder) -> {
requestBuilder.addStoreData("");
@@ -312,7 +312,7 @@
int channel = LogicalChannelMocker.mockOpenLogicalChannelResponse(mMockCi, "9000");
LogicalChannelMocker.mockSendToLogicalChannel(mMockCi, channel, "A19000", "9000",
"B22B6103", "6985");
- LogicalChannelMocker.mockCloseLogicalChannel(mMockCi, channel);
+ LogicalChannelMocker.mockCloseLogicalChannel(mMockCi, channel, /* error= */ null);
// Each segment has 0xFF (the limit of a single command) bytes.
String s1 = new String(new char[0xFF]).replace("\0", "AA");
@@ -339,7 +339,7 @@
@Test
public void testChannelAlreadyOpened() throws InterruptedException {
int channel = LogicalChannelMocker.mockOpenLogicalChannelResponse(mMockCi, "9000");
- LogicalChannelMocker.mockCloseLogicalChannel(mMockCi, channel);
+ LogicalChannelMocker.mockCloseLogicalChannel(mMockCi, channel, /* error= */ null);
ResponseCaptor outerResponseCaptor = new ResponseCaptor();
mSender.send(
diff --git a/tests/telephonytests/src/com/android/internal/telephony/uicc/euicc/apdu/LogicalChannelMocker.java b/tests/telephonytests/src/com/android/internal/telephony/uicc/euicc/apdu/LogicalChannelMocker.java
index 27f743f..e8aeed1 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/uicc/euicc/apdu/LogicalChannelMocker.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/uicc/euicc/apdu/LogicalChannelMocker.java
@@ -16,6 +16,7 @@
package com.android.internal.telephony.uicc.euicc.apdu;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
@@ -30,7 +31,6 @@
import com.android.internal.telephony.uicc.IccIoResult;
import com.android.internal.telephony.uicc.IccUtils;
-import org.mockito.ArgumentCaptor;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -48,13 +48,12 @@
int[] responseInts = isException ? null : getSelectResponse(responseObject.toString());
Throwable exception = isException ? (Throwable) responseObject : null;
- ArgumentCaptor<Message> response = ArgumentCaptor.forClass(Message.class);
doAnswer((Answer<Void>) invocation -> {
- Message msg = response.getValue();
+ Message msg = invocation.getArgument(2);
AsyncResult.forMessage(msg, responseInts, exception);
msg.sendToTarget();
return null;
- }).when(mockCi).iccOpenLogicalChannel(anyString(), anyInt(), response.capture());
+ }).when(mockCi).iccOpenLogicalChannel(anyString(), anyInt(), any());
return LOGICAL_CHANNEL;
}
@@ -64,22 +63,20 @@
*/
public static void mockSendToLogicalChannel(CommandsInterface mockCi, int channel,
Object... responseObjects) {
- ArgumentCaptor<Message> response = ArgumentCaptor.forClass(Message.class);
-
doAnswer(new Answer() {
private int mIndex = 0;
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
- Object responseObject = responseObjects[mIndex++];
- mockIccTransmitApduLogicalChannelResponse(response, responseObject);
+ Object response = responseObjects[mIndex++];
+ mockIccTransmitApduLogicalChannelResponse(invocation.getArgument(8), response);
return null;
}
}).when(mockCi).iccTransmitApduLogicalChannel(eq(channel), anyInt(), anyInt(), anyInt(),
- anyInt(), anyInt(), anyString(), anyBoolean(), response.capture());
+ anyInt(), anyInt(), anyString(), anyBoolean(), any());
}
- private static void mockIccTransmitApduLogicalChannelResponse(ArgumentCaptor<Message> response,
+ private static void mockIccTransmitApduLogicalChannelResponse(Message msg,
Object responseObject) throws Throwable {
boolean isException = responseObject instanceof Throwable;
@@ -95,20 +92,22 @@
IccIoResult result = isException ? null : new IccIoResult(sw1, sw2, hex);
Throwable exception = isException ? (Throwable) responseObject : null;
- Message msg = response.getValue();
AsyncResult.forMessage(msg, result, exception);
msg.sendToTarget();
}
- public static void mockCloseLogicalChannel(CommandsInterface mockCi, int channel) {
- ArgumentCaptor<Message> response = ArgumentCaptor.forClass(Message.class);
+ /**
+ * @param error can be {@code null} for a success response or an exception for a failure
+ */
+ public static void mockCloseLogicalChannel(
+ CommandsInterface mockCi, int channel, @Nullable Throwable error) {
doAnswer((Answer<Void>) invocation -> {
- Message msg = response.getValue();
- AsyncResult.forMessage(msg);
+ Message msg = invocation.getArgument(2);
+ AsyncResult.forMessage(msg, null, error);
msg.sendToTarget();
return null;
}).when(mockCi).iccCloseLogicalChannel(eq(channel),
- eq(true /*isEs10*/), response.capture());
+ eq(true /*isEs10*/), any());
}
private static int[] getSelectResponse(String responseHex) {