Merge "Use system API ACTION_SERVICE_PROVIDERS_UPDATED"
diff --git a/Android.bp b/Android.bp
index efe8ad8..b9ddc08 100644
--- a/Android.bp
+++ b/Android.bp
@@ -96,6 +96,7 @@
"android.hardware.radio.config-V1.0-java-shallow",
"android.hardware.radio.config-V1.1-java-shallow",
"android.hardware.radio.config-V1.2-java-shallow",
+ "android.hardware.radio.config-V1.3-java-shallow",
"android.hardware.radio.deprecated-V1.0-java-shallow",
"ecc-protos-lite",
"libphonenumber-nogeocoder",
diff --git a/src/java/com/android/internal/telephony/CarrierActionAgent.java b/src/java/com/android/internal/telephony/CarrierActionAgent.java
index 157c09f..ff60a71 100644
--- a/src/java/com/android/internal/telephony/CarrierActionAgent.java
+++ b/src/java/com/android/internal/telephony/CarrierActionAgent.java
@@ -89,7 +89,7 @@
final String action = intent.getAction();
final String iccState = intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE);
if (TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(action)){
- if (intent.getBooleanExtra(TelephonyIntents.EXTRA_REBROADCAST_ON_UNLOCK, false)) {
+ if (intent.getBooleanExtra(Intent.EXTRA_REBROADCAST_ON_UNLOCK, false)) {
// ignore rebroadcast since carrier apps are direct boot aware.
return;
}
diff --git a/src/java/com/android/internal/telephony/CellularNetworkValidator.java b/src/java/com/android/internal/telephony/CellularNetworkValidator.java
index 0530312..4b8e102 100644
--- a/src/java/com/android/internal/telephony/CellularNetworkValidator.java
+++ b/src/java/com/android/internal/telephony/CellularNetworkValidator.java
@@ -102,7 +102,7 @@
*/
public boolean isValidationFeatureSupported() {
return PhoneConfigurationManager.getInstance().getCurrentPhoneCapability()
- .validationBeforeSwitchSupported;
+ .getPsDataConnectionLingerTimeMillis() > 0;
}
@VisibleForTesting
diff --git a/src/java/com/android/internal/telephony/CommandsInterface.java b/src/java/com/android/internal/telephony/CommandsInterface.java
index 650ea6b..64c82d5 100644
--- a/src/java/com/android/internal/telephony/CommandsInterface.java
+++ b/src/java/com/android/internal/telephony/CommandsInterface.java
@@ -16,16 +16,19 @@
package com.android.internal.telephony;
+import android.annotation.NonNull;
import android.compat.annotation.UnsupportedAppUsage;
import android.net.KeepalivePacketData;
import android.net.LinkProperties;
import android.os.Handler;
import android.os.Message;
import android.os.WorkSource;
+import android.telephony.AccessNetworkConstants.AccessNetworkType;
import android.telephony.CarrierRestrictionRules;
import android.telephony.ClientRequestStats;
import android.telephony.ImsiEncryptionInfo;
import android.telephony.NetworkScanRequest;
+import android.telephony.RadioAccessSpecifier;
import android.telephony.SignalThresholdInfo;
import android.telephony.data.DataProfile;
import android.telephony.emergency.EmergencyNumber;
@@ -1374,8 +1377,15 @@
@UnsupportedAppUsage
void setNetworkSelectionModeAutomatic(Message response);
+ /**
+ * Ask the radio to connect to the input network with specific RadioAccessNetwork
+ * and change selection mode to manual.
+ * @param operatorNumeric PLMN ID of the network to select.
+ * @param ran radio access network type (see {@link AccessNetworkType}).
+ * @param response callback message.
+ */
@UnsupportedAppUsage
- void setNetworkSelectionModeManual(String operatorNumeric, Message response);
+ void setNetworkSelectionModeManual(String operatorNumeric, int ran, Message response);
/**
* Queries whether the current network selection mode is automatic
@@ -2432,6 +2442,20 @@
default void enableUiccApplications(boolean enable, Message onCompleteMessage) {}
/**
+ * Specify which bands modem's background scan must act on.
+ * If {@code specifiers} is non-empty, the scan will be restricted to the bands specified.
+ * Otherwise, it scans all bands.
+ *
+ * For example, CBRS is only on LTE band 48. By specifying this band,
+ * modem saves more power.
+ *
+ * @param specifiers which bands to scan.
+ * @param onComplete a message to send when complete.
+ */
+ default void setSystemSelectionChannels(@NonNull List<RadioAccessSpecifier> specifiers,
+ Message onComplete) {}
+
+ /**
* Whether uicc applications are enabled or not.
*
* @param onCompleteMessage a Message to return to the requester
diff --git a/src/java/com/android/internal/telephony/Connection.java b/src/java/com/android/internal/telephony/Connection.java
old mode 100755
new mode 100644
index 835b2b4..0d6ef2c
--- a/src/java/com/android/internal/telephony/Connection.java
+++ b/src/java/com/android/internal/telephony/Connection.java
@@ -43,6 +43,8 @@
public abstract class Connection {
private static final String TAG = "Connection";
+ public static final String ADHOC_CONFERENCE_ADDRESS = "tel:conf-factory";
+
public interface PostDialListener {
void onPostDialWait();
void onPostDialChar(char c);
@@ -185,6 +187,8 @@
protected String mAddress; // MAY BE NULL!!!
@UnsupportedAppUsage
protected String mDialString; // outgoing calls only
+ protected String[] mParticipantsToDial;// outgoing calls only
+ protected boolean mIsAdhocConference;
@UnsupportedAppUsage
protected int mNumberPresentation = PhoneConstants.PRESENTATION_ALLOWED;
@UnsupportedAppUsage
@@ -314,6 +318,20 @@
}
/**
+ * Gets the participants address (e.g. phone number) associated with connection.
+ *
+ * @return address or null if unavailable
+ */
+ public String[] getParticipantsToDial() {
+ return mParticipantsToDial;
+ }
+
+ // return whether connection is AdhocConference or not
+ public boolean isAdhocConference() {
+ return mIsAdhocConference;
+ }
+
+ /**
* Gets CNAP name associated with connection.
* @return cnap name or null if unavailable
*/
diff --git a/src/java/com/android/internal/telephony/DefaultPhoneNotifier.java b/src/java/com/android/internal/telephony/DefaultPhoneNotifier.java
index 1cc5a08..7edb451 100644
--- a/src/java/com/android/internal/telephony/DefaultPhoneNotifier.java
+++ b/src/java/com/android/internal/telephony/DefaultPhoneNotifier.java
@@ -213,12 +213,6 @@
}
@Override
- public void notifyOemHookRawEventForSubscriber(Phone sender, byte[] rawData) {
- mTelephonyRegistryMgr.notifyOemHookRawEventForSubscriber(sender.getSubId(),
- sender.getPhoneId(), rawData);
- }
-
- @Override
public void notifyPhoneCapabilityChanged(PhoneCapability capability) {
mTelephonyRegistryMgr.notifyPhoneCapabilityChanged(capability);
}
diff --git a/src/java/com/android/internal/telephony/DeviceStateMonitor.java b/src/java/com/android/internal/telephony/DeviceStateMonitor.java
index f9177a5..6cf5e4c 100644
--- a/src/java/com/android/internal/telephony/DeviceStateMonitor.java
+++ b/src/java/com/android/internal/telephony/DeviceStateMonitor.java
@@ -36,7 +36,6 @@
import android.os.PowerManager;
import android.telephony.AccessNetworkConstants.AccessNetworkType;
import android.telephony.CarrierConfigManager;
-import com.android.telephony.Rlog;
import android.telephony.SignalThresholdInfo;
import android.telephony.TelephonyManager;
import android.util.LocalLog;
@@ -45,6 +44,7 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.IndentingPrintWriter;
+import com.android.telephony.Rlog;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -76,6 +76,7 @@
static final int EVENT_RADIO_AVAILABLE = 6;
@VisibleForTesting
static final int EVENT_WIFI_CONNECTION_CHANGED = 7;
+ static final int EVENT_UPDATE_ALWAYS_REPORT_SIGNAL_STRENGTH = 8;
// TODO(b/74006656) load hysteresis values from a property when DeviceStateMonitor starts
private static final int HYSTERESIS_KBPS = 50;
@@ -163,6 +164,11 @@
*/
private boolean mIsWifiConnected;
+ /**
+ * True indicates we should always enable the signal strength reporting from radio.
+ */
+ private boolean mIsAlwaysSignalStrengthReportingEnabled;
+
@VisibleForTesting
static final int CELL_INFO_INTERVAL_SHORT_MS = 2000;
@VisibleForTesting
@@ -313,7 +319,8 @@
// 3. When the update mode is IGNORE_SCREEN_OFF. This mode is used in some corner cases like
// when Bluetooth carkit is connected, we still want to update signal strength even
// when screen is off.
- if (mIsCharging || mIsScreenOn
+ // 4. Any of system services is registrating to always listen to signal strength changes
+ if (mIsAlwaysSignalStrengthReportingEnabled || mIsCharging || mIsScreenOn
|| mUpdateModes.get(TelephonyManager.INDICATION_FILTER_SIGNAL_STRENGTH)
== TelephonyManager.INDICATION_UPDATE_MODE_IGNORE_SCREEN_OFF) {
return false;
@@ -410,6 +417,15 @@
sendMessage(obtainMessage(EVENT_UPDATE_MODE_CHANGED, filters, mode));
}
+ /**
+ * Set if Telephony need always report signal strength.
+ *
+ * @param isEnable
+ */
+ public void setAlwaysReportSignalStrength(boolean isEnable) {
+ sendMessage(obtainMessage(EVENT_UPDATE_ALWAYS_REPORT_SIGNAL_STRENGTH, isEnable ? 1 : 0));
+ }
+
private void onSetIndicationUpdateMode(int filters, int mode) {
if ((filters & TelephonyManager.INDICATION_FILTER_SIGNAL_STRENGTH) != 0) {
mUpdateModes.put(TelephonyManager.INDICATION_FILTER_SIGNAL_STRENGTH, mode);
@@ -453,6 +469,9 @@
case EVENT_WIFI_CONNECTION_CHANGED:
onUpdateDeviceState(msg.what, msg.arg1 != WIFI_UNAVAILABLE);
break;
+ case EVENT_UPDATE_ALWAYS_REPORT_SIGNAL_STRENGTH:
+ onUpdateDeviceState(msg.what, msg.arg1 != 0);
+ break;
default:
throw new IllegalStateException("Unexpected message arrives. msg = " + msg.what);
}
@@ -487,7 +506,10 @@
case EVENT_WIFI_CONNECTION_CHANGED:
if (mIsWifiConnected == state) return;
mIsWifiConnected = state;
-
+ break;
+ case EVENT_UPDATE_ALWAYS_REPORT_SIGNAL_STRENGTH:
+ if (mIsAlwaysSignalStrengthReportingEnabled == state) return;
+ mIsAlwaysSignalStrengthReportingEnabled = state;
break;
default:
return;
diff --git a/src/java/com/android/internal/telephony/GsmCdmaPhone.java b/src/java/com/android/internal/telephony/GsmCdmaPhone.java
index 65310d0..85e69d0 100644
--- a/src/java/com/android/internal/telephony/GsmCdmaPhone.java
+++ b/src/java/com/android/internal/telephony/GsmCdmaPhone.java
@@ -1222,6 +1222,38 @@
ringingCallState.isAlive());
}
+ private boolean useImsForCall(DialArgs dialArgs) {
+ return isImsUseEnabled()
+ && mImsPhone != null
+ && (mImsPhone.isVolteEnabled() || mImsPhone.isWifiCallingEnabled() ||
+ (mImsPhone.isVideoEnabled() && VideoProfile.isVideo(dialArgs.videoState)))
+ && (mImsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE);
+ }
+
+ @Override
+ public Connection startConference(String[] participantsToDial, DialArgs dialArgs)
+ throws CallStateException {
+ Phone imsPhone = mImsPhone;
+ boolean useImsForCall = useImsForCall(dialArgs);
+ logd("useImsForCall=" + useImsForCall);
+ if (useImsForCall) {
+ try {
+ if (DBG) logd("Trying IMS PS Conference call");
+ return imsPhone.startConference(participantsToDial, dialArgs);
+ } catch (CallStateException e) {
+ if (DBG) logd("IMS PS conference call exception " + e +
+ "useImsForCall =" + useImsForCall + ", imsPhone =" + imsPhone);
+ CallStateException ce = new CallStateException(e.getError(), e.getMessage());
+ ce.setStackTrace(e.getStackTrace());
+ throw ce;
+ }
+ } else {
+ throw new CallStateException(
+ CallStateException.ERROR_OUT_OF_SERVICE,
+ "cannot dial conference call in out of service");
+ }
+ }
+
@Override
public Connection dial(String dialString, @NonNull DialArgs dialArgs)
throws CallStateException {
@@ -1242,11 +1274,7 @@
boolean allowWpsOverIms = configManager.getConfigForSubId(getSubId())
.getBoolean(CarrierConfigManager.KEY_SUPPORT_WPS_OVER_IMS_BOOL);
- boolean useImsForCall = isImsUseEnabled()
- && imsPhone != null
- && (imsPhone.isVolteEnabled() || imsPhone.isWifiCallingEnabled() ||
- (imsPhone.isVideoEnabled() && VideoProfile.isVideo(dialArgs.videoState)))
- && (imsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE)
+ boolean useImsForCall = useImsForCall(dialArgs)
&& (isWpsCall ? allowWpsOverIms : true);
boolean useImsForEmergency = imsPhone != null
diff --git a/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java b/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java
index 7a900c2..3b1be0c 100644
--- a/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java
+++ b/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java
@@ -315,13 +315,17 @@
}
/**
- * Copy a raw SMS PDU to the Icc.
+ * Copies a raw SMS PDU to the ICC.
*
- * @param pdu the raw PDU to store
- * @param status message status (STATUS_ON_ICC_READ, STATUS_ON_ICC_UNREAD,
- * STATUS_ON_ICC_SENT, STATUS_ON_ICC_UNSENT)
- * @return success or not
- *
+ * @param callingPackage the package name of the calling app.
+ * @param status message status. One of these status:
+ * <code>STATUS_ON_ICC_READ</code>
+ * <code>STATUS_ON_ICC_UNREAD</code>
+ * <code>STATUS_ON_ICC_SENT</code>
+ * <code>STATUS_ON_ICC_UNSENT</code>
+ * @param pdu the raw PDU to store.
+ * @param smsc the SMSC for this message. Null means use default.
+ * @return true for success. Otherwise false.
*/
@UnsupportedAppUsage
public boolean copyMessageToIccEf(String callingPackage, int status, byte[] pdu, byte[] smsc) {
diff --git a/src/java/com/android/internal/telephony/IntentBroadcaster.java b/src/java/com/android/internal/telephony/IntentBroadcaster.java
index c393165..5ba4929 100644
--- a/src/java/com/android/internal/telephony/IntentBroadcaster.java
+++ b/src/java/com/android/internal/telephony/IntentBroadcaster.java
@@ -50,7 +50,7 @@
while (iterator.hasNext()) {
Map.Entry pair = (Map.Entry) iterator.next();
Intent i = (Intent) pair.getValue();
- i.putExtra(TelephonyIntents.EXTRA_REBROADCAST_ON_UNLOCK, true);
+ i.putExtra(Intent.EXTRA_REBROADCAST_ON_UNLOCK, true);
iterator.remove();
logd("Rebroadcasting intent " + i.getAction() + " "
+ i.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE)
diff --git a/src/java/com/android/internal/telephony/Phone.java b/src/java/com/android/internal/telephony/Phone.java
index 0044141..e8bd32a 100644
--- a/src/java/com/android/internal/telephony/Phone.java
+++ b/src/java/com/android/internal/telephony/Phone.java
@@ -53,7 +53,7 @@
import android.telephony.PhysicalChannelConfig;
import android.telephony.PreciseDataConnectionState;
import android.telephony.RadioAccessFamily;
-import com.android.telephony.Rlog;
+import android.telephony.RadioAccessSpecifier;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.SubscriptionManager;
@@ -87,6 +87,7 @@
import com.android.internal.telephony.uicc.UiccController;
import com.android.internal.telephony.uicc.UsimServiceTable;
import com.android.internal.telephony.util.TelephonyUtils;
+import com.android.telephony.Rlog;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -322,8 +323,20 @@
* TODO: Replace this with a proper exception; {@link CallStateException} doesn't make sense.
*/
public static final String CS_FALLBACK = "cs_fallback";
- public static final String EXTRA_KEY_ALERT_TITLE = "alertTitle";
- public static final String EXTRA_KEY_ALERT_MESSAGE = "alertMessage";
+ /**
+ * @deprecated Use {@link android.telephony.ims.ImsManager#EXTRA_WFC_REGISTRATION_FAILURE_TITLE}
+ * instead.
+ */
+ @Deprecated
+ public static final String EXTRA_KEY_ALERT_TITLE =
+ android.telephony.ims.ImsManager.EXTRA_WFC_REGISTRATION_FAILURE_TITLE;
+ /**
+ * @deprecated Use
+ * {@link android.telephony.ims.ImsManager#EXTRA_WFC_REGISTRATION_FAILURE_MESSAGE} instead.
+ */
+ @Deprecated
+ public static final String EXTRA_KEY_ALERT_MESSAGE =
+ android.telephony.ims.ImsManager.EXTRA_WFC_REGISTRATION_FAILURE_MESSAGE;
public static final String EXTRA_KEY_ALERT_SHOW = "alertShow";
public static final String EXTRA_KEY_NOTIFICATION_MESSAGE = "notificationMessage";
@@ -690,13 +703,7 @@
break;
case EVENT_UNSOL_OEM_HOOK_RAW:
- ar = (AsyncResult)msg.obj;
- if (ar.exception == null) {
- byte[] data = (byte[])ar.result;
- mNotifier.notifyOemHookRawEventForSubscriber(this, data);
- } else {
- Rlog.e(LOG_TAG, "OEM hook raw exception: " + ar.exception);
- }
+ // deprecated, ignore
break;
case EVENT_CONFIG_LCE:
@@ -1373,7 +1380,7 @@
nsm.operatorAlphaShort = network.getOperatorAlphaShort();
Message msg = obtainMessage(EVENT_SET_NETWORK_MANUAL_COMPLETE, nsm);
- mCi.setNetworkSelectionModeManual(network.getOperatorNumeric(), msg);
+ mCi.setNetworkSelectionModeManual(network.getOperatorNumeric(), network.getRan(), msg);
if (persistSelection) {
updateSavedNetworkOperator(nsm);
@@ -2318,6 +2325,11 @@
mCi.nvResetConfig(2 /* erase NV */, response);
}
+ public void setSystemSelectionChannels(List<RadioAccessSpecifier> specifiers,
+ Message response) {
+ mCi.setSystemSelectionChannels(specifiers, response);
+ }
+
public void notifyDataActivity() {
mNotifier.notifyDataActivity(this);
}
@@ -3265,6 +3277,17 @@
}
/**
+ * Enable or disable always reporting signal strength changes from radio.
+ *
+ * @param isEnable {@code true} for enabling; {@code false} for disabling.
+ */
+ public void setAlwaysReportSignalStrength(boolean isEnable) {
+ if (mDeviceStateMonitor != null) {
+ mDeviceStateMonitor.setAlwaysReportSignalStrength(isEnable);
+ }
+ }
+
+ /**
* TODO: Adding a function for each property is not good.
* A fucntion of type getPhoneProp(propType) where propType is an
* enum of GSM+CDMA+LTE props would be a better approach.
diff --git a/src/java/com/android/internal/telephony/PhoneConfigurationManager.java b/src/java/com/android/internal/telephony/PhoneConfigurationManager.java
index 86ab72b..7a0614c 100644
--- a/src/java/com/android/internal/telephony/PhoneConfigurationManager.java
+++ b/src/java/com/android/internal/telephony/PhoneConfigurationManager.java
@@ -28,12 +28,12 @@
import android.os.RegistrantList;
import android.sysprop.TelephonyProperties;
import android.telephony.PhoneCapability;
-import com.android.telephony.Rlog;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.telephony.Rlog;
import java.util.HashMap;
import java.util.Map;
@@ -311,7 +311,7 @@
}
public int getNumberOfModemsWithSimultaneousDataConnections() {
- return mStaticCapability.maxActiveData;
+ return mStaticCapability.getMaxActivePsVoice();
}
private void notifyCapabilityChanged() {
@@ -326,7 +326,7 @@
*/
public void switchMultiSimConfig(int numOfSims) {
log("switchMultiSimConfig: with numOfSims = " + numOfSims);
- if (getStaticPhoneCapability().logicalModemList.size() < numOfSims) {
+ if (getStaticPhoneCapability().getLogicalModemUuids().size() < numOfSims) {
log("switchMultiSimConfig: Phone is not capable of enabling "
+ numOfSims + " sims, exiting!");
return;
diff --git a/src/java/com/android/internal/telephony/PhoneInternalInterface.java b/src/java/com/android/internal/telephony/PhoneInternalInterface.java
index 4d94270..757cd8e 100644
--- a/src/java/com/android/internal/telephony/PhoneInternalInterface.java
+++ b/src/java/com/android/internal/telephony/PhoneInternalInterface.java
@@ -438,6 +438,21 @@
Connection dial(String dialString, @NonNull DialArgs dialArgs) throws CallStateException;
/**
+ * Initiate a new conference connection. This happens asynchronously, so you
+ * cannot assume the audio path is connected (or a call index has been
+ * assigned) until PhoneStateChanged notification has occurred.
+ *
+ * @param participantsToDial The participants to dial.
+ * @param dialArgs Parameters to perform the start conference with.
+ * @exception CallStateException if a new outgoing call is not currently
+ * possible because no more call slots exist or a call exists
+ * that is dialing, alerting, ringing, or waiting. Other
+ * errors are handled asynchronously.
+ */
+ Connection startConference(String[] participantsToDial, @NonNull DialArgs dialArgs)
+ throws CallStateException;
+
+ /**
* Handles PIN MMI commands (PIN/PIN2/PUK/PUK2), which are initiated
* without SEND (so <code>dial</code> is not appropriate).
*
diff --git a/src/java/com/android/internal/telephony/PhoneNotifier.java b/src/java/com/android/internal/telephony/PhoneNotifier.java
index a762951..aa6c4bc 100644
--- a/src/java/com/android/internal/telephony/PhoneNotifier.java
+++ b/src/java/com/android/internal/telephony/PhoneNotifier.java
@@ -86,9 +86,6 @@
/** Send a notification that the users mobile data setting has changed */
void notifyUserMobileDataStateChanged(Phone sender, boolean state);
- /** Send a notification with an OEM hook payload */
- void notifyOemHookRawEventForSubscriber(Phone sender, byte[] rawData);
-
/** Send a notification that the phone capability has changed */
void notifyPhoneCapabilityChanged(PhoneCapability capability);
diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java
index b2428cb..1984c41 100644
--- a/src/java/com/android/internal/telephony/RIL.java
+++ b/src/java/com/android/internal/telephony/RIL.java
@@ -19,6 +19,7 @@
import static com.android.internal.telephony.RILConstants.*;
import static com.android.internal.util.Preconditions.checkNotNull;
+import android.annotation.NonNull;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.hardware.radio.V1_0.Carrier;
@@ -51,6 +52,7 @@
import android.hardware.radio.V1_4.CarrierRestrictionsWithPriority;
import android.hardware.radio.V1_4.SimLockMultiSimPolicy;
import android.hardware.radio.V1_5.AccessNetwork;
+import android.hardware.radio.V1_5.RadioAccessNetworks;
import android.hardware.radio.deprecated.V1_0.IOemHook;
import android.net.InetAddresses;
import android.net.KeepalivePacketData;
@@ -968,6 +970,75 @@
}
@Override
+ public void setSystemSelectionChannels(@NonNull List<RadioAccessSpecifier> specifiers,
+ Message onComplete) {
+ IRadio radioProxy = getRadioProxy(onComplete);
+ if (mRadioVersion.less(RADIO_HAL_VERSION_1_3)) {
+ if (RILJ_LOGV) riljLog("setSystemSelectionChannels: not supported.");
+ if (onComplete != null) {
+ AsyncResult.forMessage(onComplete, null,
+ CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
+ onComplete.sendToTarget();
+ }
+ return;
+ }
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_SYSTEM_SELECTION_CHANNELS, onComplete,
+ mRILDefaultWorkSource);
+
+ if (mRadioVersion.less(RADIO_HAL_VERSION_1_5)) {
+ android.hardware.radio.V1_3.IRadio radioProxy13 =
+ (android.hardware.radio.V1_3.IRadio) radioProxy;
+ if (radioProxy13 != null) {
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
+ + " setSystemSelectionChannels_1.3= "
+ + specifiers);
+ }
+
+ ArrayList<android.hardware.radio.V1_1.RadioAccessSpecifier> halSpecifiers =
+ specifiers.stream()
+ .map(this::convertRadioAccessSpecifierToRadioHAL)
+ .collect(Collectors.toCollection(ArrayList::new));
+
+ try {
+ radioProxy13.setSystemSelectionChannels(rr.mSerial,
+ !halSpecifiers.isEmpty(),
+ halSpecifiers);
+ } catch (RemoteException | RuntimeException e) {
+ handleRadioProxyExceptionForRR(rr, "setSystemSelectionChannels", e);
+ }
+ }
+ }
+
+ if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
+ android.hardware.radio.V1_5.IRadio radioProxy15 =
+ (android.hardware.radio.V1_5.IRadio) radioProxy;
+
+ if (radioProxy15 != null) {
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
+ + " setSystemSelectionChannels_1.5= "
+ + specifiers);
+ }
+
+ ArrayList<android.hardware.radio.V1_5.RadioAccessSpecifier> halSpecifiers =
+ specifiers.stream()
+ .map(this::convertRadioAccessSpecifierToRadioHAL_1_5)
+ .collect(Collectors.toCollection(ArrayList::new));
+
+ try {
+ radioProxy15.setSystemSelectionChannels_1_5(rr.mSerial,
+ !halSpecifiers.isEmpty(),
+ halSpecifiers);
+ } catch (RemoteException | RuntimeException e) {
+ handleRadioProxyExceptionForRR(rr, "setSystemSelectionChannels", e);
+ }
+ }
+ }
+ }
+
+ @Override
public void getModemStatus(Message result) {
IRadio radioProxy = getRadioProxy(result);
if (mRadioVersion.less(RADIO_HAL_VERSION_1_3)) {
@@ -1439,7 +1510,7 @@
// ServiceState.RIL_RADIO_TECHNOLOGY_XXXX.
dpi.bearerBitmap = ServiceState.convertNetworkTypeBitmaskToBearerBitmask(
dp.getBearerBitmask()) << 1;
- dpi.mtu = dp.getMtu();
+ dpi.mtu = dp.getMtuV4();
dpi.mvnoType = MvnoType.NONE;
dpi.mvnoMatchData = "";
@@ -1473,7 +1544,7 @@
// ServiceState.RIL_RADIO_TECHNOLOGY_XXXX.
dpi.bearerBitmap = ServiceState.convertNetworkTypeBitmaskToBearerBitmask(
dp.getBearerBitmask()) << 1;
- dpi.mtu = dp.getMtu();
+ dpi.mtu = dp.getMtuV4();
dpi.persistent = dp.isPersistent();
dpi.preferred = dp.isPreferred();
@@ -1493,29 +1564,30 @@
android.hardware.radio.V1_5.DataProfileInfo dpi =
new android.hardware.radio.V1_5.DataProfileInfo();
- dpi.base.apn = dp.getApn();
- dpi.base.protocol = dp.getProtocolType();
- dpi.base.roamingProtocol = dp.getRoamingProtocolType();
- dpi.base.authType = dp.getAuthType();
- dpi.base.user = dp.getUserName();
- dpi.base.password = dp.getPassword();
- dpi.base.type = dp.getType();
- dpi.base.maxConnsTime = dp.getMaxConnectionsTime();
- dpi.base.maxConns = dp.getMaxConnections();
- dpi.base.waitTime = dp.getWaitTime();
- dpi.base.enabled = dp.isEnabled();
+ dpi.apn = dp.getApn();
+ dpi.protocol = dp.getProtocolType();
+ dpi.roamingProtocol = dp.getRoamingProtocolType();
+ dpi.authType = dp.getAuthType();
+ dpi.user = dp.getUserName();
+ dpi.password = dp.getPassword();
+ dpi.type = dp.getType();
+ dpi.maxConnsTime = dp.getMaxConnectionsTime();
+ dpi.maxConns = dp.getMaxConnections();
+ dpi.waitTime = dp.getWaitTime();
+ dpi.enabled = dp.isEnabled();
dpi.supportedApnTypesBitmap = dp.getSupportedApnTypesBitmask();
// Shift by 1 bit due to the discrepancy between
// android.hardware.radio.V1_0.RadioAccessFamily and the bitmask version of
// ServiceState.RIL_RADIO_TECHNOLOGY_XXXX.
- dpi.base.bearerBitmap = ServiceState.convertNetworkTypeBitmaskToBearerBitmask(
+ dpi.bearerBitmap = ServiceState.convertNetworkTypeBitmaskToBearerBitmask(
dp.getBearerBitmask()) << 1;
- dpi.base.mtu = dp.getMtu();
- dpi.base.persistent = dp.isPersistent();
- dpi.base.preferred = dp.isPreferred();
+ dpi.mtuV4 = dp.getMtuV4();
+ dpi.mtuV6 = dp.getMtuV6();
+ dpi.persistent = dp.isPersistent();
+ dpi.preferred = dp.isPreferred();
// profile id is only meaningful when it's persistent on the modem.
- dpi.base.profileId = (dpi.base.persistent) ? dp.getProfileId() : DataProfileId.INVALID;
+ dpi.profileId = (dpi.persistent) ? dp.getProfileId() : DataProfileId.INVALID;
return dpi;
}
@@ -2089,20 +2161,31 @@
}
@Override
- public void setNetworkSelectionModeManual(String operatorNumeric, Message result) {
+ public void setNetworkSelectionModeManual(String operatorNumeric, int ran, Message result) {
IRadio radioProxy = getRadioProxy(result);
if (radioProxy != null) {
RILRequest rr = obtainRequest(RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL, result,
mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
- + " operatorNumeric = " + operatorNumeric);
- }
-
try {
- radioProxy.setNetworkSelectionModeManual(rr.mSerial,
- convertNullToEmptyString(operatorNumeric));
+ int accessNetwork = convertRanToAnt(ran);
+ if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
+ android.hardware.radio.V1_5.IRadio radioProxy15 =
+ (android.hardware.radio.V1_5.IRadio) radioProxy;
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
+ + " operatorNumeric = " + operatorNumeric
+ + ", ran = " + accessNetwork);
+ }
+ radioProxy15.setNetworkSelectionModeManual_1_5(rr.mSerial,
+ convertNullToEmptyString(operatorNumeric), accessNetwork);
+ } else {
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
+ + " operatorNumeric = " + operatorNumeric);
+ }
+ radioProxy.setNetworkSelectionModeManual(rr.mSerial,
+ convertNullToEmptyString(operatorNumeric));
+ }
} catch (RemoteException | RuntimeException e) {
handleRadioProxyExceptionForRR(rr, "setNetworkSelectionModeManual", e);
}
@@ -4653,6 +4736,23 @@
}
}
+ private static int convertRanToAnt(int radioAccessNetwork) {
+ switch(radioAccessNetwork) {
+ case RadioAccessNetworks.GERAN:
+ return AccessNetworkType.GERAN;
+ case RadioAccessNetworks.UTRAN:
+ return AccessNetworkType.UTRAN;
+ case RadioAccessNetworks.EUTRAN:
+ return AccessNetworkType.EUTRAN;
+ case RadioAccessNetworks.NGRAN:
+ return AccessNetworkType.NGRAN;
+ case RadioAccessNetworks.CDMA2000:
+ return AccessNetworkType.CDMA2000;
+ default:
+ return AccessNetworkType.UNKNOWN;
+ }
+ }
+
@Override
public void setSimCardPower(int state, Message result, WorkSource workSource) {
workSource = getDeafultWorkSourceIfInvalid(workSource);
@@ -5875,6 +5975,8 @@
return "RIL_REQUEST_ENABLE_UICC_APPLICATIONS";
case RIL_REQUEST_GET_UICC_APPLICATIONS_ENABLEMENT:
return "RIL_REQUEST_GET_UICC_APPLICATIONS_ENABLEMENT";
+ case RIL_REQUEST_SET_SYSTEM_SELECTION_CHANNELS:
+ return "RIL_REQUEST_SET_SYSTEM_SELECTION_CHANNELS";
default: return "<unknown request>";
}
}
@@ -6294,7 +6396,7 @@
}
/**
- * Convert SetupDataCallResult defined in 1.0 or 1.4/types.hal into DataCallResponse
+ * Convert SetupDataCallResult defined in 1.0, 1.4, or 1.5 types.hal into DataCallResponse
* @param dcResult setup data call result
* @return converted DataCallResponse object
*/
@@ -6302,7 +6404,7 @@
public static DataCallResponse convertDataCallResult(Object dcResult) {
if (dcResult == null) return null;
- int cause, suggestedRetryTime, cid, active, mtu;
+ int cause, suggestedRetryTime, cid, active, mtu, mtuV4, mtuV6;
String ifname;
int protocolType;
String[] addresses = null;
@@ -6311,7 +6413,7 @@
String[] pcscfs = null;
List<LinkAddress> laList = new ArrayList<>();
- int version = 0;
+ int version;
if (dcResult instanceof android.hardware.radio.V1_0.SetupDataCallResult) {
final android.hardware.radio.V1_0.SetupDataCallResult result =
@@ -6335,6 +6437,7 @@
pcscfs = result.pcscf.split("\\s+");
}
mtu = result.mtu;
+ mtuV4 = mtuV6 = 0;
version = 0;
} else if (dcResult instanceof android.hardware.radio.V1_4.SetupDataCallResult) {
final android.hardware.radio.V1_4.SetupDataCallResult result =
@@ -6350,6 +6453,7 @@
gateways = result.gateways.stream().toArray(String[]::new);
pcscfs = result.pcscf.stream().toArray(String[]::new);
mtu = result.mtu;
+ mtuV4 = mtuV6 = 0;
version = 4;
} else if (dcResult instanceof android.hardware.radio.V1_5.SetupDataCallResult) {
final android.hardware.radio.V1_5.SetupDataCallResult result =
@@ -6367,7 +6471,9 @@
dnses = result.dnses.stream().toArray(String[]::new);
gateways = result.gateways.stream().toArray(String[]::new);
pcscfs = result.pcscf.stream().toArray(String[]::new);
- mtu = result.mtu;
+ mtu = 0;
+ mtuV4 = result.mtuV4;
+ mtuV6 = result.mtuV6;
version = 5;
} else {
Rlog.e(RILJ_LOG_TAG, "Unsupported SetupDataCallResult " + dcResult);
@@ -6445,8 +6551,22 @@
}
}
- return new DataCallResponse(cause, suggestedRetryTime, cid, active, protocolType, ifname,
- laList, dnsList, gatewayList, pcscfList, mtu);
+ return new DataCallResponse.Builder()
+ .setCause(cause)
+ .setSuggestedRetryTime(suggestedRetryTime)
+ .setId(cid)
+ .setLinkStatus(active)
+ .setProtocolType(protocolType)
+ .setInterfaceName(ifname)
+ .setAddresses(laList)
+ .setDnsAddresses(dnsList)
+ .setGatewayAddresses(gatewayList)
+ .setPcscfAddresses(pcscfList)
+ .setMtu(mtu)
+ .setMtuV4(mtuV4)
+ .setMtuV6(mtuV6)
+ .setVersion(version)
+ .build();
}
/**
diff --git a/src/java/com/android/internal/telephony/RadioConfig.java b/src/java/com/android/internal/telephony/RadioConfig.java
index 922aba7..24d79f2 100644
--- a/src/java/com/android/internal/telephony/RadioConfig.java
+++ b/src/java/com/android/internal/telephony/RadioConfig.java
@@ -38,15 +38,19 @@
import android.os.Registrant;
import android.os.RemoteException;
import android.os.WorkSource;
-import com.android.telephony.Rlog;
+import android.telephony.PhoneCapability;
+import android.telephony.Rlog;
+import android.telephony.SimSlotCapability;
import android.util.SparseArray;
import com.android.internal.telephony.uicc.IccSlotStatus;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
import java.util.NoSuchElementException;
import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
/**
* This class provides wrapper APIs for IRadioConfig interface.
@@ -64,6 +68,8 @@
private static final HalVersion RADIO_CONFIG_HAL_VERSION_1_1 = new HalVersion(1, 1);
+ private static final HalVersion RADIO_CONFIG_HAL_VERSION_1_3 = new HalVersion(1, 3);
+
private final boolean mIsMobileNetworkSupported;
private volatile IRadioConfig mRadioConfigProxy = null;
// IRadioConfig version
@@ -340,11 +346,20 @@
logd(rr.serialString() + "> " + requestToString(rr.mRequest));
}
- try {
- ((android.hardware.radio.config.V1_1.IRadioConfig) mRadioConfigProxy)
- .getPhoneCapability(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- resetProxyAndRequestList("getPhoneCapability", e);
+ if (mRadioConfigVersion.greaterOrEqual(RADIO_CONFIG_HAL_VERSION_1_3)) {
+ try {
+ ((android.hardware.radio.config.V1_3.IRadioConfig) mRadioConfigProxy)
+ .getPhoneCapability_1_3(rr.mSerial);
+ } catch (RemoteException | RuntimeException e) {
+ resetProxyAndRequestList("getPhoneCapability_1_3", e);
+ }
+ } else {
+ try {
+ ((android.hardware.radio.config.V1_1.IRadioConfig) mRadioConfigProxy)
+ .getPhoneCapability(rr.mSerial);
+ } catch (RemoteException | RuntimeException e) {
+ resetProxyAndRequestList("getPhoneCapability", e);
+ }
}
}
@@ -487,6 +502,49 @@
return response;
}
+ static PhoneCapability convertHalPhoneCapability(
+ android.hardware.radio.config.V1_1.PhoneCapability pc) {
+ long psDataConnectionLingerTimeMillis = pc.isInternetLingeringSupported ? 1 : 0;
+
+ List<String> logicalModemUuids = new ArrayList<>();
+ for (android.hardware.radio.config.V1_1.ModemInfo modemInfo : pc.logicalModemList) {
+ logicalModemUuids.add("com.xxxx.lm" + modemInfo.modemId);
+ }
+
+ List<List<Long>> features = new ArrayList<>();
+ for (int i = 0; i < pc.maxActiveData; i++) {
+ List<Long> feature = new ArrayList<>();
+ feature.add(PhoneCapability.MODEM_FEATURE_PS_VOICE_REG);
+ features.add(feature);
+ }
+
+ return new PhoneCapability(0, 0, 0, 0, psDataConnectionLingerTimeMillis, 0,
+ null, null, null, null, logicalModemUuids, null, features);
+ }
+
+ static PhoneCapability convertHalPhoneCapability_1_3(
+ android.hardware.radio.config.V1_3.PhoneCapability pc) {
+ List<SimSlotCapability> simSlotCapabilities = new ArrayList<>();
+ for (android.hardware.radio.config.V1_3.SimSlotCapability sc : pc.simSlotCapabilities) {
+ simSlotCapabilities.add(new SimSlotCapability(sc.physicalSlotId, sc.slotType));
+ }
+
+ List<List<Long>> features = new ArrayList<>();
+ for (android.hardware.radio.config.V1_3.ConcurrentModemFeatures cmf
+ : pc.concurrentFeatureSupport) {
+ features.add(cmf.modemFeatures
+ .stream()
+ .mapToLong(Integer::longValue)
+ .boxed()
+ .collect(Collectors.toList()));
+ }
+
+ return new PhoneCapability(pc.utranUeCategoryDl, pc.utranUeCategoryUl,
+ pc.eutranUeCategoryDl, pc.eutranUeCategoryUl, pc.psDataConnectionLingerTimeMillis,
+ pc.supportedRats, pc.geranBands, pc.utranBands, pc.eutranBands, pc.ngranBands,
+ pc.logicalModemUuids, simSlotCapabilities, features);
+ }
+
private static void logd(String log) {
Rlog.d(TAG, log);
}
diff --git a/src/java/com/android/internal/telephony/RadioConfigResponse.java b/src/java/com/android/internal/telephony/RadioConfigResponse.java
index 8e509de..0f4a719 100644
--- a/src/java/com/android/internal/telephony/RadioConfigResponse.java
+++ b/src/java/com/android/internal/telephony/RadioConfigResponse.java
@@ -20,14 +20,12 @@
import android.hardware.radio.V1_0.RadioResponseInfo;
import android.hardware.radio.config.V1_1.ModemsConfig;
import android.hardware.radio.config.V1_2.IRadioConfigResponse;
-import android.telephony.ModemInfo;
import android.telephony.PhoneCapability;
-import com.android.telephony.Rlog;
import com.android.internal.telephony.uicc.IccSlotStatus;
+import com.android.telephony.Rlog;
import java.util.ArrayList;
-import java.util.List;
/**
* This class is the implementation of IRadioConfigResponse interface.
@@ -115,23 +113,6 @@
}
}
- private PhoneCapability convertHalPhoneCapability(
- android.hardware.radio.config.V1_1.PhoneCapability phoneCapability) {
- // TODO b/121394331: clean up V1_1.PhoneCapability fields.
- int maxActiveVoiceCalls = 0;
- int maxActiveData = phoneCapability.maxActiveData;
- int max5G = 0;
- boolean validationBeforeSwitchSupported = phoneCapability.isInternetLingeringSupported;
- List<ModemInfo> logicalModemList = new ArrayList();
-
- for (android.hardware.radio.config.V1_1.ModemInfo
- modemInfo : phoneCapability.logicalModemList) {
- logicalModemList.add(new ModemInfo(modemInfo.modemId));
- }
-
- return new PhoneCapability(maxActiveVoiceCalls, maxActiveData, max5G, logicalModemList,
- validationBeforeSwitchSupported);
- }
/**
* Response function for IRadioConfig.getPhoneCapability().
*/
@@ -140,7 +121,7 @@
RILRequest rr = mRadioConfig.processResponse(responseInfo);
if (rr != null) {
- PhoneCapability ret = convertHalPhoneCapability(phoneCapability);
+ PhoneCapability ret = RadioConfig.convertHalPhoneCapability(phoneCapability);
if (responseInfo.error == RadioError.NONE) {
// send response
RadioResponse.sendMessageResponse(rr.mResult, ret);
@@ -158,6 +139,31 @@
}
/**
+ * Response function for IRadioConfig.getPhoneCapability_1_3().
+ */
+ public void getPhoneCapabilityResponse_1_3(RadioResponseInfo responseInfo,
+ android.hardware.radio.config.V1_3.PhoneCapability phoneCapability) {
+ RILRequest rr = mRadioConfig.processResponse(responseInfo);
+
+ if (rr != null) {
+ PhoneCapability ret = RadioConfig.convertHalPhoneCapability_1_3(phoneCapability);
+ if (responseInfo.error == RadioError.NONE) {
+ // send response
+ RadioResponse.sendMessageResponse(rr.mResult, ret);
+ Rlog.d(TAG, rr.serialString() + "< "
+ + mRadioConfig.requestToString(rr.mRequest) + " " + ret.toString());
+ } else {
+ rr.onError(responseInfo.error, ret);
+ Rlog.e(TAG, rr.serialString() + "< "
+ + mRadioConfig.requestToString(rr.mRequest) + " error "
+ + responseInfo.error);
+ }
+ } else {
+ Rlog.e(TAG, "getPhoneCapabilityResponse_1_3: Error " + responseInfo.toString());
+ }
+ }
+
+ /**
* Response function for IRadioConfig.setPreferredDataModem().
*/
public void setPreferredDataModemResponse(RadioResponseInfo responseInfo) {
diff --git a/src/java/com/android/internal/telephony/RadioResponse.java b/src/java/com/android/internal/telephony/RadioResponse.java
index ba23f9d..784faa6 100644
--- a/src/java/com/android/internal/telephony/RadioResponse.java
+++ b/src/java/com/android/internal/telephony/RadioResponse.java
@@ -2386,4 +2386,8 @@
mRil.processResponseDone(rr, responseInfo, enabled);
}
}
+
+ public void setSystemSelectionChannelsResponse_1_5(RadioResponseInfo info) {
+ responseVoid(info);
+ }
}
diff --git a/src/java/com/android/internal/telephony/ServiceStateTracker.java b/src/java/com/android/internal/telephony/ServiceStateTracker.java
index 697a910..6507c7e 100755
--- a/src/java/com/android/internal/telephony/ServiceStateTracker.java
+++ b/src/java/com/android/internal/telephony/ServiceStateTracker.java
@@ -16,7 +16,6 @@
package com.android.internal.telephony;
-import static android.provider.Telephony.ServiceStateTable.getContentValuesForServiceState;
import static android.provider.Telephony.ServiceStateTable.getUriForSubscriptionId;
import static com.android.internal.telephony.CarrierActionAgent.CARRIER_ACTION_SET_RADIO_ENABLED;
@@ -33,6 +32,7 @@
import android.compat.annotation.UnsupportedAppUsage;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
+import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@@ -44,6 +44,7 @@
import android.os.BaseBundle;
import android.os.Handler;
import android.os.Message;
+import android.os.Parcel;
import android.os.PersistableBundle;
import android.os.Registrant;
import android.os.RegistrantList;
@@ -281,6 +282,15 @@
protected static final int EVENT_CELL_LOCATION_RESPONSE = 56;
protected static final int EVENT_CARRIER_CONFIG_CHANGED = 57;
+ /**
+ * The current service state.
+ *
+ * This is a column name in {@link android.provider.Telephony.ServiceStateTable}.
+ *
+ * Copied from packages/services/Telephony/src/com/android/phone/ServiceStateProvider.java
+ */
+ private static final String SERVICE_STATE = "service_state";
+
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = {"CARRIER_NAME_DISPLAY_BITMASK"},
value = {CARRIER_NAME_DISPLAY_BITMASK_SHOW_PLMN,
@@ -5658,4 +5668,22 @@
Context.TELEPHONY_SERVICE);
tm.setDataNetworkTypeForPhone(mPhone.getPhoneId(), type);
}
+
+ /**
+ * Used to insert a ServiceState into the ServiceStateProvider as a ContentValues instance.
+ *
+ * Copied from packages/services/Telephony/src/com/android/phone/ServiceStateProvider.java
+ *
+ * @param state the ServiceState to convert into ContentValues
+ * @return the convertedContentValues instance
+ */
+ private ContentValues getContentValuesForServiceState(ServiceState state) {
+ ContentValues values = new ContentValues();
+ final Parcel p = Parcel.obtain();
+ state.writeToParcel(p, 0);
+ // Turn the parcel to byte array. Safe to do this because the content values were never
+ // written into a persistent storage. ServiceStateProvider keeps values in the memory.
+ values.put(SERVICE_STATE, p.marshall());
+ return values;
+ }
}
diff --git a/src/java/com/android/internal/telephony/TelephonyTester.java b/src/java/com/android/internal/telephony/TelephonyTester.java
index e95a949..6b470e8 100644
--- a/src/java/com/android/internal/telephony/TelephonyTester.java
+++ b/src/java/com/android/internal/telephony/TelephonyTester.java
@@ -26,6 +26,7 @@
import android.telephony.AccessNetworkConstants;
import com.android.telephony.Rlog;
import android.telephony.ServiceState;
+import android.telephony.TelephonyManager;
import android.telephony.ims.ImsCallProfile;
import android.telephony.ims.ImsConferenceState;
import android.telephony.ims.ImsExternalCallState;
@@ -260,7 +261,7 @@
}
imsCall.getImsCallSessionListenerProxy().callSessionHandoverFailed(imsCall.getCallSession(),
- ServiceState.RIL_RADIO_TECHNOLOGY_LTE, ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN,
+ TelephonyManager.NETWORK_TYPE_LTE, TelephonyManager.NETWORK_TYPE_IWLAN,
new ImsReasonInfo());
}
diff --git a/src/java/com/android/internal/telephony/cdma/EriInfo.java b/src/java/com/android/internal/telephony/cdma/EriInfo.java
index 3e9680b..bd27f94 100644
--- a/src/java/com/android/internal/telephony/cdma/EriInfo.java
+++ b/src/java/com/android/internal/telephony/cdma/EriInfo.java
@@ -16,14 +16,16 @@
package com.android.internal.telephony.cdma;
+import android.telephony.CdmaEriInformation;
+
public final class EriInfo {
- public static final int ROAMING_INDICATOR_ON = 0;
- public static final int ROAMING_INDICATOR_OFF = 1;
- public static final int ROAMING_INDICATOR_FLASH = 2;
+ public static final int ROAMING_INDICATOR_ON = CdmaEriInformation.ERI_ON;
+ public static final int ROAMING_INDICATOR_OFF = CdmaEriInformation.ERI_OFF;
+ public static final int ROAMING_INDICATOR_FLASH = CdmaEriInformation.ERI_FLASH;
- public static final int ROAMING_ICON_MODE_NORMAL = 0;
- public static final int ROAMING_ICON_MODE_FLASH = 1;
+ public static final int ROAMING_ICON_MODE_NORMAL = CdmaEriInformation.ERI_ICON_MODE_NORMAL;
+ public static final int ROAMING_ICON_MODE_FLASH = CdmaEriInformation.ERI_ICON_MODE_FLASH;
public int roamingIndicator;
public int iconIndex;
diff --git a/src/java/com/android/internal/telephony/dataconnection/DataConnection.java b/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
index 50aee17..dc2efbc 100644
--- a/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
+++ b/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
@@ -16,8 +16,8 @@
package com.android.internal.telephony.dataconnection;
-import static android.net.NetworkPolicyManager.OVERRIDE_CONGESTED;
-import static android.net.NetworkPolicyManager.OVERRIDE_UNMETERED;
+import static android.net.NetworkPolicyManager.SUBSCRIPTION_OVERRIDE_CONGESTED;
+import static android.net.NetworkPolicyManager.SUBSCRIPTION_OVERRIDE_UNMETERED;
import android.annotation.IntDef;
import android.annotation.Nullable;
@@ -643,10 +643,13 @@
// Check if we should fake an error.
if (mDcTesterFailBringUpAll.getDcFailBringUp().mCounter > 0) {
- DataCallResponse response = new DataCallResponse(
- mDcTesterFailBringUpAll.getDcFailBringUp().mFailCause,
- mDcTesterFailBringUpAll.getDcFailBringUp().mSuggestedRetryTime, 0, 0, 0, "",
- null, null, null, null, PhoneConstants.UNSET_MTU);
+ DataCallResponse response = new DataCallResponse.Builder()
+ .setCause(mDcTesterFailBringUpAll.getDcFailBringUp().mFailCause)
+ .setSuggestedRetryTime(
+ mDcTesterFailBringUpAll.getDcFailBringUp().mSuggestedRetryTime)
+ .setMtuV4(PhoneConstants.UNSET_MTU)
+ .setMtuV6(PhoneConstants.UNSET_MTU)
+ .build();
Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp);
AsyncResult.forMessage(msg, response, null);
@@ -1340,10 +1343,10 @@
result.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_CONGESTED);
// Override values set above when requested by policy
- if ((mSubscriptionOverride & OVERRIDE_UNMETERED) != 0) {
+ if ((mSubscriptionOverride & SUBSCRIPTION_OVERRIDE_UNMETERED) != 0) {
result.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED);
}
- if ((mSubscriptionOverride & OVERRIDE_CONGESTED) != 0) {
+ if ((mSubscriptionOverride & SUBSCRIPTION_OVERRIDE_CONGESTED) != 0) {
result.removeCapability(NetworkCapabilities.NET_CAPABILITY_NOT_CONGESTED);
}
@@ -1473,14 +1476,17 @@
}
for (InetAddress gateway : response.getGatewayAddresses()) {
+ int mtu = linkProperties.hasGlobalIPv6Address() ? response.getMtuV6()
+ : response.getMtuV4();
// Allow 0.0.0.0 or :: as a gateway;
// this indicates a point-to-point interface.
linkProperties.addRoute(new RouteInfo(null, gateway, null,
- RouteInfo.RTN_UNICAST));
+ RouteInfo.RTN_UNICAST, mtu));
}
// set interface MTU
// this may clobber the setting read from the APN db, but that's ok
+ // TODO: remove once LinkProperties#setMtu is deprecated
linkProperties.setMtu(response.getMtu());
result = SetupResult.SUCCESS;
diff --git a/src/java/com/android/internal/telephony/dataconnection/DcController.java b/src/java/com/android/internal/telephony/dataconnection/DcController.java
index 4104013..1098042 100644
--- a/src/java/com/android/internal/telephony/dataconnection/DcController.java
+++ b/src/java/com/android/internal/telephony/dataconnection/DcController.java
@@ -19,16 +19,12 @@
import android.content.Context;
import android.hardware.radio.V1_4.DataConnActiveStatus;
import android.net.LinkAddress;
-import android.net.util.LinkPropertiesUtils;
-import android.net.util.LinkPropertiesUtils.CompareResult;
-import android.net.util.NetUtils;
import android.os.AsyncResult;
import android.os.Handler;
import android.os.Message;
import android.telephony.AccessNetworkConstants;
import android.telephony.DataFailCause;
import android.telephony.PhoneStateListener;
-import com.android.telephony.Rlog;
import android.telephony.TelephonyManager;
import android.telephony.data.DataCallResponse;
@@ -39,6 +35,10 @@
import com.android.internal.telephony.util.TelephonyUtils;
import com.android.internal.util.State;
import com.android.internal.util.StateMachine;
+import com.android.net.module.util.LinkPropertiesUtils;
+import com.android.net.module.util.LinkPropertiesUtils.CompareResult;
+import com.android.net.module.util.NetUtils;
+import com.android.telephony.Rlog;
import java.io.FileDescriptor;
import java.io.PrintWriter;
diff --git a/src/java/com/android/internal/telephony/dataconnection/DcTracker.java b/src/java/com/android/internal/telephony/dataconnection/DcTracker.java
index b67a675..b6364f6 100644
--- a/src/java/com/android/internal/telephony/dataconnection/DcTracker.java
+++ b/src/java/com/android/internal/telephony/dataconnection/DcTracker.java
@@ -43,7 +43,6 @@
import android.database.ContentObserver;
import android.database.Cursor;
import android.net.ConnectivityManager;
-import android.net.INetworkPolicyListener;
import android.net.LinkProperties;
import android.net.NetworkAgent;
import android.net.NetworkCapabilities;
@@ -428,8 +427,8 @@
};
private NetworkPolicyManager mNetworkPolicyManager;
- private final INetworkPolicyListener mNetworkPolicyListener =
- new NetworkPolicyManager.Listener() {
+ private final NetworkPolicyManager.SubscriptionCallback mSubscriptionCallback =
+ new NetworkPolicyManager.SubscriptionCallback() {
@Override
public void onSubscriptionOverride(int subId, int overrideMask, int overrideValue) {
if (mPhone == null || mPhone.getSubId() != subId) return;
@@ -729,8 +728,9 @@
mSubscriptionManager = SubscriptionManager.from(mPhone.getContext());
mSubscriptionManager.addOnSubscriptionsChangedListener(mOnSubscriptionsChangedListener);
- mNetworkPolicyManager = NetworkPolicyManager.from(mPhone.getContext());
- mNetworkPolicyManager.registerListener(mNetworkPolicyListener);
+ mNetworkPolicyManager = (NetworkPolicyManager) mPhone.getContext()
+ .getSystemService(Context.NETWORK_POLICY_SERVICE);
+ mNetworkPolicyManager.registerSubscriptionCallback(mSubscriptionCallback);
HandlerThread dcHandlerThread = new HandlerThread("DcHandlerThread");
dcHandlerThread.start();
@@ -845,7 +845,7 @@
mSubscriptionManager
.removeOnSubscriptionsChangedListener(mOnSubscriptionsChangedListener);
- mNetworkPolicyManager.unregisterListener(mNetworkPolicyListener);
+ mNetworkPolicyManager.unregisterSubscriptionCallback(mSubscriptionCallback);
mDcc.dispose();
mDcTesterFailBringUpAll.dispose();
diff --git a/src/java/com/android/internal/telephony/imsphone/ImsPhone.java b/src/java/com/android/internal/telephony/imsphone/ImsPhone.java
index 83794d2..a363003 100644
--- a/src/java/com/android/internal/telephony/imsphone/ImsPhone.java
+++ b/src/java/com/android/internal/telephony/imsphone/ImsPhone.java
@@ -16,6 +16,9 @@
package com.android.internal.telephony.imsphone;
+import static android.telephony.ims.ImsManager.EXTRA_WFC_REGISTRATION_FAILURE_MESSAGE;
+import static android.telephony.ims.ImsManager.EXTRA_WFC_REGISTRATION_FAILURE_TITLE;
+
import static com.android.internal.telephony.CommandsInterface.CB_FACILITY_BAIC;
import static com.android.internal.telephony.CommandsInterface.CB_FACILITY_BAICr;
import static com.android.internal.telephony.CommandsInterface.CB_FACILITY_BAOC;
@@ -860,6 +863,18 @@
}
@Override
+ public Connection startConference(String[] participantsToDial, DialArgs dialArgs)
+ throws CallStateException {
+ ImsDialArgs.Builder imsDialArgsBuilder;
+ if (!(dialArgs instanceof ImsDialArgs)) {
+ imsDialArgsBuilder = ImsDialArgs.Builder.from(dialArgs);
+ } else {
+ imsDialArgsBuilder = ImsDialArgs.Builder.from((ImsDialArgs) dialArgs);
+ }
+ return mCT.startConference(participantsToDial, imsDialArgsBuilder.build());
+ }
+
+ @Override
public Connection dial(String dialString, DialArgs dialArgs) throws CallStateException {
return dialInternal(dialString, dialArgs, null);
}
@@ -1923,16 +1938,19 @@
// Default result code (as passed to sendOrderedBroadcast)
// means that intent was not received by WfcSettings.
- CharSequence title = intent.getCharSequenceExtra(EXTRA_KEY_ALERT_TITLE);
- CharSequence messageAlert = intent.getCharSequenceExtra(EXTRA_KEY_ALERT_MESSAGE);
- CharSequence messageNotification = intent.getCharSequenceExtra(EXTRA_KEY_NOTIFICATION_MESSAGE);
+ CharSequence title =
+ intent.getCharSequenceExtra(EXTRA_WFC_REGISTRATION_FAILURE_TITLE);
+ CharSequence messageAlert =
+ intent.getCharSequenceExtra(EXTRA_WFC_REGISTRATION_FAILURE_MESSAGE);
+ CharSequence messageNotification =
+ intent.getCharSequenceExtra(EXTRA_KEY_NOTIFICATION_MESSAGE);
Intent resultIntent = new Intent(Intent.ACTION_MAIN);
resultIntent.setClassName("com.android.settings",
"com.android.settings.Settings$WifiCallingSettingsActivity");
resultIntent.putExtra(EXTRA_KEY_ALERT_SHOW, true);
- resultIntent.putExtra(EXTRA_KEY_ALERT_TITLE, title);
- resultIntent.putExtra(EXTRA_KEY_ALERT_MESSAGE, messageAlert);
+ resultIntent.putExtra(EXTRA_WFC_REGISTRATION_FAILURE_TITLE, title);
+ resultIntent.putExtra(EXTRA_WFC_REGISTRATION_FAILURE_MESSAGE, messageAlert);
PendingIntent resultPendingIntent =
PendingIntent.getActivity(
mContext,
@@ -2057,9 +2075,10 @@
// If WfcSettings are active then alert will be shown
// otherwise notification will be added.
- Intent intent = new Intent(ImsManager.ACTION_IMS_REGISTRATION_ERROR);
- intent.putExtra(EXTRA_KEY_ALERT_TITLE, title);
- intent.putExtra(EXTRA_KEY_ALERT_MESSAGE, messageAlert);
+ Intent intent = new Intent(
+ android.telephony.ims.ImsManager.ACTION_WFC_IMS_REGISTRATION_ERROR);
+ intent.putExtra(EXTRA_WFC_REGISTRATION_FAILURE_TITLE, title);
+ intent.putExtra(EXTRA_WFC_REGISTRATION_FAILURE_MESSAGE, messageAlert);
intent.putExtra(EXTRA_KEY_NOTIFICATION_MESSAGE, messageNotification);
mContext.sendOrderedBroadcast(intent, null, mResultReceiver,
null, Activity.RESULT_OK, null, null);
diff --git a/src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java b/src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java
index 964cfda..34994b8f 100644
--- a/src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java
+++ b/src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java
@@ -810,6 +810,91 @@
}
}
+ private boolean prepareForDialing(ImsPhone.ImsDialArgs dialArgs) throws CallStateException {
+ boolean holdBeforeDial = false;
+ // note that this triggers call state changed notif
+ clearDisconnected();
+ if (mImsManager == null) {
+ throw new CallStateException("service not available");
+ }
+ // See if there are any issues which preclude placing a call; throw a CallStateException
+ // if there is.
+ checkForDialIssues();
+ int videoState = dialArgs.videoState;
+ if (!canAddVideoCallDuringImsAudioCall(videoState)) {
+ throw new CallStateException("cannot dial in current state");
+ }
+
+ // The new call must be assigned to the foreground call.
+ // That call must be idle, so place anything that's
+ // there on hold
+ if (mForegroundCall.getState() == ImsPhoneCall.State.ACTIVE) {
+ if (mBackgroundCall.getState() != ImsPhoneCall.State.IDLE) {
+ //we should have failed in checkForDialIssues above before we get here
+ throw new CallStateException(CallStateException.ERROR_TOO_MANY_CALLS,
+ "Already too many ongoing calls.");
+ }
+ // foreground call is empty for the newly dialed connection
+ holdBeforeDial = true;
+ mPendingCallVideoState = videoState;
+ mPendingIntentExtras = dialArgs.intentExtras;
+ holdActiveCallForPendingMo();
+ }
+
+ ImsPhoneCall.State fgState = ImsPhoneCall.State.IDLE;
+ ImsPhoneCall.State bgState = ImsPhoneCall.State.IDLE;
+
+ synchronized (mSyncHold) {
+ if (holdBeforeDial) {
+ fgState = mForegroundCall.getState();
+ bgState = mBackgroundCall.getState();
+ //holding foreground call failed
+ if (fgState == ImsPhoneCall.State.ACTIVE) {
+ throw new CallStateException("cannot dial in current state");
+ }
+ //holding foreground call succeeded
+ if (bgState == ImsPhoneCall.State.HOLDING) {
+ holdBeforeDial = false;
+ }
+ }
+ }
+ return holdBeforeDial;
+ }
+
+ public Connection startConference(String[] participantsToDial, ImsPhone.ImsDialArgs dialArgs)
+ throws CallStateException {
+
+ int clirMode = dialArgs.clirMode;
+ int videoState = dialArgs.videoState;
+
+ if (DBG) log("dial clirMode=" + clirMode);
+ boolean holdBeforeDial = prepareForDialing(dialArgs);
+
+ mClirMode = clirMode;
+
+ synchronized (mSyncHold) {
+ mLastDialArgs = dialArgs;
+ mPendingMO = new ImsPhoneConnection(mPhone,
+ participantsToDial, this, mForegroundCall,
+ false);
+ mPendingMO.setVideoState(videoState);
+ if (dialArgs.rttTextStream != null) {
+ log("startConference: setting RTT stream on mPendingMO");
+ mPendingMO.setCurrentRttTextStream(dialArgs.rttTextStream);
+ }
+ }
+ addConnection(mPendingMO);
+
+ if (!holdBeforeDial) {
+ dialInternal(mPendingMO, clirMode, videoState, dialArgs.intentExtras);
+ }
+
+ updatePhoneState();
+ mPhone.notifyPreciseCallStateChanged();
+
+ return mPendingMO;
+ }
+
@UnsupportedAppUsage
public Connection dial(String dialString, int videoState, Bundle intentExtras) throws
CallStateException {
@@ -845,20 +930,8 @@
dialString = convertNumberIfNecessary(mPhone, dialString);
}
- // note that this triggers call state changed notif
- clearDisconnected();
-
- if (mImsManager == null) {
- throw new CallStateException("service not available");
- }
-
- // See if there are any issues which preclude placing a call; throw a CallStateException
- // if there is.
- checkForDialIssues();
-
- if (!canAddVideoCallDuringImsAudioCall(videoState)) {
- throw new CallStateException("cannot dial in current state");
- }
+ mClirMode = clirMode;
+ boolean holdBeforeDial = prepareForDialing(dialArgs);
if (isPhoneInEcmMode && isEmergencyNumber) {
handleEcmTimer(ImsPhone.CANCEL_ECM_TIMER);
@@ -872,46 +945,10 @@
videoState = VideoProfile.STATE_AUDIO_ONLY;
}
- boolean holdBeforeDial = false;
-
- // The new call must be assigned to the foreground call.
- // That call must be idle, so place anything that's
- // there on hold
- if (mForegroundCall.getState() == ImsPhoneCall.State.ACTIVE) {
- if (mBackgroundCall.getState() != ImsPhoneCall.State.IDLE) {
- //we should have failed in checkForDialIssues above before we get here
- throw new CallStateException(CallStateException.ERROR_TOO_MANY_CALLS,
- "Already too many ongoing calls.");
- }
- // foreground call is empty for the newly dialed connection
- holdBeforeDial = true;
- // Cache the video state for pending MO call.
- mPendingCallVideoState = videoState;
- mPendingIntentExtras = dialArgs.intentExtras;
- holdActiveCallForPendingMo();
- }
-
- ImsPhoneCall.State fgState = ImsPhoneCall.State.IDLE;
- ImsPhoneCall.State bgState = ImsPhoneCall.State.IDLE;
-
- mClirMode = clirMode;
+ // Cache the video state for pending MO call.
+ mPendingCallVideoState = videoState;
synchronized (mSyncHold) {
- if (holdBeforeDial) {
- fgState = mForegroundCall.getState();
- bgState = mBackgroundCall.getState();
-
- //holding foreground call failed
- if (fgState == ImsPhoneCall.State.ACTIVE) {
- throw new CallStateException("cannot dial in current state");
- }
-
- //holding foreground call succeeded
- if (bgState == ImsPhoneCall.State.HOLDING) {
- holdBeforeDial = false;
- }
- }
-
mLastDialString = dialString;
mLastDialArgs = dialArgs;
mPendingMO = new ImsPhoneConnection(mPhone,
@@ -1122,8 +1159,9 @@
return;
}
- if (conn.getAddress()== null || conn.getAddress().length() == 0
- || conn.getAddress().indexOf(PhoneNumberUtils.WILD) >= 0) {
+ if (!conn.isAdhocConference() &&
+ (conn.getAddress()== null || conn.getAddress().length() == 0
+ || conn.getAddress().indexOf(PhoneNumberUtils.WILD) >= 0)) {
// Phone number is invalid
conn.setDisconnectCause(DisconnectCause.INVALID_NUMBER);
sendEmptyMessageDelayed(EVENT_HANGUP_PENDINGMO, TIMEOUT_HANGUP_PENDINGMO);
@@ -1142,6 +1180,9 @@
try {
String[] callees = new String[] { conn.getAddress() };
ImsCallProfile profile = mImsManager.createCallProfile(serviceType, callType);
+ if (conn.isAdhocConference()) {
+ profile.setCallExtraBoolean(ImsCallProfile.EXTRA_CONFERENCE, true);
+ }
profile.setCallExtraInt(ImsCallProfile.EXTRA_OIR, clirMode);
if (isEmergencyCall) {
@@ -1181,7 +1222,9 @@
// being sent to the lower layers/to the network.
}
- ImsCall imsCall = mImsManager.makeCall(profile, callees, mImsCallListener);
+ ImsCall imsCall = mImsManager.makeCall(profile,
+ conn.isAdhocConference() ? conn.getParticipantsToDial() : callees,
+ mImsCallListener);
conn.setImsCall(imsCall);
mMetrics.writeOnImsCallStart(mPhone.getPhoneId(),
@@ -3158,8 +3201,7 @@
@Override
public void onCallQualityChanged(ImsCall imsCall, CallQuality callQuality) {
// convert ServiceState.radioTech to TelephonyManager.NetworkType constant
- mPhone.onCallQualityChanged(callQuality,
- ServiceState.rilRadioTechnologyToNetworkType(imsCall.getRadioTechnology()));
+ mPhone.onCallQualityChanged(callQuality, imsCall.getNetworkType());
String callId = imsCall.getSession().getCallId();
CallQualityMetrics cqm = mCallQualityMetrics.get(callId);
if (cqm == null) {
diff --git a/src/java/com/android/internal/telephony/imsphone/ImsPhoneCommandInterface.java b/src/java/com/android/internal/telephony/imsphone/ImsPhoneCommandInterface.java
index 28143f4..acc7731 100644
--- a/src/java/com/android/internal/telephony/imsphone/ImsPhoneCommandInterface.java
+++ b/src/java/com/android/internal/telephony/imsphone/ImsPhoneCommandInterface.java
@@ -334,8 +334,7 @@
}
@Override
- public void setNetworkSelectionModeManual(
- String operatorNumeric, Message response) {
+ public void setNetworkSelectionModeManual(String operatorNumeric, int ran, Message response) {
}
@Override
diff --git a/src/java/com/android/internal/telephony/imsphone/ImsPhoneConnection.java b/src/java/com/android/internal/telephony/imsphone/ImsPhoneConnection.java
index 7e6db99..f87876d 100644
--- a/src/java/com/android/internal/telephony/imsphone/ImsPhoneConnection.java
+++ b/src/java/com/android/internal/telephony/imsphone/ImsPhoneConnection.java
@@ -35,6 +35,7 @@
import android.telephony.PhoneNumberUtils;
import com.android.telephony.Rlog;
import android.telephony.ServiceState;
+import android.telephony.TelephonyManager;
import android.telephony.ims.ImsCallProfile;
import android.telephony.ims.ImsStreamMediaProfile;
import android.text.TextUtils;
@@ -185,6 +186,7 @@
mHandler = new MyHandler(mOwner.getLooper());
mHandlerMessenger = new Messenger(mHandler);
mImsCall = imsCall;
+ mIsAdhocConference = isMultiparty();
if ((imsCall != null) && (imsCall.getCallProfile() != null)) {
mAddress = imsCall.getCallProfile().getCallExtra(ImsCallProfile.EXTRA_OI);
@@ -260,6 +262,37 @@
}
}
+ /** This is an MO conference call, created when dialing */
+ public ImsPhoneConnection(Phone phone, String[] participantsToDial, ImsPhoneCallTracker ct,
+ ImsPhoneCall parent, boolean isEmergency) {
+ super(PhoneConstants.PHONE_TYPE_IMS);
+ createWakeLock(phone.getContext());
+ acquireWakeLock();
+
+ mOwner = ct;
+ mHandler = new MyHandler(mOwner.getLooper());
+ mHandlerMessenger = new Messenger(mHandler);
+
+ mDialString = mAddress = Connection.ADHOC_CONFERENCE_ADDRESS;
+ mParticipantsToDial = participantsToDial;
+ mIsAdhocConference = true;
+
+ mIsIncoming = false;
+ mCnapName = null;
+ mCnapNamePresentation = PhoneConstants.PRESENTATION_ALLOWED;
+ mNumberPresentation = PhoneConstants.PRESENTATION_ALLOWED;
+ mCreateTime = System.currentTimeMillis();
+
+ mParent = parent;
+ parent.attachFake(this, ImsPhoneCall.State.DIALING);
+
+ if (phone.getContext().getResources().getBoolean(
+ com.android.internal.R.bool.config_use_voip_mode_for_ims)) {
+ setAudioModeIsVoip(true);
+ }
+ }
+
+
public void dispose() {
}
@@ -1160,17 +1193,18 @@
* @param extras The ImsCallProfile extras.
*/
private void updateImsCallRatFromExtras(Bundle extras) {
- if (extras.containsKey(ImsCallProfile.EXTRA_CALL_RAT_TYPE) ||
- extras.containsKey(ImsCallProfile.EXTRA_CALL_RAT_TYPE_ALT)) {
+ if (extras.containsKey(ImsCallProfile.EXTRA_CALL_NETWORK_TYPE)
+ || extras.containsKey(ImsCallProfile.EXTRA_CALL_RAT_TYPE)
+ || extras.containsKey(ImsCallProfile.EXTRA_CALL_RAT_TYPE_ALT)) {
ImsCall call = getImsCall();
- int callTech = ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN;
+ int networkType = TelephonyManager.NETWORK_TYPE_UNKNOWN;
if (call != null) {
- callTech = call.getRadioTechnology();
+ networkType = call.getNetworkType();
}
- // Report any changes for call tech change
- setCallRadioTech(callTech);
+ // Report any changes for network type change
+ setCallRadioTech(ServiceState.networkTypeToRilRadioTechnology(networkType));
}
}
@@ -1278,6 +1312,8 @@
sb.append(getTelecomCallId());
sb.append(" address: ");
sb.append(Rlog.pii(LOG_TAG, getAddress()));
+ sb.append(" isAdhocConf: ");
+ sb.append(isAdhocConference() ? "Y" : "N");
sb.append(" ImsCall: ");
synchronized (this) {
if (mImsCall == null) {
diff --git a/src/java/com/android/internal/telephony/sip/SipCommandInterface.java b/src/java/com/android/internal/telephony/sip/SipCommandInterface.java
index 4762979..5ea1f6c 100644
--- a/src/java/com/android/internal/telephony/sip/SipCommandInterface.java
+++ b/src/java/com/android/internal/telephony/sip/SipCommandInterface.java
@@ -335,8 +335,7 @@
}
@Override
- public void setNetworkSelectionModeManual(
- String operatorNumeric, Message response) {
+ public void setNetworkSelectionModeManual(String operatorNumeric, int ran, Message response) {
}
@Override
diff --git a/src/java/com/android/internal/telephony/sip/SipPhone.java b/src/java/com/android/internal/telephony/sip/SipPhone.java
index 72fd9da..8e85e9a 100644
--- a/src/java/com/android/internal/telephony/sip/SipPhone.java
+++ b/src/java/com/android/internal/telephony/sip/SipPhone.java
@@ -186,6 +186,12 @@
}
@Override
+ public Connection startConference(String[] participantsToDial, DialArgs dialArgs)
+ throws CallStateException {
+ throw new CallStateException("startConference: not supported");
+ }
+
+ @Override
public Connection dial(String dialString, DialArgs dialArgs) throws CallStateException {
synchronized (SipPhone.class) {
return dialInternal(dialString, dialArgs.videoState);
diff --git a/tests/telephonytests/Android.bp b/tests/telephonytests/Android.bp
index 4690c89..6709b48 100644
--- a/tests/telephonytests/Android.bp
+++ b/tests/telephonytests/Android.bp
@@ -25,10 +25,22 @@
],
platform_apis: true,
- jarjar_rules: ":jarjar-rules-shared",
+ jarjar_rules: ":jarjar-rules-telephony-tests",
test_suites: [
"mts",
"device-tests",
],
}
+
+genrule {
+ name: "jarjar-rules-telephony-tests",
+ srcs: [
+ // Order matters: test rules override the base ones
+ "jarjar-rules-tests.txt",
+ ":jarjar-rules-shared",
+ ],
+ out: ["jarjar-rules-telephony-tests-combined.txt"],
+ cmd: "cat $(in) > $(out)",
+ visibility: ["//visibility:private"],
+}
diff --git a/tests/telephonytests/jarjar-rules-tests.txt b/tests/telephonytests/jarjar-rules-tests.txt
new file mode 100644
index 0000000..91b5b32
--- /dev/null
+++ b/tests/telephonytests/jarjar-rules-tests.txt
@@ -0,0 +1,6 @@
+# NetworkFactory is included in telephony-common and services.net
+# Rename the non-jarjared, services.net version to avoid conflicts.
+# This causes two NetworkFactory classes to appear in the test package (one used
+# by services-net and one by telephony-common), similarly to what happens on a
+# real device, except that in the test they have different package names.
+rule android.net.NetworkFactory* android.net.services.NetworkFactory@1
diff --git a/tests/telephonytests/src/android/telephony/ims/ImsCallSessionListenerTests.java b/tests/telephonytests/src/android/telephony/ims/ImsCallSessionListenerTests.java
new file mode 100644
index 0000000..99461c1
--- /dev/null
+++ b/tests/telephonytests/src/android/telephony/ims/ImsCallSessionListenerTests.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telephony.ims;
+
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.verify;
+
+import android.telephony.ServiceState;
+import android.telephony.TelephonyManager;
+import android.telephony.ims.aidl.IImsCallSessionListener;
+
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+@RunWith(AndroidJUnit4.class)
+public class ImsCallSessionListenerTests {
+
+ @Mock
+ IImsCallSessionListener mMockListener;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void testListenerMayHandoverDeprecated() throws Exception {
+ ImsCallSessionListener mTestListener = new ImsCallSessionListener(mMockListener);
+ mTestListener.callSessionMayHandover(ServiceState.RIL_RADIO_TECHNOLOGY_LTE,
+ ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN);
+ // verify we get the correct network type equivalent of this param.
+ verify(mMockListener).callSessionMayHandover(TelephonyManager.NETWORK_TYPE_LTE,
+ TelephonyManager.NETWORK_TYPE_IWLAN);
+ }
+
+ @Test
+ public void testListenerHandoverDeprecated() throws Exception {
+ ImsReasonInfo imsReasonInfo = new ImsReasonInfo();
+ ImsCallSessionListener mTestListener = new ImsCallSessionListener(mMockListener);
+ mTestListener.callSessionHandover(ServiceState.RIL_RADIO_TECHNOLOGY_LTE,
+ ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN, imsReasonInfo);
+ // verify we get the correct network type equivalent of this param.
+ verify(mMockListener).callSessionHandover(eq(TelephonyManager.NETWORK_TYPE_LTE),
+ eq(TelephonyManager.NETWORK_TYPE_IWLAN), eq(imsReasonInfo));
+ }
+
+ @Test
+ public void testListenerHandoverFailedDeprecated() throws Exception {
+ ImsReasonInfo imsReasonInfo = new ImsReasonInfo(
+ ImsReasonInfo.CODE_REJECT_ONGOING_HANDOVER, 0 /*extraCode*/);
+ ImsCallSessionListener mTestListener = new ImsCallSessionListener(mMockListener);
+ mTestListener.callSessionHandoverFailed(ServiceState.RIL_RADIO_TECHNOLOGY_LTE,
+ ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN, imsReasonInfo);
+ // verify we get the correct network type equivalent of this param.
+ verify(mMockListener).callSessionHandoverFailed(eq(TelephonyManager.NETWORK_TYPE_LTE),
+ eq(TelephonyManager.NETWORK_TYPE_IWLAN), eq(imsReasonInfo));
+ }
+
+}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/CellIdentityGsmTest.java b/tests/telephonytests/src/com/android/internal/telephony/CellIdentityGsmTest.java
index f50cea1..1a77ea4 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/CellIdentityGsmTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/CellIdentityGsmTest.java
@@ -21,8 +21,9 @@
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
-/** Unit tests for {@link CellIdentityGsm}. */
+import java.util.Collections;
+/** Unit tests for {@link CellIdentityGsm}. */
public class CellIdentityGsmTest extends AndroidTestCase {
// Location Area Code ranges from 0 to 65535.
@@ -45,7 +46,7 @@
public void testDefaultConstructor() {
CellIdentityGsm ci =
new CellIdentityGsm(LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR,
- ALPHA_LONG, ALPHA_SHORT);
+ ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
assertEquals(LAC, ci.getLac());
assertEquals(CID, ci.getCid());
@@ -66,7 +67,7 @@
final String mncWithThreeDigit = "061";
CellIdentityGsm ci =
new CellIdentityGsm(LAC, CID, ARFCN, BSIC, MCC_STR, mncWithThreeDigit,
- ALPHA_LONG, ALPHA_SHORT);
+ ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
assertEquals(MCC, ci.getMcc());
assertEquals(61, ci.getMnc());
@@ -80,7 +81,7 @@
final String mncWithTwoDigit = "61";
CellIdentityGsm ci =
new CellIdentityGsm(LAC, CID, ARFCN, BSIC, MCC_STR, mncWithTwoDigit,
- ALPHA_LONG, ALPHA_SHORT);
+ ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
assertEquals(MCC, ci.getMcc());
assertEquals(61, ci.getMnc());
@@ -92,7 +93,8 @@
@SmallTest
public void testConstructorWithEmptyMccMnc() {
CellIdentityGsm ci =
- new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, null, ALPHA_LONG, ALPHA_SHORT);
+ new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, null, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList());
assertEquals(Integer.MAX_VALUE, ci.getMcc());
assertEquals(Integer.MAX_VALUE, ci.getMnc());
@@ -100,7 +102,8 @@
assertNull(ci.getMncString());
assertNull(ci.getMobileNetworkOperator());
- ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, MCC_STR, null, ALPHA_LONG, ALPHA_SHORT);
+ ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, MCC_STR, null, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList());
assertEquals(MCC, ci.getMcc());
assertEquals(Integer.MAX_VALUE, ci.getMnc());
@@ -108,7 +111,8 @@
assertNull(ci.getMncString());
assertNull(ci.getMobileNetworkOperator());
- ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, MNC_STR, ALPHA_LONG, ALPHA_SHORT);
+ ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, MNC_STR, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList());
assertEquals(MNC, ci.getMnc());
assertEquals(Integer.MAX_VALUE, ci.getMcc());
@@ -116,7 +120,8 @@
assertNull(ci.getMccString());
assertNull(ci.getMobileNetworkOperator());
- ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, "", "", ALPHA_LONG, ALPHA_SHORT);
+ ci = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, "", "", ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList());
assertEquals(Integer.MAX_VALUE, ci.getMcc());
assertEquals(Integer.MAX_VALUE, ci.getMnc());
@@ -128,20 +133,26 @@
@SmallTest
public void testEquals() {
CellIdentityGsm ciA = new CellIdentityGsm(
- LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT);
+ LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList());
CellIdentityGsm ciB = new CellIdentityGsm(
- LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT);
+ LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList());
assertTrue(ciA.equals(ciB));
- ciA = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, MNC_STR, ALPHA_LONG, ALPHA_SHORT);
- ciB = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, MNC_STR, ALPHA_LONG, ALPHA_SHORT);
+ ciA = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, MNC_STR, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList());
+ ciB = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, MNC_STR, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList());
assertTrue(ciA.equals(ciB));
ciA = new CellIdentityGsm(
- LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT);
- ciB = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, MNC_STR, ALPHA_LONG, ALPHA_SHORT);
+ LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList());
+ ciB = new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, MNC_STR, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList());
assertFalse(ciA.equals(ciB));
}
@@ -150,7 +161,7 @@
public void testParcel() {
CellIdentityGsm ci =
new CellIdentityGsm(LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR,
- ALPHA_LONG, ALPHA_SHORT);
+ ALPHA_LONG, ALPHA_SHORT, Collections.emptyList());
Parcel p = Parcel.obtain();
ci.writeToParcel(p, 0);
@@ -163,7 +174,8 @@
@SmallTest
public void testParcelWithUnknowMccMnc() {
CellIdentityGsm ci =
- new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, null, ALPHA_LONG, ALPHA_SHORT);
+ new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, null, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList());
Parcel p = Parcel.obtain();
ci.writeToParcel(p, 0);
@@ -178,7 +190,8 @@
final String invalidMcc = "randomStuff";
final String invalidMnc = "randomStuff";
CellIdentityGsm ci =
- new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, null, ALPHA_LONG, ALPHA_SHORT);
+ new CellIdentityGsm(LAC, CID, ARFCN, BSIC, null, null, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList());
Parcel p = Parcel.obtain();
ci.writeToParcel(p, 0);
diff --git a/tests/telephonytests/src/com/android/internal/telephony/CellIdentityLteTest.java b/tests/telephonytests/src/com/android/internal/telephony/CellIdentityLteTest.java
index bb0b6fa..8664fd5 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/CellIdentityLteTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/CellIdentityLteTest.java
@@ -22,6 +22,8 @@
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
+import java.util.Collections;
+
/** Unit tests for {@link CellIdentityLte}. */
public class CellIdentityLteTest extends AndroidTestCase {
@@ -46,7 +48,7 @@
public void testDefaultConstructor() {
CellIdentityLte ci =
new CellIdentityLte(CI, PCI, TAC, EARFCN, BANDWIDTH, MCC_STR, MNC_STR,
- ALPHA_LONG, ALPHA_SHORT);
+ ALPHA_LONG, ALPHA_SHORT, Collections.emptyList(), null);
assertEquals(CI, ci.getCi());
assertEquals(PCI, ci.getPci());
@@ -68,7 +70,7 @@
final String mncWithThreeDigit = "061";
CellIdentityLte ci =
new CellIdentityLte(CI, PCI, TAC, EARFCN, BANDWIDTH, MCC_STR, mncWithThreeDigit,
- ALPHA_LONG, ALPHA_SHORT);
+ ALPHA_LONG, ALPHA_SHORT, Collections.emptyList(), null);
assertEquals(MCC, ci.getMcc());
assertEquals(61, ci.getMnc());
@@ -82,7 +84,7 @@
final String mncWithTwoDigit = "61";
CellIdentityLte ci =
new CellIdentityLte(CI, PCI, TAC, EARFCN, BANDWIDTH, MCC_STR, mncWithTwoDigit,
- ALPHA_LONG, ALPHA_SHORT);
+ ALPHA_LONG, ALPHA_SHORT, Collections.emptyList(), null);
assertEquals(MCC, ci.getMcc());
assertEquals(61, ci.getMnc());
@@ -94,7 +96,8 @@
@SmallTest
public void testConstructorWithEmptyMccMnc() {
CellIdentityLte ci = new CellIdentityLte(
- CI, PCI, TAC, EARFCN, BANDWIDTH, null, null, ALPHA_LONG, ALPHA_SHORT);
+ CI, PCI, TAC, EARFCN, BANDWIDTH, null, null, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
assertEquals(Integer.MAX_VALUE, ci.getMcc());
assertEquals(Integer.MAX_VALUE, ci.getMnc());
@@ -103,7 +106,8 @@
assertNull(ci.getMobileNetworkOperator());
ci = new CellIdentityLte(
- CI, PCI, TAC, EARFCN, BANDWIDTH, MCC_STR, null, ALPHA_LONG, ALPHA_SHORT);
+ CI, PCI, TAC, EARFCN, BANDWIDTH, MCC_STR, null, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
assertEquals(MCC, ci.getMcc());
assertEquals(Integer.MAX_VALUE, ci.getMnc());
@@ -112,7 +116,8 @@
assertNull(ci.getMobileNetworkOperator());
ci = new CellIdentityLte(
- CI, PCI, TAC, EARFCN, BANDWIDTH, null, MNC_STR, ALPHA_LONG, ALPHA_SHORT);
+ CI, PCI, TAC, EARFCN, BANDWIDTH, null, MNC_STR, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
assertEquals(MNC, ci.getMnc());
assertEquals(Integer.MAX_VALUE, ci.getMcc());
@@ -121,7 +126,8 @@
assertNull(ci.getMobileNetworkOperator());
ci = new CellIdentityLte(
- CI, PCI, TAC, EARFCN, BANDWIDTH, "", "", ALPHA_LONG, ALPHA_SHORT);
+ CI, PCI, TAC, EARFCN, BANDWIDTH, "", "", ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
assertEquals(Integer.MAX_VALUE, ci.getMcc());
assertEquals(Integer.MAX_VALUE, ci.getMnc());
@@ -152,23 +158,29 @@
@SmallTest
public void testEquals() {
CellIdentityLte ciA = new CellIdentityLte(
- CI, PCI, TAC, EARFCN, BANDWIDTH, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT);
+ CI, PCI, TAC, EARFCN, BANDWIDTH, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
CellIdentityLte ciB = new CellIdentityLte(
- CI, PCI, TAC, EARFCN, BANDWIDTH, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT);
+ CI, PCI, TAC, EARFCN, BANDWIDTH, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
assertTrue(ciA.equals(ciB));
ciA = new CellIdentityLte(
- CI, PCI, TAC, EARFCN, BANDWIDTH, null, null, ALPHA_LONG, ALPHA_SHORT);
+ CI, PCI, TAC, EARFCN, BANDWIDTH, null, null, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
ciB = new CellIdentityLte(
- CI, PCI, TAC, EARFCN, BANDWIDTH, null, null, ALPHA_LONG, ALPHA_SHORT);
+ CI, PCI, TAC, EARFCN, BANDWIDTH, null, null, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
assertTrue(ciA.equals(ciB));
ciA = new CellIdentityLte(
- CI, PCI, TAC, EARFCN, BANDWIDTH, MCC_STR, null, ALPHA_LONG, ALPHA_SHORT);
+ CI, PCI, TAC, EARFCN, BANDWIDTH, MCC_STR, null, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
ciB = new CellIdentityLte(
- CI, PCI, TAC, EARFCN, BANDWIDTH, null, null, ALPHA_LONG, ALPHA_SHORT);
+ CI, PCI, TAC, EARFCN, BANDWIDTH, null, null, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
assertFalse(ciA.equals(ciB));
}
@@ -177,7 +189,7 @@
public void testParcel() {
CellIdentityLte ci =
new CellIdentityLte(CI, PCI, TAC, EARFCN, BANDWIDTH, MCC_STR, MNC_STR,
- ALPHA_LONG, ALPHA_SHORT);
+ ALPHA_LONG, ALPHA_SHORT, Collections.emptyList(), null);
Parcel p = Parcel.obtain();
ci.writeToParcel(p, 0);
@@ -190,7 +202,8 @@
@SmallTest
public void testParcelWithUnknownMccMnc() {
CellIdentityLte ci = new CellIdentityLte(
- CI, PCI, TAC, EARFCN, BANDWIDTH, null, null, ALPHA_LONG, ALPHA_SHORT);
+ CI, PCI, TAC, EARFCN, BANDWIDTH, null, null, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
Parcel p = Parcel.obtain();
p.writeInt(CellInfo.TYPE_LTE);
@@ -214,7 +227,8 @@
final String invalidMcc = "randomStuff";
final String invalidMnc = "randomStuff";
CellIdentityLte ci = new CellIdentityLte(
- CI, PCI, TAC, EARFCN, BANDWIDTH, null, null, ALPHA_LONG, ALPHA_SHORT);
+ CI, PCI, TAC, EARFCN, BANDWIDTH, null, null, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
Parcel p = Parcel.obtain();
p.writeInt(CellInfo.TYPE_LTE);
diff --git a/tests/telephonytests/src/com/android/internal/telephony/CellIdentityNrTest.java b/tests/telephonytests/src/com/android/internal/telephony/CellIdentityNrTest.java
index ede0f25..7ade8b7 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/CellIdentityNrTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/CellIdentityNrTest.java
@@ -19,12 +19,15 @@
import static com.google.common.truth.Truth.assertThat;
import android.os.Parcel;
+import android.telephony.AccessNetworkConstants;
import android.telephony.CellIdentityNr;
import android.telephony.CellInfo;
import android.test.AndroidTestCase;
import org.junit.Test;
+import java.util.Collections;
+
public class CellIdentityNrTest extends AndroidTestCase {
private static final String MCC = "310";
private static final String MNC = "260";
@@ -36,12 +39,14 @@
private static final int PCI = 123;
private static final int TAC = 32767;
private static final int NCI = 8675309;
+ private static final int BAND = AccessNetworkConstants.NgranBands.BAND_1;
@Test
public void testGetMethod() {
// GIVEN an instance of CellIdentityNr
CellIdentityNr cellIdentityNr =
- new CellIdentityNr(PCI, TAC, NRARFCN, MCC, MNC, NCI, ALPHAL, ALPHAS);
+ new CellIdentityNr(PCI, TAC, NRARFCN, BAND, MCC, MNC, NCI, ALPHAL, ALPHAS,
+ Collections.emptyList());
// THEN the get method should return correct value
assertThat(cellIdentityNr.getType()).isEqualTo(CellInfo.TYPE_NR);
@@ -60,9 +65,11 @@
public void testEquals_sameParameters() {
// GIVEN an instance of CellIdentityNr, and create another object with the same parameters
CellIdentityNr cellIdentityNr =
- new CellIdentityNr(PCI, TAC, NRARFCN, MCC, MNC, NCI, ALPHAL, ALPHAS);
+ new CellIdentityNr(PCI, TAC, NRARFCN, BAND, MCC, MNC, NCI, ALPHAL, ALPHAS,
+ Collections.emptyList());
CellIdentityNr anotherCellIdentityNr =
- new CellIdentityNr(PCI, TAC, NRARFCN, MCC, MNC, NCI, ALPHAL, ALPHAS);
+ new CellIdentityNr(PCI, TAC, NRARFCN, BAND, MCC, MNC, NCI, ALPHAL, ALPHAS,
+ Collections.emptyList());
// THEN this two objects are equivalent
assertThat(cellIdentityNr).isEqualTo(anotherCellIdentityNr);
@@ -72,9 +79,11 @@
public void testEquals_differentParameters() {
// GIVEN an instance of CellIdentityNr, and create another object with different parameters
CellIdentityNr cellIdentityNr =
- new CellIdentityNr(PCI, TAC, NRARFCN, MCC, MNC, NCI, ALPHAL, ALPHAS);
+ new CellIdentityNr(PCI, TAC, NRARFCN, BAND, MCC, MNC, NCI, ALPHAL, ALPHAS,
+ Collections.emptyList());
CellIdentityNr anotherCellIdentityNr =
- new CellIdentityNr(PCI, TAC, NRARFCN, MCC, MNC, NCI + 1, ALPHAL, ALPHAS);
+ new CellIdentityNr(PCI, TAC, NRARFCN, BAND, MCC, MNC, NCI + 1, ALPHAL, ALPHAS,
+ Collections.emptyList());
// THEN this two objects are different
assertThat(cellIdentityNr).isNotEqualTo(anotherCellIdentityNr);
@@ -84,7 +93,8 @@
public void testParcel() {
// GIVEN an instance of CellIdentityNr
CellIdentityNr cellIdentityNr =
- new CellIdentityNr(PCI, TAC, NRARFCN, MCC, MNC, NCI, ALPHAL, ALPHAS);
+ new CellIdentityNr(PCI, TAC, NRARFCN, BAND, MCC, MNC, NCI, ALPHAL, ALPHAS,
+ Collections.emptyList());
// WHEN write the object to parcel and create another object with that parcel
Parcel parcel = Parcel.obtain();
@@ -98,6 +108,7 @@
assertThat(anotherCellIdentityNr.getNrarfcn()).isEqualTo(NRARFCN);
assertThat(anotherCellIdentityNr.getPci()).isEqualTo(PCI);
assertThat(anotherCellIdentityNr.getTac()).isEqualTo(TAC);
+ assertThat(anotherCellIdentityNr.getBand()).isEqualTo(BAND);
assertThat(anotherCellIdentityNr.getOperatorAlphaLong()).isEqualTo(ALPHAL);
assertThat(anotherCellIdentityNr.getOperatorAlphaShort()).isEqualTo(ALPHAS);
assertThat(anotherCellIdentityNr.getMccString()).isEqualTo(MCC);
diff --git a/tests/telephonytests/src/com/android/internal/telephony/CellIdentityTdscdmaTest.java b/tests/telephonytests/src/com/android/internal/telephony/CellIdentityTdscdmaTest.java
index 78c5547..a0c67a5 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/CellIdentityTdscdmaTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/CellIdentityTdscdmaTest.java
@@ -24,6 +24,8 @@
/** Unit tests for {@link CellIdentityTdscdma}. */
+import java.util.Collections;
+
public class CellIdentityTdscdmaTest extends AndroidTestCase {
// Cell identity ranges from 0 to 268435456.
@@ -67,7 +69,8 @@
public void testConstructor() {
CellIdentityTdscdma ci =
new CellIdentityTdscdma(
- MCC_STR, MNC_STR, LAC, CID, CPID, UARFCN, ALPHA_LONG, ALPHA_SHORT);
+ MCC_STR, MNC_STR, LAC, CID, CPID, UARFCN, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
assertEquals(MCC_STR, ci.getMccString());
assertEquals(MNC_STR, ci.getMncString());
@@ -83,22 +86,25 @@
@SmallTest
public void testConstructorWithEmptyMccMnc() {
CellIdentityTdscdma ci = new CellIdentityTdscdma(
- null, null, LAC, CID, CPID, UARFCN, "", "");
+ null, null, LAC, CID, CPID, UARFCN, "", "", Collections.emptyList(), null);
assertNull(ci.getMccString());
assertNull(ci.getMncString());
- ci = new CellIdentityTdscdma(MCC_STR, null, LAC, CID, CPID, UARFCN, "", "");
+ ci = new CellIdentityTdscdma(MCC_STR, null, LAC, CID, CPID, UARFCN, "", "",
+ Collections.emptyList(), null);
assertEquals(MCC_STR, ci.getMccString());
assertNull(ci.getMncString());
- ci = new CellIdentityTdscdma(null, MNC_STR, LAC, CID, CPID, UARFCN, "", "");
+ ci = new CellIdentityTdscdma(null, MNC_STR, LAC, CID, CPID, UARFCN, "", "",
+ Collections.emptyList(), null);
assertEquals(MNC_STR, ci.getMncString());
assertNull(ci.getMccString());
- ci = new CellIdentityTdscdma("", "", LAC, CID, CPID, UARFCN, "", "");
+ ci = new CellIdentityTdscdma("", "", LAC, CID, CPID, UARFCN, "", "",
+ Collections.emptyList(), null);
assertNull(ci.getMccString());
assertNull(ci.getMncString());
@@ -107,7 +113,8 @@
@SmallTest
public void testParcel() {
CellIdentityTdscdma ci = new CellIdentityTdscdma(
- MCC_STR, MNC_STR, LAC, CID, UARFCN, CPID, ALPHA_LONG, ALPHA_SHORT);
+ MCC_STR, MNC_STR, LAC, CID, UARFCN, CPID, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
Parcel p = Parcel.obtain();
ci.writeToParcel(p, 0);
@@ -121,7 +128,8 @@
public void testParcelWithUnknowMccMnc() {
CellIdentityTdscdma ci =
new CellIdentityTdscdma(
- null, null, LAC, CID, CPID, UARFCN, ALPHA_LONG, ALPHA_SHORT);
+ null, null, LAC, CID, CPID, UARFCN, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
Parcel p = Parcel.obtain();
p.writeInt(CellInfo.TYPE_TDSCDMA);
@@ -145,7 +153,8 @@
final String invalidMnc = "randomStuff";
CellIdentityTdscdma ci =
new CellIdentityTdscdma(
- null, null, LAC, CID, CPID, UARFCN, ALPHA_LONG, ALPHA_SHORT);
+ null, null, LAC, CID, CPID, UARFCN, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
Parcel p = Parcel.obtain();
p.writeInt(CellInfo.TYPE_TDSCDMA);
diff --git a/tests/telephonytests/src/com/android/internal/telephony/CellIdentityTest.java b/tests/telephonytests/src/com/android/internal/telephony/CellIdentityTest.java
index 6b65a46..166c89c 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/CellIdentityTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/CellIdentityTest.java
@@ -25,6 +25,8 @@
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
+import java.util.Collections;
+
public class CellIdentityTest extends AndroidTestCase {
// Cell identity ranges from 0 to 268435456.
@@ -67,14 +69,16 @@
@SmallTest
public void testConstructCellIdentityGsm() {
// Test values below zero (these must all be non-negative)
- CellIdentityGsm gsm = new CellIdentityGsm(-1, -1, -1, -1, null, null, null, null);
+ CellIdentityGsm gsm = new CellIdentityGsm(-1, -1, -1, -1, null, null, null, null,
+ Collections.emptyList());
assertEquals(CellInfo.UNAVAILABLE, gsm.getLac());
assertEquals(CellInfo.UNAVAILABLE, gsm.getCid());
assertEquals(CellInfo.UNAVAILABLE, gsm.getArfcn());
assertEquals(CellInfo.UNAVAILABLE, gsm.getBsic());
// Test max values of LAC, CID, ARFCN, and BSIC
- gsm = new CellIdentityGsm(MAX_LAC, MAX_CID, MAX_ARFCN, MAX_BSIC, null, null, null, null);
+ gsm = new CellIdentityGsm(MAX_LAC, MAX_CID, MAX_ARFCN, MAX_BSIC, null, null, null, null,
+ Collections.emptyList());
assertEquals(MAX_LAC, gsm.getLac());
assertEquals(MAX_CID, gsm.getCid());
assertEquals(MAX_ARFCN, gsm.getArfcn());
@@ -82,7 +86,8 @@
// Test max values + 1 of LAC, CID, ARFCN, and BSIC
gsm = new CellIdentityGsm(
- MAX_LAC + 1, MAX_CID + 1, MAX_ARFCN + 1, MAX_BSIC + 1, null, null, null, null);
+ MAX_LAC + 1, MAX_CID + 1, MAX_ARFCN + 1, MAX_BSIC + 1, null, null, null, null,
+ Collections.emptyList());
assertEquals(CellInfo.UNAVAILABLE, gsm.getLac());
assertEquals(CellInfo.UNAVAILABLE, gsm.getCid());
assertEquals(CellInfo.UNAVAILABLE, gsm.getArfcn());
@@ -93,23 +98,25 @@
@SmallTest
public void testEquals() {
CellIdentity ciA = new CellIdentityLte(
- CI, PCI, TAC, EARFCN, BANDWIDTH, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT);
+ CI, PCI, TAC, EARFCN, BANDWIDTH, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
CellIdentity ciB = new CellIdentityLte(
- CI, PCI, TAC, EARFCN, BANDWIDTH, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT);
+ CI, PCI, TAC, EARFCN, BANDWIDTH, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
assertTrue(ciA.equals(ciB));
ciA = new CellIdentityLte(CI, PCI, TAC, EARFCN, BANDWIDTH, null, null, ALPHA_LONG,
- ALPHA_SHORT);
+ ALPHA_SHORT, Collections.emptyList(), null);
ciB = new CellIdentityLte(CI, PCI, TAC, EARFCN, BANDWIDTH, null, null, ALPHA_LONG,
- ALPHA_SHORT);
+ ALPHA_SHORT, Collections.emptyList(), null);
assertTrue(ciA.equals(ciB));
ciA = new CellIdentityLte(CI, PCI, TAC, EARFCN, BANDWIDTH, MCC_STR, null, ALPHA_LONG,
- ALPHA_SHORT);
+ ALPHA_SHORT, Collections.emptyList(), null);
ciB = new CellIdentityLte(CI, PCI, TAC, EARFCN, BANDWIDTH, null, null, ALPHA_LONG,
- ALPHA_SHORT);
+ ALPHA_SHORT, Collections.emptyList(), null);
assertFalse(ciA.equals(ciB));
}
@@ -117,7 +124,7 @@
@SmallTest
public void testParcel() {
CellIdentity ci = new CellIdentityLte(CI, PCI, TAC, EARFCN, BANDWIDTH, MCC_STR, MNC_STR,
- ALPHA_LONG, ALPHA_SHORT);
+ ALPHA_LONG, ALPHA_SHORT, Collections.emptyList(), null);
Parcel p = Parcel.obtain();
ci.writeToParcel(p, 0);
diff --git a/tests/telephonytests/src/com/android/internal/telephony/CellIdentityWcdmaTest.java b/tests/telephonytests/src/com/android/internal/telephony/CellIdentityWcdmaTest.java
index c978c28..86a256b 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/CellIdentityWcdmaTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/CellIdentityWcdmaTest.java
@@ -21,6 +21,8 @@
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
+import java.util.Collections;
+
/** Unit tests for {@link CellIdentityWcdma}. */
public class CellIdentityWcdmaTest extends AndroidTestCase {
@@ -44,7 +46,7 @@
public void testDefaultConstructor() {
CellIdentityWcdma ci =
new CellIdentityWcdma(LAC, CID, PSC, UARFCN, MCC_STR, MNC_STR,
- ALPHA_LONG, ALPHA_SHORT);
+ ALPHA_LONG, ALPHA_SHORT, Collections.emptyList(), null);
assertEquals(LAC, ci.getLac());
assertEquals(CID, ci.getCid());
@@ -65,7 +67,7 @@
final String mncWithThreeDigit = "061";
CellIdentityWcdma ci =
new CellIdentityWcdma(LAC, CID, PSC, UARFCN, MCC_STR, mncWithThreeDigit,
- ALPHA_LONG, ALPHA_SHORT);
+ ALPHA_LONG, ALPHA_SHORT, Collections.emptyList(), null);
assertEquals(MCC, ci.getMcc());
assertEquals(61, ci.getMnc());
@@ -79,7 +81,7 @@
final String mncWithTwoDigit = "61";
CellIdentityWcdma ci =
new CellIdentityWcdma(LAC, CID, PSC, UARFCN, MCC_STR, mncWithTwoDigit,
- ALPHA_LONG, ALPHA_SHORT);
+ ALPHA_LONG, ALPHA_SHORT, Collections.emptyList(), null);
assertEquals(MCC, ci.getMcc());
assertEquals(61, ci.getMnc());
@@ -92,7 +94,8 @@
public void testConstructorWithEmptyMccMnc() {
final String integerMaxValue = String.valueOf(Integer.MAX_VALUE);
CellIdentityWcdma ci =
- new CellIdentityWcdma(LAC, CID, PSC, UARFCN, null, null, ALPHA_LONG, ALPHA_SHORT);
+ new CellIdentityWcdma(LAC, CID, PSC, UARFCN, null, null, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
assertEquals(Integer.MAX_VALUE, ci.getMcc());
assertEquals(Integer.MAX_VALUE, ci.getMnc());
@@ -100,7 +103,8 @@
assertNull(ci.getMncString());
assertNull(ci.getMobileNetworkOperator());
- ci = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, MCC_STR, null, ALPHA_LONG, ALPHA_SHORT);
+ ci = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, MCC_STR, null, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
assertEquals(MCC, ci.getMcc());
assertEquals(Integer.MAX_VALUE, ci.getMnc());
@@ -108,7 +112,8 @@
assertNull(ci.getMncString());
assertNull(ci.getMobileNetworkOperator());
- ci = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, null, MNC_STR, ALPHA_LONG, ALPHA_SHORT);
+ ci = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, null, MNC_STR, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
assertEquals(MNC, ci.getMnc());
assertEquals(Integer.MAX_VALUE, ci.getMcc());
@@ -116,7 +121,8 @@
assertNull(ci.getMccString());
assertNull(ci.getMobileNetworkOperator());
- ci = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, "", "", ALPHA_LONG, ALPHA_SHORT);
+ ci = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, "", "", ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
assertEquals(Integer.MAX_VALUE, ci.getMcc());
assertEquals(Integer.MAX_VALUE, ci.getMnc());
@@ -128,19 +134,25 @@
@SmallTest
public void testEquals() {
CellIdentityWcdma ciA = new CellIdentityWcdma(
- LAC, CID, PSC, UARFCN, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT);
+ LAC, CID, PSC, UARFCN, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
CellIdentityWcdma ciB = new CellIdentityWcdma(
- LAC, CID, PSC, UARFCN, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT);
+ LAC, CID, PSC, UARFCN, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
assertTrue(ciA.equals(ciB));
- ciA = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, null, null, ALPHA_LONG, ALPHA_SHORT);
- ciB = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, null, null, ALPHA_LONG, ALPHA_SHORT);
+ ciA = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, null, null, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
+ ciB = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, null, null, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
assertTrue(ciA.equals(ciB));
- ciA = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, MCC_STR, null, ALPHA_LONG, ALPHA_SHORT);
- ciB = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, null, null, ALPHA_LONG, ALPHA_SHORT);
+ ciA = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, MCC_STR, null, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
+ ciB = new CellIdentityWcdma(LAC, CID, PSC, UARFCN, null, null, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
assertFalse(ciA.equals(ciB));
}
@@ -149,7 +161,7 @@
public void testParcel() {
CellIdentityWcdma ci =
new CellIdentityWcdma(LAC, CID, PSC, UARFCN, MCC_STR, MNC_STR,
- ALPHA_LONG, ALPHA_SHORT);
+ ALPHA_LONG, ALPHA_SHORT, Collections.emptyList(), null);
Parcel p = Parcel.obtain();
ci.writeToParcel(p, 0);
@@ -162,7 +174,8 @@
@SmallTest
public void testParcelWithUnknowMccMnc() {
CellIdentityWcdma ci =
- new CellIdentityWcdma(LAC, CID, PSC, UARFCN, null, null, ALPHA_LONG, ALPHA_SHORT);
+ new CellIdentityWcdma(LAC, CID, PSC, UARFCN, null, null, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
Parcel p = Parcel.obtain();
ci.writeToParcel(p, 0);
@@ -177,7 +190,8 @@
final String invalidMcc = "randomStuff";
final String invalidMnc = "randomStuff";
CellIdentityWcdma ci =
- new CellIdentityWcdma(LAC, CID, PSC, UARFCN, null, null, ALPHA_LONG, ALPHA_SHORT);
+ new CellIdentityWcdma(LAC, CID, PSC, UARFCN, null, null, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
Parcel p = Parcel.obtain();
ci.writeToParcel(p, 0);
diff --git a/tests/telephonytests/src/com/android/internal/telephony/CellularNetworkValidatorTest.java b/tests/telephonytests/src/com/android/internal/telephony/CellularNetworkValidatorTest.java
index 155e3ea..e564da5 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/CellularNetworkValidatorTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/CellularNetworkValidatorTest.java
@@ -46,9 +46,9 @@
private CellularNetworkValidator mValidatorUT;
private int mValidatedSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
private static final PhoneCapability CAPABILITY_WITH_VALIDATION_SUPPORTED =
- new PhoneCapability(1, 1, 0, null, true);
+ new PhoneCapability(0, 0, 0, 0, 1, 0, null, null, null, null, null, null, null);
private static final PhoneCapability CAPABILITY_WITHOUT_VALIDATION_SUPPORTED =
- new PhoneCapability(1, 1, 0, null, false);
+ new PhoneCapability(0, 0, 0, 0, 0, 0, null, null, null, null, null, null, null);
CellularNetworkValidator.ValidationCallback mCallback = (validated, subId) -> {
mValidated = validated;
@@ -75,7 +75,7 @@
*/
@Test
@SmallTest
- public void testValidationSupported() throws Exception {
+ public void testValidationSupported() {
doReturn(CAPABILITY_WITH_VALIDATION_SUPPORTED).when(mPhoneConfigurationManager)
.getCurrentPhoneCapability();
assertTrue(mValidatorUT.isValidationFeatureSupported());
@@ -90,7 +90,7 @@
*/
@Test
@SmallTest
- public void testValidateSuccess() throws Exception {
+ public void testValidateSuccess() {
int subId = 1;
int timeout = 1000;
NetworkRequest expectedRequest = new NetworkRequest.Builder()
@@ -124,7 +124,7 @@
*/
@Test
@SmallTest
- public void testValidateTimeout() throws Exception {
+ public void testValidateTimeout() {
int subId = 1;
int timeout = 100;
NetworkRequest expectedRequest = new NetworkRequest.Builder()
@@ -159,7 +159,7 @@
*/
@Test
@SmallTest
- public void testValidateFailure() throws Exception {
+ public void testValidateFailure() {
int subId = 1;
int timeout = 100;
NetworkRequest expectedRequest = new NetworkRequest.Builder()
@@ -192,7 +192,7 @@
*/
@Test
@SmallTest
- public void testNetworkAvailableNotValidated() throws Exception {
+ public void testNetworkAvailableNotValidated() {
int subId = 1;
int timeout = 100;
NetworkRequest expectedRequest = new NetworkRequest.Builder()
diff --git a/tests/telephonytests/src/com/android/internal/telephony/DefaultPhoneNotifierTest.java b/tests/telephonytests/src/com/android/internal/telephony/DefaultPhoneNotifierTest.java
index 33fc0e9..04d7d06 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/DefaultPhoneNotifierTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/DefaultPhoneNotifierTest.java
@@ -42,6 +42,7 @@
import org.mockito.Mock;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
public class DefaultPhoneNotifierTest extends TelephonyTest {
@@ -248,7 +249,8 @@
@Test @SmallTest
public void testNotifyCellLocation() throws Exception {
// mock gsm cell location
- CellIdentityGsm mGsmCellLocation = new CellIdentityGsm(2, 3, 0, 0, null, null, null, null);
+ CellIdentityGsm mGsmCellLocation = new CellIdentityGsm(
+ 2, 3, 0, 0, null, null, null, null, Collections.emptyList());
doReturn(mGsmCellLocation).when(mPhone).getCellIdentity();
ArgumentCaptor<CellIdentityGsm> cellLocationCapture =
ArgumentCaptor.forClass(CellIdentityGsm.class);
diff --git a/tests/telephonytests/src/com/android/internal/telephony/LocaleTrackerTest.java b/tests/telephonytests/src/com/android/internal/telephony/LocaleTrackerTest.java
index 5d69ab6..19bf186 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/LocaleTrackerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/LocaleTrackerTest.java
@@ -80,7 +80,7 @@
mCellInfo.setCellIdentity(new CellIdentityGsm(
CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE,
CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE,
- US_MCC, FAKE_MNC, null, null));
+ US_MCC, FAKE_MNC, null, null, Collections.emptyList()));
doAnswer(invocation -> {
Message m = invocation.getArgument(1);
AsyncResult.forMessage(m, Arrays.asList(mCellInfo), null);
diff --git a/tests/telephonytests/src/com/android/internal/telephony/ModemInfoTest.java b/tests/telephonytests/src/com/android/internal/telephony/ModemInfoTest.java
deleted file mode 100644
index 6e646d5..0000000
--- a/tests/telephonytests/src/com/android/internal/telephony/ModemInfoTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.telephony;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-
-import android.os.Parcel;
-import android.telephony.ModemInfo;
-import android.test.suitebuilder.annotation.SmallTest;
-
-import org.junit.Test;
-
-public class ModemInfoTest {
- @Test
- @SmallTest
- public void basicTests() throws Exception {
- int modemId = 1;
- int rat = 2;
- boolean isVoiceSupported = true;
- boolean isDataSupported = false;
- ModemInfo modemInfo = new ModemInfo(modemId, rat, isVoiceSupported, isDataSupported);
-
- assertEquals(modemId, modemInfo.modemId);
- assertEquals(rat, modemInfo.rat);
- assertEquals(isVoiceSupported, modemInfo.isVoiceSupported);
- assertEquals(isDataSupported, modemInfo.isDataSupported);
- assertNotEquals(modemInfo, new ModemInfo(
- modemId + 1, rat, isVoiceSupported, isDataSupported));
- assertNotEquals(modemInfo, new ModemInfo(
- modemId, rat + 1, isVoiceSupported, isDataSupported));
- assertNotEquals(modemInfo, new ModemInfo(modemId, rat, !isVoiceSupported, isDataSupported));
- assertNotEquals(modemInfo, new ModemInfo(modemId, rat, isVoiceSupported, !isDataSupported));
- }
-
- @Test
- @SmallTest
- public void parcelReadWrite() throws Exception {
- int modemId = 1;
- int rat = 2;
- boolean isVoiceSupported = true;
- boolean isDataSupported = false;
- ModemInfo modemInfo = new ModemInfo(modemId, rat, isVoiceSupported, isDataSupported);
-
- Parcel parcel = Parcel.obtain();
- modemInfo.writeToParcel(parcel, 0);
- parcel.setDataPosition(0);
- ModemInfo toCompare = ModemInfo.CREATOR.createFromParcel(parcel);
-
- assertEquals(modemId, toCompare.modemId);
- assertEquals(rat, toCompare.rat);
- assertEquals(isVoiceSupported, toCompare.isVoiceSupported);
- assertEquals(isDataSupported, toCompare.isDataSupported);
- assertEquals(modemInfo, toCompare);
- }
-}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/NetworkScanResultTest.java b/tests/telephonytests/src/com/android/internal/telephony/NetworkScanResultTest.java
index 1b58f36..77398b2 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/NetworkScanResultTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/NetworkScanResultTest.java
@@ -32,6 +32,7 @@
import org.junit.Test;
import java.util.ArrayList;
+import java.util.Collections;
/** Unit tests for {@link NetworkScanResult}. */
public class NetworkScanResultTest {
@@ -41,7 +42,8 @@
public void testParcel() {
ArrayList<CellInfo> infos = new ArrayList<CellInfo>();
- CellIdentityGsm cig = new CellIdentityGsm(1, 2, 40, 5, "001", "01", "test", "tst");
+ CellIdentityGsm cig = new CellIdentityGsm(1, 2, 40, 5, "001", "01", "test", "tst",
+ Collections.emptyList());
CellSignalStrengthGsm cssg = new CellSignalStrengthGsm(5, 6, 7);
CellInfoGsm gsm = new CellInfoGsm();
gsm.setRegistered(true);
@@ -51,7 +53,7 @@
infos.add(gsm);
CellIdentityLte cil = new CellIdentityLte(
- 10, 5, 200, 2000, 10000, "001", "01", "test", "tst");
+ 10, 5, 200, 2000, 10000, "001", "01", "test", "tst", Collections.emptyList(), null);
CellSignalStrengthLte cssl = new CellSignalStrengthLte(15, 16, 17, 18, 19, 20);
CellInfoLte lte = new CellInfoLte();
lte.setRegistered(false);
diff --git a/tests/telephonytests/src/com/android/internal/telephony/PhoneCapabilityTest.java b/tests/telephonytests/src/com/android/internal/telephony/PhoneCapabilityTest.java
index a504dc1..53d80b2 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/PhoneCapabilityTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/PhoneCapabilityTest.java
@@ -20,9 +20,9 @@
import static org.junit.Assert.assertNotEquals;
import android.os.Parcel;
-import android.telephony.ModemInfo;
+import android.telephony.AccessNetworkConstants.AccessNetworkType;
import android.telephony.PhoneCapability;
-import android.test.suitebuilder.annotation.SmallTest;
+import android.telephony.SimSlotCapability;
import org.junit.Test;
@@ -31,53 +31,108 @@
public class PhoneCapabilityTest {
@Test
- @SmallTest
- public void basicTests() throws Exception {
- int maxActiveVoiceCalls = 1;
- int maxActiveData = 2;
- int max5G = 3;
- ModemInfo modemInfo = new ModemInfo(1, 2, true, false);
- List<ModemInfo> logicalModemList = new ArrayList<>();
- logicalModemList.add(modemInfo);
+ public void basicTests() {
+ int utranUeCategoryDl = 1;
+ int utranUeCategoryUl = 2;
+ int eutranUeCategoryDl = 3;
+ int eutranUeCategoryUl = 4;
+ long lingerTime = 5;
+ long supportedRats = 6;
+ List<Integer> geranBands = new ArrayList<>();
+ geranBands.add(1);
+ List<Integer> utranBands = new ArrayList<>();
+ utranBands.add(2);
+ List<Integer> eutranBands = new ArrayList<>();
+ eutranBands.add(3);
+ List<Integer> ngranBands = new ArrayList<>();
+ ngranBands.add(4);
+ List<String> logicalModemUuids = new ArrayList<>();
+ logicalModemUuids.add("com.google.android.lm0");
+ List<SimSlotCapability> simSlotCapabilities = new ArrayList<>();
+ simSlotCapabilities.add(new SimSlotCapability(1, 2));
+ List<List<Long>> concurrentFeaturesSupport = new ArrayList<>();
+ List<Long> feature = new ArrayList<>();
+ feature.add(PhoneCapability.MODEM_FEATURE_CDMA2000_EHRPD_REG);
+ concurrentFeaturesSupport.add(feature);
- PhoneCapability capability = new PhoneCapability(maxActiveVoiceCalls, maxActiveData, max5G,
- logicalModemList, false);
+ PhoneCapability capability = new PhoneCapability(utranUeCategoryDl, utranUeCategoryUl,
+ eutranUeCategoryDl, eutranUeCategoryUl, lingerTime,
+ supportedRats, geranBands, utranBands, eutranBands, ngranBands, logicalModemUuids,
+ simSlotCapabilities, concurrentFeaturesSupport);
- assertEquals(maxActiveVoiceCalls, capability.maxActiveVoiceCalls);
- assertEquals(maxActiveData, capability.maxActiveData);
- assertEquals(max5G, capability.max5G);
- assertEquals(1, capability.logicalModemList.size());
- assertEquals(modemInfo, capability.logicalModemList.get(0));
- PhoneCapability toCompare = new PhoneCapability(
- maxActiveVoiceCalls + 1, maxActiveData - 1, max5G, logicalModemList, false);
- assertEquals(capability, new PhoneCapability(
- maxActiveVoiceCalls, maxActiveData, max5G, logicalModemList, false));
+ assertEquals(utranUeCategoryDl, capability.getUeCategory(false, AccessNetworkType.UTRAN));
+ assertEquals(utranUeCategoryUl, capability.getUeCategory(true, AccessNetworkType.UTRAN));
+ assertEquals(eutranUeCategoryDl, capability.getUeCategory(false, AccessNetworkType.EUTRAN));
+ assertEquals(eutranUeCategoryUl, capability.getUeCategory(true, AccessNetworkType.EUTRAN));
+ assertEquals(lingerTime, capability.getPsDataConnectionLingerTimeMillis());
+ assertEquals(supportedRats, capability.getSupportedRats());
+ assertEquals(geranBands, capability.getBands(AccessNetworkType.GERAN));
+ assertEquals(utranBands, capability.getBands(AccessNetworkType.UTRAN));
+ assertEquals(eutranBands, capability.getBands(AccessNetworkType.EUTRAN));
+ assertEquals(ngranBands, capability.getBands(AccessNetworkType.NGRAN));
+ assertEquals(logicalModemUuids, capability.getLogicalModemUuids());
+ assertEquals(simSlotCapabilities, capability.getSimSlotCapabilities());
+ assertEquals(concurrentFeaturesSupport, capability.getConcurrentFeaturesSupport());
+
+ PhoneCapability toCompare = new PhoneCapability(utranUeCategoryDl + 1,
+ utranUeCategoryUl + 1, eutranUeCategoryDl + 1, eutranUeCategoryUl + 1,
+ lingerTime + 1, supportedRats + 1, geranBands, utranBands, eutranBands, ngranBands,
+ logicalModemUuids, simSlotCapabilities, concurrentFeaturesSupport);
+ assertEquals(capability, new PhoneCapability(utranUeCategoryDl, utranUeCategoryUl,
+ eutranUeCategoryDl, eutranUeCategoryUl, lingerTime,
+ supportedRats, geranBands, utranBands, eutranBands, ngranBands, logicalModemUuids,
+ simSlotCapabilities, concurrentFeaturesSupport));
assertNotEquals(capability, toCompare);
}
@Test
- @SmallTest
- public void parcelReadWrite() throws Exception {
- int maxActiveVoiceCalls = 1;
- int maxActiveData = 2;
- int max5G = 3;
- ModemInfo modemInfo = new ModemInfo(1, 2, true, false);
- List<ModemInfo> logicalModemList = new ArrayList<>();
- logicalModemList.add(modemInfo);
+ public void parcelReadWrite() {
+ int utranUeCategoryDl = 1;
+ int utranUeCategoryUl = 2;
+ int eutranUeCategoryDl = 3;
+ int eutranUeCategoryUl = 4;
+ long lingerTime = 5;
+ long supportedRats = 6;
+ List<Integer> geranBands = new ArrayList<>();
+ geranBands.add(1);
+ List<Integer> utranBands = new ArrayList<>();
+ utranBands.add(2);
+ List<Integer> eutranBands = new ArrayList<>();
+ eutranBands.add(3);
+ List<Integer> ngranBands = new ArrayList<>();
+ ngranBands.add(4);
+ List<String> logicalModemUuids = new ArrayList<>();
+ logicalModemUuids.add("com.google.android.lm0");
+ List<SimSlotCapability> simSlotCapabilities = new ArrayList<>();
+ simSlotCapabilities.add(new SimSlotCapability(1, 2));
+ List<List<Long>> concurrentFeaturesSupport = new ArrayList<>();
+ List<Long> feature = new ArrayList<>();
+ feature.add(PhoneCapability.MODEM_FEATURE_NETWORK_SCAN);
+ concurrentFeaturesSupport.add(feature);
- PhoneCapability capability = new PhoneCapability(maxActiveVoiceCalls, maxActiveData, max5G,
- logicalModemList, false);
+ PhoneCapability capability = new PhoneCapability(utranUeCategoryDl, utranUeCategoryUl,
+ eutranUeCategoryDl, eutranUeCategoryUl, lingerTime,
+ supportedRats, geranBands, utranBands, eutranBands, ngranBands, logicalModemUuids,
+ simSlotCapabilities, concurrentFeaturesSupport);
Parcel parcel = Parcel.obtain();
capability.writeToParcel(parcel, 0);
parcel.setDataPosition(0);
PhoneCapability toCompare = PhoneCapability.CREATOR.createFromParcel(parcel);
- assertEquals(maxActiveVoiceCalls, toCompare.maxActiveVoiceCalls);
- assertEquals(maxActiveData, toCompare.maxActiveData);
- assertEquals(max5G, toCompare.max5G);
- assertEquals(1, toCompare.logicalModemList.size());
- assertEquals(modemInfo, toCompare.logicalModemList.get(0));
+ assertEquals(utranUeCategoryDl, capability.getUeCategory(false, AccessNetworkType.UTRAN));
+ assertEquals(utranUeCategoryUl, capability.getUeCategory(true, AccessNetworkType.UTRAN));
+ assertEquals(eutranUeCategoryDl, capability.getUeCategory(false, AccessNetworkType.EUTRAN));
+ assertEquals(eutranUeCategoryUl, capability.getUeCategory(true, AccessNetworkType.EUTRAN));
+ assertEquals(lingerTime, capability.getPsDataConnectionLingerTimeMillis());
+ assertEquals(supportedRats, capability.getSupportedRats());
+ assertEquals(geranBands, capability.getBands(AccessNetworkType.GERAN));
+ assertEquals(utranBands, capability.getBands(AccessNetworkType.UTRAN));
+ assertEquals(eutranBands, capability.getBands(AccessNetworkType.EUTRAN));
+ assertEquals(ngranBands, capability.getBands(AccessNetworkType.NGRAN));
+ assertEquals(logicalModemUuids, capability.getLogicalModemUuids());
+ assertEquals(simSlotCapabilities, capability.getSimSlotCapabilities());
+ assertEquals(concurrentFeaturesSupport, capability.getConcurrentFeaturesSupport());
assertEquals(capability, toCompare);
}
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/PhoneSwitcherTest.java b/tests/telephonytests/src/com/android/internal/telephony/PhoneSwitcherTest.java
index 362d713..c02c515 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/PhoneSwitcherTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/PhoneSwitcherTest.java
@@ -116,8 +116,8 @@
@Before
public void setUp() throws Exception {
super.setUp(getClass().getSimpleName());
-
- PhoneCapability phoneCapability = new PhoneCapability(1, 1, 0, null, false);
+ PhoneCapability phoneCapability = new PhoneCapability(0, 0, 0, 0, 0, 0,
+ null, null, null, null, null, null, null);
doReturn(phoneCapability).when(mPhoneConfigurationManager).getCurrentPhoneCapability();
doReturn(Call.State.ACTIVE).when(mActiveCall).getState();
diff --git a/tests/telephonytests/src/com/android/internal/telephony/RILTest.java b/tests/telephonytests/src/com/android/internal/telephony/RILTest.java
index d9cef03..5a0fb52 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/RILTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/RILTest.java
@@ -163,6 +163,7 @@
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
@RunWith(AndroidTestingRunner.class)
@@ -1170,7 +1171,7 @@
expected.setRegistered(false);
expected.setTimeStamp(TIMESTAMP);
CellIdentityLte cil = new CellIdentityLte(CI, PCI, TAC, EARFCN, Integer.MAX_VALUE, MCC_STR,
- MNC_STR, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT);
+ MNC_STR, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT, Collections.emptyList(), null);
CellSignalStrengthLte css = new CellSignalStrengthLte(
RSSI, RSRP, RSRQ, RSSNR, CQI, TIMING_ADVANCE);
expected.setCellIdentity(cil);
@@ -1211,7 +1212,8 @@
expected.setRegistered(false);
expected.setTimeStamp(TIMESTAMP);
CellIdentityGsm ci = new CellIdentityGsm(
- LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT);
+ LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT,
+ Collections.emptyList());
CellSignalStrengthGsm cs = new CellSignalStrengthGsm(
RSSI, BIT_ERROR_RATE, TIMING_ADVANCE);
expected.setCellIdentity(ci);
@@ -1251,7 +1253,8 @@
expected.setRegistered(false);
expected.setTimeStamp(TIMESTAMP);
CellIdentityWcdma ci = new CellIdentityWcdma(
- LAC, CID, PSC, UARFCN, MCC_STR, MNC_STR, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT);
+ LAC, CID, PSC, UARFCN, MCC_STR, MNC_STR, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT,
+ Collections.emptyList(), null);
CellSignalStrengthWcdma cs = new CellSignalStrengthWcdma(
RSSI, BIT_ERROR_RATE, Integer.MAX_VALUE, Integer.MAX_VALUE);
expected.setCellIdentity(ci);
@@ -1293,7 +1296,8 @@
expected.setTimeStamp(TIMESTAMP);
expected.setCellConnectionStatus(CellInfo.CONNECTION_NONE);
CellIdentityTdscdma ci = new CellIdentityTdscdma(
- MCC_STR, MNC_STR, LAC, CID, PSC, UARFCN, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT);
+ MCC_STR, MNC_STR, LAC, CID, PSC, UARFCN, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT,
+ Collections.emptyList(), null);
CellSignalStrengthTdscdma cs = new CellSignalStrengthTdscdma(
RSSI, BIT_ERROR_RATE, RSCP);
expected.setCellIdentity(ci);
@@ -1355,7 +1359,8 @@
expected.setRegistered(false);
expected.setTimeStamp(TIMESTAMP);
CellIdentityLte cil = new CellIdentityLte(
- CI, PCI, TAC, EARFCN, BANDWIDTH, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT);
+ CI, PCI, TAC, EARFCN, BANDWIDTH, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
CellSignalStrengthLte css = new CellSignalStrengthLte(
RSSI, RSRP, RSRQ, RSSNR, CQI, TIMING_ADVANCE);
expected.setCellIdentity(cil);
@@ -1376,7 +1381,7 @@
expected.setRegistered(false);
expected.setTimeStamp(TIMESTAMP);
CellIdentityLte cil = new CellIdentityLte(CI, PCI, TAC, EARFCN, BANDWIDTH, MCC_STR, MNC_STR,
- EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT);
+ EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT, Collections.emptyList(), null);
CellSignalStrengthLte css = new CellSignalStrengthLte(
RSSI, RSRP, RSRQ, RSSNR, CQI, TIMING_ADVANCE);
expected.setCellIdentity(cil);
@@ -1399,7 +1404,8 @@
expected.setRegistered(false);
expected.setTimeStamp(TIMESTAMP);
CellIdentityLte cil = new CellIdentityLte(
- CI, PCI, TAC, EARFCN, BANDWIDTH, null, null, ALPHA_LONG, ALPHA_SHORT);
+ CI, PCI, TAC, EARFCN, BANDWIDTH, null, null, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
CellSignalStrengthLte css = new CellSignalStrengthLte(
RSSI, RSRP, RSRQ, RSSNR, CQI, TIMING_ADVANCE);
expected.setCellIdentity(cil);
@@ -1419,7 +1425,8 @@
expected.setRegistered(false);
expected.setTimeStamp(TIMESTAMP);
CellIdentityGsm ci = new CellIdentityGsm(
- LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT);
+ LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList());
CellSignalStrengthGsm cs = new CellSignalStrengthGsm(
RSSI, BIT_ERROR_RATE, TIMING_ADVANCE);
expected.setCellIdentity(ci);
@@ -1440,7 +1447,8 @@
expected.setRegistered(false);
expected.setTimeStamp(TIMESTAMP);
CellIdentityGsm ci = new CellIdentityGsm(
- LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT);
+ LAC, CID, ARFCN, BSIC, MCC_STR, MNC_STR, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT,
+ Collections.emptyList());
CellSignalStrengthGsm cs = new CellSignalStrengthGsm(
RSSI, BIT_ERROR_RATE, TIMING_ADVANCE);
expected.setCellIdentity(ci);
@@ -1463,7 +1471,8 @@
expected.setRegistered(false);
expected.setTimeStamp(TIMESTAMP);
CellIdentityGsm ci = new CellIdentityGsm(
- LAC, CID, ARFCN, BSIC, null, null, ALPHA_LONG, ALPHA_SHORT);
+ LAC, CID, ARFCN, BSIC, null, null, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList());
CellSignalStrengthGsm cs = new CellSignalStrengthGsm(
RSSI, BIT_ERROR_RATE, TIMING_ADVANCE);
expected.setCellIdentity(ci);
@@ -1484,7 +1493,8 @@
expected.setRegistered(false);
expected.setTimeStamp(TIMESTAMP);
CellIdentityWcdma ci = new CellIdentityWcdma(
- LAC, CID, PSC, UARFCN, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT);
+ LAC, CID, PSC, UARFCN, MCC_STR, MNC_STR, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
CellSignalStrengthWcdma cs =
new CellSignalStrengthWcdma(RSSI, BIT_ERROR_RATE, RSCP, ECNO);
expected.setCellIdentity(ci);
@@ -1505,7 +1515,8 @@
expected.setRegistered(false);
expected.setTimeStamp(TIMESTAMP);
CellIdentityWcdma ci = new CellIdentityWcdma(
- LAC, CID, PSC, UARFCN, MCC_STR, MNC_STR, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT);
+ LAC, CID, PSC, UARFCN, MCC_STR, MNC_STR, EMPTY_ALPHA_LONG, EMPTY_ALPHA_SHORT,
+ Collections.emptyList(), null);
CellSignalStrengthWcdma cs = new CellSignalStrengthWcdma(
RSSI, BIT_ERROR_RATE, RSCP, ECNO);
expected.setCellIdentity(ci);
@@ -1528,7 +1539,8 @@
expected.setRegistered(false);
expected.setTimeStamp(TIMESTAMP);
CellIdentityWcdma ci = new CellIdentityWcdma(
- LAC, CID, PSC, UARFCN, null, null, ALPHA_LONG, ALPHA_SHORT);
+ LAC, CID, PSC, UARFCN, null, null, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList(), null);
CellSignalStrengthWcdma cs = new CellSignalStrengthWcdma(
RSSI, BIT_ERROR_RATE, RSCP, ECNO);
expected.setCellIdentity(ci);
@@ -1612,8 +1624,9 @@
CellSignalStrengthNr signalStrengthNr =
(CellSignalStrengthNr) cellInfoNr.getCellSignalStrength();
- CellIdentityNr expectedCellIdentity = new CellIdentityNr(PCI, TAC, NRARFCN, MCC_STR,
- MNC_STR, CI, ALPHA_LONG, ALPHA_SHORT);
+ CellIdentityNr expectedCellIdentity = new CellIdentityNr(PCI, TAC, NRARFCN,
+ CellInfo.UNAVAILABLE, MCC_STR, MNC_STR, CI, ALPHA_LONG, ALPHA_SHORT,
+ Collections.emptyList());
CellSignalStrengthNr expectedSignalStrength = new CellSignalStrengthNr(-RSRP, -RSRQ,
SIGNAL_NOISE_RATIO, -RSRP, -RSRQ, SIGNAL_NOISE_RATIO);
@@ -1638,17 +1651,26 @@
result10.pcscf = "fd00:976a:c206:20::6 fd00:976a:c206:20::9 fd00:976a:c202:1d::9";
result10.mtu = 1500;
- DataCallResponse response = new DataCallResponse(0, -1, 0, 2, ApnSetting.PROTOCOL_IPV4V6,
- "ifname",
- Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress("10.0.2.15"), 32),
- new LinkAddress("2607:fb90:a620:651d:eabe:f8da:c107:44be/64")),
- Arrays.asList(InetAddresses.parseNumericAddress("10.0.2.3"),
- InetAddresses.parseNumericAddress("fd00:976a::9")),
- Arrays.asList(InetAddresses.parseNumericAddress("10.0.2.15"),
- InetAddresses.parseNumericAddress("fe80::2")),
- Arrays.asList(InetAddresses.parseNumericAddress("fd00:976a:c206:20::6"),
+ DataCallResponse response = new DataCallResponse.Builder()
+ .setCause(0)
+ .setSuggestedRetryTime(-1)
+ .setId(0)
+ .setLinkStatus(2)
+ .setProtocolType(ApnSetting.PROTOCOL_IPV4V6)
+ .setInterfaceName("ifname")
+ .setAddresses(Arrays.asList(
+ new LinkAddress(InetAddresses.parseNumericAddress("10.0.2.15"), 32),
+ new LinkAddress("2607:fb90:a620:651d:eabe:f8da:c107:44be/64")))
+ .setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress("10.0.2.3"),
+ InetAddresses.parseNumericAddress("fd00:976a::9")))
+ .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress("10.0.2.15"),
+ InetAddresses.parseNumericAddress("fe80::2")))
+ .setPcscfAddresses(Arrays.asList(
+ InetAddresses.parseNumericAddress("fd00:976a:c206:20::6"),
InetAddresses.parseNumericAddress("fd00:976a:c206:20::9"),
- InetAddresses.parseNumericAddress("fd00:976a:c202:1d::9")), 1500);
+ InetAddresses.parseNumericAddress("fd00:976a:c202:1d::9")))
+ .setMtu(1500)
+ .build();
assertEquals(response, RIL.convertDataCallResult(result10));
diff --git a/tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java b/tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java
index 0b4c6aa..2353bd8 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java
@@ -108,6 +108,7 @@
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@@ -470,7 +471,8 @@
private CellInfoGsm getCellInfoGsm() {
CellInfoGsm tmp = new CellInfoGsm();
- tmp.setCellIdentity(new CellIdentityGsm(0, 1, 900, 5, "001", "01", "test", "tst"));
+ tmp.setCellIdentity(new CellIdentityGsm(0, 1, 900, 5, "001", "01", "test", "tst",
+ Collections.emptyList()));
tmp.setCellSignalStrength(new CellSignalStrengthGsm(-85, 2, 3));
return tmp;
}
@@ -839,7 +841,7 @@
// TODO(nharold): we probably should remove support for this procedure (GET_LOC)
public void testGsmCellLocation() {
CellIdentityGsm cellIdentityGsm = new CellIdentityGsm(
- 2, 3, 900, 5, "001", "01", "test", "tst");
+ 2, 3, 900, 5, "001", "01", "test", "tst", Collections.emptyList());
NetworkRegistrationInfo result = new NetworkRegistrationInfo.Builder()
.setDomain(NetworkRegistrationInfo.DOMAIN_CS)
@@ -1938,7 +1940,8 @@
@Test
public void testRatRatchet() throws Exception {
CellIdentityGsm cellIdentity =
- new CellIdentityGsm(0, 1, 900, 5, "001", "01", "test", "tst");
+ new CellIdentityGsm(0, 1, 900, 5, "001", "01", "test", "tst",
+ Collections.emptyList());
// start on GPRS
changeRegState(1, cellIdentity, 16, 1);
assertEquals(ServiceState.STATE_IN_SERVICE, sst.getCurrentDataConnectionState());
@@ -1956,14 +1959,16 @@
@Test
public void testRatRatchetWithCellChange() throws Exception {
CellIdentityGsm cellIdentity =
- new CellIdentityGsm(0, 1, 900, 5, "001", "01", "test", "tst");
+ new CellIdentityGsm(0, 1, 900, 5, "001", "01", "test", "tst",
+ Collections.emptyList());
// update data reg state to be in service
changeRegState(1, cellIdentity, 16, 2);
assertEquals(ServiceState.STATE_IN_SERVICE, sst.getCurrentDataConnectionState());
assertEquals(ServiceState.RIL_RADIO_TECHNOLOGY_GSM, sst.mSS.getRilVoiceRadioTechnology());
assertEquals(ServiceState.RIL_RADIO_TECHNOLOGY_EDGE, sst.mSS.getRilDataRadioTechnology());
// RAT: EDGE -> GPRS cell ID: 1 -> 2
- cellIdentity = new CellIdentityGsm(0, 2, 900, 5, "001", "01", "test", "tst");
+ cellIdentity = new CellIdentityGsm(0, 2, 900, 5, "001", "01", "test", "tst",
+ Collections.emptyList());
changeRegState(1, cellIdentity, 16, 1);
assertEquals(ServiceState.RIL_RADIO_TECHNOLOGY_GPRS, sst.mSS.getRilDataRadioTechnology());
@@ -1978,7 +1983,8 @@
public void testRatRatchetWithCellChangeBeforeRatChange() throws Exception {
// cell ID update
CellIdentityGsm cellIdentity =
- new CellIdentityGsm(0, 1, 900, 5, "001", "01", "test", "tst");
+ new CellIdentityGsm(0, 1, 900, 5, "001", "01", "test", "tst",
+ Collections.emptyList());
changeRegState(1, cellIdentity, 16, 2);
assertEquals(ServiceState.STATE_IN_SERVICE, sst.getCurrentDataConnectionState());
assertEquals(ServiceState.RIL_RADIO_TECHNOLOGY_EDGE, sst.mSS.getRilDataRadioTechnology());
@@ -2037,7 +2043,8 @@
public void testPhyChanBandwidthUpdatedOnDataRegState() throws Exception {
// Cell ID change should trigger hasLocationChanged.
CellIdentityLte cellIdentity5 =
- new CellIdentityLte(1, 1, 5, 1, 5000, "001", "01", "test", "tst");
+ new CellIdentityLte(1, 1, 5, 1, 5000, "001", "01", "test", "tst",
+ Collections.emptyList(), null);
sendPhyChanConfigChange(new int[] {10000});
sendRegStateUpdateForLteCellId(cellIdentity5);
@@ -2048,7 +2055,8 @@
public void testPhyChanBandwidthNotUpdatedWhenInvalidInCellIdentity() throws Exception {
// Cell ID change should trigger hasLocationChanged.
CellIdentityLte cellIdentityInv =
- new CellIdentityLte(1, 1, 5, 1, 12345, "001", "01", "test", "tst");
+ new CellIdentityLte(1, 1, 5, 1, 12345, "001", "01", "test", "tst",
+ Collections.emptyList(), null);
sendPhyChanConfigChange(new int[] {10000});
sendRegStateUpdateForLteCellId(cellIdentityInv);
@@ -2059,7 +2067,8 @@
public void testPhyChanBandwidthPrefersCarrierAggregationReport() throws Exception {
// Cell ID change should trigger hasLocationChanged.
CellIdentityLte cellIdentity10 =
- new CellIdentityLte(1, 1, 5, 1, 10000, "001", "01", "test", "tst");
+ new CellIdentityLte(1, 1, 5, 1, 10000, "001", "01", "test", "tst",
+ Collections.emptyList(), null);
sendPhyChanConfigChange(new int[] {10000, 5000});
sendRegStateUpdateForLteCellId(cellIdentity10);
@@ -2070,7 +2079,8 @@
public void testPhyChanBandwidthRatchetedOnPhyChanBandwidth() throws Exception {
// LTE Cell with bandwidth = 10000
CellIdentityLte cellIdentity10 =
- new CellIdentityLte(1, 1, 1, 1, 10000, "1", "1", "test", "tst");
+ new CellIdentityLte(1, 1, 1, 1, 10000, "1", "1", "test", "tst",
+ Collections.emptyList(), null);
sendRegStateUpdateForLteCellId(cellIdentity10);
assertTrue(Arrays.equals(new int[] {10000}, sst.mSS.getCellBandwidths()));
@@ -2117,7 +2127,8 @@
// Start state: Cell data only LTE + IWLAN
CellIdentityLte cellIdentity =
- new CellIdentityLte(1, 1, 5, 1, 5000, "001", "01", "test", "tst");
+ new CellIdentityLte(1, 1, 5, 1, 5000, "001", "01", "test", "tst",
+ Collections.emptyList(), null);
changeRegStateWithIwlan(
// WWAN
NetworkRegistrationInfo.REGISTRATION_STATE_HOME, cellIdentity,
@@ -2272,7 +2283,8 @@
sst.mSS = ss;
CellIdentityLte cellId =
- new CellIdentityLte(1, 1, 5, 1, 5000, "001", "01", "test", "tst");
+ new CellIdentityLte(1, 1, 5, 1, 5000, "001", "01", "test", "tst",
+ Collections.emptyList(), null);
LteVopsSupportInfo lteVopsSupportInfo =
new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED,
LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED);
diff --git a/tests/telephonytests/src/com/android/internal/telephony/SimSlotCapabilityTest.java b/tests/telephonytests/src/com/android/internal/telephony/SimSlotCapabilityTest.java
new file mode 100644
index 0000000..8763c82
--- /dev/null
+++ b/tests/telephonytests/src/com/android/internal/telephony/SimSlotCapabilityTest.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.telephony;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
+import android.os.Parcel;
+import android.telephony.SimSlotCapability;
+
+import org.junit.Test;
+
+public class SimSlotCapabilityTest {
+ @Test
+ public void basicTests() {
+ int physicalSlotId = 0;
+ int slotType = SimSlotCapability.SLOT_TYPE_UICC;
+
+ SimSlotCapability capability = new SimSlotCapability(physicalSlotId, slotType);
+ assertEquals(physicalSlotId, capability.getPhysicalSlotIndex());
+ assertEquals(slotType, capability.getSlotType());
+
+ SimSlotCapability toCompare = new SimSlotCapability(physicalSlotId + 1,
+ SimSlotCapability.SLOT_TYPE_IUICC);
+ assertEquals(capability, new SimSlotCapability(physicalSlotId, slotType));
+ assertNotEquals(capability, toCompare);
+ }
+
+ @Test
+ public void parcelReadWrite() {
+ int physicalSlotId = 0;
+ int slotType = SimSlotCapability.SLOT_TYPE_EUICC;
+
+ SimSlotCapability capability = new SimSlotCapability(physicalSlotId, slotType);
+
+ Parcel parcel = Parcel.obtain();
+ capability.writeToParcel(parcel, 0);
+ parcel.setDataPosition(0);
+ SimSlotCapability toCompare = SimSlotCapability.CREATOR.createFromParcel(parcel);
+
+ assertEquals(physicalSlotId, capability.getPhysicalSlotIndex());
+ assertEquals(slotType, capability.getSlotType());
+ assertEquals(capability, toCompare);
+ }
+}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/SimulatedCommands.java b/tests/telephonytests/src/com/android/internal/telephony/SimulatedCommands.java
index 9269a2f..9b5d104 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/SimulatedCommands.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/SimulatedCommands.java
@@ -43,7 +43,6 @@
import android.telephony.ImsiEncryptionInfo;
import android.telephony.NetworkRegistrationInfo;
import android.telephony.NetworkScanRequest;
-import com.android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.SignalThresholdInfo;
@@ -71,6 +70,7 @@
import com.android.internal.telephony.uicc.IccCardStatus;
import com.android.internal.telephony.uicc.IccIoResult;
import com.android.internal.telephony.uicc.IccSlotStatus;
+import com.android.telephony.Rlog;
import java.util.ArrayList;
import java.util.List;
@@ -1406,8 +1406,9 @@
@Override
public void exitEmergencyCallbackMode(Message result) {unimplemented(result);}
@Override
- public void setNetworkSelectionModeManual(
- String operatorNumeric, Message result) {unimplemented(result);}
+ public void setNetworkSelectionModeManual(String operatorNumeric, int ran, Message result) {
+ unimplemented(result);
+ }
/**
* Queries whether the current network selection mode is automatic
diff --git a/tests/telephonytests/src/com/android/internal/telephony/SimulatedCommandsVerifier.java b/tests/telephonytests/src/com/android/internal/telephony/SimulatedCommandsVerifier.java
index 7e82719..d1cc359 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/SimulatedCommandsVerifier.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/SimulatedCommandsVerifier.java
@@ -948,7 +948,7 @@
}
@Override
- public void setNetworkSelectionModeManual(String operatorNumeric, Message response) {
+ public void setNetworkSelectionModeManual(String operatorNumeric, int ran, Message response) {
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/TelephonyRegistryTest.java b/tests/telephonytests/src/com/android/internal/telephony/TelephonyRegistryTest.java
index 0a40be4..577601e 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/TelephonyRegistryTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/TelephonyRegistryTest.java
@@ -129,16 +129,17 @@
doReturn(mMockSubInfo).when(mSubscriptionManager).getActiveSubscriptionInfo(anyInt());
doReturn(0/*slotIndex*/).when(mMockSubInfo).getSimSlotIndex();
// mTelephonyRegistry.listen with notifyNow = true should trigger callback immediately.
- PhoneCapability phoneCapability = new PhoneCapability(1, 2, 3, null, false);
+ PhoneCapability phoneCapability = new PhoneCapability(1, 2, 3, 4, 5, 6,
+ null, null, null, null, null, null, null);
mTelephonyRegistry.notifyPhoneCapabilityChanged(phoneCapability);
mTelephonyRegistry.listenWithFeature(mContext.getOpPackageName(), mContext.getFeatureId(),
- mPhoneStateListener.callback,
- LISTEN_PHONE_CAPABILITY_CHANGE, true);
+ mPhoneStateListener.callback, LISTEN_PHONE_CAPABILITY_CHANGE, true);
processAllMessages();
assertEquals(phoneCapability, mPhoneCapability);
// notifyPhoneCapabilityChanged with a new capability. Callback should be triggered.
- phoneCapability = new PhoneCapability(3, 2, 2, null, false);
+ phoneCapability = new PhoneCapability(6, 5, 4, 3, 2, 1,
+ null, null, null, null, null, null, null);
mTelephonyRegistry.notifyPhoneCapabilityChanged(phoneCapability);
processAllMessages();
assertEquals(phoneCapability, mPhoneCapability);
@@ -295,4 +296,45 @@
processAllMessages();
assertEquals(mPhoneStateListener.invocationCount.get(), 4);
}
+
+ /**
+ * Validate that SecuirtyException is thrown when we try to listen without permission
+ * READ_PRECISE_PHONE_STATE.
+ */
+ @Test
+ @SmallTest
+ public void testListenWithoutPermission() {
+ // Clear all permission grants for test.
+ mContextFixture.addCallingOrSelfPermission("");
+
+ assertThrowSecurityExceptionWhenListenWithoutPermission(
+ PhoneStateListener.LISTEN_PRECISE_CALL_STATE,
+ "LISTEN_PRECISE_CALL_STATE");
+
+ assertThrowSecurityExceptionWhenListenWithoutPermission(
+ PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE,
+ "LISTEN_PRECISE_DATA_CONNECTION_STATE");
+
+ assertThrowSecurityExceptionWhenListenWithoutPermission(
+ PhoneStateListener.LISTEN_CALL_DISCONNECT_CAUSES,
+ "LISTEN_CALL_DISCONNECT_CAUSES");
+
+ assertThrowSecurityExceptionWhenListenWithoutPermission(
+ PhoneStateListener.LISTEN_CALL_ATTRIBUTES_CHANGED,
+ "LISTEN_CALL_ATTRIBUTES_CHANGED");
+
+ assertThrowSecurityExceptionWhenListenWithoutPermission(
+ PhoneStateListener.LISTEN_IMS_CALL_DISCONNECT_CAUSES,
+ "LISTEN_IMS_CALL_DISCONNECT_CAUSES");
+ }
+
+ private void assertThrowSecurityExceptionWhenListenWithoutPermission(int event,
+ String eventDesc) {
+ try {
+ mTelephonyRegistry.listen(mContext.getOpPackageName(),
+ mPhoneStateListener.callback, event, true);
+ fail("SecurityException should throw when listen " + eventDesc + " without permission");
+ } catch (SecurityException expected) {
+ }
+ }
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/dataconnection/DataCallResponseTest.java b/tests/telephonytests/src/com/android/internal/telephony/dataconnection/DataCallResponseTest.java
index f923700..529e81e 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/dataconnection/DataCallResponseTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/dataconnection/DataCallResponseTest.java
@@ -36,13 +36,22 @@
@SmallTest
public void testParcel() throws Exception {
- DataCallResponse response = new DataCallResponse(0, -1, 1, 2,
- ApnSetting.PROTOCOL_IP, FAKE_IFNAME,
- Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)),
- 1440);
+ DataCallResponse response = new DataCallResponse.Builder()
+ .setCause(0)
+ .setSuggestedRetryTime(-1)
+ .setId(1)
+ .setLinkStatus(2)
+ .setProtocolType(ApnSetting.PROTOCOL_IP)
+ .setInterfaceName(FAKE_IFNAME)
+ .setAddresses(Arrays.asList(
+ new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)))
+ .setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)))
+ .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)))
+ .setPcscfAddresses(
+ Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)))
+ .setMtuV4(1440)
+ .setMtuV6(1440)
+ .build();
Parcel p = Parcel.obtain();
response.writeToParcel(p, 0);
@@ -54,34 +63,62 @@
@SmallTest
public void testEquals() throws Exception {
- DataCallResponse response = new DataCallResponse(0, -1, 1, 2,
- ApnSetting.PROTOCOL_IP, FAKE_IFNAME,
- Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)),
- 1440);
+ DataCallResponse response = new DataCallResponse.Builder()
+ .setCause(0)
+ .setSuggestedRetryTime(-1)
+ .setId(1)
+ .setLinkStatus(2)
+ .setProtocolType(ApnSetting.PROTOCOL_IP)
+ .setInterfaceName(FAKE_IFNAME)
+ .setAddresses(Arrays.asList(
+ new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)))
+ .setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)))
+ .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)))
+ .setPcscfAddresses(
+ Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)))
+ .setMtuV4(1440)
+ .setMtuV6(1400)
+ .build();
- DataCallResponse response1 = new DataCallResponse(0, -1, 1, 2,
- ApnSetting.PROTOCOL_IP, FAKE_IFNAME,
- Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)),
- 1440);
+ DataCallResponse response1 = new DataCallResponse.Builder()
+ .setCause(0)
+ .setSuggestedRetryTime(-1)
+ .setId(1)
+ .setLinkStatus(2)
+ .setProtocolType(ApnSetting.PROTOCOL_IP)
+ .setInterfaceName(FAKE_IFNAME)
+ .setAddresses(Arrays.asList(
+ new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)))
+ .setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)))
+ .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)))
+ .setPcscfAddresses(
+ Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)))
+ .setMtuV4(1440)
+ .setMtuV6(1400)
+ .build();
assertEquals(response, response);
assertEquals(response, response1);
- DataCallResponse response2 = new DataCallResponse(1, -1, 1, 3,
- ApnSetting.PROTOCOL_IP, FAKE_IFNAME,
- Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS),
- InetAddresses.parseNumericAddress(FAKE_DNS)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS),
- InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)),
- 1441);
+ DataCallResponse response2 = new DataCallResponse.Builder()
+ .setCause(1)
+ .setSuggestedRetryTime(-1)
+ .setId(1)
+ .setLinkStatus(3)
+ .setProtocolType(ApnSetting.PROTOCOL_IP)
+ .setInterfaceName(FAKE_IFNAME)
+ .setAddresses(Arrays.asList(
+ new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)))
+ .setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS),
+ InetAddresses.parseNumericAddress(FAKE_DNS)))
+ .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)))
+ .setPcscfAddresses(Arrays.asList(
+ InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS),
+ InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)))
+ .setMtuV4(1441)
+ .setMtuV6(1440)
+ .build();
+
assertNotSame(response1, response2);
assertNotSame(response1, null);
assertNotSame(response1, new String[1]);
diff --git a/tests/telephonytests/src/com/android/internal/telephony/dataconnection/DataConnectionTest.java b/tests/telephonytests/src/com/android/internal/telephony/dataconnection/DataConnectionTest.java
index 2d6192c..f7534e7 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/dataconnection/DataConnectionTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/dataconnection/DataConnectionTest.java
@@ -18,8 +18,8 @@
import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_CONGESTED;
import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_METERED;
-import static android.net.NetworkPolicyManager.OVERRIDE_CONGESTED;
-import static android.net.NetworkPolicyManager.OVERRIDE_UNMETERED;
+import static android.net.NetworkPolicyManager.SUBSCRIPTION_OVERRIDE_CONGESTED;
+import static android.net.NetworkPolicyManager.SUBSCRIPTION_OVERRIDE_UNMETERED;
import static com.android.internal.telephony.TelephonyTestUtils.waitForMs;
import static com.android.internal.telephony.dataconnection.DcTrackerTest.FAKE_ADDRESS;
@@ -425,77 +425,138 @@
@Test
@SmallTest
public void testModemSuggestRetry() throws Exception {
- DataCallResponse response = new DataCallResponse(0, 0, 1, 2,
- ApnSetting.PROTOCOL_IP, FAKE_IFNAME,
- Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)),
- 1440);
-
+ DataCallResponse response = new DataCallResponse.Builder()
+ .setCause(0)
+ .setSuggestedRetryTime(0)
+ .setId(1)
+ .setLinkStatus(2)
+ .setProtocolType(ApnSetting.PROTOCOL_IP)
+ .setInterfaceName(FAKE_IFNAME)
+ .setAddresses(Arrays.asList(
+ new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)))
+ .setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)))
+ .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)))
+ .setPcscfAddresses(
+ Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)))
+ .setMtuV4(1440)
+ .setMtuV6(1440)
+ .build();
assertEquals(response.getSuggestedRetryTime(), getSuggestedRetryDelay(response));
- response = new DataCallResponse(0, 1000, 1, 2,
- ApnSetting.PROTOCOL_IP, FAKE_IFNAME,
- Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)),
- 1440);
+ response = new DataCallResponse.Builder()
+ .setCause(0)
+ .setSuggestedRetryTime(1000)
+ .setId(1)
+ .setLinkStatus(2)
+ .setProtocolType(ApnSetting.PROTOCOL_IP)
+ .setInterfaceName(FAKE_IFNAME)
+ .setAddresses(Arrays.asList(
+ new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)))
+ .setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)))
+ .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)))
+ .setPcscfAddresses(
+ Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)))
+ .setMtuV4(1440)
+ .setMtuV6(1440)
+ .build();
assertEquals(response.getSuggestedRetryTime(), getSuggestedRetryDelay(response));
- response = new DataCallResponse(0, 9999, 1, 2,
- ApnSetting.PROTOCOL_IP, FAKE_IFNAME,
- Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)),
- 1440);
+ response = new DataCallResponse.Builder()
+ .setCause(0)
+ .setSuggestedRetryTime(9999)
+ .setId(1)
+ .setLinkStatus(2)
+ .setProtocolType(ApnSetting.PROTOCOL_IP)
+ .setInterfaceName(FAKE_IFNAME)
+ .setAddresses(Arrays.asList(
+ new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)))
+ .setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)))
+ .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)))
+ .setPcscfAddresses(
+ Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)))
+ .setMtuV4(1440)
+ .setMtuV6(1440)
+ .build();
assertEquals(response.getSuggestedRetryTime(), getSuggestedRetryDelay(response));
}
@Test
@SmallTest
public void testModemNotSuggestRetry() throws Exception {
- DataCallResponse response = new DataCallResponse(0, -1, 1, 2,
- ApnSetting.PROTOCOL_IP, FAKE_IFNAME,
- Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)),
- 1440);
-
+ DataCallResponse response = new DataCallResponse.Builder()
+ .setCause(0)
+ .setSuggestedRetryTime(-1)
+ .setId(1)
+ .setLinkStatus(2)
+ .setProtocolType(ApnSetting.PROTOCOL_IP)
+ .setInterfaceName(FAKE_IFNAME)
+ .setAddresses(Arrays.asList(
+ new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)))
+ .setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)))
+ .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)))
+ .setPcscfAddresses(
+ Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)))
+ .setMtuV4(1440)
+ .setMtuV6(1440)
+ .build();
assertEquals(RetryManager.NO_SUGGESTED_RETRY_DELAY, getSuggestedRetryDelay(response));
- response = new DataCallResponse(0, -5, 1, 2,
- ApnSetting.PROTOCOL_IP, FAKE_IFNAME,
- Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)),
- 1440);
+ response = new DataCallResponse.Builder()
+ .setCause(0)
+ .setSuggestedRetryTime(-5)
+ .setId(1)
+ .setLinkStatus(2)
+ .setProtocolType(ApnSetting.PROTOCOL_IP)
+ .setInterfaceName(FAKE_IFNAME)
+ .setAddresses(Arrays.asList(
+ new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)))
+ .setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)))
+ .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)))
+ .setPcscfAddresses(
+ Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)))
+ .setMtuV4(1440)
+ .setMtuV6(1440)
+ .build();
assertEquals(RetryManager.NO_SUGGESTED_RETRY_DELAY, getSuggestedRetryDelay(response));
- response = new DataCallResponse(0, Integer.MIN_VALUE, 1, 2,
- ApnSetting.PROTOCOL_IP, FAKE_IFNAME,
- Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)),
- 1440);
+ response = new DataCallResponse.Builder()
+ .setCause(0)
+ .setSuggestedRetryTime(Integer.MIN_VALUE)
+ .setId(1)
+ .setLinkStatus(2)
+ .setProtocolType(ApnSetting.PROTOCOL_IP)
+ .setInterfaceName(FAKE_IFNAME)
+ .setAddresses(Arrays.asList(
+ new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)))
+ .setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)))
+ .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)))
+ .setPcscfAddresses(
+ Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)))
+ .setMtuV4(1440)
+ .setMtuV6(1440)
+ .build();
assertEquals(RetryManager.NO_SUGGESTED_RETRY_DELAY, getSuggestedRetryDelay(response));
}
@Test
@SmallTest
public void testModemSuggestNoRetry() throws Exception {
- DataCallResponse response = new DataCallResponse(0, Integer.MAX_VALUE, 1, 2,
- ApnSetting.PROTOCOL_IP, FAKE_IFNAME,
- Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)),
- 1440);
+ DataCallResponse response = new DataCallResponse.Builder()
+ .setCause(0)
+ .setSuggestedRetryTime(Integer.MAX_VALUE)
+ .setId(1)
+ .setLinkStatus(2)
+ .setProtocolType(ApnSetting.PROTOCOL_IP)
+ .setInterfaceName(FAKE_IFNAME)
+ .setAddresses(Arrays.asList(
+ new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)))
+ .setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)))
+ .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)))
+ .setPcscfAddresses(
+ Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)))
+ .setMtuV4(1440)
+ .setMtuV6(1440)
+ .build();
assertEquals(RetryManager.NO_RETRY, getSuggestedRetryDelay(response));
}
@@ -590,12 +651,13 @@
assertFalse(getNetworkCapabilities().hasCapability(NET_CAPABILITY_NOT_METERED));
assertTrue(getNetworkCapabilities().hasCapability(NET_CAPABILITY_NOT_CONGESTED));
- mDc.onSubscriptionOverride(OVERRIDE_UNMETERED, OVERRIDE_UNMETERED);
+ mDc.onSubscriptionOverride(SUBSCRIPTION_OVERRIDE_UNMETERED,
+ SUBSCRIPTION_OVERRIDE_UNMETERED);
assertTrue(getNetworkCapabilities().hasCapability(NET_CAPABILITY_NOT_METERED));
assertTrue(getNetworkCapabilities().hasCapability(NET_CAPABILITY_NOT_CONGESTED));
- mDc.onSubscriptionOverride(OVERRIDE_UNMETERED, 0);
+ mDc.onSubscriptionOverride(SUBSCRIPTION_OVERRIDE_UNMETERED, 0);
assertFalse(getNetworkCapabilities().hasCapability(NET_CAPABILITY_NOT_METERED));
assertTrue(getNetworkCapabilities().hasCapability(NET_CAPABILITY_NOT_CONGESTED));
@@ -611,12 +673,13 @@
assertFalse(getNetworkCapabilities().hasCapability(NET_CAPABILITY_NOT_METERED));
assertTrue(getNetworkCapabilities().hasCapability(NET_CAPABILITY_NOT_CONGESTED));
- mDc.onSubscriptionOverride(OVERRIDE_CONGESTED, OVERRIDE_CONGESTED);
+ mDc.onSubscriptionOverride(SUBSCRIPTION_OVERRIDE_CONGESTED,
+ SUBSCRIPTION_OVERRIDE_CONGESTED);
assertFalse(getNetworkCapabilities().hasCapability(NET_CAPABILITY_NOT_METERED));
assertFalse(getNetworkCapabilities().hasCapability(NET_CAPABILITY_NOT_CONGESTED));
- mDc.onSubscriptionOverride(OVERRIDE_CONGESTED, 0);
+ mDc.onSubscriptionOverride(SUBSCRIPTION_OVERRIDE_CONGESTED, 0);
assertFalse(getNetworkCapabilities().hasCapability(NET_CAPABILITY_NOT_METERED));
assertTrue(getNetworkCapabilities().hasCapability(NET_CAPABILITY_NOT_CONGESTED));
@@ -675,14 +738,22 @@
@Test
@SmallTest
public void testSetLinkProperties() throws Exception {
-
- DataCallResponse response = new DataCallResponse(0, -1, 1, 2,
- ApnSetting.PROTOCOL_IP, FAKE_IFNAME,
- Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)),
- 1440);
+ DataCallResponse response = new DataCallResponse.Builder()
+ .setCause(0)
+ .setSuggestedRetryTime(-1)
+ .setId(1)
+ .setLinkStatus(2)
+ .setProtocolType(ApnSetting.PROTOCOL_IP)
+ .setInterfaceName(FAKE_IFNAME)
+ .setAddresses(Arrays.asList(
+ new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)))
+ .setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)))
+ .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)))
+ .setPcscfAddresses(
+ Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)))
+ .setMtuV4(1440)
+ .setMtuV6(1440)
+ .build();
LinkProperties linkProperties = new LinkProperties();
assertEquals(SetupResult.SUCCESS, setLinkProperties(response, linkProperties));
@@ -722,33 +793,45 @@
@Test
@SmallTest
public void testSetLinkPropertiesEmptyAddress() throws Exception {
-
// 224.224.224.224 is an invalid address.
- DataCallResponse response = new DataCallResponse(0, -1, 1, 2,
- ApnSetting.PROTOCOL_IP, FAKE_IFNAME,
- null,
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)),
- 1440);
+ DataCallResponse response = new DataCallResponse.Builder()
+ .setCause(0)
+ .setSuggestedRetryTime(-1)
+ .setId(1)
+ .setLinkStatus(2)
+ .setProtocolType(ApnSetting.PROTOCOL_IP)
+ .setInterfaceName(FAKE_IFNAME)
+ .setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)))
+ .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)))
+ .setPcscfAddresses(
+ Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)))
+ .setMtuV4(1440)
+ .setMtuV6(1440)
+ .build();
LinkProperties linkProperties = new LinkProperties();
- assertEquals(SetupResult.ERROR_INVALID_ARG,
- setLinkProperties(response, linkProperties));
+ assertEquals(SetupResult.ERROR_INVALID_ARG, setLinkProperties(response, linkProperties));
}
@Test
@SmallTest
public void testSetLinkPropertiesEmptyDns() throws Exception {
-
// Empty dns entry.
- DataCallResponse response = new DataCallResponse(0, -1, 1, 2,
- ApnSetting.PROTOCOL_IP, FAKE_IFNAME,
- Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)),
- null,
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)),
- 1440);
+ DataCallResponse response = new DataCallResponse.Builder()
+ .setCause(0)
+ .setSuggestedRetryTime(-1)
+ .setId(1)
+ .setLinkStatus(2)
+ .setProtocolType(ApnSetting.PROTOCOL_IP)
+ .setInterfaceName(FAKE_IFNAME)
+ .setAddresses(Arrays.asList(
+ new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)))
+ .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)))
+ .setPcscfAddresses(
+ Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)))
+ .setMtuV4(1440)
+ .setMtuV6(1440)
+ .build();
// Make sure no exception was thrown
LinkProperties linkProperties = new LinkProperties();
diff --git a/tests/telephonytests/src/com/android/internal/telephony/dataconnection/DcControllerTest.java b/tests/telephonytests/src/com/android/internal/telephony/dataconnection/DcControllerTest.java
index cfff763..9c1d1a8 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/dataconnection/DcControllerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/dataconnection/DcControllerTest.java
@@ -115,15 +115,23 @@
@SmallTest
public void testDataDormant() throws Exception {
assertEquals("DccDefaultState", getCurrentState().getName());
- ArrayList<DataCallResponse> l = new ArrayList<DataCallResponse>();
- DataCallResponse dcResponse = new DataCallResponse(0, -1, 1,
- DATA_CONNECTION_ACTIVE_PH_LINK_DORMANT, ApnSetting.PROTOCOL_IP, FAKE_IFNAME,
- Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)),
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)),
- 1440);
-
+ ArrayList<DataCallResponse> l = new ArrayList<>();
+ DataCallResponse dcResponse = new DataCallResponse.Builder()
+ .setCause(0)
+ .setSuggestedRetryTime(-1)
+ .setId(1)
+ .setLinkStatus(DATA_CONNECTION_ACTIVE_PH_LINK_DORMANT)
+ .setProtocolType(ApnSetting.PROTOCOL_IP)
+ .setInterfaceName(FAKE_IFNAME)
+ .setAddresses(Arrays.asList(
+ new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)))
+ .setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)))
+ .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)))
+ .setPcscfAddresses(
+ Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)))
+ .setMtuV4(1440)
+ .setMtuV6(1440)
+ .build();
l.add(dcResponse);
mDc.mCid = 1;
diff --git a/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsCallTest.java b/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsCallTest.java
index d64c69d..f84713e 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsCallTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsCallTest.java
@@ -16,25 +16,24 @@
package com.android.internal.telephony.imsphone;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertTrue;
+
import android.os.Bundle;
import android.telephony.ServiceState;
+import android.telephony.TelephonyManager;
+import android.telephony.ims.ImsCallProfile;
import android.test.suitebuilder.annotation.SmallTest;
import com.android.ims.ImsCall;
-import android.telephony.ims.ImsCallProfile;
-
import com.android.internal.telephony.TelephonyTest;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.doReturn;
-
public class ImsCallTest extends TelephonyTest {
private Bundle mBundle;
@@ -54,14 +53,27 @@
@Test
@SmallTest
- public void testSetWifi() {
+ public void testSetWifiDeprecated() {
ImsCall mTestImsCall = new ImsCall(mContext, mTestCallProfile);
assertFalse(mTestImsCall.isWifiCall());
- assertNotEquals(mTestImsCall.getRadioTechnology(), ServiceState.RIL_RADIO_TECHNOLOGY_LTE);
+ assertNotEquals(mTestImsCall.getNetworkType(), TelephonyManager.NETWORK_TYPE_LTE);
+ // use deprecated API
mBundle.putString(ImsCallProfile.EXTRA_CALL_RAT_TYPE,
ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN + "");
assertTrue(mTestImsCall.isWifiCall());
- assertNotEquals(mTestImsCall.getRadioTechnology(), ServiceState.RIL_RADIO_TECHNOLOGY_LTE);
+ assertNotEquals(mTestImsCall.getNetworkType(), TelephonyManager.NETWORK_TYPE_LTE);
+ }
+
+ @Test
+ @SmallTest
+ public void testSetWifi() {
+ ImsCall mTestImsCall = new ImsCall(mContext, mTestCallProfile);
+ assertFalse(mTestImsCall.isWifiCall());
+ assertNotEquals(mTestImsCall.getNetworkType(), TelephonyManager.NETWORK_TYPE_LTE);
+ mBundle.putInt(ImsCallProfile.EXTRA_CALL_NETWORK_TYPE,
+ TelephonyManager.NETWORK_TYPE_IWLAN);
+ assertTrue(mTestImsCall.isWifiCall());
+ assertNotEquals(mTestImsCall.getNetworkType(), TelephonyManager.NETWORK_TYPE_LTE);
}
@Test
@@ -69,11 +81,23 @@
public void testSetWifiAlt() {
ImsCall mTestImsCall = new ImsCall(mContext, mTestCallProfile);
assertFalse(mTestImsCall.isWifiCall());
- assertNotEquals(mTestImsCall.getRadioTechnology(), ServiceState.RIL_RADIO_TECHNOLOGY_LTE);
+ assertNotEquals(mTestImsCall.getNetworkType(), TelephonyManager.NETWORK_TYPE_LTE);
mBundle.putString(ImsCallProfile.EXTRA_CALL_RAT_TYPE_ALT,
ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN + "");
assertTrue(mTestImsCall.isWifiCall());
- assertNotEquals(mTestImsCall.getRadioTechnology(), ServiceState.RIL_RADIO_TECHNOLOGY_LTE);
+ assertNotEquals(mTestImsCall.getNetworkType(), TelephonyManager.NETWORK_TYPE_LTE);
+ }
+
+ @Test
+ @SmallTest
+ public void testSetLteNoWifiDeprecated() {
+ ImsCall mTestImsCall = new ImsCall(mContext, mTestCallProfile);
+ assertFalse(mTestImsCall.isWifiCall());
+ assertNotEquals(mTestImsCall.getNetworkType(), TelephonyManager.NETWORK_TYPE_LTE);
+ mBundle.putString(ImsCallProfile.EXTRA_CALL_RAT_TYPE,
+ ServiceState.RIL_RADIO_TECHNOLOGY_LTE + "");
+ assertFalse(mTestImsCall.isWifiCall());
+ assertEquals(mTestImsCall.getNetworkType(), TelephonyManager.NETWORK_TYPE_LTE);
}
@Test
@@ -81,11 +105,11 @@
public void testSetLteNoWifi() {
ImsCall mTestImsCall = new ImsCall(mContext, mTestCallProfile);
assertFalse(mTestImsCall.isWifiCall());
- assertNotEquals(mTestImsCall.getRadioTechnology(), ServiceState.RIL_RADIO_TECHNOLOGY_LTE);
- mBundle.putString(ImsCallProfile.EXTRA_CALL_RAT_TYPE,
- ServiceState.RIL_RADIO_TECHNOLOGY_LTE + "");
+ assertNotEquals(mTestImsCall.getNetworkType(), TelephonyManager.NETWORK_TYPE_LTE);
+ mBundle.putInt(ImsCallProfile.EXTRA_CALL_NETWORK_TYPE,
+ TelephonyManager.NETWORK_TYPE_LTE);
assertFalse(mTestImsCall.isWifiCall());
- assertEquals(mTestImsCall.getRadioTechnology(), ServiceState.RIL_RADIO_TECHNOLOGY_LTE);
+ assertEquals(mTestImsCall.getNetworkType(), TelephonyManager.NETWORK_TYPE_LTE);
}
@Test
@@ -93,10 +117,10 @@
public void testSetLteNoWifiAlt() {
ImsCall mTestImsCall = new ImsCall(mContext, mTestCallProfile);
assertFalse(mTestImsCall.isWifiCall());
- assertNotEquals(mTestImsCall.getRadioTechnology(), ServiceState.RIL_RADIO_TECHNOLOGY_LTE);
+ assertNotEquals(mTestImsCall.getNetworkType(), TelephonyManager.NETWORK_TYPE_LTE);
mBundle.putString(ImsCallProfile.EXTRA_CALL_RAT_TYPE_ALT,
ServiceState.RIL_RADIO_TECHNOLOGY_LTE + "");
assertFalse(mTestImsCall.isWifiCall());
- assertEquals(mTestImsCall.getRadioTechnology(), ServiceState.RIL_RADIO_TECHNOLOGY_LTE);
+ assertEquals(mTestImsCall.getNetworkType(), TelephonyManager.NETWORK_TYPE_LTE);
}
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneCallTrackerTest.java b/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneCallTrackerTest.java
index d257e45..9434949 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneCallTrackerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneCallTrackerTest.java
@@ -44,7 +44,6 @@
import android.telephony.CarrierConfigManager;
import android.telephony.DisconnectCause;
import android.telephony.PhoneNumberUtils;
-import android.telephony.ServiceState;
import android.telephony.TelephonyManager;
import android.telephony.ims.ImsCallProfile;
import android.telephony.ims.ImsCallSession;
@@ -707,18 +706,18 @@
// First handover from LTE to WIFI; this takes us into a mid-call state.
call.getImsCallSessionListenerProxy().callSessionHandover(call.getCallSession(),
- ServiceState.RIL_RADIO_TECHNOLOGY_LTE, ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN,
+ TelephonyManager.NETWORK_TYPE_LTE, TelephonyManager.NETWORK_TYPE_IWLAN,
new ImsReasonInfo());
// Handover back to LTE.
call.getImsCallSessionListenerProxy().callSessionHandover(call.getCallSession(),
- ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN, ServiceState.RIL_RADIO_TECHNOLOGY_LTE,
+ TelephonyManager.NETWORK_TYPE_IWLAN, TelephonyManager.NETWORK_TYPE_LTE,
new ImsReasonInfo());
verify(mImsPhoneConnectionListener).onConnectionEvent(eq(
TelephonyManager.EVENT_HANDOVER_VIDEO_FROM_WIFI_TO_LTE), isNull());
// Finally hand back to WIFI
call.getImsCallSessionListenerProxy().callSessionHandover(call.getCallSession(),
- ServiceState.RIL_RADIO_TECHNOLOGY_LTE, ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN,
+ TelephonyManager.NETWORK_TYPE_LTE, TelephonyManager.NETWORK_TYPE_IWLAN,
new ImsReasonInfo());
verify(mImsPhoneConnectionListener).onConnectionEvent(eq(
TelephonyManager.EVENT_HANDOVER_VIDEO_FROM_LTE_TO_WIFI), isNull());
diff --git a/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneConnectionTest.java b/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneConnectionTest.java
index 5050b89..1aa47d4 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneConnectionTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneConnectionTest.java
@@ -38,6 +38,7 @@
import android.telephony.DisconnectCause;
import android.telephony.PhoneNumberUtils;
import android.telephony.ServiceState;
+import android.telephony.TelephonyManager;
import android.telephony.ims.ImsCallProfile;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
@@ -248,13 +249,26 @@
@Test
@SmallTest
+ public void testSetWifiDeprecated() {
+ mConnectionUT = new ImsPhoneConnection(mImsPhone, mImsCall, mImsCT, mForeGroundCall, false);
+ assertFalse(mConnectionUT.isWifi());
+ // ImsCall.getRadioTechnology is tested elsewhere
+ doReturn(TelephonyManager.NETWORK_TYPE_IWLAN).when(mImsCall).getNetworkType();
+ mBundle.putString(ImsCallProfile.EXTRA_CALL_RAT_TYPE,
+ ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN + "");
+ assertTrue(mConnectionUT.update(mImsCall, Call.State.ACTIVE));
+ assertTrue(mConnectionUT.isWifi());
+ }
+
+ @Test
+ @SmallTest
public void testSetWifi() {
mConnectionUT = new ImsPhoneConnection(mImsPhone, mImsCall, mImsCT, mForeGroundCall, false);
assertFalse(mConnectionUT.isWifi());
// ImsCall.getRadioTechnology is tested elsewhere
- doReturn(ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN).when(mImsCall).getRadioTechnology();
- mBundle.putString(ImsCallProfile.EXTRA_CALL_RAT_TYPE,
- ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN + "");
+ doReturn(TelephonyManager.NETWORK_TYPE_IWLAN).when(mImsCall).getNetworkType();
+ mBundle.putString(ImsCallProfile.EXTRA_CALL_NETWORK_TYPE,
+ TelephonyManager.NETWORK_TYPE_IWLAN + "");
assertTrue(mConnectionUT.update(mImsCall, Call.State.ACTIVE));
assertTrue(mConnectionUT.isWifi());
}
@@ -265,7 +279,7 @@
mConnectionUT = new ImsPhoneConnection(mImsPhone, mImsCall, mImsCT, mForeGroundCall, false);
assertFalse(mConnectionUT.isWifi());
// ImsCall.getRadioTechnology is tested elsewhere
- doReturn(ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN).when(mImsCall).getRadioTechnology();
+ doReturn(TelephonyManager.NETWORK_TYPE_IWLAN).when(mImsCall).getNetworkType();
// Tests to make sure that the EXTRA_CALL_RAT_TYPE_ALT string is set correctly for newer
// devices.
mBundle.putString(ImsCallProfile.EXTRA_CALL_RAT_TYPE_ALT,
@@ -276,13 +290,26 @@
@Test
@SmallTest
+ public void testSetLTEDeprecated() {
+ mConnectionUT = new ImsPhoneConnection(mImsPhone, mImsCall, mImsCT, mForeGroundCall, false);
+ assertNotEquals(mConnectionUT.getCallRadioTech(), ServiceState.RIL_RADIO_TECHNOLOGY_LTE);
+ // ImsCall.getRadioTechnology is tested elsewhere
+ doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mImsCall).getNetworkType();
+ mBundle.putString(ImsCallProfile.EXTRA_CALL_RAT_TYPE,
+ ServiceState.RIL_RADIO_TECHNOLOGY_LTE + "");
+ assertTrue(mConnectionUT.update(mImsCall, Call.State.ACTIVE));
+ assertEquals(mConnectionUT.getCallRadioTech(), ServiceState.RIL_RADIO_TECHNOLOGY_LTE);
+ }
+
+ @Test
+ @SmallTest
public void testSetLTE() {
mConnectionUT = new ImsPhoneConnection(mImsPhone, mImsCall, mImsCT, mForeGroundCall, false);
assertNotEquals(mConnectionUT.getCallRadioTech(), ServiceState.RIL_RADIO_TECHNOLOGY_LTE);
// ImsCall.getRadioTechnology is tested elsewhere
- doReturn(ServiceState.RIL_RADIO_TECHNOLOGY_LTE).when(mImsCall).getRadioTechnology();
- mBundle.putString(ImsCallProfile.EXTRA_CALL_RAT_TYPE,
- ServiceState.RIL_RADIO_TECHNOLOGY_LTE + "");
+ doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mImsCall).getNetworkType();
+ mBundle.putString(ImsCallProfile.EXTRA_CALL_NETWORK_TYPE,
+ TelephonyManager.NETWORK_TYPE_LTE + "");
assertTrue(mConnectionUT.update(mImsCall, Call.State.ACTIVE));
assertEquals(mConnectionUT.getCallRadioTech(), ServiceState.RIL_RADIO_TECHNOLOGY_LTE);
}
@@ -293,7 +320,7 @@
mConnectionUT = new ImsPhoneConnection(mImsPhone, mImsCall, mImsCT, mForeGroundCall, false);
assertNotEquals(mConnectionUT.getCallRadioTech(), ServiceState.RIL_RADIO_TECHNOLOGY_LTE);
// ImsCall.getRadioTechnology is tested elsewhere
- doReturn(ServiceState.RIL_RADIO_TECHNOLOGY_LTE).when(mImsCall).getRadioTechnology();
+ doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mImsCall).getNetworkType();
// Tests to make sure that the EXTRA_CALL_RAT_TYPE_ALT string is set correctly for newer
// devices.
mBundle.putString(ImsCallProfile.EXTRA_CALL_RAT_TYPE_ALT,
diff --git a/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneTest.java b/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneTest.java
index 1c5169d..345994d 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneTest.java
@@ -69,7 +69,6 @@
import com.android.ims.FeatureConnector;
import com.android.ims.ImsEcbmStateListener;
-import com.android.ims.ImsManager;
import com.android.ims.ImsUtInterface;
import com.android.ims.RcsFeatureManager;
import com.android.internal.telephony.Call;
@@ -630,15 +629,14 @@
assertEquals(false, mImsPhoneUT.getWakeLock().isHeld());
}
- @FlakyTest
@Test
@SmallTest
- @Ignore
public void testProcessDisconnectReason() throws Exception {
// set up CarrierConfig
PersistableBundle bundle = mContextFixture.getCarrierConfigBundle();
bundle.putStringArray(CarrierConfigManager.KEY_WFC_OPERATOR_ERROR_CODES_STRING_ARRAY,
new String[]{"REG09|0"});
+ doReturn(true).when(mImsManager).isWfcEnabledByUser();
// set up overlays
String title = "title";
@@ -655,18 +653,17 @@
mImsPhoneUT.processDisconnectReason(
new ImsReasonInfo(ImsReasonInfo.CODE_REGISTRATION_ERROR, 0, "REG09"));
- // TODO: Verify that WFC has been turned off (can't do it right now because
- // setWfcSetting is static).
- //verify(mImsManager).setWfcSetting(any(), eq(false));
-
ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
verify(mContext).sendOrderedBroadcast(
intent.capture(), nullable(String.class), any(BroadcastReceiver.class),
nullable(Handler.class), eq(Activity.RESULT_OK), nullable(String.class),
nullable(Bundle.class));
- assertEquals(ImsManager.ACTION_IMS_REGISTRATION_ERROR, intent.getValue().getAction());
- assertEquals(title, intent.getValue().getStringExtra(Phone.EXTRA_KEY_ALERT_TITLE));
- assertEquals(messageAlert, intent.getValue().getStringExtra(Phone.EXTRA_KEY_ALERT_MESSAGE));
+ assertEquals(android.telephony.ims.ImsManager.ACTION_WFC_IMS_REGISTRATION_ERROR,
+ intent.getValue().getAction());
+ assertEquals(title, intent.getValue().getStringExtra(
+ android.telephony.ims.ImsManager.EXTRA_WFC_REGISTRATION_FAILURE_TITLE));
+ assertEquals(messageAlert, intent.getValue().getStringExtra(
+ android.telephony.ims.ImsManager.EXTRA_WFC_REGISTRATION_FAILURE_MESSAGE));
assertEquals(messageNotification,
intent.getValue().getStringExtra(Phone.EXTRA_KEY_NOTIFICATION_MESSAGE));
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/metrics/TelephonyMetricsTest.java b/tests/telephonytests/src/com/android/internal/telephony/metrics/TelephonyMetricsTest.java
index 70b795b..c1d0bce 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/metrics/TelephonyMetricsTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/metrics/TelephonyMetricsTest.java
@@ -504,19 +504,22 @@
@Test
@SmallTest
public void testWriteOnSetupDataCallResponse() throws Exception {
- DataCallResponse response = new DataCallResponse(
- 5, /* status */
- 6, /* suggestedRetryTime */
- 7, /* cid */
- 8, /* active */
- ApnSetting.PROTOCOL_IPV4V6, /* protocolType */
- FAKE_IFNAME, /* ifname */
- Arrays.asList(new LinkAddress(
- InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)), /* addresses */
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)), /* dnses */
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)), /* gateways */
- Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)), /* pcscfs */
- 1440 /* mtu */);
+ DataCallResponse response = new DataCallResponse.Builder()
+ .setCause(5)
+ .setSuggestedRetryTime(6)
+ .setId(7)
+ .setLinkStatus(8)
+ .setProtocolType(ApnSetting.PROTOCOL_IPV4V6)
+ .setInterfaceName(FAKE_IFNAME)
+ .setAddresses(Arrays.asList(
+ new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0)))
+ .setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS)))
+ .setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY)))
+ .setPcscfAddresses(
+ Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS)))
+ .setMtuV4(1440)
+ .setMtuV6(1440)
+ .build();
mMetrics.writeOnRilSolicitedResponse(mPhone.getPhoneId(), 1, 2,
RIL_REQUEST_SETUP_DATA_CALL, response);