Merge "Fix crash that occurs on devices that does not have telephony features." into main
diff --git a/Android.bp b/Android.bp
index a943299..c717d86 100644
--- a/Android.bp
+++ b/Android.bp
@@ -83,6 +83,8 @@
proto: {
type: "lite",
},
+
+ generate_product_characteristics_rro: true,
}
// Allow other applications to use public constants from SlicePurchaseController
diff --git a/src/com/android/phone/PhoneGlobals.java b/src/com/android/phone/PhoneGlobals.java
index cbbc889..2ae39df 100644
--- a/src/com/android/phone/PhoneGlobals.java
+++ b/src/com/android/phone/PhoneGlobals.java
@@ -1185,7 +1185,8 @@
msg.arg1 = mDefaultDataSubId;
msg.sendToTarget();
} else if (dataAllowed && dataIsNowRoaming(mDefaultDataSubId)) {
- if (!shouldShowRoamingNotification(roamingOperatorNumeric)) {
+ if (!shouldShowRoamingNotification(roamingOperatorNumeric != null
+ ? roamingOperatorNumeric : phone.getServiceState().getOperatorNumeric())) {
Log.d(LOG_TAG, "Skip showing roaming connected notification.");
return;
}
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index e53a674..839d8cb 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -25,6 +25,7 @@
import static android.telephony.TelephonyManager.HAL_SERVICE_RADIO;
import static android.telephony.satellite.SatelliteManager.KEY_SATELLITE_COMMUNICATION_ALLOWED;
import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_ACCESS_BARRED;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_REQUEST_NOT_SUPPORTED;
import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_SUCCESS;
import static com.android.internal.telephony.PhoneConstants.PHONE_TYPE_CDMA;
@@ -9453,17 +9454,17 @@
enforceModifyPermission();
}
- if (reason == TelephonyManager.DATA_ENABLED_REASON_USER && enabled
- && null != callingPackage && opEnableMobileDataByUser()) {
- mAppOps.noteOp(AppOpsManager.OPSTR_ENABLE_MOBILE_DATA_BY_USER, Binder.getCallingUid(),
- callingPackage, null, null);
- }
-
enforceTelephonyFeatureWithException(callingPackage,
PackageManager.FEATURE_TELEPHONY_DATA, "setDataEnabledForReason");
+ int callingUid = Binder.getCallingUid();
final long identity = Binder.clearCallingIdentity();
try {
+ if (reason == TelephonyManager.DATA_ENABLED_REASON_USER && enabled
+ && null != callingPackage && opEnableMobileDataByUser()) {
+ mAppOps.noteOp(AppOpsManager.OPSTR_ENABLE_MOBILE_DATA_BY_USER,
+ callingUid, callingPackage, null, null);
+ }
Phone phone = getPhone(subId);
if (phone != null) {
if (reason == TelephonyManager.DATA_ENABLED_REASON_CARRIER) {
@@ -13000,13 +13001,14 @@
* @param enableSatellite {@code true} to enable the satellite modem and
* {@code false} to disable.
* @param enableDemoMode {@code true} to enable demo mode and {@code false} to disable.
+ * @param isEmergency {@code true} to enable emergency mode, {@code false} otherwise.
* @param callback The callback to get the result of the request.
*
* @throws SecurityException if the caller doesn't have the required permission.
*/
@Override
public void requestSatelliteEnabled(int subId, boolean enableSatellite, boolean enableDemoMode,
- @NonNull IIntegerConsumer callback) {
+ boolean isEmergency, @NonNull IIntegerConsumer callback) {
enforceSatelliteCommunicationPermission("requestSatelliteEnabled");
if (enableSatellite) {
ResultReceiver resultReceiver = new ResultReceiver(mMainThreadHandler) {
@@ -13077,6 +13079,22 @@
}
/**
+ * Request to get whether the satellite service is enabled with emergency mode.
+ *
+ * @param subId The subId of the subscription to check whether the satellite demo mode
+ * is enabled for.
+ * @param result The result receiver that returns whether the satellite emergency mode is
+ * enabled if the request is successful or an error code if the request failed.
+ *
+ * @throws SecurityException if the caller doesn't have the required permission.
+ */
+ @Override
+ public void requestIsEmergencyModeEnabled(int subId, @NonNull ResultReceiver result) {
+ enforceSatelliteCommunicationPermission("requestIsEmergencyModeEnabled");
+ result.send(SATELLITE_RESULT_REQUEST_NOT_SUPPORTED, null);
+ }
+
+ /**
* Request to get whether the satellite service is supported on the device.
*
* @param subId The subId of the subscription to check satellite service support for.
@@ -13652,20 +13670,43 @@
}
/**
- * This API can be used by only CTS to update the timeout duration in milliseconds whether
- * the device is aligned with the satellite for demo mode
+ * This API can be used by only CTS to override the timeout durations used by the
+ * DatagramController module.
*
* @param timeoutMillis The timeout duration in millisecond.
* @return {@code true} if the timeout duration is set successfully, {@code false} otherwise.
*/
- public boolean setSatelliteDeviceAlignedTimeoutDuration(long timeoutMillis) {
- Log.d(LOG_TAG, "setDeviceAlignedTimeoutDuration - " + timeoutMillis);
+ public boolean setDatagramControllerTimeoutDuration(
+ boolean reset, int timeoutType, long timeoutMillis) {
+ Log.d(LOG_TAG, "setDatagramControllerTimeoutDuration - " + timeoutMillis + ", reset="
+ + reset + ", timeoutMillis=" + timeoutMillis);
TelephonyPermissions.enforceShellOnly(
- Binder.getCallingUid(), "setDeviceAlignedTimeoutDuration");
+ Binder.getCallingUid(), "setDatagramControllerTimeoutDuration");
TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(mApp,
SubscriptionManager.INVALID_SUBSCRIPTION_ID,
- "setDeviceAlignedTimeoutDuration");
- return mSatelliteController.setSatelliteDeviceAlignedTimeoutDuration(timeoutMillis);
+ "setDatagramControllerTimeoutDuration");
+ return mSatelliteController.setDatagramControllerTimeoutDuration(
+ reset, timeoutType, timeoutMillis);
+ }
+
+ /**
+ * This API can be used by only CTS to override the timeout durations used by the
+ * SatelliteController module.
+ *
+ * @param timeoutMillis The timeout duration in millisecond.
+ * @return {@code true} if the timeout duration is set successfully, {@code false} otherwise.
+ */
+ public boolean setSatelliteControllerTimeoutDuration(
+ boolean reset, int timeoutType, long timeoutMillis) {
+ Log.d(LOG_TAG, "setSatelliteControllerTimeoutDuration - " + timeoutMillis + ", reset="
+ + reset + ", timeoutMillis=" + timeoutMillis);
+ TelephonyPermissions.enforceShellOnly(
+ Binder.getCallingUid(), "setSatelliteControllerTimeoutDuration");
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(mApp,
+ SubscriptionManager.INVALID_SUBSCRIPTION_ID,
+ "setSatelliteControllerTimeoutDuration");
+ return mSatelliteController.setSatelliteControllerTimeoutDuration(
+ reset, timeoutType, timeoutMillis);
}
/**
diff --git a/src/com/android/phone/TelephonyShellCommand.java b/src/com/android/phone/TelephonyShellCommand.java
index 3e3d31d..c55cc6c 100644
--- a/src/com/android/phone/TelephonyShellCommand.java
+++ b/src/com/android/phone/TelephonyShellCommand.java
@@ -191,8 +191,11 @@
"set-satellite-listening-timeout-duration";
private static final String SET_SATELLITE_POINTING_UI_CLASS_NAME =
"set-satellite-pointing-ui-class-name";
- private static final String SET_SATELLITE_DEVICE_ALIGNED_TIMEOUT_DURATION =
- "set-satellite-device-aligned-timeout-duration";
+ private static final String SET_DATAGRAM_CONTROLLER_TIMEOUT_DURATION =
+ "set-datagram-controller-timeout-duration";
+
+ private static final String SET_SATELLITE_CONTROLLER_TIMEOUT_DURATION =
+ "set-satellite-controller-timeout-duration";
private static final String SET_EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE =
"set-emergency-call-to-satellite-handover-type";
private static final String SET_COUNTRY_CODES = "set-country-codes";
@@ -397,8 +400,10 @@
return handleSetSatelliteListeningTimeoutDuration();
case SET_SATELLITE_POINTING_UI_CLASS_NAME:
return handleSetSatellitePointingUiClassNameCommand();
- case SET_SATELLITE_DEVICE_ALIGNED_TIMEOUT_DURATION:
- return handleSettSatelliteDeviceAlignedTimeoutDuration();
+ case SET_DATAGRAM_CONTROLLER_TIMEOUT_DURATION:
+ return handleSetDatagramControllerTimeoutDuration();
+ case SET_SATELLITE_CONTROLLER_TIMEOUT_DURATION:
+ return handleSetSatelliteControllerTimeoutDuration();
case SET_EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE:
return handleSetEmergencyCallToSatelliteHandoverType();
case SET_SHOULD_SEND_DATAGRAM_TO_MODEM_IN_DEMO_MODE:
@@ -3368,31 +3373,85 @@
return 0;
}
- private int handleSettSatelliteDeviceAlignedTimeoutDuration() {
+ private int handleSetDatagramControllerTimeoutDuration() {
PrintWriter errPw = getErrPrintWriter();
+ boolean reset = false;
+ int timeoutType = 0;
long timeoutMillis = 0;
String opt;
while ((opt = getNextOption()) != null) {
switch (opt) {
- case "-t": {
+ case "-d": {
timeoutMillis = Long.parseLong(getNextArgRequired());
break;
}
+ case "-r": {
+ reset = true;
+ break;
+ }
+ case "-t": {
+ timeoutType = Integer.parseInt(getNextArgRequired());
+ break;
+ }
}
}
- Log.d(LOG_TAG, "handleSettSatelliteDeviceAlignedTimeoutDuration: timeoutMillis="
- + timeoutMillis);
+ Log.d(LOG_TAG, "setDatagramControllerTimeoutDuration: timeoutMillis="
+ + timeoutMillis + ", reset=" + reset + ", timeoutType=" + timeoutType);
try {
- boolean result = mInterface.setSatelliteDeviceAlignedTimeoutDuration(timeoutMillis);
+ boolean result = mInterface.setDatagramControllerTimeoutDuration(
+ reset, timeoutType, timeoutMillis);
if (VDBG) {
- Log.v(LOG_TAG, "setSatelliteDeviceAlignedTimeoutDuration " + timeoutMillis
+ Log.v(LOG_TAG, "setDatagramControllerTimeoutDuration " + timeoutMillis
+ ", result = " + result);
}
getOutPrintWriter().println(result);
} catch (RemoteException e) {
- Log.w(LOG_TAG, "setSatelliteDeviceAlignedTimeoutDuration: " + timeoutMillis
+ Log.w(LOG_TAG, "setDatagramControllerTimeoutDuration: " + timeoutMillis
+ + ", error = " + e.getMessage());
+ errPw.println("Exception: " + e.getMessage());
+ return -1;
+ }
+ return 0;
+ }
+
+ private int handleSetSatelliteControllerTimeoutDuration() {
+ PrintWriter errPw = getErrPrintWriter();
+ boolean reset = false;
+ int timeoutType = 0;
+ long timeoutMillis = 0;
+
+ String opt;
+ while ((opt = getNextOption()) != null) {
+ switch (opt) {
+ case "-d": {
+ timeoutMillis = Long.parseLong(getNextArgRequired());
+ break;
+ }
+ case "-r": {
+ reset = true;
+ break;
+ }
+ case "-t": {
+ timeoutType = Integer.parseInt(getNextArgRequired());
+ break;
+ }
+ }
+ }
+ Log.d(LOG_TAG, "setSatelliteControllerTimeoutDuration: timeoutMillis="
+ + timeoutMillis + ", reset=" + reset + ", timeoutType=" + timeoutType);
+
+ try {
+ boolean result = mInterface.setSatelliteControllerTimeoutDuration(
+ reset, timeoutType, timeoutMillis);
+ if (VDBG) {
+ Log.v(LOG_TAG, "setSatelliteControllerTimeoutDuration " + timeoutMillis
+ + ", result = " + result);
+ }
+ getOutPrintWriter().println(result);
+ } catch (RemoteException e) {
+ Log.w(LOG_TAG, "setSatelliteControllerTimeoutDuration: " + timeoutMillis
+ ", error = " + e.getMessage());
errPw.println("Exception: " + e.getMessage());
return -1;
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index acd83c3..7383e9d 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -37,7 +37,6 @@
import android.os.Bundle;
import android.os.ParcelUuid;
import android.os.PersistableBundle;
-import android.provider.DeviceConfig;
import android.telecom.Conference;
import android.telecom.Conferenceable;
import android.telecom.Connection;
@@ -54,7 +53,7 @@
import android.telephony.DataSpecificRegistrationInfo;
import android.telephony.DomainSelectionService;
import android.telephony.DomainSelectionService.SelectionAttributes;
-import android.telephony.EmergencyRegResult;
+import android.telephony.EmergencyRegistrationResult;
import android.telephony.NetworkRegistrationInfo;
import android.telephony.PhoneNumberUtils;
import android.telephony.RadioAccessFamily;
@@ -141,8 +140,6 @@
// Timeout before we terminate the outgoing DSDA call if HOLD did not complete in time on the
// existing call.
private static final int DEFAULT_DSDA_OUTGOING_CALL_HOLD_TIMEOUT_MS = 2000;
- private static final String KEY_DOMAIN_COMPARE_FEATURE_ENABLED_FLAG =
- "is_domain_selection_compare_feature_enabled";
// If configured, reject attempts to dial numbers matching this pattern.
private static final Pattern CDMA_ACTIVATION_CODE_REGEX_PATTERN =
@@ -231,7 +228,6 @@
private DomainSelectionResolver mDomainSelectionResolver;
private EmergencyCallDomainSelectionConnection mEmergencyCallDomainSelectionConnection;
private TelephonyConnection mEmergencyConnection;
- private String mEmergencyCallId = null;
private Executor mDomainSelectionMainExecutor;
private ImsManager mImsManager = null;
private DomainSelectionConnection mDomainSelectionConnection;
@@ -576,8 +572,7 @@
}
// Update the domain in the case that it changes,for example during initial
// setup or when there was an srvcc or internal redial.
- mEmergencyStateTracker.onEmergencyCallDomainUpdated(
- origConn.getPhoneType(), c.getTelecomCallId());
+ mEmergencyStateTracker.onEmergencyCallDomainUpdated(origConn.getPhoneType(), c);
}
@Override
@@ -590,8 +585,8 @@
+ ", state=" + state);
if (c.getState() == Connection.STATE_ACTIVE) {
mEmergencyStateTracker.onEmergencyCallStateChanged(
- c.getOriginalConnection().getState(), c.getTelecomCallId());
- releaseEmergencyCallDomainSelection(false);
+ c.getOriginalConnection().getState(), c);
+ releaseEmergencyCallDomainSelection(false, true);
}
}
@@ -609,8 +604,8 @@
return;
}
Log.i(this, "onConnectionPropertiesChanged prop=" + connectionProperties);
- mEmergencyStateTracker.onEmergencyCallPropertiesChanged(connectionProperties,
- c.getTelecomCallId());
+ mEmergencyStateTracker.onEmergencyCallPropertiesChanged(
+ connectionProperties, c);
}
};
@@ -734,9 +729,8 @@
Phone phone = mEmergencyCallDomainSelectionConnection.getPhone();
mEmergencyConnection.removeTelephonyConnectionListener(
mEmergencyConnectionListener);
- releaseEmergencyCallDomainSelection(true);
- mEmergencyStateTracker.endCall(mEmergencyCallId);
- mEmergencyCallId = null;
+ releaseEmergencyCallDomainSelection(true, false);
+ mEmergencyStateTracker.endCall(c);
retryOutgoingOriginalConnection(c, phone, isPermanentFailure);
return;
}
@@ -2287,14 +2281,6 @@
extras = new Bundle();
}
extras.putInt(PhoneConstants.EXTRA_DIAL_DOMAIN, domain);
- // Add flag to bundle for comparing legacy and new domain selection results. When
- // EXTRA_COMPARE_DOMAIN flag is true, legacy domain selection result is used for
- // placing the call and if both the results are not same then bug report is generated.
- DeviceConfig.Properties properties = //read all telephony properties
- DeviceConfig.getProperties(DeviceConfig.NAMESPACE_TELEPHONY);
- boolean compareDomainSelection =
- properties.getBoolean(KEY_DOMAIN_COMPARE_FEATURE_ENABLED_FLAG, false);
- extras.putBoolean(PhoneConstants.EXTRA_COMPARE_DOMAIN, compareDomainSelection);
if (phone != null) {
Log.v(LOG_TAG, "Call dialing. Domain: " + domain);
@@ -2430,19 +2416,19 @@
mEmergencyStateTracker = EmergencyStateTracker.getInstance();
}
- mEmergencyCallId = resultConnection.getTelecomCallId();
+ mEmergencyConnection = (TelephonyConnection) resultConnection;
CompletableFuture<Integer> future = mEmergencyStateTracker.startEmergencyCall(
- phone, mEmergencyCallId, isTestEmergencyNumber);
+ phone, resultConnection, isTestEmergencyNumber);
future.thenAccept((result) -> {
Log.d(this, "startEmergencyCall-complete result=" + result);
- if (mEmergencyCallId == null) {
+ if (mEmergencyConnection == null) {
Log.i(this, "startEmergencyCall-complete dialing canceled");
return;
}
if (result == android.telephony.DisconnectCause.NOT_DISCONNECTED) {
createEmergencyConnection(phone, (TelephonyConnection) resultConnection,
numberToDial, isTestEmergencyNumber, request, needToTurnOnRadio,
- mEmergencyStateTracker.getEmergencyRegResult());
+ mEmergencyStateTracker.getEmergencyRegistrationResult());
} else {
mEmergencyConnection = null;
String reason = "Couldn't setup emergency call";
@@ -2455,11 +2441,9 @@
mIsEmergencyCallPending = false;
}
});
- mEmergencyConnection = (TelephonyConnection) resultConnection;
- return resultConnection;
}
- Log.i(this, "placeEmergencyConnection returns null");
- return null;
+ // Non TelephonyConnection type instance means dialing failure.
+ return resultConnection;
}
@SuppressWarnings("FutureReturnValueIgnored")
@@ -2467,7 +2451,7 @@
final TelephonyConnection resultConnection, final String number,
final boolean isTestEmergencyNumber,
final ConnectionRequest request, boolean needToTurnOnRadio,
- final EmergencyRegResult regResult) {
+ final EmergencyRegistrationResult regResult) {
Log.i(this, "createEmergencyConnection");
if (phone.getImsPhone() == null) {
@@ -2515,7 +2499,7 @@
attr, mEmergencyDomainSelectionConnectionCallback);
future.thenAcceptAsync((result) -> {
Log.d(this, "createEmergencyConnection-complete result=" + result);
- if (mEmergencyCallId == null) {
+ if (mEmergencyConnection == null) {
Log.i(this, "createEmergencyConnection-complete dialing canceled");
return;
}
@@ -2533,7 +2517,7 @@
extras.putInt(PhoneConstants.EXTRA_DIAL_DOMAIN, NetworkRegistrationInfo.DOMAIN_CS);
mDomainSelectionMainExecutor.execute(
() -> {
- if (mEmergencyCallId == null) {
+ if (mEmergencyConnection == null) {
Log.i(this, "dialCsEmergencyCall dialing canceled");
return;
}
@@ -2541,14 +2525,16 @@
});
}
- private void releaseEmergencyCallDomainSelection(boolean cancel) {
+ private void releaseEmergencyCallDomainSelection(boolean cancel, boolean isActive) {
if (mEmergencyCallDomainSelectionConnection != null) {
if (cancel) mEmergencyCallDomainSelectionConnection.cancelSelection();
else mEmergencyCallDomainSelectionConnection.finishSelection();
mEmergencyCallDomainSelectionConnection = null;
}
mIsEmergencyCallPending = false;
- mEmergencyConnection = null;
+ if (!isActive) {
+ mEmergencyConnection = null;
+ }
}
/**
@@ -2568,14 +2554,14 @@
int callFailCause = c.getOriginalConnection().getPreciseDisconnectCause();
Log.i(this, "maybeReselectDomain csCause=" + callFailCause + ", psCause=" + reasonInfo);
- if (TextUtils.equals(mEmergencyCallId, c.getTelecomCallId())) {
+ if (mEmergencyConnection == c) {
if (mEmergencyCallDomainSelectionConnection != null) {
return maybeReselectDomainForEmergencyCall(c, callFailCause, reasonInfo);
}
Log.i(this, "maybeReselectDomain endCall()");
c.removeTelephonyConnectionListener(mEmergencyConnectionListener);
- mEmergencyStateTracker.endCall(c.getTelecomCallId());
- mEmergencyCallId = null;
+ releaseEmergencyCallDomainSelection(false, false);
+ mEmergencyStateTracker.endCall(c);
return false;
}
@@ -2622,7 +2608,7 @@
if (future != null) {
future.thenAcceptAsync((result) -> {
Log.d(this, "reselectDomain-complete");
- if (mEmergencyCallId == null) {
+ if (mEmergencyConnection == null) {
Log.i(this, "reselectDomain-complete dialing canceled");
return;
}
@@ -2634,9 +2620,8 @@
Log.i(this, "maybeReselectDomainForEmergencyCall endCall()");
c.removeTelephonyConnectionListener(mEmergencyConnectionListener);
- releaseEmergencyCallDomainSelection(true);
- mEmergencyStateTracker.endCall(c.getTelecomCallId());
- mEmergencyCallId = null;
+ releaseEmergencyCallDomainSelection(true, false);
+ mEmergencyStateTracker.endCall(c);
return false;
}
@@ -2850,12 +2835,12 @@
mEmergencyStateTracker = EmergencyStateTracker.getInstance();
}
- mEmergencyCallId = c.getTelecomCallId();
+ mEmergencyConnection = c;
CompletableFuture<Integer> future = mEmergencyStateTracker.startEmergencyCall(
- phone, mEmergencyCallId, isTestEmergencyNumber);
+ phone, c, isTestEmergencyNumber);
future.thenAccept((result) -> {
Log.d(this, "onEmergencyRedial-complete result=" + result);
- if (mEmergencyCallId == null) {
+ if (mEmergencyConnection == null) {
Log.i(this, "onEmergencyRedial-complete dialing canceled");
return;
}
@@ -2876,15 +2861,13 @@
mEmergencyCallDomainSelectionConnection =
(EmergencyCallDomainSelectionConnection) selectConnection;
- mEmergencyConnection = c;
-
DomainSelectionService.SelectionAttributes attr =
EmergencyCallDomainSelectionConnection.getSelectionAttributes(
phone.getPhoneId(),
phone.getSubId(), false,
c.getTelecomCallId(),
c.getAddress().getSchemeSpecificPart(), isTestEmergencyNumber,
- 0, null, mEmergencyStateTracker.getEmergencyRegResult());
+ 0, null, mEmergencyStateTracker.getEmergencyRegistrationResult());
CompletableFuture<Integer> domainFuture =
mEmergencyCallDomainSelectionConnection.createEmergencyConnection(
@@ -2896,6 +2879,7 @@
mIsEmergencyCallPending = false;
}, mDomainSelectionMainExecutor);
} else {
+ mEmergencyConnection = null;
c.setTelephonyConnectionDisconnected(
mDisconnectCauseFactory.toTelecomDisconnectCause(result, "unknown error"));
c.close();
@@ -2907,7 +2891,7 @@
private void recreateEmergencyConnection(final TelephonyConnection connection,
final Phone phone, final @NetworkRegistrationInfo.Domain int result) {
Log.d(this, "recreateEmergencyConnection result=" + result);
- if (mEmergencyCallId == null) {
+ if (mEmergencyConnection == null) {
Log.i(this, "recreateEmergencyConnection dialing canceled");
return;
}
@@ -2958,15 +2942,6 @@
Bundle extras = new Bundle();
extras.putInt(PhoneConstants.EXTRA_DIAL_DOMAIN, domain);
- // Add flag to bundle for comparing legacy and new domain selection results. When
- // EXTRA_COMPARE_DOMAIN flag is true, legacy domain selection result is used for
- // placing the call and if both the results are not same then bug report is generated.
- DeviceConfig.Properties properties = //read all telephony properties
- DeviceConfig.getProperties(DeviceConfig.NAMESPACE_TELEPHONY);
- boolean compareDomainSelection =
- properties.getBoolean(KEY_DOMAIN_COMPARE_FEATURE_ENABLED_FLAG, false);
- extras.putBoolean(PhoneConstants.EXTRA_COMPARE_DOMAIN, compareDomainSelection);
-
com.android.internal.telephony.Connection originalConnection =
connection.getOriginalConnection();
if (originalConnection instanceof ImsPhoneConnection) {
@@ -3001,16 +2976,25 @@
}
protected void onLocalHangup(TelephonyConnection c) {
- if (TextUtils.equals(mEmergencyCallId, c.getTelecomCallId())) {
- Log.i(this, "onLocalHangup " + mEmergencyCallId);
+ if (mEmergencyConnection == c) {
+ Log.i(this, "onLocalHangup " + c.getTelecomCallId());
c.removeTelephonyConnectionListener(mEmergencyConnectionListener);
- releaseEmergencyCallDomainSelection(true);
- mEmergencyStateTracker.endCall(c.getTelecomCallId());
- mEmergencyCallId = null;
+ releaseEmergencyCallDomainSelection(true, false);
+ mEmergencyStateTracker.endCall(c);
}
}
@VisibleForTesting
+ public TelephonyConnection getEmergencyConnection() {
+ return mEmergencyConnection;
+ }
+
+ @VisibleForTesting
+ public void setEmergencyConnection(TelephonyConnection c) {
+ mEmergencyConnection = c;
+ }
+
+ @VisibleForTesting
public TelephonyConnection.TelephonyConnectionListener getEmergencyConnectionListener() {
return mEmergencyConnectionListener;
}
diff --git a/src/com/android/services/telephony/domainselection/EmergencyCallDomainSelector.java b/src/com/android/services/telephony/domainselection/EmergencyCallDomainSelector.java
index 4889af8..0b5ef23 100644
--- a/src/com/android/services/telephony/domainselection/EmergencyCallDomainSelector.java
+++ b/src/com/android/services/telephony/domainselection/EmergencyCallDomainSelector.java
@@ -78,7 +78,7 @@
import android.telephony.DisconnectCause;
import android.telephony.DomainSelectionService;
import android.telephony.DomainSelectionService.SelectionAttributes;
-import android.telephony.EmergencyRegResult;
+import android.telephony.EmergencyRegistrationResult;
import android.telephony.NetworkRegistrationInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
@@ -246,7 +246,7 @@
break;
case MSG_NETWORK_SCAN_RESULT:
- handleScanResult((EmergencyRegResult) msg.obj);
+ handleScanResult((EmergencyRegistrationResult) msg.obj);
break;
case MSG_MAX_CELLULAR_TIMEOUT:
@@ -264,7 +264,7 @@
*
* @param result The scan result.
*/
- private void handleScanResult(EmergencyRegResult result) {
+ private void handleScanResult(EmergencyRegistrationResult result) {
logi("handleScanResult result=" + result);
if (mLastTransportType == TRANSPORT_TYPE_WLAN) {
@@ -307,7 +307,7 @@
* @param result The result of network scan.
* @return The selected network type.
*/
- private @RadioAccessNetworkType int getAccessNetworkType(EmergencyRegResult result) {
+ private @RadioAccessNetworkType int getAccessNetworkType(EmergencyRegistrationResult result) {
int accessNetworkType = result.getAccessNetwork();
if (accessNetworkType != EUTRAN) return accessNetworkType;
@@ -616,7 +616,7 @@
// Reset mDomainSelectionRequested to avoid redundant execution of selectDomain().
mDomainSelectionRequested = false;
- if (!allowEmergencyCalls(mSelectionAttributes.getEmergencyRegResult())) {
+ if (!allowEmergencyCalls(mSelectionAttributes.getEmergencyRegistrationResult())) {
// Detected the country and found that emergency calls are not allowed with this slot.
terminateSelectionPermanentlyForSlot();
return;
@@ -742,7 +742,7 @@
mCancelSignal = new CancellationSignal();
// In case dialing over Wi-Fi has failed, do not the change the domain preference.
- if (!wifiFailed) {
+ if (!wifiFailed || mLastPreferredNetworks == null) {
mLastPreferredNetworks = getNextPreferredNetworks(csPreferred, mTryEpsFallback);
}
mTryEpsFallback = false;
@@ -942,7 +942,8 @@
* @return {@code true} if CS is in service.
*/
private boolean isCsInService() {
- EmergencyRegResult regResult = mSelectionAttributes.getEmergencyRegResult();
+ EmergencyRegistrationResult regResult =
+ mSelectionAttributes.getEmergencyRegistrationResult();
if (regResult == null) return false;
int regState = regResult.getRegState();
@@ -962,7 +963,12 @@
* @return The network type of the CS network.
*/
private @RadioAccessNetworkType int getSelectableCsNetworkType() {
- EmergencyRegResult regResult = mSelectionAttributes.getEmergencyRegResult();
+ List<Integer> domains = getDomainPreference();
+ if (domains.indexOf(DOMAIN_CS) == NOT_SUPPORTED) {
+ return UNKNOWN;
+ }
+ EmergencyRegistrationResult regResult =
+ mSelectionAttributes.getEmergencyRegistrationResult();
logi("getSelectableCsNetworkType regResult=" + regResult);
if (regResult == null) return UNKNOWN;
@@ -987,7 +993,8 @@
* @return {@code true} if PS is in service.
*/
private boolean isPsInService() {
- EmergencyRegResult regResult = mSelectionAttributes.getEmergencyRegResult();
+ EmergencyRegistrationResult regResult =
+ mSelectionAttributes.getEmergencyRegistrationResult();
if (regResult == null) return false;
int regState = regResult.getRegState();
@@ -1008,7 +1015,12 @@
* @return The network type if the network supports emergency services over PS network.
*/
private @RadioAccessNetworkType int getSelectablePsNetworkType(boolean inService) {
- EmergencyRegResult regResult = mSelectionAttributes.getEmergencyRegResult();
+ List<Integer> domains = getDomainPreference();
+ if (domains.indexOf(DOMAIN_PS_3GPP) == NOT_SUPPORTED) {
+ return UNKNOWN;
+ }
+ EmergencyRegistrationResult regResult =
+ mSelectionAttributes.getEmergencyRegistrationResult();
logi("getSelectablePsNetworkType regResult=" + regResult);
if (regResult == null) return UNKNOWN;
if (mRequiresVoLteEnabled && !isAdvancedCallingSettingEnabled()) {
@@ -1038,7 +1050,8 @@
}
private boolean isEpsFallbackAvailable() {
- EmergencyRegResult regResult = mSelectionAttributes.getEmergencyRegResult();
+ EmergencyRegistrationResult regResult =
+ mSelectionAttributes.getEmergencyRegistrationResult();
if (regResult == null) return false;
List<Integer> ratList = getImsNetworkTypeConfiguration();
@@ -1206,7 +1219,8 @@
tm = tm.createForSubscriptionId(getSubId());
String netIso = tm.getNetworkCountryIso();
- EmergencyRegResult regResult = mSelectionAttributes.getEmergencyRegResult();
+ EmergencyRegistrationResult regResult =
+ mSelectionAttributes.getEmergencyRegistrationResult();
if (regResult != null) {
if (regResult.getRegState() == REGISTRATION_STATE_HOME) return false;
if (regResult.getRegState() == REGISTRATION_STATE_ROAMING) return true;
@@ -1360,7 +1374,7 @@
}
}
- private boolean allowEmergencyCalls(EmergencyRegResult regResult) {
+ private boolean allowEmergencyCalls(EmergencyRegistrationResult regResult) {
if (mModemCount < 2) return true;
if (regResult == null) {
loge("allowEmergencyCalls null regResult");
@@ -1397,11 +1411,6 @@
mTransportSelectorCallback.onSelectionTerminated(permanent
? DisconnectCause.EMERGENCY_PERM_FAILURE
: DisconnectCause.EMERGENCY_TEMP_FAILURE);
-
- if (mIsScanRequested && mCancelSignal != null) {
- mCancelSignal.cancel();
- mCancelSignal = null;
- }
}
/** Starts the cross stack timer. */
@@ -1411,7 +1420,8 @@
if (mModemCount == 1) return;
- EmergencyRegResult regResult = mSelectionAttributes.getEmergencyRegResult();
+ EmergencyRegistrationResult regResult =
+ mSelectionAttributes.getEmergencyRegistrationResult();
if (regResult != null) {
int regState = regResult.getRegState();
diff --git a/src/com/android/services/telephony/domainselection/EmergencySmsDomainSelector.java b/src/com/android/services/telephony/domainselection/EmergencySmsDomainSelector.java
index 5adca5a..7f28b04 100644
--- a/src/com/android/services/telephony/domainselection/EmergencySmsDomainSelector.java
+++ b/src/com/android/services/telephony/domainselection/EmergencySmsDomainSelector.java
@@ -28,7 +28,7 @@
import android.telephony.CarrierConfigManager;
import android.telephony.DataSpecificRegistrationInfo;
import android.telephony.DomainSelectionService;
-import android.telephony.EmergencyRegResult;
+import android.telephony.EmergencyRegistrationResult;
import android.telephony.NetworkRegistrationInfo;
import android.telephony.ServiceState;
import android.telephony.TelephonyManager;
@@ -81,7 +81,7 @@
public void handleMessage(@NonNull Message msg) {
switch (msg.what) {
case EVENT_EMERGENCY_NETWORK_SCAN_RESULT:
- handleEmergencyNetworkScanResult((EmergencyRegResult) msg.obj);
+ handleEmergencyNetworkScanResult((EmergencyRegistrationResult) msg.obj);
break;
default:
super.handleMessage(msg);
@@ -247,7 +247,7 @@
* @param regResult The emergency registration result that is triggered
* by the emergency network scan.
*/
- private void handleEmergencyNetworkScanResult(EmergencyRegResult regResult) {
+ private void handleEmergencyNetworkScanResult(EmergencyRegistrationResult regResult) {
logi("handleEmergencyNetworkScanResult: " + regResult);
mEmergencyNetworkScanInProgress = false;
diff --git a/src/com/android/services/telephony/domainselection/NormalCallDomainSelector.java b/src/com/android/services/telephony/domainselection/NormalCallDomainSelector.java
index ede2af4..31a1cc2 100644
--- a/src/com/android/services/telephony/domainselection/NormalCallDomainSelector.java
+++ b/src/com/android/services/telephony/domainselection/NormalCallDomainSelector.java
@@ -34,6 +34,8 @@
import android.telephony.TransportSelectorCallback;
import android.telephony.ims.ImsReasonInfo;
+import com.android.internal.annotations.VisibleForTesting;
+
/**
* Implements domain selector for outgoing non-emergency calls.
*/
@@ -42,14 +44,15 @@
private static final String LOG_TAG = "NCDS";
- private enum SelectorState {
+ @VisibleForTesting
+ protected enum SelectorState {
ACTIVE,
INACTIVE,
DESTROYED
};
- private SelectorState mSelectorState = SelectorState.INACTIVE;
- private ServiceState mServiceState;
+ protected SelectorState mSelectorState = SelectorState.INACTIVE;
+ protected ServiceState mServiceState;
private boolean mImsRegStateReceived;
private boolean mMmTelCapabilitiesReceived;
private boolean mReselectDomain;
@@ -75,6 +78,7 @@
mSelectorState = SelectorState.ACTIVE;
if (callback == null) {
+ mSelectorState = SelectorState.INACTIVE;
loge("Invalid params: TransportSelectorCallback is null");
return;
}
@@ -101,6 +105,7 @@
logd("NormalCallDomainSelection triggered. Sub-id:" + subId);
post(() -> selectDomain());
} else {
+ mSelectorState = SelectorState.INACTIVE;
loge("Subscription-ids doesn't match. This instance is associated with sub-id:"
+ getSubId() + ", requested sub-id:" + subId);
// TODO: Throw anamoly here. This condition should never occur.
@@ -135,9 +140,20 @@
@Override
public void destroy() {
logd("destroy");
- if (mSelectorState == SelectorState.INACTIVE) {
- mSelectorState = SelectorState.DESTROYED;
- super.destroy();
+ switch (mSelectorState) {
+ case INACTIVE:
+ mSelectorState = SelectorState.DESTROYED;
+ super.destroy();
+ break;
+
+ case ACTIVE:
+ loge("destroy is called when selector state is in ACTIVE state");
+ cancelSelection();
+ break;
+
+ case DESTROYED:
+ super.destroy();
+ break;
}
}
@@ -411,4 +427,9 @@
}
}
}
+
+ @VisibleForTesting
+ public SelectorState getSelectorState() {
+ return mSelectorState;
+ }
}
diff --git a/testapps/GbaTestApp/res/values-eu/strings.xml b/testapps/GbaTestApp/res/values-eu/strings.xml
index 6774d99..c192a56 100644
--- a/testapps/GbaTestApp/res/values-eu/strings.xml
+++ b/testapps/GbaTestApp/res/values-eu/strings.xml
@@ -20,10 +20,10 @@
<string name="request_naf_url" msgid="4487793541217737042">"Sareko aplikazioaren funtzioaren (NAF) URLa"</string>
<string name="request_force_bootstrapping" msgid="206043602616214325">"Bootstrapping-a erabiltzera behartu nahi duzu?"</string>
<string name="request_org" msgid="8416693445448308975">"Erakundearen kodea"</string>
- <string name="request_security_protocol" msgid="1444164827561010482">"UA segurtasun-protokoloaren IDa"</string>
+ <string name="request_security_protocol" msgid="1444164827561010482">"UA segurtasun-protokoloaren identifikatzailea"</string>
<string name="request_tls_cipher_suite" msgid="6659854717595308404">"TLS Cipher Suite ID"</string>
<string name="response_success" msgid="2469204471244527663">"Burutu da GBA autentifikazioa?"</string>
- <string name="response_fail_reason" msgid="3401426967253202496">"Hutsegitearen arrazoiaren IDa"</string>
+ <string name="response_fail_reason" msgid="3401426967253202496">"Hutsegitearen arrazoiaren identifikatzailea"</string>
<string name="response_key" msgid="8839847772051686309">"GBA-ko gakoa (CK + IK)"</string>
<string name="response_btid" msgid="2550216722679350756">"Bootstrapping Transaction Identifier (B-TID)"</string>
<string name="sample_naf" msgid="255371174145881001">"3GPP-bootstrapping@naf1.operator.com"</string>
diff --git a/testapps/TestSatelliteApp/res/layout/activity_SatelliteControl.xml b/testapps/TestSatelliteApp/res/layout/activity_SatelliteControl.xml
index 40e3c69..6a79412 100644
--- a/testapps/TestSatelliteApp/res/layout/activity_SatelliteControl.xml
+++ b/testapps/TestSatelliteApp/res/layout/activity_SatelliteControl.xml
@@ -15,7 +15,7 @@
~ limitations under the License
-->
-<LinearLayout
+<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -84,6 +84,42 @@
android:paddingRight="4dp"
android:text="@string/requestTimeForNextSatelliteVisibility"/>
<Button
+ android:id="@+id/removeUserRestrictReason"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingRight="4dp"
+ android:text="@string/removeUserRestrictReason"/>
+ <Button
+ android:id="@+id/addUserRestrictReason"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingRight="4dp"
+ android:text="@string/addUserRestrictReason"/>
+ <Button
+ android:id="@+id/getSatellitePlmn"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingRight="4dp"
+ android:text="@string/getSatellitePlmn"/>
+ <Button
+ android:id="@+id/getAllSatellitePlmn"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingRight="4dp"
+ android:text="@string/getAllSatellitePlmn"/>
+ <Button
+ android:id="@+id/isSatelliteEnabledForCarrier"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingRight="4dp"
+ android:text="@string/isSatelliteEnabledForCarrier"/>
+ <Button
+ android:id="@+id/isRequestIsSatelliteEnabledForCarrier"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingRight="4dp"
+ android:text="@string/isRequestIsSatelliteEnabledForCarrier"/>
+ <Button
android:id="@+id/Back"
android:onClick="Back"
android:textColor="@android:color/holo_blue_dark"
@@ -102,4 +138,4 @@
android:layout_centerVertical="true"
android:textSize="15dp" />
</LinearLayout>
-</LinearLayout>
+</ScrollView>
diff --git a/testapps/TestSatelliteApp/res/layout/activity_TestSatelliteWrapper.xml b/testapps/TestSatelliteApp/res/layout/activity_TestSatelliteWrapper.xml
index c136ce7..7f2f026 100644
--- a/testapps/TestSatelliteApp/res/layout/activity_TestSatelliteWrapper.xml
+++ b/testapps/TestSatelliteApp/res/layout/activity_TestSatelliteWrapper.xml
@@ -14,91 +14,157 @@
~ See the License for the specific language governing permissions and
~ limitations under the License
-->
-
-<LinearLayout
+<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:gravity="center"
- android:paddingStart="4dp">
+ android:layout_height="match_parent">
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="0dp"
- android:layout_weight="0"
- android:textColor="@android:color/holo_blue_dark"
- android:textSize="20dp"
- android:text="Satellite Wrapper Test"/>
- <Button
- android:id="@+id/requestNtnSignalStrength"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingRight="4dp"
- android:text="@string/requestNtnSignalStrength"/>
- <Button
- android:id="@+id/registerForNtnSignalStrengthChanged"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingRight="4dp"
- android:text="@string/registerForNtnSignalStrengthChanged"/>
- <Button
- android:id="@+id/unregisterForNtnSignalStrengthChanged"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingRight="4dp"
- android:text="@string/unregisterForNtnSignalStrengthChanged"/>
- <Button
- android:id="@+id/isOnlyNonTerrestrialNetworkSubscription"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingRight="4dp"
- android:text="@string/isOnlyNonTerrestrialNetworkSubscription"/>
- <Button
- android:id="@+id/registerForSatelliteCapabilitiesChanged"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingRight="4dp"
- android:text="@string/registerForSatelliteCapabilitiesChanged"/>
- <Button
- android:id="@+id/unregisterForSatelliteCapabilitiesChanged"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingRight="4dp"
- android:text="@string/unregisterForSatelliteCapabilitiesChanged"/>
<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="horizontal">
- <Button
- android:id="@+id/Back"
- android:onClick="Back"
+ android:orientation="vertical"
+ android:gravity="center"
+ android:paddingStart="4dp">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="0dp"
+ android:layout_weight="0"
android:textColor="@android:color/holo_blue_dark"
- android:layout_marginTop="10dp"
- android:layout_marginBottom="10dp"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:paddingRight="4dp"
- android:text="@string/Back"/>
+ android:textSize="20dp"
+ android:text="Satellite Wrapper Test"/>
<Button
- android:id="@+id/ClearLog"
- android:onClick="ClearLog"
- android:textColor="@android:color/holo_blue_dark"
- android:layout_marginTop="10dp"
- android:layout_marginBottom="10dp"
- android:layout_width="0dp"
+ android:id="@+id/requestNtnSignalStrength"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_weight="1"
android:paddingRight="4dp"
- android:text="@string/ClearLog"/>
+ android:text="@string/requestNtnSignalStrength"/>
+ <Button
+ android:id="@+id/registerForNtnSignalStrengthChanged"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingRight="4dp"
+ android:text="@string/registerForNtnSignalStrengthChanged"/>
+ <Button
+ android:id="@+id/unregisterForNtnSignalStrengthChanged"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingRight="4dp"
+ android:text="@string/unregisterForNtnSignalStrengthChanged"/>
+ <Button
+ android:id="@+id/isOnlyNonTerrestrialNetworkSubscription"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingRight="4dp"
+ android:text="@string/isOnlyNonTerrestrialNetworkSubscription"/>
+ <Button
+ android:id="@+id/registerForSatelliteCapabilitiesChanged"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingRight="4dp"
+ android:text="@string/registerForSatelliteCapabilitiesChanged"/>
+ <Button
+ android:id="@+id/unregisterForSatelliteCapabilitiesChanged"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingRight="4dp"
+ android:text="@string/unregisterForSatelliteCapabilitiesChanged"/>
+ <Button
+ android:id="@+id/isNonTerrestrialNetwork"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingRight="4dp"
+ android:text="@string/isNonTerrestrialNetwork"/>
+ <Button
+ android:id="@+id/getAvailableServices"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingRight="4dp"
+ android:text="@string/getAvailableServices"/>
+ <Button
+ android:id="@+id/isUsingNonTerrestrialNetwork"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingRight="4dp"
+ android:text="@string/isUsingNonTerrestrialNetwork"/>
+ <Button
+ android:id="@+id/requestAttachEnabledForCarrier_enable"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingRight="4dp"
+ android:text="@string/requestAttachEnabledForCarrier_enable"/>
+ <Button
+ android:id="@+id/requestAttachEnabledForCarrier_disable"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingRight="4dp"
+ android:text="@string/requestAttachEnabledForCarrier_disable"/>
+ <Button
+ android:id="@+id/requestIsAttachEnabledForCarrier"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingRight="4dp"
+ android:text="@string/requestIsAttachEnabledForCarrier"/>
+ <Button
+ android:id="@+id/addAttachRestrictionForCarrier"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingRight="4dp"
+ android:text="@string/addAttachRestrictionForCarrier"/>
+ <Button
+ android:id="@+id/removeAttachRestrictionForCarrier"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingRight="4dp"
+ android:text="@string/removeAttachRestrictionForCarrier"/>
+ <Button
+ android:id="@+id/getAttachRestrictionReasonsForCarrier"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingRight="4dp"
+ android:text="@string/getAttachRestrictionReasonsForCarrier"/>
+ <Button
+ android:id="@+id/getSatellitePlmnsForCarrier"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingRight="4dp"
+ android:text="@string/getSatellitePlmnsForCarrier"/>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+ <Button
+ android:id="@+id/Back"
+ android:onClick="Back"
+ android:textColor="@android:color/holo_blue_dark"
+ android:layout_marginTop="10dp"
+ android:layout_marginBottom="10dp"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:paddingRight="4dp"
+ android:text="@string/Back"/>
+ <Button
+ android:id="@+id/ClearLog"
+ android:onClick="ClearLog"
+ android:textColor="@android:color/holo_blue_dark"
+ android:layout_marginTop="10dp"
+ android:layout_marginBottom="10dp"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:paddingRight="4dp"
+ android:text="@string/ClearLog"/>
+ </LinearLayout>
+ <ListView
+ android:id="@+id/logListView"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:capitalize="characters"
+ android:textColor="@android:color/holo_blue_light"
+ android:layout_centerVertical="true"
+ android:textSize="8dp" />
</LinearLayout>
- <ListView
- android:id="@+id/logListView"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:capitalize="characters"
- android:textColor="@android:color/holo_blue_light"
- android:layout_centerVertical="true"
- android:textSize="8dp" />
-</LinearLayout>
+
+</ScrollView>
\ No newline at end of file
diff --git a/testapps/TestSatelliteApp/res/values/donottranslate_strings.xml b/testapps/TestSatelliteApp/res/values/donottranslate_strings.xml
index 8ebe5f3..20f5ca8 100644
--- a/testapps/TestSatelliteApp/res/values/donottranslate_strings.xml
+++ b/testapps/TestSatelliteApp/res/values/donottranslate_strings.xml
@@ -64,6 +64,23 @@
<string name="isOnlyNonTerrestrialNetworkSubscription">isOnlyNonTerrestrialNetworkSubscription</string>
<string name="registerForSatelliteCapabilitiesChanged">registerForSatelliteCapabilitiesChanged</string>
<string name="unregisterForSatelliteCapabilitiesChanged">unregisterForSatelliteCapabilitiesChanged</string>
+ <string name="isNonTerrestrialNetwork">isNonTerrestrialNetwork</string>
+ <string name="getAvailableServices">getAvailableServices</string>
+ <string name="isUsingNonTerrestrialNetwork">isUsingNonTerrestrialNetwork</string>
+ <string name="requestAttachEnabledForCarrier_enable">requestAttachEnabledForCarrier_enable</string>
+ <string name="requestAttachEnabledForCarrier_disable">requestAttachEnabledForCarrier_disable</string>
+ <string name="requestIsAttachEnabledForCarrier">requestIsAttachEnabledForCarrier</string>
+ <string name="addAttachRestrictionForCarrier">addAttachRestrictionForCarrier</string>
+ <string name="removeAttachRestrictionForCarrier">removeAttachRestrictionForCarrier</string>
+ <string name="getAttachRestrictionReasonsForCarrier">getAttachRestrictionReasonsForCarrier</string>
+ <string name="getSatellitePlmnsForCarrier">getSatellitePlmnsForCarrier</string>
+
+ <string name="removeUserRestrictReason">removeUserRestrictReason</string>
+ <string name="addUserRestrictReason">addUserRestrictReason</string>
+ <string name="getSatellitePlmn">getSatellitePlmn</string>
+ <string name="getAllSatellitePlmn">getAllSatellitePlmn</string>
+ <string name="isSatelliteEnabledForCarrier">isSatelliteEnabledForCarrier</string>
+ <string name="isRequestIsSatelliteEnabledForCarrier">isRequestIsSatelliteEnabledForCarrier</string>
<string name="Back">Back</string>
<string name="ClearLog">Clear Log</string>
diff --git a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/Datagram.java b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/Datagram.java
index 015ddcd..9ea1b44 100644
--- a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/Datagram.java
+++ b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/Datagram.java
@@ -29,6 +29,7 @@
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
+import android.telephony.satellite.EnableRequestAttributes;
import android.telephony.satellite.PointingInfo;
import android.telephony.satellite.SatelliteDatagram;
import android.telephony.satellite.SatelliteDatagramCallback;
@@ -169,7 +170,9 @@
private void startTransmissionUpdatesApp(View view) {
TextView textView = findViewById(R.id.text_id);
LinkedBlockingQueue<Integer> error = new LinkedBlockingQueue<>(1);
- mSatelliteManager.requestEnabled(true, true, Runnable::run, error::offer);
+ mSatelliteManager.requestEnabled(
+ new EnableRequestAttributes.Builder(true).setDemoMode(true).build(),
+ Runnable::run, error::offer);
TextView showErrorStatusTextView = findViewById(R.id.showErrorStatus);
try {
Integer value = error.poll(TIMEOUT, TimeUnit.MILLISECONDS);
@@ -228,7 +231,9 @@
if (SatelliteTestApp.getTestSatelliteService() != null) {
SatelliteTestApp.getTestSatelliteService().sendOnPendingDatagrams();
}
- mSatelliteManager.requestEnabled(true, true, Runnable::run, resultListener::offer);
+ mSatelliteManager.requestEnabled(
+ new EnableRequestAttributes.Builder(true).setDemoMode(true).build(),
+ Runnable::run, resultListener::offer);
try {
Integer value = resultListener.poll(TIMEOUT, TimeUnit.MILLISECONDS);
if (value == null) {
diff --git a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/ILocalSatelliteListener.aidl b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/ILocalSatelliteListener.aidl
index 2c320c8..0a32432 100644
--- a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/ILocalSatelliteListener.aidl
+++ b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/ILocalSatelliteListener.aidl
@@ -64,4 +64,10 @@
* enableCellularModemWhileSatelliteModeIsOn from Telephony.
*/
void onEnableCellularModemWhileSatelliteModeIsOn(in boolean enable);
+
+ /**
+ * Indicates that MockSatelliteService has just received the request
+ * setSatellitePlmn from Telephony.
+ */
+ void onSetSatellitePlmn();
}
diff --git a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/MultipleSendReceive.java b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/MultipleSendReceive.java
index 0e5ab4f..723f690 100644
--- a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/MultipleSendReceive.java
+++ b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/MultipleSendReceive.java
@@ -19,6 +19,7 @@
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
+import android.telephony.satellite.EnableRequestAttributes;
import android.telephony.satellite.SatelliteDatagram;
import android.telephony.satellite.SatelliteManager;
import android.util.Log;
@@ -66,7 +67,9 @@
SatelliteTestApp.getTestSatelliteService().sendOnSatelliteDatagramReceived(
mReceivedDatagram, 4);
LinkedBlockingQueue<Integer> resultListener = new LinkedBlockingQueue<>(1);
- mSatelliteManager.requestEnabled(true, true, Runnable::run, resultListener::offer);
+ mSatelliteManager.requestEnabled(
+ new EnableRequestAttributes.Builder(true).setDemoMode(true).build(),
+ Runnable::run, resultListener::offer);
mSatelliteManager.pollPendingDatagrams(Runnable::run, resultListener::offer);
SatelliteTestApp.getTestSatelliteService().sendOnSatelliteDatagramReceived(
mReceivedDatagram, 3);
@@ -127,7 +130,9 @@
private void multipleSendReceiveSatelliteDatagramApp(View view) {
mSatelliteManager.setDeviceAlignedWithSatellite(true);
LinkedBlockingQueue<Integer> resultListener = new LinkedBlockingQueue<>(1);
- mSatelliteManager.requestEnabled(true, true, Runnable::run, resultListener::offer);
+ mSatelliteManager.requestEnabled(
+ new EnableRequestAttributes.Builder(true).setDemoMode(true).build(),
+ Runnable::run, resultListener::offer);
String mText = "This is a test datagram message";
SatelliteDatagram datagram = new SatelliteDatagram(mText.getBytes());
mSatelliteManager.sendDatagram(SatelliteManager.DATAGRAM_TYPE_SOS_MESSAGE,
diff --git a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteControl.java b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteControl.java
index 2d01aec..dd7b825 100644
--- a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteControl.java
+++ b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteControl.java
@@ -20,6 +20,9 @@
import android.content.Intent;
import android.os.Bundle;
import android.os.OutcomeReceiver;
+import android.telephony.SubscriptionInfo;
+import android.telephony.SubscriptionManager;
+import android.telephony.satellite.EnableRequestAttributes;
import android.telephony.satellite.SatelliteCapabilities;
import android.telephony.satellite.SatelliteManager;
import android.telephony.satellite.stub.SatelliteResult;
@@ -28,6 +31,7 @@
import android.widget.TextView;
import java.time.Duration;
+import java.util.List;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
@@ -40,11 +44,13 @@
private static final long TIMEOUT = 3000;
private SatelliteManager mSatelliteManager;
+ private SubscriptionManager mSubscriptionManager;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mSatelliteManager = getSystemService(SatelliteManager.class);
+ mSubscriptionManager = getSystemService(SubscriptionManager.class);
setContentView(R.layout.activity_SatelliteControl);
findViewById(R.id.enableSatellite)
@@ -63,6 +69,18 @@
.setOnClickListener(this::requestIsCommunicationAllowedForCurrentLocationApp);
findViewById(R.id.requestTimeForNextSatelliteVisibility)
.setOnClickListener(this::requestTimeForNextSatelliteVisibilityApp);
+ findViewById(R.id.removeUserRestrictReason)
+ .setOnClickListener(this::removeUserRestrictReasonApp);
+ findViewById(R.id.addUserRestrictReason)
+ .setOnClickListener(this::addUserRestrictReasonApp);
+ findViewById(R.id.getSatellitePlmn)
+ .setOnClickListener(this::getSatellitePlmnApp);
+ findViewById(R.id.getAllSatellitePlmn)
+ .setOnClickListener(this::getAllSatellitePlmnApp);
+ findViewById(R.id.isSatelliteEnabledForCarrier)
+ .setOnClickListener(this::isSatelliteEnabledForCarrierApp);
+ findViewById(R.id.isRequestIsSatelliteEnabledForCarrier)
+ .setOnClickListener(this::isRequestIsSatelliteEnabledForCarrierApp);
findViewById(R.id.Back).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
@@ -73,7 +91,9 @@
private void enableSatelliteApp(View view) {
LinkedBlockingQueue<Integer> error = new LinkedBlockingQueue<>(1);
- mSatelliteManager.requestEnabled(true, true, Runnable::run, error::offer);
+ mSatelliteManager.requestEnabled(
+ new EnableRequestAttributes.Builder(true).setDemoMode(true).build(),
+ Runnable::run, error::offer);
TextView textView = findViewById(R.id.text_id);
try {
Integer value = error.poll(TIMEOUT, TimeUnit.MILLISECONDS);
@@ -92,7 +112,8 @@
private void disableSatelliteApp(View view) {
LinkedBlockingQueue<Integer> error = new LinkedBlockingQueue<>(1);
- mSatelliteManager.requestEnabled(false, true, Runnable::run, error::offer);
+ mSatelliteManager.requestEnabled(new EnableRequestAttributes.Builder(false).build(),
+ Runnable::run, error::offer);
TextView textView = findViewById(R.id.text_id);
try {
Integer value = error.poll(TIMEOUT, TimeUnit.MILLISECONDS);
@@ -270,4 +291,87 @@
};
mSatelliteManager.requestTimeForNextSatelliteVisibility(Runnable::run, receiver);
}
+
+ private void removeUserRestrictReasonApp(View view) {
+ TextView textView = findViewById(R.id.text_id);
+ LinkedBlockingQueue<Integer> error = new LinkedBlockingQueue<>(1);
+ List<SubscriptionInfo> infoList = mSubscriptionManager.getAvailableSubscriptionInfoList();
+ List<Integer> subIdList = infoList.stream()
+ .map(SubscriptionInfo::getSubscriptionId)
+ .toList();
+ for (int subId : subIdList) {
+ mSatelliteManager.removeAttachRestrictionForCarrier(subId,
+ SatelliteManager.SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER,
+ Runnable::run, error::offer);
+ }
+
+ try {
+ Integer value = error.poll(TIMEOUT, TimeUnit.MILLISECONDS);
+ if (value == null) {
+ textView.setText("Timed out to removeAttachRestrictionForCarrier");
+ } else if (value != SatelliteResult.SATELLITE_RESULT_SUCCESS) {
+ textView.setText("Failed to removeAttachRestrictionForCarrier with error = "
+ + SatelliteErrorUtils.mapError(value));
+ } else {
+ textView.setText(subIdList == null || subIdList.isEmpty() ? "no active subId list" :
+ "removeAttachRestrictionForCarrier for all subIdList=" + subIdList);
+ }
+ } catch (InterruptedException e) {
+ textView.setText("removeAttachRestrictionForCarrier exception caught =" + e);
+ }
+ }
+
+ private void addUserRestrictReasonApp(View view) {
+ TextView textView = findViewById(R.id.text_id);
+ LinkedBlockingQueue<Integer> error = new LinkedBlockingQueue<>(1);
+ List<SubscriptionInfo> infoList = mSubscriptionManager.getAvailableSubscriptionInfoList();
+ List<Integer> subIdList = infoList.stream()
+ .map(SubscriptionInfo::getSubscriptionId)
+ .toList();
+ for (int subId : subIdList) {
+ mSatelliteManager.addAttachRestrictionForCarrier(subId,
+ SatelliteManager.SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER,
+ Runnable::run, error::offer);
+ }
+
+ try {
+ Integer value = error.poll(TIMEOUT, TimeUnit.MILLISECONDS);
+ if (value == null) {
+ textView.setText("Timed out to addAttachRestrictionForCarrier");
+ } else if (value != SatelliteResult.SATELLITE_RESULT_SUCCESS) {
+ textView.setText("Failed to addAttachRestrictionForCarrier with error = "
+ + SatelliteErrorUtils.mapError(value));
+ } else {
+ textView.setText(subIdList == null || subIdList.isEmpty() ? "no active subId list" :
+ "addAttachRestrictionForCarrier for all subIdList=" + subIdList);
+ }
+ } catch (InterruptedException e) {
+ textView.setText("addAttachRestrictionForCarrier exception caught =" + e);
+ }
+ }
+
+ private void getSatellitePlmnApp(View view) {
+ TextView textView = findViewById(R.id.text_id);
+ textView.setText("[SatelliteService] getSatellitePlmnApp = "
+ + SatelliteTestApp.getTestSatelliteService().getCarrierPlmnList());
+ }
+
+ private void getAllSatellitePlmnApp(View view) {
+ TextView textView = findViewById(R.id.text_id);
+ textView.setText("[SatelliteService] getAllSatellitePlmnApp = "
+ + SatelliteTestApp.getTestSatelliteService().getAllSatellitePlmnList());
+ }
+
+ private void isSatelliteEnabledForCarrierApp(View view) {
+ TextView textView = findViewById(R.id.text_id);
+ textView.setText("[SatelliteService] isSatelliteEnabledForCarrier= "
+ + SatelliteTestApp.getTestSatelliteService().isSatelliteEnabledForCarrier());
+ }
+
+ private void isRequestIsSatelliteEnabledForCarrierApp(View view) {
+ TextView textView = findViewById(R.id.text_id);
+ textView.setText("[SatelliteService] isRequestIsSatelliteEnabledForCarrier= "
+ + SatelliteTestApp.getTestSatelliteService()
+ .isRequestIsSatelliteEnabledForCarrier());
+ }
}
diff --git a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteErrorUtils.java b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteErrorUtils.java
index ffdabdf..ef0c85c 100644
--- a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteErrorUtils.java
+++ b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteErrorUtils.java
@@ -16,7 +16,31 @@
package com.android.phone.testapps.satellitetestapp;
-import android.telephony.satellite.stub.SatelliteResult;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_ACCESS_BARRED;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_ERROR;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_ILLEGAL_STATE;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_MODEM_BUSY;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_MODEM_ERROR;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_NETWORK_ERROR;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_NETWORK_TIMEOUT;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_NOT_AUTHORIZED;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_NOT_REACHABLE;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_NO_RESOURCES;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_RADIO_NOT_AVAILABLE;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_REQUEST_ABORTED;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_REQUEST_FAILED;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_REQUEST_IN_PROGRESS;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_REQUEST_NOT_SUPPORTED;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_SERVER_ERROR;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_SERVICE_NOT_PROVISIONED;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_SERVICE_PROVISION_IN_PROGRESS;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_SUCCESS;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_SERVICE_ERROR;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_INVALID_MODEM_STATE;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_INVALID_ARGUMENTS;
+
import android.util.Log;
/**
@@ -31,44 +55,54 @@
*/
public static String mapError(int error) {
switch (error) {
- case SatelliteResult.SATELLITE_RESULT_SUCCESS:
+ case SATELLITE_RESULT_SUCCESS:
return "SATELLITE_RESULT_SUCCESS";
- case SatelliteResult.SATELLITE_RESULT_ERROR:
+ case SATELLITE_RESULT_ERROR:
return "SATELLITE_RESULT_ERROR";
- case SatelliteResult.SATELLITE_RESULT_SERVER_ERROR:
+ case SATELLITE_RESULT_SERVER_ERROR:
return "SATELLITE_RESULT_SERVER_ERROR";
- case SatelliteResult.SATELLITE_RESULT_SERVICE_ERROR:
+ case SATELLITE_RESULT_SERVICE_ERROR:
return "SATELLITE_RESULT_SERVICE_ERROR";
- case SatelliteResult.SATELLITE_RESULT_MODEM_ERROR:
+ case SATELLITE_RESULT_MODEM_ERROR:
return "SATELLITE_RESULT_MODEM_ERROR";
- case SatelliteResult.SATELLITE_RESULT_NETWORK_ERROR:
+ case SATELLITE_RESULT_NETWORK_ERROR:
return "SATELLITE_RESULT_NETWORK_ERROR";
- case SatelliteResult.SATELLITE_RESULT_INVALID_MODEM_STATE:
+ case SATELLITE_RESULT_INVALID_TELEPHONY_STATE:
+ return "SATELLITE_RESULT_INVALID_TELEPHONY_STATE";
+ case SATELLITE_RESULT_INVALID_MODEM_STATE:
return "SATELLITE_RESULT_INVALID_MODEM_STATE";
- case SatelliteResult.SATELLITE_RESULT_INVALID_ARGUMENTS:
+ case SATELLITE_RESULT_INVALID_ARGUMENTS:
return "SATELLITE_RESULT_INVALID_ARGUMENTS";
- case SatelliteResult.SATELLITE_RESULT_REQUEST_FAILED:
+ case SATELLITE_RESULT_REQUEST_FAILED:
return "SATELLITE_RESULT_REQUEST_FAILED";
- case SatelliteResult.SATELLITE_RESULT_RADIO_NOT_AVAILABLE:
+ case SATELLITE_RESULT_RADIO_NOT_AVAILABLE:
return "SATELLITE_RESULT_RADIO_NOT_AVAILABLE";
- case SatelliteResult.SATELLITE_RESULT_REQUEST_NOT_SUPPORTED:
+ case SATELLITE_RESULT_REQUEST_NOT_SUPPORTED:
return "SATELLITE_RESULT_REQUEST_NOT_SUPPORTED";
- case SatelliteResult.SATELLITE_RESULT_NO_RESOURCES:
+ case SATELLITE_RESULT_NO_RESOURCES:
return "SATELLITE_RESULT_NO_RESOURCES";
- case SatelliteResult.SATELLITE_RESULT_SERVICE_NOT_PROVISIONED:
+ case SATELLITE_RESULT_SERVICE_NOT_PROVISIONED:
return "SATELLITE_RESULT_SERVICE_NOT_PROVISIONED";
- case SatelliteResult.SATELLITE_RESULT_SERVICE_PROVISION_IN_PROGRESS:
+ case SATELLITE_RESULT_SERVICE_PROVISION_IN_PROGRESS:
return "SATELLITE_RESULT_SERVICE_PROVISION_IN_PROGRESS";
- case SatelliteResult.SATELLITE_RESULT_REQUEST_ABORTED:
+ case SATELLITE_RESULT_REQUEST_ABORTED:
return "SATELLITE_RESULT_REQUEST_ABORTED";
- case SatelliteResult.SATELLITE_RESULT_ACCESS_BARRED:
+ case SATELLITE_RESULT_ACCESS_BARRED:
return "SATELLITE_RESULT_ACCESS_BARRED";
- case SatelliteResult.SATELLITE_RESULT_NETWORK_TIMEOUT:
+ case SATELLITE_RESULT_NETWORK_TIMEOUT:
return "SATELLITE_RESULT_NETWORK_TIMEOUT";
- case SatelliteResult.SATELLITE_RESULT_NOT_REACHABLE:
+ case SATELLITE_RESULT_NOT_REACHABLE:
return "SATELLITE_RESULT_NOT_REACHABLE";
- case SatelliteResult.SATELLITE_RESULT_NOT_AUTHORIZED:
+ case SATELLITE_RESULT_NOT_AUTHORIZED:
return "SATELLITE_RESULT_NOT_AUTHORIZED";
+ case SATELLITE_RESULT_NOT_SUPPORTED:
+ return "SATELLITE_RESULT_NOT_SUPPORTED";
+ case SATELLITE_RESULT_REQUEST_IN_PROGRESS:
+ return "SATELLITE_RESULT_REQUEST_IN_PROGRESS";
+ case SATELLITE_RESULT_MODEM_BUSY:
+ return "SATELLITE_RESULT_MODEM_BUSY";
+ case SATELLITE_RESULT_ILLEGAL_STATE:
+ return "SATELLITE_RESULT_ILLEGAL_STATE";
}
Log.d(TAG, "Received invalid satellite service error: " + error);
return "SATELLITE_RESULT_SERVICE_ERROR";
diff --git a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteTestApp.java b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteTestApp.java
index ced9a06..c8ee5fa 100644
--- a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteTestApp.java
+++ b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteTestApp.java
@@ -138,6 +138,11 @@
public void onEnableCellularModemWhileSatelliteModeIsOn(boolean enable) {
Log.d(TAG, "onEnableCellularModemWhileSatelliteModeIsOn");
}
+
+ @Override
+ public void onSetSatellitePlmn() {
+ Log.d(TAG, "onSetSatellitePlmn");
+ }
};
private class TestSatelliteServiceConnection implements ServiceConnection {
diff --git a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SendReceive.java b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SendReceive.java
index b5e82b1..ab7b1c4 100644
--- a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SendReceive.java
+++ b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SendReceive.java
@@ -21,6 +21,7 @@
import android.os.Bundle;
import android.os.CancellationSignal;
import android.os.OutcomeReceiver;
+import android.telephony.satellite.EnableRequestAttributes;
import android.telephony.satellite.PointingInfo;
import android.telephony.satellite.SatelliteCapabilities;
import android.telephony.satellite.SatelliteDatagram;
@@ -157,7 +158,9 @@
if (SatelliteTestApp.getTestSatelliteService() != null) {
SatelliteTestApp.getTestSatelliteService().sendOnPendingDatagrams();
}
- mSatelliteManager.requestEnabled(true, true, Runnable::run, resultListener::offer);
+ mSatelliteManager.requestEnabled(
+ new EnableRequestAttributes.Builder(true).setDemoMode(true).build(),
+ Runnable::run, resultListener::offer);
try {
Integer value = resultListener.poll(TIMEOUT, TimeUnit.MILLISECONDS);
if (value == null) {
@@ -238,7 +241,9 @@
//Satellite Position
SatelliteTransmissionUpdateCallbackTestApp callback =
new SatelliteTransmissionUpdateCallbackTestApp();
- mSatelliteManager.requestEnabled(true, true, Runnable::run, error::offer);
+ mSatelliteManager.requestEnabled(
+ new EnableRequestAttributes.Builder(true).setDemoMode(true).build(),
+ Runnable::run, error::offer);
try {
Integer value = error.poll(TIMEOUT, TimeUnit.MILLISECONDS);
if (value == null) {
diff --git a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/TestSatelliteService.java b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/TestSatelliteService.java
index 9bea30c..af37611 100644
--- a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/TestSatelliteService.java
+++ b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/TestSatelliteService.java
@@ -41,7 +41,9 @@
import com.android.internal.util.FunctionalUtils;
import com.android.telephony.Rlog;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -94,6 +96,10 @@
private boolean mIsSupported;
private int mModemState;
private boolean mIsCellularModemEnabledMode;
+ private List<String> mCarrierPlmnList = new ArrayList<>();
+ private List<String> mAllPlmnList = new ArrayList<>();
+ private boolean mIsSatelliteEnabledForCarrier;
+ private boolean mIsRequestIsSatelliteEnabledForCarrier;
/**
* Create TestSatelliteService using the Executor specified for methods being called from
@@ -109,6 +115,8 @@
mIsSupported = true;
mModemState = SatelliteModemState.SATELLITE_MODEM_STATE_OFF;
mIsCellularModemEnabledMode = false;
+ mIsSatelliteEnabledForCarrier = false;
+ mIsRequestIsSatelliteEnabledForCarrier = false;
}
/**
@@ -389,6 +397,55 @@
runWithExecutor(() -> callback.accept(SATELLITE_ALWAYS_VISIBLE));
}
+ @Override
+ public void setSatellitePlmn(int simLogicalSlotIndex, List<String> carrierPlmnList,
+ List<String> allSatellitePlmnList, IIntegerConsumer resultCallback) {
+ logd("setSatellitePlmn: simLogicalSlotIndex=" + simLogicalSlotIndex + " , carrierPlmnList="
+ + carrierPlmnList + " , allSatellitePlmnList=" + allSatellitePlmnList);
+ if (mErrorCode != SatelliteResult.SATELLITE_RESULT_SUCCESS) {
+ runWithExecutor(() -> resultCallback.accept(mErrorCode));
+ return;
+ }
+ runWithExecutor(() -> resultCallback.accept(SatelliteResult.SATELLITE_RESULT_SUCCESS));
+
+ mCarrierPlmnList = carrierPlmnList;
+ mAllPlmnList = allSatellitePlmnList;
+
+ if (mLocalListener != null) {
+ runWithExecutor(() -> mLocalListener.onSetSatellitePlmn());
+ } else {
+ loge("setSatellitePlmn: mLocalListener is null");
+ }
+ }
+
+ @Override
+ public void setSatelliteEnabledForCarrier(int simLogicalSlotIndex, boolean satelliteEnabled,
+ IIntegerConsumer callback) {
+ logd("setSatelliteEnabledForCarrier: simLogicalSlotIndex=" + simLogicalSlotIndex
+ + ", satelliteEnabled=" + satelliteEnabled);
+ if (mErrorCode != SatelliteResult.SATELLITE_RESULT_SUCCESS) {
+ runWithExecutor(() -> callback.accept(mErrorCode));
+ return;
+ }
+
+ mIsSatelliteEnabledForCarrier = satelliteEnabled;
+ runWithExecutor(() -> callback.accept(SatelliteResult.SATELLITE_RESULT_SUCCESS));
+ }
+
+ @Override
+ public void requestIsSatelliteEnabledForCarrier(int simLogicalSlotIndex,
+ IIntegerConsumer resultCallback, IBooleanConsumer callback) {
+ logd("requestIsSatelliteEnabledForCarrier: simLogicalSlotIndex=" + simLogicalSlotIndex);
+ if (mErrorCode != SatelliteResult.SATELLITE_RESULT_SUCCESS) {
+ runWithExecutor(() -> resultCallback.accept(mErrorCode));
+ mIsRequestIsSatelliteEnabledForCarrier = false;
+ return;
+ }
+
+ runWithExecutor(() -> callback.accept(mIsSatelliteEnabledForCarrier));
+ mIsRequestIsSatelliteEnabledForCarrier = true;
+ }
+
public void setLocalSatelliteListener(@NonNull ILocalSatelliteListener listener) {
logd("setLocalSatelliteListener: listener=" + listener);
mLocalListener = listener;
@@ -508,6 +565,22 @@
}
}
+ public List<String> getCarrierPlmnList() {
+ return mCarrierPlmnList;
+ }
+
+ public List<String> getAllSatellitePlmnList() {
+ return mAllPlmnList;
+ }
+
+ public boolean isSatelliteEnabledForCarrier() {
+ return mIsSatelliteEnabledForCarrier;
+ }
+
+ public boolean isRequestIsSatelliteEnabledForCarrier() {
+ return mIsRequestIsSatelliteEnabledForCarrier;
+ }
+
/**
* Log the message to the radio buffer with {@code DEBUG} priority.
*
diff --git a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/TestSatelliteWrapper.java b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/TestSatelliteWrapper.java
index e4c2005..4f0679d 100644
--- a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/TestSatelliteWrapper.java
+++ b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/TestSatelliteWrapper.java
@@ -36,8 +36,10 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import java.util.function.Consumer;
import java.util.stream.Collectors;
/**
@@ -53,6 +55,7 @@
private NtnSignalStrengthCallback mNtnSignalStrengthCallback = null;
private SatelliteCapabilitiesCallbackWrapper mSatelliteCapabilitiesCallback;
private SubscriptionManager mSubscriptionManager;
+ private int mSubId;
private ListView mLogListView;
@@ -61,6 +64,7 @@
super.onCreate(savedInstanceState);
mSatelliteManagerWrapper = SatelliteManagerWrapper.getInstance(this);
mSubscriptionManager = getSystemService(SubscriptionManager.class);
+ mSubId = getActiveSubId();
setContentView(R.layout.activity_TestSatelliteWrapper);
findViewById(R.id.requestNtnSignalStrength)
@@ -75,6 +79,26 @@
.setOnClickListener(this::registerForCapabilitiesChanged);
findViewById(R.id.unregisterForSatelliteCapabilitiesChanged)
.setOnClickListener(this::unregisterForCapabilitiesChanged);
+ findViewById(R.id.isNonTerrestrialNetwork)
+ .setOnClickListener(this::isNonTerrestrialNetwork);
+ findViewById(R.id.getAvailableServices)
+ .setOnClickListener(this::getAvailableServices);
+ findViewById(R.id.isUsingNonTerrestrialNetwork)
+ .setOnClickListener(this::isUsingNonTerrestrialNetwork);
+ findViewById(R.id.requestAttachEnabledForCarrier_enable)
+ .setOnClickListener(this::requestAttachEnabledForCarrier_enable);
+ findViewById(R.id.requestAttachEnabledForCarrier_disable)
+ .setOnClickListener(this::requestAttachEnabledForCarrier_disable);
+ findViewById(R.id.requestIsAttachEnabledForCarrier)
+ .setOnClickListener(this::requestIsAttachEnabledForCarrier);
+ findViewById(R.id.addAttachRestrictionForCarrier)
+ .setOnClickListener(this::addAttachRestrictionForCarrier);
+ findViewById(R.id.removeAttachRestrictionForCarrier)
+ .setOnClickListener(this::removeAttachRestrictionForCarrier);
+ findViewById(R.id.getAttachRestrictionReasonsForCarrier)
+ .setOnClickListener(this::getAttachRestrictionReasonsForCarrier);
+ findViewById(R.id.getSatellitePlmnsForCarrier)
+ .setOnClickListener(this::getSatellitePlmnsForCarrier);
findViewById(R.id.Back).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
@@ -107,21 +131,24 @@
if (mSatelliteManagerWrapper != null) {
if (mNtnSignalStrengthCallback != null) {
- Log.d(TAG, "unregisterForNtnSignalStrengthChanged()");
+ logd("unregisterForNtnSignalStrengthChanged()");
mSatelliteManagerWrapper.unregisterForNtnSignalStrengthChanged(
mNtnSignalStrengthCallback);
}
if (mSatelliteCapabilitiesCallback != null) {
- Log.d(TAG, "unregisterForCapabilitiesChanged()");
+ logd("unregisterForCapabilitiesChanged()");
mSatelliteManagerWrapper.unregisterForCapabilitiesChanged(
mSatelliteCapabilitiesCallback);
}
}
+ mSubscriptionManager = null;
+ mSatelliteManagerWrapper = null;
+ mExecutor.shutdown();
}
private void requestNtnSignalStrength(View view) {
addLogMessage("requestNtnSignalStrength");
- Log.d(TAG, "requestNtnSignalStrength");
+ logd("requestNtnSignalStrength");
OutcomeReceiver<NtnSignalStrengthWrapper,
SatelliteManagerWrapper.SatelliteExceptionWrapper> receiver =
new OutcomeReceiver<>() {
@@ -138,7 +165,7 @@
if (exception != null) {
String onError = "requestNtnSignalStrength exception: "
+ translateResultCodeToString(exception.getErrorCode());
- Log.d(TAG, onError);
+ logd(onError);
addLogMessage(onError);
}
}
@@ -148,16 +175,16 @@
mSatelliteManagerWrapper.requestNtnSignalStrength(mExecutor, receiver);
} catch (SecurityException ex) {
String errorMessage = "requestNtnSignalStrength: " + ex.getMessage();
- Log.d(TAG, errorMessage);
+ logd(errorMessage);
addLogMessage(errorMessage);
}
}
private void registerForNtnSignalStrengthChanged(View view) {
addLogMessage("registerForNtnSignalStrengthChanged");
- Log.d(TAG, "registerForNtnSignalStrengthChanged()");
+ logd("registerForNtnSignalStrengthChanged()");
if (mNtnSignalStrengthCallback == null) {
- Log.d(TAG, "create new NtnSignalStrengthCallback instance.");
+ logd("create new NtnSignalStrengthCallback instance.");
mNtnSignalStrengthCallback = new NtnSignalStrengthCallback();
}
@@ -166,7 +193,7 @@
mNtnSignalStrengthCallback);
} catch (Exception ex) {
String errorMessage = "registerForNtnSignalStrengthChanged: " + ex.getMessage();
- Log.d(TAG, errorMessage);
+ logd(errorMessage);
addLogMessage(errorMessage);
mNtnSignalStrengthCallback = null;
}
@@ -174,7 +201,7 @@
private void unregisterForNtnSignalStrengthChanged(View view) {
addLogMessage("unregisterForNtnSignalStrengthChanged");
- Log.d(TAG, "unregisterForNtnSignalStrengthChanged()");
+ logd("unregisterForNtnSignalStrengthChanged()");
if (mNtnSignalStrengthCallback != null) {
mSatelliteManagerWrapper.unregisterForNtnSignalStrengthChanged(
mNtnSignalStrengthCallback);
@@ -187,7 +214,7 @@
private void isOnlyNonTerrestrialNetworkSubscription(View view) {
addLogMessage("isOnlyNonTerrestrialNetworkSubscription");
- Log.d(TAG, "isOnlyNonTerrestrialNetworkSubscription()");
+ logd("isOnlyNonTerrestrialNetworkSubscription()");
List<SubscriptionInfo> infoList = mSubscriptionManager.getAvailableSubscriptionInfoList();
List<Integer> subIdList = infoList.stream()
.map(SubscriptionInfo::getSubscriptionId)
@@ -214,13 +241,13 @@
private void registerForCapabilitiesChanged(View view) {
addLogMessage("registerForCapabilitiesChanged");
- Log.d(TAG, "registerForCapabilitiesChanged()");
+ logd("registerForCapabilitiesChanged()");
if (mSatelliteCapabilitiesCallback == null) {
mSatelliteCapabilitiesCallback =
SatelliteCapabilities -> {
String message = "Received SatelliteCapabillities : "
+ SatelliteCapabilities;
- Log.d(TAG, message);
+ logd(message);
runOnUiThread(() -> addLogMessage(message));
};
}
@@ -229,7 +256,7 @@
mSatelliteCapabilitiesCallback);
if (result != SatelliteManagerWrapper.SATELLITE_RESULT_SUCCESS) {
String onError = translateResultCodeToString(result);
- Log.d(TAG, onError);
+ logd(onError);
addLogMessage(onError);
mSatelliteCapabilitiesCallback = null;
}
@@ -237,7 +264,7 @@
private void unregisterForCapabilitiesChanged(View view) {
addLogMessage("unregisterForCapabilitiesChanged");
- Log.d(TAG, "unregisterForCapabilitiesChanged()");
+ logd("unregisterForCapabilitiesChanged()");
if (mSatelliteCapabilitiesCallback != null) {
mSatelliteManagerWrapper.unregisterForCapabilitiesChanged(
mSatelliteCapabilitiesCallback);
@@ -253,11 +280,238 @@
public void onNtnSignalStrengthChanged(
@NonNull NtnSignalStrengthWrapper ntnSignalStrength) {
String message = "Received NTN SignalStrength : " + ntnSignalStrength.getLevel();
- Log.d(TAG, message);
+ logd(message);
runOnUiThread(() -> addLogMessage(message));
}
}
+ private void isNonTerrestrialNetwork(View view) {
+ boolean isNonTerrestrialNetwork = mSatelliteManagerWrapper.isNonTerrestrialNetwork(mSubId);
+ addLogMessage("isNonTerrestrialNetwork=" + isNonTerrestrialNetwork);
+ logd("isNonTerrestrialNetwork=" + isNonTerrestrialNetwork);
+ }
+
+ private void getAvailableServices(View view) {
+ List<Integer> as = mSatelliteManagerWrapper.getAvailableServices(mSubId);
+ String availableServices = as.stream().map(Object::toString).collect(
+ Collectors.joining(", "));
+ addLogMessage("getAvailableServices=" + availableServices);
+ logd("getAvailableServices=" + availableServices);
+ }
+
+ private void isUsingNonTerrestrialNetwork(View view) {
+ boolean isUsingNonTerrestrialNetwork =
+ mSatelliteManagerWrapper.isUsingNonTerrestrialNetwork(mSubId);
+ addLogMessage("isUsingNonTerrestrialNetwork=" + isUsingNonTerrestrialNetwork);
+ logd("isUsingNonTerrestrialNetwork=" + isUsingNonTerrestrialNetwork);
+ }
+
+ private void requestAttachEnabledForCarrier_enable(View view) {
+ addLogMessage("requestAttachEnabledForCarrier");
+ logd("requestAttachEnabledForCarrier");
+
+ if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+ addLogMessage("requestAttachEnabledForCarrier: Subscription ID is invalid");
+ logd("requestAttachEnabledForCarrier: Subscription ID is invalid");
+ return;
+ }
+
+ Consumer<Integer> callback = result -> {
+ runOnUiThread(() -> addLogMessage("requestAttachEnabledForCarrier result: " + result));
+ logd("requestAttachEnabledForCarrier result: " + result);
+ };
+
+ try {
+ mSatelliteManagerWrapper.requestAttachEnabledForCarrier(mSubId, true, mExecutor,
+ callback);
+ } catch (SecurityException | IllegalArgumentException ex) {
+ String errorMessage = "requestAttachEnabledForCarrier: " + ex.getMessage();
+ logd(errorMessage);
+ addLogMessage(errorMessage);
+ }
+ }
+
+ private void requestAttachEnabledForCarrier_disable(View view) {
+ addLogMessage("requestAttachEnabledForCarrier");
+ logd("requestAttachEnabledForCarrier");
+
+ if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+ addLogMessage("requestAttachEnabledForCarrier: Subscription ID is invalid");
+ logd("requestAttachEnabledForCarrier: Subscription ID is invalid");
+ return;
+ }
+
+ Consumer<Integer> callback = result -> {
+ runOnUiThread(() -> addLogMessage("requestAttachEnabledForCarrier result: " + result));
+ logd("requestAttachEnabledForCarrier result: " + result);
+ };
+
+ try {
+ mSatelliteManagerWrapper.requestAttachEnabledForCarrier(mSubId, false, mExecutor,
+ callback);
+ } catch (SecurityException | IllegalArgumentException ex) {
+ String errorMessage = "requestAttachEnabledForCarrier: " + ex.getMessage();
+ logd(errorMessage);
+ addLogMessage(errorMessage);
+ }
+ }
+
+ private void requestIsAttachEnabledForCarrier(View view) {
+ logd("requestIsAttachEnabledForCarrier");
+ addLogMessage("requestIsAttachEnabledForCarrier");
+
+ if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+ addLogMessage("requestIsAttachEnabledForCarrier: Subscription ID is invalid");
+ logd("requestIsAttachEnabledForCarrier: Subscription ID is invalid");
+ return;
+ }
+
+ OutcomeReceiver<Boolean,
+ SatelliteManagerWrapper.SatelliteExceptionWrapper> receiver =
+ new OutcomeReceiver<>() {
+ @Override
+ public void onResult(Boolean result) {
+ logd("requestIsAttachEnabledForCarrier: onResult=" + result);
+ addLogMessage("requestIsAttachEnabledForCarrier: onResult=" + result);
+ }
+
+ @Override
+ public void onError(
+ SatelliteManagerWrapper.SatelliteExceptionWrapper exception) {
+ if (exception != null) {
+ String onError = "requestIsAttachEnabledForCarrier exception: "
+ + translateResultCodeToString(exception.getErrorCode());
+ logd(onError);
+ addLogMessage(onError);
+ }
+ }
+ };
+
+ try {
+ mSatelliteManagerWrapper.requestIsAttachEnabledForCarrier(mSubId, mExecutor, receiver);
+ } catch (SecurityException | IllegalStateException | IllegalArgumentException ex) {
+ String errorMessage = "requestIsAttachEnabledForCarrier: " + ex.getMessage();
+ logd(errorMessage);
+ addLogMessage(errorMessage);
+ }
+ }
+
+ private void addAttachRestrictionForCarrier(View view) {
+ addLogMessage("addAttachRestrictionForCarrier");
+ logd("addAttachRestrictionForCarrier");
+
+ if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+ addLogMessage("addAttachRestrictionForCarrier: Subscription ID is invalid");
+ logd("addAttachRestrictionForCarrier: Subscription ID is invalid");
+ return;
+ }
+
+ int reason = SatelliteManagerWrapper.SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER;
+
+ Consumer<Integer> callback = result -> {
+ runOnUiThread(() -> addLogMessage("addAttachRestrictionForCarrier result: " + result));
+ logd("addAttachRestrictionForCarrier result: " + result);
+ };
+
+ try {
+ mSatelliteManagerWrapper.addAttachRestrictionForCarrier(mSubId, reason, mExecutor,
+ callback);
+ } catch (SecurityException | IllegalArgumentException ex) {
+ String errorMessage = "addAttachRestrictionForCarrier: " + ex.getMessage();
+ logd(errorMessage);
+ addLogMessage(errorMessage);
+ }
+ }
+
+ private void removeAttachRestrictionForCarrier(View view) {
+ addLogMessage("removeAttachRestrictionForCarrier");
+ logd("removeAttachRestrictionForCarrier");
+
+ if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+ addLogMessage("removeAttachRestrictionForCarrier: Subscription ID is invalid");
+ logd("removeAttachRestrictionForCarrier: Subscription ID is invalid");
+ return;
+ }
+
+ int reason = SatelliteManagerWrapper.SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER;
+
+ Consumer<Integer> callback = result -> {
+ runOnUiThread(
+ () -> addLogMessage("removeAttachRestrictionForCarrier result: " + result));
+ logd("removeAttachRestrictionForCarrier result: " + result);
+ };
+
+ try {
+ mSatelliteManagerWrapper.removeAttachRestrictionForCarrier(mSubId, reason, mExecutor,
+ callback);
+ } catch (SecurityException | IllegalArgumentException ex) {
+ String errorMessage = "removeAttachRestrictionForCarrier: " + ex.getMessage();
+ logd(errorMessage);
+ addLogMessage(errorMessage);
+ }
+ }
+
+ private void getAttachRestrictionReasonsForCarrier(View view) {
+ addLogMessage("getAttachRestrictionReasonsForCarrier");
+ logd("getAttachRestrictionReasonsForCarrier");
+
+ if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+ addLogMessage("getAttachRestrictionReasonsForCarrier: Subscription ID is invalid");
+ logd("getAttachRestrictionReasonsForCarrier: Subscription ID is invalid");
+ return;
+ }
+
+ try {
+ Set<Integer> reasons = mSatelliteManagerWrapper.getAttachRestrictionReasonsForCarrier(
+ mSubId);
+ String stringReasons = reasons.stream().map(Object::toString).collect(
+ Collectors.joining(", "));
+ logd("getAttachRestrictionReasonsForCarrier=" + stringReasons);
+ addLogMessage("getAttachRestrictionReasonsForCarrier=" + stringReasons);
+ } catch (SecurityException | IllegalArgumentException ex) {
+ String errorMessage = "getAttachRestrictionReasonsForCarrier: " + ex.getMessage();
+ logd(errorMessage);
+ addLogMessage(errorMessage);
+ }
+ }
+
+ private void getSatellitePlmnsForCarrier(View view) {
+ addLogMessage("getSatellitePlmnsForCarrier");
+ logd("getSatellitePlmnsForCarrier");
+
+ if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+ addLogMessage("getSatellitePlmnsForCarrier: Subscription ID is invalid");
+ logd("getSatellitePlmnsForCarrier: Subscription ID is invalid");
+ return;
+ }
+
+ try {
+ List<String> reasons = mSatelliteManagerWrapper.getSatellitePlmnsForCarrier(
+ mSubId);
+ String stringReasons = reasons.stream().collect(Collectors.joining(", "));
+ logd("getSatellitePlmnsForCarrier=" + stringReasons);
+ addLogMessage("getSatellitePlmnsForCarrier=" + stringReasons);
+ } catch (SecurityException | IllegalArgumentException ex) {
+ String errorMessage = "getSatellitePlmnsForCarrier: " + ex.getMessage();
+ logd(errorMessage);
+ addLogMessage(errorMessage);
+ }
+ }
+
+ private int getActiveSubId() {
+ int subId;
+ List<SubscriptionInfo> subscriptionInfoList =
+ mSubscriptionManager.getActiveSubscriptionInfoList();
+
+ if (subscriptionInfoList != null && subscriptionInfoList.size() > 0) {
+ subId = subscriptionInfoList.get(0).getSubscriptionId();
+ } else {
+ subId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
+ }
+ logd("getActiveSubId() returns " + subId);
+ return subId;
+ }
+
private String translateResultCodeToString(
@SatelliteManagerWrapper.SatelliteResult int result) {
switch (result) {
@@ -319,4 +573,10 @@
mAdapter.notifyDataSetChanged();
mLogListView.setSelection(mAdapter.getCount() - 1);
}
+
+ private static void logd(String message) {
+ if (message != null) {
+ Log.d(TAG, message);
+ }
+ }
}
diff --git a/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java b/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
index 6f18c21..131b8ac 100644
--- a/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
+++ b/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
@@ -308,7 +308,7 @@
anyString(), anyInt());
doReturn(CompletableFuture.completedFuture(NOT_DISCONNECTED))
.when(mEmergencyStateTracker)
- .startEmergencyCall(any(), anyString(), eq(false));
+ .startEmergencyCall(any(), any(), eq(false));
replaceInstance(TelephonyConnectionService.class,
"mDomainSelectionMainExecutor", mTestConnectionService, getExecutor());
doReturn(false).when(mDomainSelectionResolver).isDomainSelectionSupported();
@@ -2141,13 +2141,22 @@
createConnectionRequest(PHONE_ACCOUNT_HANDLE_1,
TEST_EMERGENCY_NUMBER, TELECOM_CALL_ID1));
+ ArgumentCaptor<android.telecom.Connection> connectionCaptor =
+ ArgumentCaptor.forClass(android.telecom.Connection.class);
+
verify(mDomainSelectionResolver)
.getDomainSelectionConnection(eq(mPhone0), eq(SELECTOR_TYPE_CALLING), eq(true));
verify(mEmergencyStateTracker)
- .startEmergencyCall(eq(mPhone0), eq(TELECOM_CALL_ID1), eq(false));
+ .startEmergencyCall(eq(mPhone0), connectionCaptor.capture(), eq(false));
verify(mSatelliteSOSMessageRecommender).onEmergencyCallStarted(any());
verify(mEmergencyCallDomainSelectionConnection).createEmergencyConnection(any(), any());
+ android.telecom.Connection tc = connectionCaptor.getValue();
+
+ assertNotNull(tc);
+ assertEquals(TELECOM_CALL_ID1, tc.getTelecomCallId());
+ assertEquals(mTestConnectionService.getEmergencyConnection(), tc);
+
ArgumentCaptor<DialArgs> argsCaptor = ArgumentCaptor.forClass(DialArgs.class);
verify(mPhone0).dial(anyString(), argsCaptor.capture(), any());
@@ -2171,13 +2180,22 @@
createConnectionRequest(PHONE_ACCOUNT_HANDLE_1,
TEST_EMERGENCY_NUMBER, TELECOM_CALL_ID1));
+ ArgumentCaptor<android.telecom.Connection> connectionCaptor =
+ ArgumentCaptor.forClass(android.telecom.Connection.class);
+
verify(mDomainSelectionResolver)
.getDomainSelectionConnection(eq(mPhone0), eq(SELECTOR_TYPE_CALLING), eq(true));
verify(mEmergencyStateTracker)
- .startEmergencyCall(eq(mPhone0), eq(TELECOM_CALL_ID1), eq(false));
+ .startEmergencyCall(eq(mPhone0), connectionCaptor.capture(), eq(false));
verify(mSatelliteSOSMessageRecommender).onEmergencyCallStarted(any());
verify(mEmergencyCallDomainSelectionConnection).createEmergencyConnection(any(), any());
+ android.telecom.Connection tc = connectionCaptor.getValue();
+
+ assertNotNull(tc);
+ assertEquals(TELECOM_CALL_ID1, tc.getTelecomCallId());
+ assertEquals(mTestConnectionService.getEmergencyConnection(), tc);
+
ArgumentCaptor<DialArgs> argsCaptor = ArgumentCaptor.forClass(DialArgs.class);
verify(mPhone0).dial(anyString(), argsCaptor.capture(), any());
@@ -2204,14 +2222,23 @@
createConnectionRequest(PHONE_ACCOUNT_HANDLE_1,
TEST_EMERGENCY_NUMBER, TELECOM_CALL_ID1));
+ ArgumentCaptor<android.telecom.Connection> connectionCaptor =
+ ArgumentCaptor.forClass(android.telecom.Connection.class);
+
verify(mEmergencyStateTracker, times(1))
- .startEmergencyCall(eq(mPhone0), eq(TELECOM_CALL_ID1), eq(false));
+ .startEmergencyCall(eq(mPhone0), connectionCaptor.capture(), eq(false));
verify(mSatelliteSOSMessageRecommender).onEmergencyCallStarted(any());
verify(mDomainSelectionResolver, times(0))
.getDomainSelectionConnection(eq(mPhone0), eq(SELECTOR_TYPE_CALLING), eq(true));
verify(mEmergencyCallDomainSelectionConnection, times(0))
.createEmergencyConnection(any(), any());
+ android.telecom.Connection tc = connectionCaptor.getValue();
+
+ assertNotNull(tc);
+ assertEquals(TELECOM_CALL_ID1, tc.getTelecomCallId());
+ assertEquals(mTestConnectionService.getEmergencyConnection(), tc);
+
ArgumentCaptor<DialArgs> argsCaptor = ArgumentCaptor.forClass(DialArgs.class);
verify(mPhone0).dial(anyString(), argsCaptor.capture(), any());
@@ -2341,13 +2368,22 @@
createConnectionRequest(PHONE_ACCOUNT_HANDLE_1,
TEST_EMERGENCY_NUMBER, TELECOM_CALL_ID1));
+ ArgumentCaptor<android.telecom.Connection> connectionCaptor =
+ ArgumentCaptor.forClass(android.telecom.Connection.class);
+
verify(mDomainSelectionResolver)
.getDomainSelectionConnection(eq(mPhone0), eq(SELECTOR_TYPE_CALLING), eq(true));
verify(mEmergencyStateTracker)
- .startEmergencyCall(eq(mPhone0), eq(TELECOM_CALL_ID1), eq(false));
+ .startEmergencyCall(eq(mPhone0), connectionCaptor.capture(), eq(false));
verify(mSatelliteSOSMessageRecommender).onEmergencyCallStarted(any());
verify(mEmergencyCallDomainSelectionConnection).createEmergencyConnection(any(), any());
+ android.telecom.Connection tc = connectionCaptor.getValue();
+
+ assertNotNull(tc);
+ assertEquals(TELECOM_CALL_ID1, tc.getTelecomCallId());
+ assertEquals(mTestConnectionService.getEmergencyConnection(), tc);
+
ArgumentCaptor<DialArgs> argsCaptor = ArgumentCaptor.forClass(DialArgs.class);
verify(mPhone0).dial(anyString(), argsCaptor.capture(), any());
@@ -2594,13 +2630,22 @@
assertTrue(mTestConnectionService.maybeReselectDomain(c, reasonInfo, true,
android.telephony.DisconnectCause.NOT_VALID));
+ ArgumentCaptor<android.telecom.Connection> connectionCaptor =
+ ArgumentCaptor.forClass(android.telecom.Connection.class);
+
verify(mDomainSelectionResolver)
.getDomainSelectionConnection(eq(mPhone0), eq(SELECTOR_TYPE_CALLING), eq(true));
verify(mEmergencyStateTracker)
- .startEmergencyCall(eq(mPhone0), eq(TELECOM_CALL_ID1), eq(false));
+ .startEmergencyCall(eq(mPhone0), connectionCaptor.capture(), eq(false));
verify(mSatelliteSOSMessageRecommender).onEmergencyCallStarted(any());
verify(mEmergencyCallDomainSelectionConnection).createEmergencyConnection(any(), any());
+ android.telecom.Connection tc = connectionCaptor.getValue();
+
+ assertNotNull(tc);
+ assertEquals(TELECOM_CALL_ID1, tc.getTelecomCallId());
+ assertEquals(mTestConnectionService.getEmergencyConnection(), tc);
+
ArgumentCaptor<DialArgs> argsCaptor = ArgumentCaptor.forClass(DialArgs.class);
verify(mPhone0).dial(anyString(), argsCaptor.capture(), any());
@@ -2635,13 +2680,22 @@
assertTrue(mTestConnectionService.maybeReselectDomain(c, reasonInfo, true,
android.telephony.DisconnectCause.NOT_VALID));
+ ArgumentCaptor<android.telecom.Connection> connectionCaptor =
+ ArgumentCaptor.forClass(android.telecom.Connection.class);
+
verify(mDomainSelectionResolver)
.getDomainSelectionConnection(eq(mPhone0), eq(SELECTOR_TYPE_CALLING), eq(true));
verify(mEmergencyStateTracker)
- .startEmergencyCall(eq(mPhone0), eq(TELECOM_CALL_ID1), eq(false));
+ .startEmergencyCall(eq(mPhone0), connectionCaptor.capture(), eq(false));
verify(mSatelliteSOSMessageRecommender).onEmergencyCallStarted(any());
verify(mEmergencyCallDomainSelectionConnection).createEmergencyConnection(any(), any());
+ android.telecom.Connection tc = connectionCaptor.getValue();
+
+ assertNotNull(tc);
+ assertEquals(TELECOM_CALL_ID1, tc.getTelecomCallId());
+ assertEquals(mTestConnectionService.getEmergencyConnection(), tc);
+
ArgumentCaptor<DialArgs> argsCaptor = ArgumentCaptor.forClass(DialArgs.class);
verify(mPhone0).dial(anyString(), argsCaptor.capture(), any());
@@ -2763,6 +2817,10 @@
createConnectionRequest(PHONE_ACCOUNT_HANDLE_1,
TEST_EMERGENCY_NUMBER, TELECOM_CALL_ID1));
+ android.telecom.Connection c = mTestConnectionService.getEmergencyConnection();
+
+ assertNotNull(c);
+
ArgumentCaptor<DomainSelectionConnection.DomainSelectionConnectionCallback> callbackCaptor =
ArgumentCaptor.forClass(
DomainSelectionConnection.DomainSelectionConnectionCallback.class);
@@ -2778,7 +2836,7 @@
callback.onSelectionTerminated(ERROR_UNSPECIFIED);
verify(mEmergencyCallDomainSelectionConnection).cancelSelection();
- verify(mEmergencyStateTracker).endCall(eq(TELECOM_CALL_ID1));
+ verify(mEmergencyStateTracker).endCall(eq(c));
}
@Test
@@ -2791,26 +2849,23 @@
CompletableFuture<Integer> future = new CompletableFuture<>();
doReturn(future).when(mEmergencyStateTracker)
- .startEmergencyCall(any(), anyString(), eq(false));
+ .startEmergencyCall(any(), any(), eq(false));
mTestConnectionService.onCreateOutgoingConnection(PHONE_ACCOUNT_HANDLE_1,
createConnectionRequest(PHONE_ACCOUNT_HANDLE_1,
TEST_EMERGENCY_NUMBER, TELECOM_CALL_ID1));
verify(mEmergencyStateTracker)
- .startEmergencyCall(eq(mPhone0), eq(TELECOM_CALL_ID1), eq(false));
-
- TelephonyConnection c = new TestTelephonyConnection();
- c.setTelecomCallId(TELECOM_CALL_ID1);
+ .startEmergencyCall(eq(mPhone0), any(), eq(false));
// dialing is canceled
- mTestConnectionService.onLocalHangup(c);
+ mTestConnectionService.onLocalHangup(mTestConnectionService.getEmergencyConnection());
// startEmergencyCall has completed
future.complete(NOT_DISCONNECTED);
// verify that createEmergencyConnection is discarded
- verify(mEmergencyCallDomainSelectionConnection, times(0))
+ verify(mEmergencyCallDomainSelectionConnection, never())
.createEmergencyConnection(any(), any());
}
@@ -2832,17 +2887,14 @@
verify(mEmergencyCallDomainSelectionConnection).createEmergencyConnection(any(), any());
- TelephonyConnection c = new TestTelephonyConnection();
- c.setTelecomCallId(TELECOM_CALL_ID1);
-
// dialing is canceled
- mTestConnectionService.onLocalHangup(c);
+ mTestConnectionService.onLocalHangup(mTestConnectionService.getEmergencyConnection());
// domain selection has completed
future.complete(selectedDomain);
// verify that dialing is discarded
- verify(mPhone0, times(0)).dial(anyString(), any(), any());
+ verify(mPhone0, never()).dial(anyString(), any(), any());
}
@Test
@@ -2855,7 +2907,6 @@
TestTelephonyConnection c = setupForReDialForDomainSelection(
mPhone0, selectedDomain, preciseDisconnectCause, disconnectCause, true);
- c.setTelecomCallId(TELECOM_CALL_ID1);
CompletableFuture<Integer> future = new CompletableFuture<>();
doReturn(future).when(mEmergencyCallDomainSelectionConnection)
@@ -2892,20 +2943,28 @@
mImsPhone, selectedDomain, preciseDisconnectCause, disconnectCause, false);
c.setEmergencyServiceCategory(eccCategory);
c.setAddress(TEST_ADDRESS, TelecomManager.PRESENTATION_ALLOWED);
- c.setTelecomCallId(TELECOM_CALL_ID1);
CompletableFuture<Integer> future = new CompletableFuture<>();
doReturn(future).when(mEmergencyStateTracker)
- .startEmergencyCall(any(), anyString(), eq(false));
+ .startEmergencyCall(any(), any(), eq(false));
ImsReasonInfo reasonInfo = new ImsReasonInfo(CODE_SIP_ALTERNATE_EMERGENCY_CALL, 0, null);
assertTrue(mTestConnectionService.maybeReselectDomain(c, reasonInfo, true,
android.telephony.DisconnectCause.NOT_VALID));
+ ArgumentCaptor<android.telecom.Connection> connectionCaptor =
+ ArgumentCaptor.forClass(android.telecom.Connection.class);
+
verify(mEmergencyStateTracker)
- .startEmergencyCall(eq(mPhone0), eq(TELECOM_CALL_ID1), eq(false));
+ .startEmergencyCall(eq(mPhone0), connectionCaptor.capture(), eq(false));
verify(mSatelliteSOSMessageRecommender).onEmergencyCallStarted(any());
+ android.telecom.Connection tc = connectionCaptor.getValue();
+
+ assertNotNull(tc);
+ assertEquals(TELECOM_CALL_ID1, tc.getTelecomCallId());
+ assertEquals(mTestConnectionService.getEmergencyConnection(), tc);
+
// dialing is canceled
mTestConnectionService.onLocalHangup(c);
@@ -2934,7 +2993,6 @@
mImsPhone, selectedDomain, preciseDisconnectCause, disconnectCause, false);
c.setEmergencyServiceCategory(eccCategory);
c.setAddress(TEST_ADDRESS, TelecomManager.PRESENTATION_ALLOWED);
- c.setTelecomCallId(TELECOM_CALL_ID1);
CompletableFuture<Integer> future = new CompletableFuture<>();
doReturn(future).when(mEmergencyCallDomainSelectionConnection)
@@ -2953,7 +3011,7 @@
future.complete(selectedDomain);
// verify that dialing is discarded
- verify(mPhone0, times(0)).dial(anyString(), any(), any());
+ verify(mPhone0, never()).dial(anyString(), any(), any());
}
@Test
@@ -2968,15 +3026,25 @@
createConnectionRequest(PHONE_ACCOUNT_HANDLE_1,
TEST_EMERGENCY_NUMBER, TELECOM_CALL_ID1));
+ ArgumentCaptor<android.telecom.Connection> connectionCaptor =
+ ArgumentCaptor.forClass(android.telecom.Connection.class);
+
verify(mDomainSelectionResolver)
.getDomainSelectionConnection(eq(mPhone0), eq(SELECTOR_TYPE_CALLING), eq(true));
verify(mEmergencyStateTracker)
- .startEmergencyCall(eq(mPhone0), eq(TELECOM_CALL_ID1), eq(false));
+ .startEmergencyCall(eq(mPhone0), connectionCaptor.capture(), eq(false));
verify(mSatelliteSOSMessageRecommender).onEmergencyCallStarted(any());
verify(mEmergencyCallDomainSelectionConnection).createEmergencyConnection(any(), any());
verify(mPhone0).dial(anyString(), any(), any());
+ android.telecom.Connection tc = connectionCaptor.getValue();
+
+ assertNotNull(tc);
+ assertEquals(TELECOM_CALL_ID1, tc.getTelecomCallId());
+ assertEquals(mTestConnectionService.getEmergencyConnection(), tc);
+
TestTelephonyConnection c = new TestTelephonyConnection();
+ mTestConnectionService.setEmergencyConnection(c);
c.setTelecomCallId(TELECOM_CALL_ID1);
c.setIsImsConnection(true);
Connection orgConn = c.getOriginalConnection();
@@ -2990,10 +3058,10 @@
connectionListener.onOriginalConnectionConfigured(c);
verify(mEmergencyStateTracker, times(1)).onEmergencyCallDomainUpdated(
- eq(PhoneConstants.PHONE_TYPE_IMS), eq(TELECOM_CALL_ID1));
+ eq(PhoneConstants.PHONE_TYPE_IMS), eq(c));
verify(mEmergencyStateTracker, times(0)).onEmergencyCallStateChanged(
- any(), eq(TELECOM_CALL_ID1));
+ any(), eq(c));
verify(mSatelliteSOSMessageRecommender, times(0))
.onEmergencyCallConnectionStateChanged(eq(TELECOM_CALL_ID1), anyInt());
@@ -3004,7 +3072,7 @@
// ACTIVE sate is notified
verify(mEmergencyStateTracker, times(1)).onEmergencyCallStateChanged(
- eq(Call.State.ACTIVE), eq(TELECOM_CALL_ID1));
+ eq(Call.State.ACTIVE), eq(c));
verify(mSatelliteSOSMessageRecommender, times(1))
.onEmergencyCallConnectionStateChanged(eq(TELECOM_CALL_ID1),
eq(android.telecom.Connection.STATE_ACTIVE));
@@ -3017,7 +3085,7 @@
// state change not notified any more after CONNECTED once
verify(mEmergencyStateTracker, times(1)).onEmergencyCallStateChanged(
- any(), eq(TELECOM_CALL_ID1));
+ any(), eq(c));
verify(mSatelliteSOSMessageRecommender, times(1))
.onEmergencyCallConnectionStateChanged(eq(TELECOM_CALL_ID1), anyInt());
@@ -3029,7 +3097,7 @@
// state change not notified any more after CONNECTED once
verify(mEmergencyStateTracker, times(1)).onEmergencyCallStateChanged(
- any(), eq(TELECOM_CALL_ID1));
+ any(), eq(c));
verify(mSatelliteSOSMessageRecommender, times(1))
.onEmergencyCallConnectionStateChanged(eq(TELECOM_CALL_ID1), anyInt());
@@ -3041,7 +3109,7 @@
// domain change notified
verify(mEmergencyStateTracker, times(1)).onEmergencyCallDomainUpdated(
- eq(PhoneConstants.PHONE_TYPE_GSM), eq(TELECOM_CALL_ID1));
+ eq(PhoneConstants.PHONE_TYPE_GSM), eq(c));
// state change to DISCONNECTED
c.setDisconnected(null);
@@ -3051,7 +3119,7 @@
// state change not notified
verify(mEmergencyStateTracker, times(1)).onEmergencyCallStateChanged(
- any(), eq(TELECOM_CALL_ID1));
+ any(), eq(c));
verify(mSatelliteSOSMessageRecommender, times(1))
.onEmergencyCallConnectionStateChanged(eq(TELECOM_CALL_ID1), anyInt());
}
@@ -3068,15 +3136,24 @@
createConnectionRequest(PHONE_ACCOUNT_HANDLE_1,
TEST_EMERGENCY_NUMBER, TELECOM_CALL_ID1));
+ ArgumentCaptor<android.telecom.Connection> connectionCaptor =
+ ArgumentCaptor.forClass(android.telecom.Connection.class);
+
verify(mDomainSelectionResolver)
.getDomainSelectionConnection(eq(mPhone0), eq(SELECTOR_TYPE_CALLING), eq(true));
verify(mEmergencyStateTracker)
- .startEmergencyCall(eq(mPhone0), eq(TELECOM_CALL_ID1), eq(false));
+ .startEmergencyCall(eq(mPhone0), connectionCaptor.capture(), eq(false));
verify(mEmergencyCallDomainSelectionConnection).createEmergencyConnection(any(), any());
verify(mPhone0).dial(anyString(), any(), any());
+ android.telecom.Connection tc = connectionCaptor.getValue();
+
+ assertNotNull(tc);
+ assertEquals(TELECOM_CALL_ID1, tc.getTelecomCallId());
+ assertEquals(mTestConnectionService.getEmergencyConnection(), tc);
+
TestTelephonyConnection c = new TestTelephonyConnection();
- c.setTelecomCallId(TELECOM_CALL_ID1);
+ mTestConnectionService.setEmergencyConnection(c);
c.setIsImsConnection(true);
Connection orgConn = c.getOriginalConnection();
doReturn(PhoneConstants.PHONE_TYPE_IMS).when(orgConn).getPhoneType();
@@ -3088,18 +3165,18 @@
connectionListener.onConnectionPropertiesChanged(c, PROPERTY_WIFI);
verify(mEmergencyStateTracker, times(0)).onEmergencyCallPropertiesChanged(
- anyInt(), anyString());
+ anyInt(), any());
doReturn(Call.State.ACTIVE).when(orgConn).getState();
connectionListener.onConnectionPropertiesChanged(c, PROPERTY_WIFI);
verify(mEmergencyStateTracker, times(1)).onEmergencyCallPropertiesChanged(
- eq(PROPERTY_WIFI), eq(TELECOM_CALL_ID1));
+ eq(PROPERTY_WIFI), eq(c));
connectionListener.onConnectionPropertiesChanged(c, 0);
verify(mEmergencyStateTracker, times(1)).onEmergencyCallPropertiesChanged(
- eq(0), eq(TELECOM_CALL_ID1));
+ eq(0), eq(c));
}
@Test
@@ -3553,6 +3630,7 @@
private TestTelephonyConnection setupForReDialForDomainSelection(
Phone mockPhone, int domain, int preciseDisconnectCause,
int disconnectCause, boolean fromEmergency) throws Exception {
+ TestTelephonyConnection c = new TestTelephonyConnection();
try {
if (fromEmergency) {
doReturn(CompletableFuture.completedFuture(domain))
@@ -3561,8 +3639,8 @@
replaceInstance(TelephonyConnectionService.class,
"mEmergencyCallDomainSelectionConnection",
mTestConnectionService, mEmergencyCallDomainSelectionConnection);
- replaceInstance(TelephonyConnectionService.class, "mEmergencyCallId",
- mTestConnectionService, TELECOM_CALL_ID1);
+ replaceInstance(TelephonyConnectionService.class, "mEmergencyConnection",
+ mTestConnectionService, c);
} else {
doReturn(CompletableFuture.completedFuture(domain))
.when(mNormalCallDomainSelectionConnection).reselectDomain(any());
@@ -3576,7 +3654,6 @@
doReturn(true).when(mDomainSelectionResolver).isDomainSelectionSupported();
- TestTelephonyConnection c = new TestTelephonyConnection();
c.setTelecomCallId(TELECOM_CALL_ID1);
c.setMockPhone(mockPhone);
c.setAddress(TEST_ADDRESS, TelecomManager.PRESENTATION_ALLOWED);
diff --git a/tests/src/com/android/services/telephony/domainselection/EmergencyCallDomainSelectorTest.java b/tests/src/com/android/services/telephony/domainselection/EmergencyCallDomainSelectorTest.java
index 0625b2d..b9c1845 100644
--- a/tests/src/com/android/services/telephony/domainselection/EmergencyCallDomainSelectorTest.java
+++ b/tests/src/com/android/services/telephony/domainselection/EmergencyCallDomainSelectorTest.java
@@ -87,6 +87,7 @@
import android.net.ConnectivityManager;
import android.net.NetworkRequest;
import android.net.Uri;
+import android.os.CancellationSignal;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IPowerManager;
@@ -102,7 +103,7 @@
import android.telephony.DisconnectCause;
import android.telephony.DomainSelectionService;
import android.telephony.DomainSelectionService.SelectionAttributes;
-import android.telephony.EmergencyRegResult;
+import android.telephony.EmergencyRegistrationResult;
import android.telephony.NetworkRegistrationInfo;
import android.telephony.PreciseDisconnectCause;
import android.telephony.SubscriptionManager;
@@ -122,6 +123,7 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.invocation.InvocationOnMock;
@@ -164,7 +166,7 @@
private @AccessNetworkConstants.RadioAccessNetworkType List<Integer> mAccessNetwork;
private PowerManager mPowerManager;
private ConnectivityManager.NetworkCallback mNetworkCallback;
- private Consumer<EmergencyRegResult> mResultConsumer;
+ private Consumer<EmergencyRegistrationResult> mResultConsumer;
@Before
public void setUp() throws Exception {
@@ -269,7 +271,8 @@
@Override
public Void answer(InvocationOnMock invocation) throws Throwable {
mAccessNetwork = (List<Integer>) invocation.getArguments()[0];
- mResultConsumer = (Consumer<EmergencyRegResult>) invocation.getArguments()[4];
+ mResultConsumer =
+ (Consumer<EmergencyRegistrationResult>) invocation.getArguments()[4];
return null;
}
}).when(mWwanSelectorCallback).onRequestEmergencyNetworkScan(
@@ -305,7 +308,8 @@
public void testDestroyed() throws Exception {
createSelector(SLOT_0_SUB_ID);
- EmergencyRegResult regResult = getEmergencyRegResult(UTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(UTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -333,7 +337,7 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(
UNKNOWN, REGISTRATION_STATE_UNKNOWN, 0, false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
@@ -345,7 +349,7 @@
}
@Test
- public void testNullEmergencyRegResult() throws Exception {
+ public void testNullEmergencyRegistrationResult() throws Exception {
doReturn(2).when(mTelephonyManager).getActiveModemCount();
createSelector(SLOT_0_SUB_ID);
@@ -365,7 +369,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -395,7 +400,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -416,7 +422,7 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(
UNKNOWN, REGISTRATION_STATE_UNKNOWN, 0, false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
@@ -442,7 +448,7 @@
doReturn(true).when(mCsrdCtrl).isThereOtherSlot();
doReturn(new String[] {"jp"}).when(mResources).getStringArray(anyInt());
- EmergencyRegResult regResult = getEmergencyRegResult(
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(
UNKNOWN, REGISTRATION_STATE_UNKNOWN, 0, false, false, 0, 0, "", "", "jp");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
@@ -461,7 +467,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -478,7 +485,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -495,7 +503,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -518,7 +527,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -540,7 +550,7 @@
.setAddress(TEST_URI)
.setCsDisconnectCause(SERVICE_OPTION_NOT_AVAILABLE)
.setEmergency(true)
- .setEmergencyRegResult(regResult);
+ .setEmergencyRegistrationResult(regResult);
attr = builder.build();
mDomainSelector.reselectDomain(attr);
processAllMessages();
@@ -554,7 +564,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -573,7 +584,7 @@
SelectionAttributes.Builder builder =
new SelectionAttributes.Builder(SLOT_0, SLOT_0_SUB_ID, SELECTOR_TYPE_CALLING)
.setEmergency(true)
- .setEmergencyRegResult(regResult);
+ .setEmergencyRegistrationResult(regResult);
attr = builder.build();
mDomainSelector.reselectDomain(attr);
processAllMessages();
@@ -587,7 +598,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -604,7 +616,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -621,14 +634,15 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = new SelectionAttributes.Builder(
SLOT_0, SLOT_0_SUB_ID, SELECTOR_TYPE_CALLING)
.setAddress(TEST_URI)
.setEmergency(true)
- .setEmergencyRegResult(regResult)
+ .setEmergencyRegistrationResult(regResult)
.setExitedFromAirplaneMode(true)
.build();
mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
@@ -648,14 +662,15 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = new SelectionAttributes.Builder(
SLOT_0, SLOT_0_SUB_ID, SELECTOR_TYPE_CALLING)
.setAddress(TEST_URI)
.setEmergency(true)
- .setEmergencyRegResult(regResult)
+ .setEmergencyRegistrationResult(regResult)
.setExitedFromAirplaneMode(true)
.build();
mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
@@ -676,7 +691,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -693,7 +709,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -710,7 +727,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
true, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -727,7 +745,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
true, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -744,7 +763,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
true, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -761,7 +781,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
true, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -778,7 +799,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
false, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -795,7 +817,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
false, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -812,7 +835,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
false, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -829,7 +853,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
false, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -846,7 +871,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -863,7 +889,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -880,7 +907,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -897,7 +925,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -914,7 +943,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(UTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(UTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -938,7 +968,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(UTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(UTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS,
false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -960,11 +991,62 @@
}
@Test
+ public void testNotSupportPsCombinedImsRegisteredSelectCs() throws Exception {
+ PersistableBundle bundle = getDefaultPersistableBundle();
+ int[] domainPreference = new int[] {
+ CarrierConfigManager.ImsEmergency.DOMAIN_CS
+ };
+ bundle.putIntArray(KEY_EMERGENCY_DOMAIN_PREFERENCE_INT_ARRAY, domainPreference);
+ when(mCarrierConfigManager.getConfigForSubId(anyInt())).thenReturn(bundle);
+
+ createSelector(SLOT_0_SUB_ID);
+ unsolBarringInfoChanged(false);
+
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
+ NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
+ true, true, 0, 0, "", "");
+ SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
+ mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
+ processAllMessages();
+
+ bindImsService();
+
+ verifyCsDialed();
+ }
+
+ @Test
+ public void testNotSupportCsCombinedImsNotRegisteredSelectPs() throws Exception {
+ PersistableBundle bundle = getDefaultPersistableBundle();
+ int[] domainPreference = new int[] {
+ CarrierConfigManager.ImsEmergency.DOMAIN_PS_3GPP
+ };
+ bundle.putIntArray(KEY_EMERGENCY_DOMAIN_PREFERENCE_INT_ARRAY, domainPreference);
+ when(mCarrierConfigManager.getConfigForSubId(anyInt())).thenReturn(bundle);
+
+ createSelector(SLOT_0_SUB_ID);
+ unsolBarringInfoChanged(false);
+
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
+ NetworkRegistrationInfo.DOMAIN_CS | NetworkRegistrationInfo.DOMAIN_PS,
+ true, true, 0, 0, "", "");
+ SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
+ mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
+ processAllMessages();
+
+ bindImsServiceUnregistered();
+
+ verifyPsDialed();
+ }
+
+ @Test
public void testDefaultEpsImsRegisteredBarredScanPsPreferred() throws Exception {
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -981,7 +1063,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -998,7 +1081,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -1015,7 +1099,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -1032,7 +1117,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
true, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -1049,7 +1135,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
true, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -1066,7 +1153,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
true, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -1083,7 +1171,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
true, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -1100,7 +1189,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
false, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -1117,7 +1207,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
false, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -1134,7 +1225,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
false, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -1151,7 +1243,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
false, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -1168,7 +1261,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -1185,7 +1279,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -1202,7 +1297,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -1219,7 +1315,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -1236,7 +1333,7 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(
UNKNOWN, REGISTRATION_STATE_UNKNOWN, 0, false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
@@ -1256,7 +1353,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -1281,7 +1379,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -1303,7 +1402,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -1326,7 +1426,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -1348,7 +1449,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
true, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -1370,7 +1472,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -1412,7 +1515,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -1436,7 +1540,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -1475,7 +1580,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -1508,7 +1614,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -1541,7 +1648,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -1579,7 +1687,8 @@
doReturn(true).when(mCsrdCtrl).isThereOtherSlot();
doReturn(new String[] {"jp"}).when(mResources).getStringArray(anyInt());
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_UNKNOWN,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_UNKNOWN,
0, false, false, 0, 0, "", "", "jp");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
@@ -1602,7 +1711,8 @@
doReturn(true).when(mCsrdCtrl).isThereOtherSlot();
doReturn(new String[] {"jp"}).when(mResources).getStringArray(anyInt());
- EmergencyRegResult regResult = getEmergencyRegResult(UNKNOWN, REGISTRATION_STATE_UNKNOWN,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(UNKNOWN,
+ REGISTRATION_STATE_UNKNOWN,
0, false, false, 0, 0, "", "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
@@ -1632,7 +1742,8 @@
doReturn(false).when(mCsrdCtrl).isThereOtherSlot();
doReturn(new String[] {"jp"}).when(mResources).getStringArray(anyInt());
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_UNKNOWN,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_UNKNOWN,
0, false, false, 0, 0, "", "", "jp");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
@@ -1650,7 +1761,8 @@
public void testEutranWithCsDomainOnly() throws Exception {
setupForHandleScanResult();
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
DOMAIN_CS, false, false, 0, 0, "", "");
mResultConsumer.accept(regResult);
processAllMessages();
@@ -1662,7 +1774,8 @@
public void testEutranWithPsDomainOnly() throws Exception {
setupForHandleScanResult();
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
DOMAIN_PS, false, false, 0, 0, "", "");
mResultConsumer.accept(regResult);
processAllMessages();
@@ -1674,7 +1787,8 @@
public void testUtran() throws Exception {
setupForHandleScanResult();
- EmergencyRegResult regResult = getEmergencyRegResult(UTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(UTRAN,
+ REGISTRATION_STATE_HOME,
DOMAIN_CS, false, false, 0, 0, "", "");
mResultConsumer.accept(regResult);
processAllMessages();
@@ -1692,7 +1806,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(UNKNOWN, REGISTRATION_STATE_UNKNOWN,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(UNKNOWN,
+ REGISTRATION_STATE_UNKNOWN,
0, false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
@@ -1721,7 +1836,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_ROAMING,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_ROAMING,
0, true, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
@@ -1746,7 +1862,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(UNKNOWN, REGISTRATION_STATE_UNKNOWN,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(UNKNOWN,
+ REGISTRATION_STATE_UNKNOWN,
0, false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
@@ -2025,7 +2142,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -2051,7 +2169,7 @@
unsolBarringInfoChanged(false);
doReturn(2).when(mTelephonyManager).getActiveModemCount();
- EmergencyRegResult regResult = getEmergencyRegResult(
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(
UNKNOWN, REGISTRATION_STATE_UNKNOWN, 0, false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
@@ -2079,7 +2197,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(UTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(UTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -2093,7 +2212,7 @@
attr = new SelectionAttributes.Builder(SLOT_0, SLOT_0_SUB_ID, SELECTOR_TYPE_CALLING)
.setAddress(TEST_URI)
.setEmergency(true)
- .setEmergencyRegResult(regResult)
+ .setEmergencyRegistrationResult(regResult)
.setCsDisconnectCause(PreciseDisconnectCause.EMERGENCY_TEMP_FAILURE)
.build();
@@ -2108,7 +2227,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(UTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(UTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -2122,7 +2242,7 @@
attr = new SelectionAttributes.Builder(SLOT_0, SLOT_0_SUB_ID, SELECTOR_TYPE_CALLING)
.setAddress(TEST_URI)
.setEmergency(true)
- .setEmergencyRegResult(regResult)
+ .setEmergencyRegistrationResult(regResult)
.setCsDisconnectCause(PreciseDisconnectCause.EMERGENCY_PERM_FAILURE)
.build();
@@ -2137,20 +2257,31 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(
UNKNOWN, REGISTRATION_STATE_UNKNOWN, 0, false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
processAllMessages();
bindImsServiceUnregistered();
+ processAllMessages();
- verifyScanPsPreferred();
+ ArgumentCaptor<CancellationSignal> cancelCaptor =
+ ArgumentCaptor.forClass(CancellationSignal.class);
+
+ verify(mWwanSelectorCallback, times(1)).onRequestEmergencyNetworkScan(
+ any(), eq(DomainSelectionService.SCAN_TYPE_NO_PREFERENCE),
+ anyBoolean(), cancelCaptor.capture(), any());
+ assertEquals(EUTRAN, (int) mAccessNetwork.get(0));
mDomainSelector.notifyCrossStackTimerExpired();
verify(mTransportSelectorCallback)
.onSelectionTerminated(eq(DisconnectCause.EMERGENCY_TEMP_FAILURE));
+
+ CancellationSignal cancelSignal = cancelCaptor.getValue();
+ assertNotNull(cancelSignal);
+ assertFalse(cancelSignal.isCanceled());
}
@Test
@@ -2158,7 +2289,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(UTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(UTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -2278,7 +2410,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(UTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(UTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -2331,7 +2464,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(UTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(UTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -2449,7 +2583,8 @@
verify(mTransportSelectorCallback, times(1)).onWlanSelected(anyBoolean());
assertFalse(mDomainSelector.hasMessages(MSG_MAX_CELLULAR_TIMEOUT));
- EmergencyRegResult regResult = getEmergencyRegResult(UTRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(UTRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_CS,
true, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
@@ -2476,7 +2611,7 @@
when(mTelephonyManager.getSimState(anyInt())).thenReturn(
TelephonyManager.SIM_STATE_PIN_REQUIRED);
- EmergencyRegResult regResult = getEmergencyRegResult(
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(
UNKNOWN, REGISTRATION_STATE_UNKNOWN, 0, false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
@@ -2502,7 +2637,7 @@
when(mTelephonyManager.getSimState(anyInt())).thenReturn(
TelephonyManager.SIM_STATE_PIN_REQUIRED);
- EmergencyRegResult regResult = getEmergencyRegResult(
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(
UNKNOWN, REGISTRATION_STATE_UNKNOWN, 0, false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
@@ -2525,7 +2660,7 @@
createSelector(SubscriptionManager.INVALID_SUBSCRIPTION_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(
UNKNOWN, REGISTRATION_STATE_UNKNOWN, 0, false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0,
SubscriptionManager.INVALID_SUBSCRIPTION_ID, regResult);
@@ -2552,7 +2687,7 @@
// The last valid subscription supported NR.
doReturn(true).when(mCarrierConfigHelper).isVoNrEmergencySupported(eq(SLOT_0));
- EmergencyRegResult regResult = getEmergencyRegResult(
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(
UNKNOWN, REGISTRATION_STATE_UNKNOWN, 0, false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0,
SubscriptionManager.INVALID_SUBSCRIPTION_ID, regResult);
@@ -2576,7 +2711,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_UNKNOWN,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_UNKNOWN,
0, false, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
@@ -2598,7 +2734,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(NGRAN, REGISTRATION_STATE_HOME,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(NGRAN,
+ REGISTRATION_STATE_HOME,
NetworkRegistrationInfo.DOMAIN_PS, true, false, 1, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
@@ -2624,7 +2761,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(NGRAN, REGISTRATION_STATE_UNKNOWN,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(NGRAN,
+ REGISTRATION_STATE_UNKNOWN,
0, false, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
@@ -2640,7 +2778,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(UTRAN, REGISTRATION_STATE_UNKNOWN,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(UTRAN,
+ REGISTRATION_STATE_UNKNOWN,
0, false, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID,
true /*isTestEmergencyNumber*/, regResult);
@@ -2657,7 +2796,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_UNKNOWN,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_UNKNOWN,
0, false, true, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID,
true /*isTestEmergencyNumber*/, regResult);
@@ -2674,7 +2814,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(UNKNOWN, REGISTRATION_STATE_UNKNOWN,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(UNKNOWN,
+ REGISTRATION_STATE_UNKNOWN,
0, false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID,
true /*isTestEmergencyNumber*/, regResult);
@@ -2692,7 +2833,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(UTRAN, REGISTRATION_STATE_UNKNOWN,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(UTRAN,
+ REGISTRATION_STATE_UNKNOWN,
0, false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
@@ -2712,7 +2854,8 @@
doReturn(TRANSPORT_TYPE_WWAN).when(mEcbmHelper).getTransportType(anyInt());
doReturn(DATA_CONNECTED).when(mEcbmHelper).getDataConnectionState(anyInt());
- EmergencyRegResult regResult = getEmergencyRegResult(UNKNOWN, REGISTRATION_STATE_UNKNOWN,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(UNKNOWN,
+ REGISTRATION_STATE_UNKNOWN,
0, false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
@@ -2734,7 +2877,8 @@
doReturn(TRANSPORT_TYPE_WLAN).when(mEcbmHelper).getTransportType(anyInt());
doReturn(DATA_CONNECTED).when(mEcbmHelper).getDataConnectionState(anyInt());
- EmergencyRegResult regResult = getEmergencyRegResult(UNKNOWN, REGISTRATION_STATE_UNKNOWN,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(UNKNOWN,
+ REGISTRATION_STATE_UNKNOWN,
0, false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
@@ -2755,7 +2899,8 @@
doReturn(true).when(mEcbmHelper).isInEmergencyCallbackMode(anyInt());
doReturn(TRANSPORT_TYPE_WLAN).when(mEcbmHelper).getTransportType(anyInt());
- EmergencyRegResult regResult = getEmergencyRegResult(UNKNOWN, REGISTRATION_STATE_UNKNOWN,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(UNKNOWN,
+ REGISTRATION_STATE_UNKNOWN,
0, false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
@@ -2777,7 +2922,8 @@
doReturn(TRANSPORT_TYPE_WLAN).when(mEcbmHelper).getTransportType(anyInt());
doReturn(DATA_CONNECTED).when(mEcbmHelper).getDataConnectionState(anyInt());
- EmergencyRegResult regResult = getEmergencyRegResult(UNKNOWN, REGISTRATION_STATE_UNKNOWN,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(UNKNOWN,
+ REGISTRATION_STATE_UNKNOWN,
0, false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
@@ -2799,7 +2945,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(false);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_UNKNOWN,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_UNKNOWN,
0, false, false, 0, 0, "", "");
if (psFailed) {
regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_HOME,
@@ -2846,7 +2993,8 @@
createSelector(SLOT_0_SUB_ID);
unsolBarringInfoChanged(true);
- EmergencyRegResult regResult = getEmergencyRegResult(EUTRAN, REGISTRATION_STATE_UNKNOWN,
+ EmergencyRegistrationResult regResult = getEmergencyRegResult(EUTRAN,
+ REGISTRATION_STATE_UNKNOWN,
0, false, false, 0, 0, "", "");
SelectionAttributes attr = getSelectionAttributes(SLOT_0, SLOT_0_SUB_ID, regResult);
mDomainSelector.selectDomain(attr, mTransportSelectorCallback);
@@ -2922,7 +3070,7 @@
mDomainSelector.onImsMmTelCapabilitiesChanged();
}
- private static EmergencyRegResult getEmergencyRegResult(
+ private static EmergencyRegistrationResult getEmergencyRegResult(
@AccessNetworkConstants.RadioAccessNetworkType int accessNetwork,
@NetworkRegistrationInfo.RegistrationState int regState,
@NetworkRegistrationInfo.Domain int domain,
@@ -2932,13 +3080,13 @@
isEmcBearerSupported, emc, emf, mcc, mnc, "");
}
- private static EmergencyRegResult getEmergencyRegResult(
+ private static EmergencyRegistrationResult getEmergencyRegResult(
@AccessNetworkConstants.RadioAccessNetworkType int accessNetwork,
@NetworkRegistrationInfo.RegistrationState int regState,
@NetworkRegistrationInfo.Domain int domain,
boolean isVopsSupported, boolean isEmcBearerSupported, int emc, int emf,
@NonNull String mcc, @NonNull String mnc, @NonNull String iso) {
- return new EmergencyRegResult(accessNetwork, regState,
+ return new EmergencyRegistrationResult(accessNetwork, regState,
domain, isVopsSupported, isEmcBearerSupported,
emc, emf, mcc, mnc, iso);
}
@@ -3033,18 +3181,18 @@
}
private static SelectionAttributes getSelectionAttributes(int slotId, int subId,
- EmergencyRegResult regResult) {
+ EmergencyRegistrationResult regResult) {
return getSelectionAttributes(slotId, subId, false, regResult);
}
private static SelectionAttributes getSelectionAttributes(int slotId, int subId,
- boolean isTestEmergencyNumber, EmergencyRegResult regResult) {
+ boolean isTestEmergencyNumber, EmergencyRegistrationResult regResult) {
SelectionAttributes.Builder builder =
new SelectionAttributes.Builder(slotId, subId, SELECTOR_TYPE_CALLING)
.setAddress(TEST_URI)
.setEmergency(true)
.setTestEmergencyNumber(isTestEmergencyNumber)
- .setEmergencyRegResult(regResult);
+ .setEmergencyRegistrationResult(regResult);
return builder.build();
}
diff --git a/tests/src/com/android/services/telephony/domainselection/EmergencySmsDomainSelectorTest.java b/tests/src/com/android/services/telephony/domainselection/EmergencySmsDomainSelectorTest.java
index e10e9bd..51f6b6c 100644
--- a/tests/src/com/android/services/telephony/domainselection/EmergencySmsDomainSelectorTest.java
+++ b/tests/src/com/android/services/telephony/domainselection/EmergencySmsDomainSelectorTest.java
@@ -40,7 +40,7 @@
import android.telephony.CarrierConfigManager;
import android.telephony.DataSpecificRegistrationInfo;
import android.telephony.DomainSelectionService.SelectionAttributes;
-import android.telephony.EmergencyRegResult;
+import android.telephony.EmergencyRegistrationResult;
import android.telephony.NetworkRegistrationInfo;
import android.telephony.ServiceState;
import android.telephony.TelephonyManager;
@@ -94,7 +94,7 @@
private ImsStateTracker.BarringInfoListener mBarringInfoListener;
private ImsStateTracker.ServiceStateListener mServiceStateListener;
private EmergencySmsDomainSelector mDomainSelector;
- private EmergencyRegResult mEmergencyRegResult;
+ private EmergencyRegistrationResult mEmergencyRegistrationResult;
@Before
public void setUp() throws Exception {
@@ -154,7 +154,7 @@
mLooper = null;
}
- mEmergencyRegResult = null;
+ mEmergencyRegistrationResult = null;
mDomainSelector = null;
mNetworkRegistrationInfo = null;
mVopsSupportInfo = null;
@@ -993,8 +993,9 @@
doAnswer((invocation) -> {
Object[] args = invocation.getArguments();
- final Consumer<EmergencyRegResult> result = (Consumer<EmergencyRegResult>) args[4];
- result.accept(mEmergencyRegResult);
+ final Consumer<EmergencyRegistrationResult> result =
+ (Consumer<EmergencyRegistrationResult>) args[4];
+ result.accept(mEmergencyRegistrationResult);
return null;
}).when(mWwanSelectorCallback).onRequestEmergencyNetworkScan(
any(), anyInt(), anyBoolean(), any(), any());
@@ -1003,7 +1004,7 @@
private void setUpEmergencyRegResult(
@AccessNetworkConstants.RadioAccessNetworkType int accessNetwork,
@NetworkRegistrationInfo.Domain int domain, int nrEs, int nrEsfb) {
- mEmergencyRegResult = new EmergencyRegResult(accessNetwork,
+ mEmergencyRegistrationResult = new EmergencyRegistrationResult(accessNetwork,
NetworkRegistrationInfo.REGISTRATION_STATE_HOME,
domain, true, true, nrEs, nrEsfb, "001", "01", "");
}
diff --git a/tests/src/com/android/services/telephony/domainselection/NormalCallDomainSelectorTest.java b/tests/src/com/android/services/telephony/domainselection/NormalCallDomainSelectorTest.java
index d6e701a..6e438bf 100644
--- a/tests/src/com/android/services/telephony/domainselection/NormalCallDomainSelectorTest.java
+++ b/tests/src/com/android/services/telephony/domainselection/NormalCallDomainSelectorTest.java
@@ -39,7 +39,7 @@
import android.telephony.DisconnectCause;
import android.telephony.DomainSelectionService;
import android.telephony.DomainSelector;
-import android.telephony.EmergencyRegResult;
+import android.telephony.EmergencyRegistrationResult;
import android.telephony.NetworkRegistrationInfo;
import android.telephony.ServiceState;
import android.telephony.SubscriptionManager;
@@ -153,9 +153,49 @@
}
@Test
+ public void testInitialState() {
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.INACTIVE);
+ }
+
+ @Test
+ public void testDestroyedState() {
+ mNormalCallDomainSelector.destroy();
+
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.DESTROYED);
+ }
+
+ @Test
+ public void testDestroyedDuringActiveState() {
+ MockTransportSelectorCallback transportSelectorCallback =
+ new MockTransportSelectorCallback(mNormalCallDomainSelector);
+
+ DomainSelectionService.SelectionAttributes attributes =
+ new DomainSelectionService.SelectionAttributes.Builder(
+ SLOT_ID, SUB_ID_1, SELECTOR_TYPE_CALLING)
+ .setAddress(TEST_URI)
+ .setCallId(TEST_CALLID)
+ .setEmergency(false)
+ .setVideoCall(true)
+ .setExitedFromAirplaneMode(false)
+ .build();
+
+ mNormalCallDomainSelector.selectDomain(attributes, transportSelectorCallback);
+
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.ACTIVE);
+
+ mNormalCallDomainSelector.destroy();
+
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.DESTROYED);
+ }
+
+ @Test
public void testSelectDomainInputParams() {
MockTransportSelectorCallback transportSelectorCallback =
- new MockTransportSelectorCallback();
+ new MockTransportSelectorCallback(mNormalCallDomainSelector);
DomainSelectionService.SelectionAttributes attributes =
new DomainSelectionService.SelectionAttributes.Builder(
@@ -168,6 +208,8 @@
.build();
mNormalCallDomainSelector.selectDomain(attributes, transportSelectorCallback);
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.ACTIVE);
// Case 1: null inputs
try {
@@ -176,6 +218,9 @@
fail("Invalid input params not handled." + e.getMessage());
}
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.INACTIVE);
+
// Case 2: null TransportSelectorCallback
try {
mNormalCallDomainSelector.selectDomain(attributes, null);
@@ -183,6 +228,9 @@
fail("Invalid params (SelectionAttributes) not handled." + e.getMessage());
}
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.INACTIVE);
+
// Case 3: null SelectionAttributes
transportSelectorCallback.mSelectionTerminated = false;
try {
@@ -194,6 +242,9 @@
assertTrue(transportSelectorCallback
.verifyOnSelectionTerminated(DisconnectCause.OUTGOING_FAILURE));
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.DESTROYED);
+
// Case 4: Invalid Subscription-id
attributes = new DomainSelectionService.SelectionAttributes.Builder(
SLOT_ID, SubscriptionManager.INVALID_SUBSCRIPTION_ID, SELECTOR_TYPE_CALLING)
@@ -212,6 +263,9 @@
assertTrue(transportSelectorCallback
.verifyOnSelectionTerminated(DisconnectCause.OUTGOING_FAILURE));
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.DESTROYED);
+
// Case 5: Invalid SELECTOR_TYPE
attributes =
new DomainSelectionService.SelectionAttributes.Builder(
@@ -231,6 +285,9 @@
assertTrue(transportSelectorCallback
.verifyOnSelectionTerminated(DisconnectCause.OUTGOING_FAILURE));
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.DESTROYED);
+
// Case 6: Emergency Call
attributes = new DomainSelectionService.SelectionAttributes.Builder(
SLOT_ID, SUB_ID_1, SELECTOR_TYPE_CALLING)
@@ -246,6 +303,9 @@
fail("Invalid params (SelectionAttributes) not handled." + e.getMessage());
}
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.DESTROYED);
+
assertTrue(transportSelectorCallback
.verifyOnSelectionTerminated(DisconnectCause.OUTGOING_FAILURE));
}
@@ -253,7 +313,7 @@
@Test
public void testOutOfService() {
MockTransportSelectorCallback transportSelectorCallback =
- new MockTransportSelectorCallback();
+ new MockTransportSelectorCallback(mNormalCallDomainSelector);
DomainSelectionService.SelectionAttributes attributes =
new DomainSelectionService.SelectionAttributes.Builder(
SLOT_ID, SUB_ID_1, SELECTOR_TYPE_CALLING)
@@ -263,18 +323,24 @@
.setVideoCall(true)
.setExitedFromAirplaneMode(false)
.build();
+
ServiceState serviceState = new ServiceState();
serviceState.setStateOutOfService();
initialize(serviceState, false, false, false, false);
+
mNormalCallDomainSelector.selectDomain(attributes, transportSelectorCallback);
+
assertTrue(transportSelectorCallback
.verifyOnSelectionTerminated(DisconnectCause.OUT_OF_SERVICE));
+
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.DESTROYED);
}
@Test
public void testDomainSelection() {
MockTransportSelectorCallback transportSelectorCallback =
- new MockTransportSelectorCallback();
+ new MockTransportSelectorCallback(mNormalCallDomainSelector);
DomainSelectionService.SelectionAttributes attributes =
new DomainSelectionService.SelectionAttributes.Builder(
SLOT_ID, SUB_ID_1, SELECTOR_TYPE_CALLING)
@@ -289,17 +355,28 @@
ServiceState serviceState = new ServiceState();
serviceState.setState(ServiceState.STATE_IN_SERVICE);
initialize(serviceState, true, true, true, true);
+
mNormalCallDomainSelector.selectDomain(attributes, transportSelectorCallback);
+
assertTrue(transportSelectorCallback.verifyOnWlanSelected());
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.INACTIVE);
+
// Case 2: 5G
mNormalCallDomainSelector.selectDomain(attributes, transportSelectorCallback);
+
initialize(serviceState, true, false, true, true);
mNormalCallDomainSelector.selectDomain(attributes, transportSelectorCallback);
+
assertTrue(transportSelectorCallback.verifyOnWwanSelected());
+
assertTrue(transportSelectorCallback
.verifyOnDomainSelected(NetworkRegistrationInfo.DOMAIN_PS));
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.INACTIVE);
+
// Case 3: PS -> CS redial
ImsReasonInfo imsReasonInfo = new ImsReasonInfo();
imsReasonInfo.mCode = ImsReasonInfo.CODE_LOCAL_CALL_CS_RETRY_REQUIRED;
@@ -312,10 +389,15 @@
.setExitedFromAirplaneMode(false)
.setPsDisconnectCause(imsReasonInfo)
.build();
+
mNormalCallDomainSelector.reselectDomain(attributes);
+
assertTrue(transportSelectorCallback
.verifyOnDomainSelected(NetworkRegistrationInfo.DOMAIN_CS));
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.INACTIVE);
+
// Case 4: CS call
NetworkRegistrationInfo nwRegistrationInfo = new NetworkRegistrationInfo(
NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN,
@@ -323,24 +405,36 @@
AccessNetworkConstants.AccessNetworkType.UTRAN, 0, false,
null, null, null, false, 0, 0, 0);
serviceState.addNetworkRegistrationInfo(nwRegistrationInfo);
+
mNormalCallDomainSelector.selectDomain(attributes, transportSelectorCallback);
+
initialize(serviceState, false, false, false, false);
mNormalCallDomainSelector.selectDomain(attributes, transportSelectorCallback);
+
assertTrue(transportSelectorCallback.verifyOnWwanSelected());
+
assertTrue(transportSelectorCallback
.verifyOnDomainSelected(NetworkRegistrationInfo.DOMAIN_CS));
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.INACTIVE);
+
//Case 5: Backup calling
serviceState.setStateOutOfService();
initialize(serviceState, true, true, true, true);
+
mNormalCallDomainSelector.selectDomain(attributes, transportSelectorCallback);
+
assertTrue(transportSelectorCallback.verifyOnWlanSelected());
+
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.ACTIVE);
}
@Test
public void testWPSCallDomainSelection() {
MockTransportSelectorCallback transportSelectorCallback =
- new MockTransportSelectorCallback();
+ new MockTransportSelectorCallback(mNormalCallDomainSelector);
DomainSelectionService.SelectionAttributes attributes =
new DomainSelectionService.SelectionAttributes.Builder(
SLOT_ID, SUB_ID_1, SELECTOR_TYPE_CALLING)
@@ -356,35 +450,53 @@
config.putBoolean(CarrierConfigManager.KEY_SUPPORT_WPS_OVER_IMS_BOOL, false);
doReturn(config).when(mMockCarrierConfigMgr).getConfigForSubId(SUB_ID_1,
new String[]{CarrierConfigManager.KEY_SUPPORT_WPS_OVER_IMS_BOOL});
+
ServiceState serviceState = new ServiceState();
serviceState.setState(ServiceState.STATE_IN_SERVICE);
initialize(serviceState, true, true, true, true);
+
mNormalCallDomainSelector.selectDomain(attributes, transportSelectorCallback);
+
assertTrue(transportSelectorCallback.verifyOnWwanSelected());
+
assertTrue(transportSelectorCallback
.verifyOnDomainSelected(NetworkRegistrationInfo.DOMAIN_CS));
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.INACTIVE);
+
//Case 2: WPS supported by IMS and WLAN registered
config.putBoolean(CarrierConfigManager.KEY_SUPPORT_WPS_OVER_IMS_BOOL, true);
serviceState.setState(ServiceState.STATE_IN_SERVICE);
initialize(serviceState, true, true, true, true);
+
mNormalCallDomainSelector.selectDomain(attributes, transportSelectorCallback);
+
assertTrue(transportSelectorCallback.verifyOnWlanSelected());
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.INACTIVE);
+
//Case 2: WPS supported by IMS and LTE registered
config.putBoolean(CarrierConfigManager.KEY_SUPPORT_WPS_OVER_IMS_BOOL, true);
serviceState.setState(ServiceState.STATE_IN_SERVICE);
initialize(serviceState, true, false, true, true);
+
mNormalCallDomainSelector.selectDomain(attributes, transportSelectorCallback);
+
assertTrue(transportSelectorCallback.verifyOnWwanSelected());
+
assertTrue(transportSelectorCallback
.verifyOnDomainSelected(NetworkRegistrationInfo.DOMAIN_PS));
+
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.INACTIVE);
}
@Test
public void testTtyCallDomainSelection() {
MockTransportSelectorCallback transportSelectorCallback =
- new MockTransportSelectorCallback();
+ new MockTransportSelectorCallback(mNormalCallDomainSelector);
DomainSelectionService.SelectionAttributes attributes =
new DomainSelectionService.SelectionAttributes.Builder(
SLOT_ID, SUB_ID_1, SELECTOR_TYPE_CALLING)
@@ -401,29 +513,48 @@
config.putBoolean(CarrierConfigManager.KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL, false);
doReturn(config).when(mMockCarrierConfigMgr).getConfigForSubId(SUB_ID_1,
new String[]{CarrierConfigManager.KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL});
+
ServiceState serviceState = new ServiceState();
serviceState.setState(ServiceState.STATE_IN_SERVICE);
initialize(serviceState, true, false, true, true);
+
mNormalCallDomainSelector.selectDomain(attributes, transportSelectorCallback);
+
assertTrue(transportSelectorCallback.verifyOnWwanSelected());
+
assertTrue(transportSelectorCallback
.verifyOnDomainSelected(NetworkRegistrationInfo.DOMAIN_CS));
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.INACTIVE);
+
//Case 2: TTY supported by IMS and TTY enabled
config.putBoolean(CarrierConfigManager.KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL, true);
mNormalCallDomainSelector.selectDomain(attributes, transportSelectorCallback);
+
assertTrue(transportSelectorCallback.verifyOnWwanSelected());
+
assertTrue(transportSelectorCallback
.verifyOnDomainSelected(NetworkRegistrationInfo.DOMAIN_PS));
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.INACTIVE);
+
//Case 3: TTY supported by IMS and TTY disabled
doReturn(TelecomManager.TTY_MODE_OFF).when(mMockTelecomManager).getCurrentTtyMode();
mNormalCallDomainSelector.selectDomain(attributes, transportSelectorCallback);
+
assertTrue(transportSelectorCallback.verifyOnWwanSelected());
+
assertTrue(transportSelectorCallback
.verifyOnDomainSelected(NetworkRegistrationInfo.DOMAIN_PS));
+
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.INACTIVE);
}
+
+
static class MockTransportSelectorCallback implements TransportSelectorCallback,
WwanSelectorCallback {
public boolean mCreated;
@@ -433,11 +564,20 @@
public boolean mDomainSelected;
int mCauseCode;
int mSelectedDomain;
+ NormalCallDomainSelector mNormalCallDomainSelector;
+
+ MockTransportSelectorCallback(NormalCallDomainSelector normalCallDomainSelector) {
+ mNormalCallDomainSelector = normalCallDomainSelector;
+ }
@Override
public synchronized void onCreated(DomainSelector selector) {
Log.d(TAG, "onCreated");
mCreated = true;
+
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.INACTIVE);
+
notifyAll();
}
@@ -452,6 +592,10 @@
public synchronized void onWlanSelected(boolean useEmergencyPdn) {
Log.d(TAG, "onWlanSelected");
mWlanSelected = true;
+
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.INACTIVE);
+
notifyAll();
}
@@ -467,6 +611,9 @@
Executors.newSingleThreadExecutor().execute(() -> {
consumer.accept(this);
});
+
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.INACTIVE);
}
public boolean verifyOnWwanSelected() {
@@ -479,6 +626,10 @@
Log.i(TAG, "onSelectionTerminated - called");
mCauseCode = cause;
mSelectionTerminated = true;
+
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.INACTIVE);
+
notifyAll();
}
@@ -503,10 +654,10 @@
@Override
public void onRequestEmergencyNetworkScan(@NonNull List<Integer> preferredNetworks,
- int scanType,
- boolean resetScan,
- @NonNull CancellationSignal signal,
- @NonNull Consumer<EmergencyRegResult> consumer) {
+ int scanType,
+ boolean resetScan,
+ @NonNull CancellationSignal signal,
+ @NonNull Consumer<EmergencyRegistrationResult> consumer) {
Log.i(TAG, "onRequestEmergencyNetworkScan - called");
}
@@ -516,6 +667,10 @@
Log.i(TAG, "onDomainSelected - called");
mSelectedDomain = domain;
mDomainSelected = true;
+
+ assertEquals(mNormalCallDomainSelector.getSelectorState(),
+ NormalCallDomainSelector.SelectorState.INACTIVE);
+
notifyAll();
}