diff --git a/core/res/res/values/config_telephony.xml b/core/res/res/values/config_telephony.xml
index 71b2f00ff2b15..f2a16d355ed7b 100644
--- a/core/res/res/values/config_telephony.xml
+++ b/core/res/res/values/config_telephony.xml
@@ -130,4 +130,9 @@
true, routing from the android emergency number database will be ignored. -->
false
+
+
+ false
+
diff --git a/telephony/java/android/telephony/PhoneCapability.java b/telephony/java/android/telephony/PhoneCapability.java
index 63e3468ac19b8..48170dfd0e54d 100644
--- a/telephony/java/android/telephony/PhoneCapability.java
+++ b/telephony/java/android/telephony/PhoneCapability.java
@@ -90,7 +90,9 @@ public final class PhoneCapability implements Parcelable {
/**
* mMaxActiveVoiceSubscriptions defines the maximum subscriptions that can support
* simultaneous voice calls. For a dual sim dual standby (DSDS) device it would be one, but
- * for a dual sim dual active device it would be 2.
+ * for a dual sim dual active (DSDA) device, or a DSDS device that supports "virtual DSDA" (
+ * using the data line of 1 SIM to temporarily provide IMS voice connectivity to the other SIM)
+ * it would be 2.
*
* @hide
*/
@@ -99,7 +101,7 @@ public final class PhoneCapability implements Parcelable {
/**
* mMaxActiveDataSubscriptions defines the maximum subscriptions that can support
* simultaneous data connections.
- * For example, for L+L device it should be 2.
+ * For example, for dual sim dual active L+L device it should be 2.
*
* @hide
*/
@@ -114,14 +116,20 @@ public final class PhoneCapability implements Parcelable {
*/
private final boolean mNetworkValidationBeforeSwitchSupported;
- /** @hide */
- private final List mLogicalModemList;
-
/**
* List of logical modem information.
*
* @hide
*/
+ @NonNull
+ private final List mLogicalModemList;
+
+ /**
+ * Device NR capabilities.
+ *
+ * @hide
+ */
+ @NonNull
private final int[] mDeviceNrCapabilities;
/** @hide */
@@ -136,6 +144,18 @@ public final class PhoneCapability implements Parcelable {
this.mDeviceNrCapabilities = deviceNrCapabilities;
}
+ private PhoneCapability(@NonNull Builder builder) {
+ this.mMaxActiveVoiceSubscriptions = builder.mMaxActiveVoiceSubscriptions;
+ this.mMaxActiveDataSubscriptions = builder.mMaxActiveDataSubscriptions;
+ // Make sure it's not null.
+ this.mLogicalModemList = builder.mLogicalModemList == null ? new ArrayList<>()
+ : builder.mLogicalModemList;
+ this.mNetworkValidationBeforeSwitchSupported =
+ builder.mNetworkValidationBeforeSwitchSupported;
+ this.mDeviceNrCapabilities = builder.mDeviceNrCapabilities;
+
+ }
+
@Override
public String toString() {
return "mMaxActiveVoiceSubscriptions=" + mMaxActiveVoiceSubscriptions
@@ -264,4 +284,121 @@ public final class PhoneCapability implements Parcelable {
public @NonNull @DeviceNrCapability int[] getDeviceNrCapabilities() {
return mDeviceNrCapabilities == null ? (new int[0]) : mDeviceNrCapabilities;
}
+
+
+ /**
+ * Builder for {@link PhoneCapability}.
+ *
+ * @hide
+ */
+ public static class Builder {
+ /**
+ * mMaxActiveVoiceSubscriptions defines the maximum subscriptions that can support
+ * simultaneous voice calls. For a dual sim dual standby (DSDS) device it would be one, but
+ * for a dual sim dual active (DSDA) device, or a DSDS device that supports "virtual DSDA"
+ * (using the data line of 1 SIM to temporarily provide IMS voice connectivity to the other
+ * SIM) it would be 2.
+ *
+ * @hide
+ */
+ private int mMaxActiveVoiceSubscriptions = 0;
+
+ /**
+ * mMaxActiveDataSubscriptions defines the maximum subscriptions that can support
+ * simultaneous data connections. For example, for L+L device it should be 2.
+ *
+ * @hide
+ */
+ private int mMaxActiveDataSubscriptions = 0;
+
+ /**
+ * Whether modem supports both internet PDN up so that we can do ping test before tearing
+ * down the other one.
+ *
+ * @hide
+ */
+ private boolean mNetworkValidationBeforeSwitchSupported = false;
+
+ /**
+ * List of logical modem information.
+ *
+ * @hide
+ */
+ @NonNull
+ private List mLogicalModemList = new ArrayList<>();
+
+ /**
+ * Device NR capabilities.
+ *
+ * @hide
+ */
+ @NonNull
+ private int[] mDeviceNrCapabilities = new int[0];
+
+ /**
+ * Default constructor.
+ */
+ public Builder() {
+ }
+
+ public Builder(@NonNull PhoneCapability phoneCapability) {
+ mMaxActiveVoiceSubscriptions = phoneCapability.mMaxActiveVoiceSubscriptions;
+ mMaxActiveDataSubscriptions = phoneCapability.mMaxActiveDataSubscriptions;
+ mNetworkValidationBeforeSwitchSupported =
+ phoneCapability.mNetworkValidationBeforeSwitchSupported;
+ mLogicalModemList = phoneCapability.mLogicalModemList;
+ mDeviceNrCapabilities = phoneCapability.mDeviceNrCapabilities;
+ }
+
+ /**
+ * Sets the max active voice subscriptions supported by the device.
+ */
+ public Builder setMaxActiveVoiceSubscriptions(int maxActiveVoiceSubscriptions) {
+ mMaxActiveVoiceSubscriptions = maxActiveVoiceSubscriptions;
+ return this;
+ }
+
+ /**
+ * Sets the max active voice subscriptions supported by the device.
+ */
+ public Builder setMaxActiveDataSubscriptions(int maxActiveDataSubscriptions) {
+ mMaxActiveDataSubscriptions = maxActiveDataSubscriptions;
+ return this;
+ }
+
+ /**
+ * Sets the max active data subscriptions supported by the device. Can be fewer than the
+ * active voice subscriptions.
+ */
+ public Builder setNetworkValidationBeforeSwitchSupported(
+ boolean networkValidationBeforeSwitchSupported) {
+ mNetworkValidationBeforeSwitchSupported = networkValidationBeforeSwitchSupported;
+ return this;
+ }
+
+ /**
+ * Sets the logical modem list of the device.
+ */
+ public Builder setLogicalModemList(@NonNull List logicalModemList) {
+ mLogicalModemList = logicalModemList;
+ return this;
+ }
+
+ /**
+ * Sets the NR capabilities supported by the device.
+ */
+ public Builder setDeviceNrCapabilities(@NonNull int[] deviceNrCapabilities) {
+ mDeviceNrCapabilities = deviceNrCapabilities;
+ return this;
+ }
+
+ /**
+ * Build the {@link PhoneCapability}.
+ *
+ * @return The {@link PhoneCapability} instance.
+ */
+ public PhoneCapability build() {
+ return new PhoneCapability(this);
+ }
+ }
}