summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Sarah Chin <sarahchin@google.com> 2019-12-06 10:23:49 -0800
committer Sarah Chin <sarahchin@google.com> 2020-01-24 23:45:39 -0800
commite8b76356340f6c6c78de97abf449b6a55150e558 (patch)
tree1d1982ebc0d2bd138a0c9df73717db799da2fc58
parent51598fab099978f2444669fb86b815c79e104b15 (diff)
Modify PhoneCapabilities for device capabilities
Updated PhoneCapability from 1.3 RadioConfig HAL New SimSlotCapability Add getPhoneCapability API Test: atest FrameworksTelephonyTests Bug: 143238237 Bug: 143238191 Change-Id: I3349c3e50a806fb7bfd65b1bf16079878a5aeb06 Merged-In: I3349c3e50a806fb7bfd65b1bf16079878a5aeb06
-rw-r--r--api/current.txt37
-rw-r--r--telephony/java/android/telephony/AccessNetworkConstants.java16
-rw-r--r--telephony/java/android/telephony/PhoneCapability.java454
-rw-r--r--telephony/java/android/telephony/SimSlotCapability.java130
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java18
-rw-r--r--telephony/java/com/android/internal/telephony/ITelephony.aidl12
6 files changed, 599 insertions, 68 deletions
diff --git a/api/current.txt b/api/current.txt
index ffe71a254110..8ecacfb54f12 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -45314,8 +45314,32 @@ package android.telephony {
public final class PhoneCapability implements android.os.Parcelable {
method public int describeContents();
+ method @NonNull public java.util.List<java.lang.Integer> getBands(int);
+ method @NonNull public java.util.List<java.util.List<java.lang.Long>> getConcurrentFeaturesSupport();
+ method @NonNull public java.util.List<java.lang.String> getLogicalModemUuids();
+ method public int getMaxActiveDedicatedBearers();
+ method public int getMaxActiveInternetData();
+ method public int getMaxActivePsVoice();
+ method public long getPsDataConnectionLingerTimeMillis();
+ method @NonNull public java.util.List<android.telephony.SimSlotCapability> getSimSlotCapabilities();
+ method public long getSupportedRats();
+ method public int getUeCategory(boolean, int);
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 long MODEM_FEATURE_3GPP2_REG = 1L; // 0x1L
+ field public static final long MODEM_FEATURE_3GPP_REG = 2L; // 0x2L
+ field public static final long MODEM_FEATURE_CDMA2000_EHRPD_REG = 4L; // 0x4L
+ field public static final long MODEM_FEATURE_CSIM = 8192L; // 0x2000L
+ field public static final long MODEM_FEATURE_CS_VOICE_SESSION = 512L; // 0x200L
+ field public static final long MODEM_FEATURE_DEDICATED_BEARER = 2048L; // 0x800L
+ field public static final long MODEM_FEATURE_EUTRAN_REG = 32L; // 0x20L
+ field public static final long MODEM_FEATURE_EUTRA_NR_DUAL_CONNECTIVITY_REG = 128L; // 0x80L
+ field public static final long MODEM_FEATURE_GERAN_REG = 8L; // 0x8L
+ field public static final long MODEM_FEATURE_INTERACTIVE_DATA_SESSION = 1024L; // 0x400L
+ field public static final long MODEM_FEATURE_NETWORK_SCAN = 4096L; // 0x1000L
+ field public static final long MODEM_FEATURE_NGRAN_REG = 64L; // 0x40L
+ field public static final long MODEM_FEATURE_PS_VOICE_REG = 256L; // 0x100L
+ field public static final long MODEM_FEATURE_UTRAN_REG = 16L; // 0x10L
}
public class PhoneNumberFormattingTextWatcher implements android.text.TextWatcher {
@@ -45500,6 +45524,18 @@ package android.telephony {
field public static final int INVALID = 2147483647; // 0x7fffffff
}
+ public final class SimSlotCapability implements android.os.Parcelable {
+ method public int describeContents();
+ method public int getPhysicalSlotIndex();
+ method public int getSlotType();
+ method public void writeToParcel(@NonNull android.os.Parcel, int);
+ field @NonNull public static final android.os.Parcelable.Creator<android.telephony.SimSlotCapability> CREATOR;
+ field public static final int SLOT_TYPE_EUICC = 3; // 0x3
+ field public static final int SLOT_TYPE_IUICC = 2; // 0x2
+ field public static final int SLOT_TYPE_SOFT_SIM = 4; // 0x4
+ field public static final int SLOT_TYPE_UICC = 1; // 0x1
+ }
+
public final class SmsManager {
method public String createAppSpecificSmsToken(android.app.PendingIntent);
method @Nullable public String createAppSpecificSmsTokenWithPackageInfo(@Nullable String, @NonNull android.app.PendingIntent);
@@ -45846,6 +45882,7 @@ package android.telephony {
method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public int getNetworkSelectionMode();
method public String getNetworkSpecifier();
method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getNetworkType();
+ method @Nullable @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public android.telephony.PhoneCapability getPhoneCapability();
method @Deprecated public int getPhoneCount();
method public int getPhoneType();
method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PHONE_STATE}) public int getPreferredOpportunisticDataSubscription();
diff --git a/telephony/java/android/telephony/AccessNetworkConstants.java b/telephony/java/android/telephony/AccessNetworkConstants.java
index 6d2ac9dbb737..b1d647fec0c5 100644
--- a/telephony/java/android/telephony/AccessNetworkConstants.java
+++ b/telephony/java/android/telephony/AccessNetworkConstants.java
@@ -67,6 +67,22 @@ public final class AccessNetworkConstants {
}
}
+ /**
+ * Access network type
+ * @hide
+ */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef(prefix = {"RADIO_ACCESS_NETWORK_TYPE_"},
+ value = {
+ AccessNetworkType.UNKNOWN,
+ AccessNetworkType.GERAN,
+ AccessNetworkType.UTRAN,
+ AccessNetworkType.EUTRAN,
+ AccessNetworkType.CDMA2000,
+ AccessNetworkType.IWLAN,
+ AccessNetworkType.NGRAN})
+ public @interface RadioAccessNetworkType {}
+
public static final class AccessNetworkType {
public static final int UNKNOWN = 0;
public static final int GERAN = 1;
diff --git a/telephony/java/android/telephony/PhoneCapability.java b/telephony/java/android/telephony/PhoneCapability.java
index 8a75831a75b8..90244b3df350 100644
--- a/telephony/java/android/telephony/PhoneCapability.java
+++ b/telephony/java/android/telephony/PhoneCapability.java
@@ -16,13 +16,20 @@
package android.telephony;
+import android.annotation.LongDef;
import android.annotation.NonNull;
-import android.annotation.SystemApi;
+import android.annotation.Nullable;
import android.os.Parcel;
import android.os.Parcelable;
+import android.telephony.AccessNetworkConstants.AccessNetworkType;
+import android.telephony.AccessNetworkConstants.RadioAccessNetworkType;
+import android.telephony.TelephonyManager.NetworkTypeBitMask;
+import com.android.internal.util.CollectionUtils;
+
+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;
@@ -31,68 +38,365 @@ import java.util.Objects;
* are shared between those modems defined by list of modem IDs.
*/
public final class PhoneCapability implements Parcelable {
- // Hardcoded default DSDS capability.
+ /** Modem feature indicating 3GPP2 capability. */
+ public static final long MODEM_FEATURE_3GPP2_REG = 1 << 0;
+ /** Modem feature indicating 3GPP capability. */
+ public static final long MODEM_FEATURE_3GPP_REG = 1 << 1;
+ /** Modem feature indicating CDMA 2000 with EHRPD capability. */
+ public static final long MODEM_FEATURE_CDMA2000_EHRPD_REG = 1 << 2;
+ /** Modem feature indicating GSM capability. */
+ public static final long MODEM_FEATURE_GERAN_REG = 1 << 3;
+ /** Modem feature indicating UMTS capability. */
+ public static final long MODEM_FEATURE_UTRAN_REG = 1 << 4;
+ /** Modem feature indicating LTE capability. */
+ public static final long MODEM_FEATURE_EUTRAN_REG = 1 << 5;
+ /** Modem feature indicating 5G capability.*/
+ public static final long MODEM_FEATURE_NGRAN_REG = 1 << 6;
+ /** Modem feature indicating EN-DC capability. */
+ public static final long MODEM_FEATURE_EUTRA_NR_DUAL_CONNECTIVITY_REG = 1 << 7;
+ /** Modem feature indicating VoLTE capability (IMS registered). */
+ public static final long MODEM_FEATURE_PS_VOICE_REG = 1 << 8;
+ /** Modem feature indicating CS voice call capability. */
+ public static final long MODEM_FEATURE_CS_VOICE_SESSION = 1 << 9;
+ /** Modem feature indicating Internet connection capability. */
+ public static final long MODEM_FEATURE_INTERACTIVE_DATA_SESSION = 1 << 10;
+ /**
+ * Modem feature indicating dedicated bearer capability.
+ * For services that require a high level QoS (eg. VoLTE), the network can create
+ * a dedicated bearer with the required QoS on top of an established default bearer.
+ * This will provide a dedicated tunnel for one or more specific traffic types.
+ */
+ public static final long MODEM_FEATURE_DEDICATED_BEARER = 1 << 11;
+ /** Modem feature indicating network scan capability. */
+ public static final long MODEM_FEATURE_NETWORK_SCAN = 1 << 12;
+ /** Modem feature indicating corresponding SIM has CDMA capability. */
+ public static final long MODEM_FEATURE_CSIM = 1 << 13;
+
/** @hide */
+ @LongDef(flag = true, prefix = {"MODEM_FEATURE_" }, value = {
+ MODEM_FEATURE_3GPP2_REG,
+ MODEM_FEATURE_3GPP_REG,
+ MODEM_FEATURE_CDMA2000_EHRPD_REG,
+ MODEM_FEATURE_GERAN_REG,
+ MODEM_FEATURE_UTRAN_REG,
+ MODEM_FEATURE_EUTRAN_REG,
+ MODEM_FEATURE_NGRAN_REG,
+ MODEM_FEATURE_EUTRA_NR_DUAL_CONNECTIVITY_REG,
+ MODEM_FEATURE_PS_VOICE_REG,
+ MODEM_FEATURE_CS_VOICE_SESSION,
+ MODEM_FEATURE_INTERACTIVE_DATA_SESSION,
+ MODEM_FEATURE_DEDICATED_BEARER,
+ MODEM_FEATURE_NETWORK_SCAN,
+ MODEM_FEATURE_CSIM,
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface ModemFeature {
+ }
+
+ /**
+ * Hardcoded default DSDS capability.
+ * @hide
+ */
public static final PhoneCapability DEFAULT_DSDS_CAPABILITY;
- // Hardcoded default Single SIM single standby capability.
- /** @hide */
+ /**
+ * Hardcoded default Single SIM single standby capability.
+ * @hide
+ */
public static final PhoneCapability DEFAULT_SSSS_CAPABILITY;
static {
- ModemInfo modemInfo1 = new ModemInfo(0, 0, true, true);
- ModemInfo modemInfo2 = new ModemInfo(1, 0, true, true);
+ List<List<Long>> capabilities = new ArrayList<>();
+ List<Long> modem1 = new ArrayList<>();
+ List<Long> modem2 = new ArrayList<>();
+ modem1.add(MODEM_FEATURE_GERAN_REG | MODEM_FEATURE_UTRAN_REG | MODEM_FEATURE_EUTRAN_REG
+ | MODEM_FEATURE_PS_VOICE_REG | MODEM_FEATURE_CS_VOICE_SESSION
+ | MODEM_FEATURE_INTERACTIVE_DATA_SESSION | MODEM_FEATURE_DEDICATED_BEARER);
+ modem2.add(MODEM_FEATURE_GERAN_REG | MODEM_FEATURE_UTRAN_REG | MODEM_FEATURE_EUTRAN_REG
+ | MODEM_FEATURE_PS_VOICE_REG | MODEM_FEATURE_INTERACTIVE_DATA_SESSION
+ | MODEM_FEATURE_DEDICATED_BEARER);
+ capabilities.add(modem1);
+ capabilities.add(modem2);
+ List<String> uuids = new ArrayList<>();
+ uuids.add("com.xxxx.lm0");
+ uuids.add("com.xxxx.lm1");
+ long rats = TelephonyManager.NETWORK_TYPE_BITMASK_GSM
+ | TelephonyManager.NETWORK_TYPE_BITMASK_GPRS
+ | TelephonyManager.NETWORK_TYPE_BITMASK_EDGE
+ | TelephonyManager.NETWORK_TYPE_BITMASK_UMTS
+ | TelephonyManager.NETWORK_TYPE_BITMASK_LTE;
+ DEFAULT_DSDS_CAPABILITY = new PhoneCapability(0, 0, 0, 0, 0, rats, null, null, null, null,
+ uuids, null, capabilities);
+
+ capabilities = new ArrayList<>();
+ capabilities.add(modem1);
+ uuids = new ArrayList<>();
+ uuids.add("com.xxxx.lm0");
+ DEFAULT_SSSS_CAPABILITY = new PhoneCapability(0, 0, 0, 0, 0, rats, null, null, null, null,
+ uuids, null, capabilities);
+ }
- List<ModemInfo> logicalModemList = new ArrayList<>();
- logicalModemList.add(modemInfo1);
- logicalModemList.add(modemInfo2);
- DEFAULT_DSDS_CAPABILITY = new PhoneCapability(1, 1, 0, logicalModemList, false);
+ private final int mUtranUeCategoryDl;
+ private final int mUtranUeCategoryUl;
+ private final int mEutranUeCategoryDl;
+ private final int mEutranUeCategoryUl;
+ private final long mPsDataConnectionLingerTimeMillis;
+ private final @NetworkTypeBitMask long mSupportedRats;
+ private final List<Integer> mGeranBands;
+ private final List<Integer> mUtranBands;
+ private final List<Integer> mEutranBands;
+ private final List<Integer> mNgranBands;
+ private final List<String> mLogicalModemUuids;
+ private final List<SimSlotCapability> mSimSlotCapabilities;
+ private final @ModemFeature List<List<Long>> mConcurrentFeaturesSupport;
- logicalModemList = new ArrayList<>();
- logicalModemList.add(modemInfo1);
- DEFAULT_SSSS_CAPABILITY = new PhoneCapability(1, 1, 0, logicalModemList, false);
+ /**
+ * Default constructor to create a PhoneCapability object.
+ * @param utranUeCategoryDl 3GPP UE category for UTRAN downlink.
+ * @param utranUeCategoryUl 3GPP UE category for UTRAN uplink.
+ * @param eutranUeCategoryDl 3GPP UE category for EUTRAN downlink.
+ * @param eutranUeCategoryUl 3GPP UE category for EUTRAN uplink.
+ * @param psDataConnectionLingerTimeMillis length of the grace period to allow a smooth
+ * "handover" between data connections.
+ * @param supportedRats all radio access technologies this phone is capable of supporting.
+ * @param geranBands list of supported {@link AccessNetworkConstants.GeranBand}.
+ * @param utranBands list of supported {@link AccessNetworkConstants.UtranBand}.
+ * @param eutranBands list of supported {@link AccessNetworkConstants.EutranBand}.
+ * @param ngranBands list of supported {@link AccessNetworkConstants.NgranBands}.
+ * @param logicalModemUuids list of logical modem UUIDs, typically of the form
+ * "com.xxxx.lmX", where X is the logical modem ID.
+ * @param simSlotCapabilities list of {@link SimSlotCapability} for the device
+ * @param concurrentFeaturesSupport list of list of concurrently supportable modem feature sets.
+ * @hide
+ */
+ public PhoneCapability(int utranUeCategoryDl, int utranUeCategoryUl, int eutranUeCategoryDl,
+ int eutranUeCategoryUl, long psDataConnectionLingerTimeMillis,
+ @NetworkTypeBitMask long supportedRats, @Nullable List<Integer> geranBands,
+ @Nullable List<Integer> utranBands, @Nullable List<Integer> eutranBands,
+ @Nullable List<Integer> ngranBands, @Nullable List<String> logicalModemUuids,
+ @Nullable List<SimSlotCapability> simSlotCapabilities,
+ @Nullable @ModemFeature List<List<Long>> concurrentFeaturesSupport) {
+ this.mUtranUeCategoryDl = utranUeCategoryDl;
+ this.mUtranUeCategoryUl = utranUeCategoryUl;
+ this.mEutranUeCategoryDl = eutranUeCategoryDl;
+ this.mEutranUeCategoryUl = eutranUeCategoryUl;
+ this.mPsDataConnectionLingerTimeMillis = psDataConnectionLingerTimeMillis;
+ this.mSupportedRats = supportedRats;
+ this.mGeranBands = CollectionUtils.emptyIfNull(geranBands);
+ this.mUtranBands = CollectionUtils.emptyIfNull(utranBands);
+ this.mEutranBands = CollectionUtils.emptyIfNull(eutranBands);
+ this.mNgranBands = CollectionUtils.emptyIfNull(ngranBands);
+ this.mLogicalModemUuids = CollectionUtils.emptyIfNull(logicalModemUuids);
+ this.mSimSlotCapabilities = CollectionUtils.emptyIfNull(simSlotCapabilities);
+ this.mConcurrentFeaturesSupport = CollectionUtils.emptyIfNull(concurrentFeaturesSupport);
}
- /** @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;
- /** @hide */
- public PhoneCapability(int maxActiveVoiceCalls, int maxActiveData, int max5G,
- List<ModemInfo> logicalModemList, boolean validationBeforeSwitchSupported) {
- this.maxActiveVoiceCalls = maxActiveVoiceCalls;
- this.maxActiveData = maxActiveData;
- this.max5G = max5G;
- // Make sure it's not null.
- this.logicalModemList = logicalModemList == null ? new ArrayList<>() : logicalModemList;
- this.validationBeforeSwitchSupported = validationBeforeSwitchSupported;
+ private PhoneCapability(Parcel in) {
+ mUtranUeCategoryDl = in.readInt();
+ mUtranUeCategoryUl = in.readInt();
+ mEutranUeCategoryDl = in.readInt();
+ mEutranUeCategoryUl = in.readInt();
+ mPsDataConnectionLingerTimeMillis = in.readLong();
+ mSupportedRats = in.readLong();
+ mGeranBands = new ArrayList<>();
+ in.readList(mGeranBands, Integer.class.getClassLoader());
+ mUtranBands = new ArrayList<>();
+ in.readList(mUtranBands, Integer.class.getClassLoader());
+ mEutranBands = new ArrayList<>();
+ in.readList(mEutranBands, Integer.class.getClassLoader());
+ mNgranBands = new ArrayList<>();
+ in.readList(mNgranBands, Integer.class.getClassLoader());
+ mLogicalModemUuids = in.createStringArrayList();
+ mSimSlotCapabilities = in.createTypedArrayList(SimSlotCapability.CREATOR);
+ int length = in.readInt();
+ mConcurrentFeaturesSupport = new ArrayList<>();
+ for (int i = 0; i < length; i++) {
+ ArrayList<Long> feature = new ArrayList<>();
+ in.readList(feature, Long.class.getClassLoader());
+ mConcurrentFeaturesSupport.add(feature);
+ }
}
- @Override
- public String toString() {
- return "maxActiveVoiceCalls=" + maxActiveVoiceCalls + " maxActiveData=" + maxActiveData
- + " max5G=" + max5G + "logicalModemList:"
- + Arrays.toString(logicalModemList.toArray());
+ /**
+ * 3GPP UE category for a given Radio Access Network and direction.
+ *
+ * References are:
+ * TS 25.306 Table 4.1a EUTRAN downlink
+ * TS 25.306 Table 5.1a-2 EUTRAN uplink
+ * TS 25.306 Table 5.1a UTRAN downlink
+ * TS 25.306 Table 5.1g UTRAN uplink
+ *
+ * @param uplink true for uplink direction and false for downlink direction.
+ * @param accessNetworkType accessNetworkType, defined in {@link AccessNetworkType}.
+ * @return the UE category, or -1 if it is not supported.
+ */
+ public int getUeCategory(boolean uplink, @RadioAccessNetworkType int accessNetworkType) {
+ if (uplink) {
+ switch (accessNetworkType) {
+ case AccessNetworkType.UTRAN: return mUtranUeCategoryUl;
+ case AccessNetworkType.EUTRAN: return mEutranUeCategoryUl;
+ default: return -1;
+ }
+ } else {
+ switch (accessNetworkType) {
+ case AccessNetworkType.UTRAN: return mUtranUeCategoryDl;
+ case AccessNetworkType.EUTRAN: return mEutranUeCategoryDl;
+ default: return -1;
+ }
+ }
}
- 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());
+ /**
+ * In cellular devices that support a greater number of logical modems than
+ * Internet connections, some devices support a grace period to allow a smooth "handover"
+ * between those connections. If that feature is supported, then this API will provide
+ * the length of that grace period in milliseconds. If it is not supported, the default value
+ * for the grace period is 0.
+ * @return handover linger time in milliseconds, or 0 if it is not supported.
+ */
+ public long getPsDataConnectionLingerTimeMillis() {
+ return mPsDataConnectionLingerTimeMillis;
+ }
+
+ /**
+ * The radio access technologies this device is capable of supporting.
+ * @return a bitfield of all supported network types, defined in {@link TelephonyManager}
+ */
+ public @NetworkTypeBitMask long getSupportedRats() {
+ return mSupportedRats;
+ }
+
+ /**
+ * List of supported cellular bands for the given accessNetworkType.
+ * @param accessNetworkType accessNetworkType, defined in {@link AccessNetworkType}.
+ * @return a list of bands, or an empty list if the access network type is unsupported.
+ */
+ public @NonNull List<Integer> getBands(@RadioAccessNetworkType int accessNetworkType) {
+ switch (accessNetworkType) {
+ case AccessNetworkType.GERAN: return mGeranBands;
+ case AccessNetworkType.UTRAN: return mUtranBands;
+ case AccessNetworkType.EUTRAN: return mEutranBands;
+ case AccessNetworkType.NGRAN: return mNgranBands;
+ default: return new ArrayList<>();
+ }
+ }
+
+ /**
+ * List of logical modem UUIDs, each typically "com.xxxx.lmX", where X is the logical modem ID.
+ * @return a list of modem UUIDs, one for every logical modem the device has.
+ */
+ public @NonNull List<String> getLogicalModemUuids() {
+ return mLogicalModemUuids;
+ }
+
+ /**
+ * List of {@link SimSlotCapability} for the device. The order of SIMs corresponds to the
+ * order of modems in {@link #getLogicalModemUuids}.
+ * @return a list of SIM slot capabilities, one for every SIM slot the device has.
+ */
+ public @NonNull List<SimSlotCapability> getSimSlotCapabilities() {
+ return mSimSlotCapabilities;
+ }
+
+ /**
+ * A List of Lists of concurrently supportable modem feature sets.
+ *
+ * Each entry in the top-level list is an independent configuration across all modems
+ * that describes the capabilities of the device as a whole.
+ *
+ * Each entry in the second-level list is a bitfield of ModemFeatures that describes
+ * the capabilities for a single modem. In the second-level list, the order of the modems
+ * corresponds to order of the UUIDs in {@link #getLogicalModemUuids}.
+ *
+ * For symmetric capabilities that can only be active on one modem at a time, there will be
+ * multiple configurations (equal to the number of modems) that shows it active on each modem.
+ * For asymmetric capabilities that are only available on one of the modems, all configurations
+ * will have that capability on just that one modem.
+ *
+ * The example below shows the concurrentFeaturesSupport for a 3-modem device with
+ * theoretical capabilities SYMMETRIC (available on all modems, but only one at a time) and
+ * ASYMMETRIC (only available on the first modem):
+ * {
+ * Configuration 1: ASYMMETRIC and SYMMETRIC on modem 1, modem 2 empty, modem 3 empty
+ * {(ASYMMETRIC | SYMMETRIC), (), ()},
+ *
+ * Configuration 2: ASYMMETRIC on modem 1, SYMMETRIC on modem 2, modem 3 empty
+ * {(ASYMMETRIC), (SYMMETRIC), ()},
+ *
+ * Configuration 3: ASYMMETRIC on modem 1, modem 2 empty, SYMMETRIC on modem 3
+ * {(ASYMMETRIC), (), (SYMMETRIC)}
+ * }
+ *
+ * @return List of all concurrently supportable modem features.
+ */
+ public @NonNull @ModemFeature List<List<Long>> getConcurrentFeaturesSupport() {
+ return mConcurrentFeaturesSupport;
+ }
+
+ /**
+ * How many modems can simultaneously have PS attached.
+ * @return maximum number of active PS voice connections.
+ */
+ public int getMaxActivePsVoice() {
+ return countFeature(MODEM_FEATURE_PS_VOICE_REG);
+ }
+
+ /**
+ * How many modems can simultaneously support active data connections.
+ * For DSDS, this will be 1, and for DSDA this will be 2.
+ * @return maximum number of active Internet data sessions.
+ */
+ public int getMaxActiveInternetData() {
+ return countFeature(MODEM_FEATURE_INTERACTIVE_DATA_SESSION);
+ }
+
+ /**
+ * How many modems can simultaneously have dedicated bearer capability.
+ * @return maximum number of active dedicated bearers.
+ */
+ public int getMaxActiveDedicatedBearers() {
+ return countFeature(MODEM_FEATURE_DEDICATED_BEARER);
+ }
+
+ /**
+ * Whether the CBRS band 48 is supported or not.
+ * @return true if any RadioAccessNetwork supports CBRS and false if none do.
+ * @hide
+ */
+ public boolean isCbrsSupported() {
+ return mEutranBands.contains(AccessNetworkConstants.EutranBand.BAND_48)
+ || mNgranBands.contains(AccessNetworkConstants.NgranBands.BAND_48);
+ }
+
+ private int countFeature(@ModemFeature long feature) {
+ int count = 0;
+ for (long featureSet : mConcurrentFeaturesSupport.get(0)) {
+ if ((featureSet & feature) != 0) {
+ count++;
+ }
+ }
+ return count;
+ }
+
+ @Override
+ public String toString() {
+ return "utranUeCategoryDl=" + mUtranUeCategoryDl
+ + " utranUeCategoryUl=" + mUtranUeCategoryUl
+ + " eutranUeCategoryDl=" + mEutranUeCategoryDl
+ + " eutranUeCategoryUl=" + mEutranUeCategoryUl
+ + " psDataConnectionLingerTimeMillis=" + mPsDataConnectionLingerTimeMillis
+ + " supportedRats=" + mSupportedRats + " geranBands=" + mGeranBands
+ + " utranBands=" + mUtranBands + " eutranBands=" + mEutranBands
+ + " ngranBands=" + mNgranBands + " logicalModemUuids=" + mLogicalModemUuids
+ + " simSlotCapabilities=" + mSimSlotCapabilities
+ + " concurrentFeaturesSupport=" + mConcurrentFeaturesSupport;
}
@Override
public int hashCode() {
- return Objects.hash(maxActiveVoiceCalls, maxActiveData, max5G, logicalModemList,
- validationBeforeSwitchSupported);
+ return Objects.hash(mUtranUeCategoryDl, mUtranUeCategoryUl, mEutranUeCategoryDl,
+ mEutranUeCategoryUl, mPsDataConnectionLingerTimeMillis, mSupportedRats, mGeranBands,
+ mUtranBands, mEutranBands, mNgranBands, mLogicalModemUuids, mSimSlotCapabilities,
+ mConcurrentFeaturesSupport);
}
@Override
@@ -107,11 +411,19 @@ 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 (mUtranUeCategoryDl == s.mUtranUeCategoryDl
+ && mUtranUeCategoryUl == s.mUtranUeCategoryUl
+ && mEutranUeCategoryDl == s.mEutranUeCategoryDl
+ && mEutranUeCategoryUl == s.mEutranUeCategoryUl
+ && mPsDataConnectionLingerTimeMillis == s.mPsDataConnectionLingerTimeMillis
+ && mSupportedRats == s.mSupportedRats
+ && mGeranBands.equals(s.mGeranBands)
+ && mUtranBands.equals(s.mUtranBands)
+ && mEutranBands.equals(s.mEutranBands)
+ && mNgranBands.equals(s.mNgranBands)
+ && mLogicalModemUuids.equals(s.mLogicalModemUuids)
+ && mSimSlotCapabilities.equals(s.mSimSlotCapabilities)
+ && mConcurrentFeaturesSupport.equals(s.mConcurrentFeaturesSupport));
}
/**
@@ -125,20 +437,32 @@ 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(mUtranUeCategoryDl);
+ dest.writeInt(mUtranUeCategoryUl);
+ dest.writeInt(mEutranUeCategoryDl);
+ dest.writeInt(mEutranUeCategoryUl);
+ dest.writeLong(mPsDataConnectionLingerTimeMillis);
+ dest.writeLong(mSupportedRats);
+ dest.writeList(mGeranBands);
+ dest.writeList(mUtranBands);
+ dest.writeList(mEutranBands);
+ dest.writeList(mNgranBands);
+ dest.writeStringList(mLogicalModemUuids);
+ dest.writeTypedList(mSimSlotCapabilities);
+ dest.writeInt(mConcurrentFeaturesSupport.size());
+ for (List<Long> feature : mConcurrentFeaturesSupport) {
+ dest.writeList(feature);
+ }
}
- public static final @android.annotation.NonNull Parcelable.Creator<PhoneCapability> CREATOR = new Parcelable.Creator() {
- public PhoneCapability createFromParcel(Parcel in) {
- return new PhoneCapability(in);
- }
+ public static final @NonNull Parcelable.Creator<PhoneCapability> CREATOR =
+ new Parcelable.Creator() {
+ public PhoneCapability createFromParcel(Parcel in) {
+ return new PhoneCapability(in);
+ }
- public PhoneCapability[] newArray(int size) {
- return new PhoneCapability[size];
- }
- };
+ public PhoneCapability[] newArray(int size) {
+ return new PhoneCapability[size];
+ }
+ };
}
diff --git a/telephony/java/android/telephony/SimSlotCapability.java b/telephony/java/android/telephony/SimSlotCapability.java
new file mode 100644
index 000000000000..3d38d0429908
--- /dev/null
+++ b/telephony/java/android/telephony/SimSlotCapability.java
@@ -0,0 +1,130 @@
+/*
+ * 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 android.telephony;
+
+import android.annotation.IntDef;
+import android.annotation.NonNull;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.util.Objects;
+
+/**
+ * Capabilities for a SIM Slot.
+ */
+public final class SimSlotCapability implements Parcelable {
+ /** Slot type for UICC (removable SIM). */
+ public static final int SLOT_TYPE_UICC = 1;
+ /** Slot type for iUICC/iSIM (integrated SIM). */
+ public static final int SLOT_TYPE_IUICC = 2;
+ /** Slot type for eUICC/eSIM (embedded SIM). */
+ public static final int SLOT_TYPE_EUICC = 3;
+ /** Slot type for soft SIM (no physical SIM). */
+ public static final int SLOT_TYPE_SOFT_SIM = 4;
+
+ /** @hide */
+ @IntDef(prefix = {"SLOT_TYPE_" }, value = {
+ SLOT_TYPE_UICC,
+ SLOT_TYPE_IUICC,
+ SLOT_TYPE_EUICC,
+ SLOT_TYPE_SOFT_SIM,
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface SlotType {
+ }
+
+ private final int mPhysicalSlotIndex;
+ private final int mSlotType;
+
+ /** @hide */
+ public SimSlotCapability(int physicalSlotId, int slotType) {
+ this.mPhysicalSlotIndex = physicalSlotId;
+ this.mSlotType = slotType;
+ }
+
+ private SimSlotCapability(Parcel in) {
+ mPhysicalSlotIndex = in.readInt();
+ mSlotType = in.readInt();
+ }
+
+ /**
+ * @return physical SIM slot index
+ */
+ public int getPhysicalSlotIndex() {
+ return mPhysicalSlotIndex;
+ }
+
+ /**
+ * @return type of SIM {@link SlotType}
+ */
+ public @SlotType int getSlotType() {
+ return mSlotType;
+ }
+
+ @Override
+ public String toString() {
+ return "mPhysicalSlotIndex=" + mPhysicalSlotIndex + " slotType=" + mSlotType;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(mPhysicalSlotIndex, mSlotType);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == null || !(o instanceof SimSlotCapability) || hashCode() != o.hashCode()) {
+ return false;
+ }
+
+ if (this == o) {
+ return true;
+ }
+
+ SimSlotCapability s = (SimSlotCapability) o;
+
+ return (mPhysicalSlotIndex == s.mPhysicalSlotIndex && mSlotType == s.mSlotType);
+ }
+
+ /**
+ * {@link Parcelable#describeContents}
+ */
+ public @ContentsFlags int describeContents() {
+ return 0;
+ }
+
+ /**
+ * {@link Parcelable#writeToParcel}
+ */
+ public void writeToParcel(@NonNull Parcel dest, @WriteFlags int flags) {
+ dest.writeInt(mPhysicalSlotIndex);
+ dest.writeInt(mSlotType);
+ }
+
+ public static final @NonNull Parcelable.Creator<SimSlotCapability> CREATOR =
+ new Parcelable.Creator() {
+ public SimSlotCapability createFromParcel(Parcel in) {
+ return new SimSlotCapability(in);
+ }
+
+ public SimSlotCapability[] newArray(int size) {
+ return new SimSlotCapability[size];
+ }
+ };
+}
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 173f84e81dae..4256dece34c3 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -1440,6 +1440,24 @@ public class TelephonyManager {
//
/**
+ * Returns the {@link PhoneCapability} for the device or null if it is not available.
+ * <p>
+ * Requires Permission: READ_PHONE_STATE or that the calling app has
+ * carrier privileges (see {@link #hasCarrierPrivileges}).
+ */
+ @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
+ @Nullable
+ public PhoneCapability getPhoneCapability() {
+ try {
+ ITelephony telephony = getITelephony();
+ return telephony == null ? null :
+ telephony.getPhoneCapability(getSubId(), getOpPackageName(), getFeatureId());
+ } catch (RemoteException ex) {
+ return null;
+ }
+ }
+
+ /**
* Returns the software version number for the device, for example,
* the IMEI/SV for GSM phones. Return null if the software version is
* not available.
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index dfb4ee50f7cc..cef9986fcd46 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -38,6 +38,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.ServiceState;
@@ -1825,12 +1826,17 @@ interface ITelephony {
/**
* Return the network selection mode on the subscription with id {@code subId}.
*/
- int getNetworkSelectionMode(int subId);
+ int getNetworkSelectionMode(int subId);
- /**
+ /**
+ * Return the PhoneCapability for the device.
+ */
+ PhoneCapability getPhoneCapability(int subId, String callingPackage, String callingFeatureId);
+
+ /**
* Return true if the device is in emergency sms mode, false otherwise.
*/
- boolean isInEmergencySmsMode();
+ boolean isInEmergencySmsMode();
/**
* Return the modem radio power state for slot index.