summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author SongFerng Wang <songferngwang@google.com> 2021-07-22 06:15:05 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2021-07-22 06:15:05 +0000
commit8c19236f8f18e8c0f82a3c5dfbe0cd2a086c3bbc (patch)
treeffb2026ba9936472ce6b6af6fc1fd9b99ad80577
parent265e8cf6704837dd86e65c9b70d50dcebbb32480 (diff)
parent4a66d8e5428223fede7049e8b465cac94309b9ac (diff)
Merge changes from topics "ApiReview_DEVICE_NR_CAPABILITY", "getPhoneCapability"
* changes: Changing DEVICE_NR_CAPABILITY type and renaming getMaxActiveInternetData Add getPhoneCapability function in TelephonyManager
-rw-r--r--core/api/current.txt6
-rw-r--r--core/api/system-current.txt12
-rw-r--r--core/res/res/values/config.xml5
-rw-r--r--core/res/res/values/symbols.xml3
-rw-r--r--telephony/java/android/telephony/PhoneCapability.java207
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java28
-rw-r--r--telephony/java/com/android/internal/telephony/ITelephony.aidl6
7 files changed, 219 insertions, 48 deletions
diff --git a/core/api/current.txt b/core/api/current.txt
index fb7d986a3138..64976fac21f2 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -40287,12 +40287,6 @@ package android.telephony {
field public static final int SCAN_TYPE_PERIODIC = 1; // 0x1
}
- public final class PhoneCapability implements android.os.Parcelable {
- method public int describeContents();
- method public void writeToParcel(@NonNull android.os.Parcel, int);
- field @NonNull public static final android.os.Parcelable.Creator<android.telephony.PhoneCapability> CREATOR;
- }
-
public class PhoneNumberFormattingTextWatcher implements android.text.TextWatcher {
ctor public PhoneNumberFormattingTextWatcher();
ctor public PhoneNumberFormattingTextWatcher(String);
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index 383684a6b4f2..1648e7f66c72 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -9753,6 +9753,17 @@ package android.telephony {
field public static final int REASON_UNSPECIFIED = 0; // 0x0
}
+ public final class PhoneCapability implements android.os.Parcelable {
+ method public int describeContents();
+ method @NonNull public int[] getDeviceNrCapabilities();
+ method @IntRange(from=1) public int getMaxActiveDataSubscriptions();
+ method @IntRange(from=1) public int getMaxActiveVoiceSubscriptions();
+ method public void writeToParcel(@NonNull android.os.Parcel, int);
+ field @NonNull public static final android.os.Parcelable.Creator<android.telephony.PhoneCapability> CREATOR;
+ field public static final int DEVICE_NR_CAPABILITY_NSA = 1; // 0x1
+ field public static final int DEVICE_NR_CAPABILITY_SA = 2; // 0x2
+ }
+
public final class PhoneNumberRange implements android.os.Parcelable {
ctor public PhoneNumberRange(@NonNull String, @NonNull String, @NonNull String, @NonNull String);
method public int describeContents();
@@ -10272,6 +10283,7 @@ package android.telephony {
method public int getMaxNumberOfSimultaneouslyActiveSims();
method public static long getMaxNumberVerificationTimeoutMillis();
method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String[] getMergedImsisFromGroup();
+ method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public android.telephony.PhoneCapability getPhoneCapability();
method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getPreferredNetworkTypeBitmask();
method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public int getRadioPowerState();
method public int getSimApplicationState();
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 6f5fbae65be6..564991099899 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -4426,4 +4426,9 @@
<!-- Whether to allow the caching of the SIM PIN for verification after unattended reboot -->
<bool name="config_allow_pin_storage_for_unattended_reboot">true</bool>
+
+ <!-- Whether the device enable the standalone (SA) mode of 5G NR.-->
+ <bool name="config_telephony5gStandalone">false</bool>
+ <!-- Whether the device enable the non-standalone (NSA) mode of 5G NR.-->
+ <bool name="config_telephony5gNonStandalone">false</bool>
</resources>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index c50c494f5656..9e44a9f83e15 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -4075,4 +4075,7 @@
<java-symbol type="array" name="config_keep_warming_services" />
<java-symbol type="bool" name="config_voice_data_sms_auto_fallback" />
+
+ <java-symbol type="bool" name="config_telephony5gStandalone" />
+ <java-symbol type="bool" name="config_telephony5gNonStandalone" />
</resources>
diff --git a/telephony/java/android/telephony/PhoneCapability.java b/telephony/java/android/telephony/PhoneCapability.java
index 6571858fc4ae..a3aaf61a6fec 100644
--- a/telephony/java/android/telephony/PhoneCapability.java
+++ b/telephony/java/android/telephony/PhoneCapability.java
@@ -16,19 +16,27 @@
package android.telephony;
+import android.annotation.IntDef;
+import android.annotation.IntRange;
import android.annotation.NonNull;
+import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
/**
- * Define capability of a modem group. That is, the capabilities
- * are shared between those modems defined by list of modem IDs.
+ * Phone capability which describes the data connection capability of modem.
+ * It's used to evaluate possible phone config change, for example from single
+ * SIM device to multi-SIM device.
+ * @hide
*/
+@SystemApi
public final class PhoneCapability implements Parcelable {
// Hardcoded default DSDS capability.
/** @hide */
@@ -37,6 +45,30 @@ public final class PhoneCapability implements Parcelable {
/** @hide */
public static final PhoneCapability DEFAULT_SSSS_CAPABILITY;
+ /** @hide */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef(prefix = { "DEVICE_NR_CAPABILITY_" }, value = {
+ DEVICE_NR_CAPABILITY_NSA,
+ DEVICE_NR_CAPABILITY_SA,
+ })
+ public @interface DeviceNrCapability {}
+
+ /**
+ * Indicates DEVICE_NR_CAPABILITY_NSA determine that the device enable the non-standalone
+ * (NSA) mode of 5G NR.
+ * @hide
+ */
+ @SystemApi
+ public static final int DEVICE_NR_CAPABILITY_NSA = 1;
+
+ /**
+ * Indicates DEVICE_NR_CAPABILITY_SA determine that the device enable the standalone (SA)
+ * mode of 5G NR.
+ * @hide
+ */
+ @SystemApi
+ public static final int DEVICE_NR_CAPABILITY_SA = 2;
+
static {
ModemInfo modemInfo1 = new ModemInfo(0, 0, true, true);
ModemInfo modemInfo2 = new ModemInfo(1, 0, true, true);
@@ -44,55 +76,91 @@ public final class PhoneCapability implements Parcelable {
List<ModemInfo> logicalModemList = new ArrayList<>();
logicalModemList.add(modemInfo1);
logicalModemList.add(modemInfo2);
- DEFAULT_DSDS_CAPABILITY = new PhoneCapability(1, 1, 0, logicalModemList, false);
+ int[] deviceNrCapabilities = new int[0];
+
+ DEFAULT_DSDS_CAPABILITY = new PhoneCapability(1, 1, logicalModemList, false,
+ deviceNrCapabilities);
logicalModemList = new ArrayList<>();
logicalModemList.add(modemInfo1);
- DEFAULT_SSSS_CAPABILITY = new PhoneCapability(1, 1, 0, logicalModemList, false);
+ DEFAULT_SSSS_CAPABILITY = new PhoneCapability(1, 1, logicalModemList, false,
+ deviceNrCapabilities);
}
+ /**
+ * 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.
+ *
+ * @hide
+ */
+ private final int mMaxActiveVoiceSubscriptions;
+
+ /**
+ * mMaxActiveDataSubscriptions defines the maximum subscriptions that can support
+ * simultaneous data connections.
+ * For example, for L+L device it should be 2.
+ *
+ * @hide
+ */
+ private final int mMaxActiveDataSubscriptions;
+
+ /**
+ * Whether modem supports both internet PDN up so
+ * that we can do ping test before tearing down the
+ * other one.
+ *
+ * @hide
+ */
+ private final boolean mNetworkValidationBeforeSwitchSupported;
+
/** @hide */
- public final int maxActiveVoiceCalls;
- /** @hide */
- public final int maxActiveData;
- /** @hide */
- public final int max5G;
- /** @hide */
- public final boolean validationBeforeSwitchSupported;
- /** @hide */
- public final List<ModemInfo> logicalModemList;
+ private final List<ModemInfo> mLogicalModemList;
+
+ /**
+ * List of logical modem information.
+ *
+ * @hide
+ */
+ private final int[] mDeviceNrCapabilities;
/** @hide */
- public PhoneCapability(int maxActiveVoiceCalls, int maxActiveData, int max5G,
- List<ModemInfo> logicalModemList, boolean validationBeforeSwitchSupported) {
- this.maxActiveVoiceCalls = maxActiveVoiceCalls;
- this.maxActiveData = maxActiveData;
- this.max5G = max5G;
+ public PhoneCapability(int maxActiveVoiceSubscriptions, int maxActiveDataSubscriptions,
+ List<ModemInfo> logicalModemList, boolean networkValidationBeforeSwitchSupported,
+ int[] deviceNrCapabilities) {
+ this.mMaxActiveVoiceSubscriptions = maxActiveVoiceSubscriptions;
+ this.mMaxActiveDataSubscriptions = maxActiveDataSubscriptions;
// Make sure it's not null.
- this.logicalModemList = logicalModemList == null ? new ArrayList<>() : logicalModemList;
- this.validationBeforeSwitchSupported = validationBeforeSwitchSupported;
+ this.mLogicalModemList = logicalModemList == null ? new ArrayList<>() : logicalModemList;
+ this.mNetworkValidationBeforeSwitchSupported = networkValidationBeforeSwitchSupported;
+ this.mDeviceNrCapabilities = deviceNrCapabilities;
}
@Override
public String toString() {
- return "maxActiveVoiceCalls=" + maxActiveVoiceCalls + " maxActiveData=" + maxActiveData
- + " max5G=" + max5G + "logicalModemList:"
- + Arrays.toString(logicalModemList.toArray());
+ return "mMaxActiveVoiceSubscriptions=" + mMaxActiveVoiceSubscriptions
+ + " mMaxActiveDataSubscriptions=" + mMaxActiveDataSubscriptions
+ + " mNetworkValidationBeforeSwitchSupported="
+ + mNetworkValidationBeforeSwitchSupported
+ + " mDeviceNrCapability " + Arrays.toString(mDeviceNrCapabilities);
}
private PhoneCapability(Parcel in) {
- maxActiveVoiceCalls = in.readInt();
- maxActiveData = in.readInt();
- max5G = in.readInt();
- validationBeforeSwitchSupported = in.readBoolean();
- logicalModemList = new ArrayList<>();
- in.readList(logicalModemList, ModemInfo.class.getClassLoader());
+ mMaxActiveVoiceSubscriptions = in.readInt();
+ mMaxActiveDataSubscriptions = in.readInt();
+ mNetworkValidationBeforeSwitchSupported = in.readBoolean();
+ mLogicalModemList = new ArrayList<>();
+ in.readList(mLogicalModemList, ModemInfo.class.getClassLoader());
+ mDeviceNrCapabilities = in.createIntArray();
}
@Override
public int hashCode() {
- return Objects.hash(maxActiveVoiceCalls, maxActiveData, max5G, logicalModemList,
- validationBeforeSwitchSupported);
+ return Objects.hash(mMaxActiveVoiceSubscriptions,
+ mMaxActiveDataSubscriptions,
+ mLogicalModemList,
+ mNetworkValidationBeforeSwitchSupported,
+ Arrays.hashCode(mDeviceNrCapabilities));
}
@Override
@@ -107,11 +175,12 @@ public final class PhoneCapability implements Parcelable {
PhoneCapability s = (PhoneCapability) o;
- return (maxActiveVoiceCalls == s.maxActiveVoiceCalls
- && maxActiveData == s.maxActiveData
- && max5G == s.max5G
- && validationBeforeSwitchSupported == s.validationBeforeSwitchSupported
- && logicalModemList.equals(s.logicalModemList));
+ return (mMaxActiveVoiceSubscriptions == s.mMaxActiveVoiceSubscriptions
+ && mMaxActiveDataSubscriptions == s.mMaxActiveDataSubscriptions
+ && mNetworkValidationBeforeSwitchSupported
+ == s.mNetworkValidationBeforeSwitchSupported
+ && mLogicalModemList.equals(s.mLogicalModemList)
+ && Arrays.equals(mDeviceNrCapabilities, s.mDeviceNrCapabilities));
}
/**
@@ -125,14 +194,15 @@ public final class PhoneCapability implements Parcelable {
* {@link Parcelable#writeToParcel}
*/
public void writeToParcel(@NonNull Parcel dest, @Parcelable.WriteFlags int flags) {
- dest.writeInt(maxActiveVoiceCalls);
- dest.writeInt(maxActiveData);
- dest.writeInt(max5G);
- dest.writeBoolean(validationBeforeSwitchSupported);
- dest.writeList(logicalModemList);
+ dest.writeInt(mMaxActiveVoiceSubscriptions);
+ dest.writeInt(mMaxActiveDataSubscriptions);
+ dest.writeBoolean(mNetworkValidationBeforeSwitchSupported);
+ dest.writeList(mLogicalModemList);
+ dest.writeIntArray(mDeviceNrCapabilities);
}
- public static final @android.annotation.NonNull Parcelable.Creator<PhoneCapability> CREATOR = new Parcelable.Creator() {
+ public static final @android.annotation.NonNull Parcelable.Creator<PhoneCapability> CREATOR =
+ new Parcelable.Creator() {
public PhoneCapability createFromParcel(Parcel in) {
return new PhoneCapability(in);
}
@@ -141,4 +211,57 @@ public final class PhoneCapability implements Parcelable {
return new PhoneCapability[size];
}
};
+
+ /**
+ * @return 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.
+ * @hide
+ */
+ @SystemApi
+ public @IntRange(from = 1) int getMaxActiveVoiceSubscriptions() {
+ return mMaxActiveVoiceSubscriptions;
+ }
+
+ /**
+ * @return the maximum subscriptions that can support simultaneous data connections.
+ * For example, for L+L device it should be 2.
+ * @hide
+ */
+ @SystemApi
+ public @IntRange(from = 1) int getMaxActiveDataSubscriptions() {
+ return mMaxActiveDataSubscriptions;
+ }
+
+ /**
+ * @return Check whether the Citizens Broadband Radio Service(CBRS) network validation before
+ * CBRS switch is supported or not.
+ *
+ * @hide
+ */
+ public boolean isNetworkValidationBeforeSwitchSupported() {
+ return mNetworkValidationBeforeSwitchSupported;
+ }
+
+ /**
+ * @return The list of logical modem information.
+ * @hide
+ */
+ public List<ModemInfo> getLogicalModemList() {
+ return mLogicalModemList;
+ }
+
+ /**
+ * Return List of the device's NR capability. If the device doesn't support NR capability,
+ * then this api return empty array.
+ * @see DEVICE_NR_CAPABILITY_NSA
+ * @see DEVICE_NR_CAPABILITY_SA
+ *
+ * @return List of the device's NR capability.
+ * @hide
+ */
+ @SystemApi
+ public @NonNull @DeviceNrCapability int[] getDeviceNrCapabilities() {
+ return mDeviceNrCapabilities == null ? (new int[0]) : mDeviceNrCapabilities;
+ }
}
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index c7761605fc7b..4189784bf5e0 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -15065,4 +15065,32 @@ public class TelephonyManager {
}
return PREPARE_UNATTENDED_REBOOT_ERROR;
}
+
+ /**
+ * Gets the current phone capability.
+ *
+ * @return the PhoneCapability which describes the data connection capability of modem.
+ * It's used to evaluate possible phone config change, for example from single
+ * SIM device to multi-SIM device.
+ * @hide
+ */
+ @SystemApi
+ @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+ public @NonNull PhoneCapability getPhoneCapability() {
+ try {
+ ITelephony telephony = getITelephony();
+ if (telephony != null) {
+ return telephony.getPhoneCapability();
+ } else {
+ throw new IllegalStateException("telephony service is null.");
+ }
+ } catch (RemoteException ex) {
+ ex.rethrowAsRuntimeException();
+ }
+ if (getActiveModemCount() > 1) {
+ return PhoneCapability.DEFAULT_DSDS_CAPABILITY;
+ } else {
+ return PhoneCapability.DEFAULT_SSSS_CAPABILITY;
+ }
+ }
}
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index 374aedaf3c71..9b2f119ac77d 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -43,6 +43,7 @@ import android.telephony.ICellInfoCallback;
import android.telephony.ModemActivityInfo;
import android.telephony.NeighboringCellInfo;
import android.telephony.NetworkScanRequest;
+import android.telephony.PhoneCapability;
import android.telephony.PhoneNumberRange;
import android.telephony.RadioAccessFamily;
import android.telephony.RadioAccessSpecifier;
@@ -2440,4 +2441,9 @@ interface ITelephony {
* of error.
*/
int prepareForUnattendedReboot();
+
+ /**
+ * Gets the current phone capability.
+ */
+ PhoneCapability getPhoneCapability();
}