Add RadioAccessFamily rank am: de780c84b5
am: 86739bd8d6
Change-Id: I05c4d9d3269ca893b51529df96760bda5b31db8b
This commit is contained in:
@@ -29,32 +29,38 @@ import com.android.internal.telephony.RILConstants;
|
||||
public class RadioAccessFamily implements Parcelable {
|
||||
|
||||
// Radio Access Family
|
||||
// 2G
|
||||
public static final int RAF_UNKNOWN = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN);
|
||||
public static final int RAF_GSM = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_GSM);
|
||||
public static final int RAF_GPRS = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_GPRS);
|
||||
public static final int RAF_EDGE = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EDGE);
|
||||
public static final int RAF_UMTS = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_UMTS);
|
||||
public static final int RAF_IS95A = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_IS95A);
|
||||
public static final int RAF_IS95B = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_IS95B);
|
||||
public static final int RAF_1xRTT = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_1xRTT);
|
||||
// 3G
|
||||
public static final int RAF_EVDO_0 = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_0);
|
||||
public static final int RAF_EVDO_A = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_A);
|
||||
public static final int RAF_HSDPA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSDPA);
|
||||
public static final int RAF_HSUPA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSUPA);
|
||||
public static final int RAF_HSPA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSPA);
|
||||
public static final int RAF_EVDO_B = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_B);
|
||||
public static final int RAF_EHRPD = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD);
|
||||
public static final int RAF_LTE = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_LTE);
|
||||
public static final int RAF_HSUPA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSUPA);
|
||||
public static final int RAF_HSDPA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSDPA);
|
||||
public static final int RAF_HSPA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSPA);
|
||||
public static final int RAF_HSPAP = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSPAP);
|
||||
public static final int RAF_GSM = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_GSM);
|
||||
public static final int RAF_UMTS = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_UMTS);
|
||||
public static final int RAF_TD_SCDMA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_TD_SCDMA);
|
||||
// 4G
|
||||
public static final int RAF_LTE = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_LTE);
|
||||
public static final int RAF_LTE_CA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_LTE_CA);
|
||||
|
||||
// Grouping of RAFs
|
||||
// 2G
|
||||
private static final int GSM = RAF_GSM | RAF_GPRS | RAF_EDGE;
|
||||
private static final int HS = RAF_HSUPA | RAF_HSDPA | RAF_HSPA | RAF_HSPAP;
|
||||
private static final int CDMA = RAF_IS95A | RAF_IS95B | RAF_1xRTT;
|
||||
// 3G
|
||||
private static final int EVDO = RAF_EVDO_0 | RAF_EVDO_A | RAF_EVDO_B | RAF_EHRPD;
|
||||
private static final int HS = RAF_HSUPA | RAF_HSDPA | RAF_HSPA | RAF_HSPAP;
|
||||
private static final int WCDMA = HS | RAF_UMTS;
|
||||
// 4G
|
||||
private static final int LTE = RAF_LTE | RAF_LTE_CA;
|
||||
|
||||
/* Phone ID of phone */
|
||||
@@ -239,6 +245,24 @@ public class RadioAccessFamily implements Parcelable {
|
||||
return raf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the highest capability of the RadioAccessFamily (4G > 3G > 2G).
|
||||
* @param raf The RadioAccessFamily that we wish to filter
|
||||
* @return The highest radio capability
|
||||
*/
|
||||
public static int getHighestRafCapability(int raf) {
|
||||
if ((LTE & raf) > 0) {
|
||||
return TelephonyManager.NETWORK_CLASS_4_G;
|
||||
}
|
||||
if ((EVDO|HS|WCDMA & raf) > 0) {
|
||||
return TelephonyManager.NETWORK_CLASS_3_G;
|
||||
}
|
||||
if((GSM|CDMA & raf) > 0) {
|
||||
return TelephonyManager.NETWORK_CLASS_2_G;
|
||||
}
|
||||
return TelephonyManager.NETWORK_CLASS_UNKNOWN;
|
||||
}
|
||||
|
||||
public static int getNetworkTypeFromRaf(int raf) {
|
||||
int type;
|
||||
|
||||
|
||||
@@ -1662,6 +1662,12 @@ public class TelephonyManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Network Class Definitions.
|
||||
* Do not change this order, it is used for sorting during emergency calling in
|
||||
* {@link TelephonyConnectionService#getFirstPhoneForEmergencyCall()}. Any newer technologies
|
||||
* should be added after the current definitions.
|
||||
*/
|
||||
/** Unknown network class. {@hide} */
|
||||
public static final int NETWORK_CLASS_UNKNOWN = 0;
|
||||
/** Class of broadly defined "2G" networks. {@hide} */
|
||||
|
||||
Reference in New Issue
Block a user