Merge "Separate voice and data radio technology/network type & registration state."
This commit is contained in:
@@ -20855,18 +20855,22 @@ package android.telephony {
|
||||
ctor public ServiceState(android.os.Parcel);
|
||||
method protected void copyFrom(android.telephony.ServiceState);
|
||||
method public int describeContents();
|
||||
method public int getDataRegState();
|
||||
method public boolean getIsManualSelection();
|
||||
method public java.lang.String getOperatorAlphaLong();
|
||||
method public java.lang.String getOperatorAlphaShort();
|
||||
method public java.lang.String getOperatorNumeric();
|
||||
method public boolean getRoaming();
|
||||
method public int getState();
|
||||
method public int getVoiceState();
|
||||
method public void setDataRegState(int);
|
||||
method public void setIsManualSelection(boolean);
|
||||
method public void setOperatorName(java.lang.String, java.lang.String, java.lang.String);
|
||||
method public void setRoaming(boolean);
|
||||
method public void setState(int);
|
||||
method public void setStateOff();
|
||||
method public void setStateOutOfService();
|
||||
method public void setVoiceState(int);
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator CREATOR;
|
||||
field public static final int STATE_EMERGENCY_ONLY = 2; // 0x2
|
||||
@@ -20968,6 +20972,7 @@ package android.telephony {
|
||||
method public int getCallState();
|
||||
method public android.telephony.CellLocation getCellLocation();
|
||||
method public int getDataActivity();
|
||||
method public int getDataNetworkType();
|
||||
method public int getDataState();
|
||||
method public java.lang.String getDeviceId();
|
||||
method public java.lang.String getDeviceSoftwareVersion();
|
||||
@@ -20986,6 +20991,7 @@ package android.telephony {
|
||||
method public java.lang.String getSubscriberId();
|
||||
method public java.lang.String getVoiceMailAlphaTag();
|
||||
method public java.lang.String getVoiceMailNumber();
|
||||
method public int getVoiceNetworkType();
|
||||
method public boolean hasIccCard();
|
||||
method public boolean isNetworkRoaming();
|
||||
method public void listen(android.telephony.PhoneStateListener, int);
|
||||
|
||||
@@ -36,6 +36,7 @@ import android.util.Log;
|
||||
public class ServiceState implements Parcelable {
|
||||
|
||||
static final String LOG_TAG = "PHONE";
|
||||
static final boolean DBG = true;
|
||||
|
||||
/**
|
||||
* Normal operation condition, the phone is registered
|
||||
@@ -61,6 +62,46 @@ public class ServiceState implements Parcelable {
|
||||
*/
|
||||
public static final int STATE_POWER_OFF = 3;
|
||||
|
||||
/**
|
||||
* RIL level registration state values from ril.h
|
||||
* ((const char **)response)[0] is registration state 0-6,
|
||||
* 0 - Not registered, MT is not currently searching
|
||||
* a new operator to register
|
||||
* 1 - Registered, home network
|
||||
* 2 - Not registered, but MT is currently searching
|
||||
* a new operator to register
|
||||
* 3 - Registration denied
|
||||
* 4 - Unknown
|
||||
* 5 - Registered, roaming
|
||||
* 10 - Same as 0, but indicates that emergency calls
|
||||
* are enabled.
|
||||
* 12 - Same as 2, but indicates that emergency calls
|
||||
* are enabled.
|
||||
* 13 - Same as 3, but indicates that emergency calls
|
||||
* are enabled.
|
||||
* 14 - Same as 4, but indicates that emergency calls
|
||||
* are enabled.
|
||||
* @hide
|
||||
*/
|
||||
public static final int RIL_REG_STATE_NOT_REG = 0;
|
||||
/** @hide */
|
||||
public static final int RIL_REG_STATE_HOME = 1;
|
||||
/** @hide */
|
||||
public static final int RIL_REG_STATE_SEARCHING = 2;
|
||||
/** @hide */
|
||||
public static final int RIL_REG_STATE_DENIED = 3;
|
||||
/** @hide */
|
||||
public static final int RIL_REG_STATE_UNKNOWN = 4;
|
||||
/** @hide */
|
||||
public static final int RIL_REG_STATE_ROAMING = 5;
|
||||
/** @hide */
|
||||
public static final int RIL_REG_STATE_NOT_REG_EMERGENCY_CALL_ENABLED = 10;
|
||||
/** @hide */
|
||||
public static final int RIL_REG_STATE_SEARCHING_EMERGENCY_CALL_ENABLED = 12;
|
||||
/** @hide */
|
||||
public static final int RIL_REG_STATE_DENIED_EMERGENCY_CALL_ENABLED = 13;
|
||||
/** @hide */
|
||||
public static final int RIL_REG_STATE_UNKNOWN_EMERGENCY_CALL_ENABLED = 14;
|
||||
|
||||
/**
|
||||
* Available radio technologies for GSM, UMTS and CDMA.
|
||||
@@ -122,7 +163,8 @@ public class ServiceState implements Parcelable {
|
||||
/** @hide */
|
||||
public static final int REGISTRATION_STATE_ROAMING = 5;
|
||||
|
||||
private int mState = STATE_OUT_OF_SERVICE;
|
||||
private int mVoiceRegState = STATE_OUT_OF_SERVICE;
|
||||
private int mDataRegState = STATE_OUT_OF_SERVICE;
|
||||
private boolean mRoaming;
|
||||
private String mOperatorAlphaLong;
|
||||
private String mOperatorAlphaShort;
|
||||
@@ -131,8 +173,9 @@ public class ServiceState implements Parcelable {
|
||||
|
||||
private boolean mIsEmergencyOnly;
|
||||
|
||||
//***** CDMA
|
||||
private int mRadioTechnology;
|
||||
private int mRilVoiceRadioTechnology;
|
||||
private int mRilDataRadioTechnology;
|
||||
|
||||
private boolean mCssIndicator;
|
||||
private int mNetworkId;
|
||||
private int mSystemId;
|
||||
@@ -174,13 +217,15 @@ public class ServiceState implements Parcelable {
|
||||
}
|
||||
|
||||
protected void copyFrom(ServiceState s) {
|
||||
mState = s.mState;
|
||||
mVoiceRegState = s.mVoiceRegState;
|
||||
mDataRegState = s.mDataRegState;
|
||||
mRoaming = s.mRoaming;
|
||||
mOperatorAlphaLong = s.mOperatorAlphaLong;
|
||||
mOperatorAlphaShort = s.mOperatorAlphaShort;
|
||||
mOperatorNumeric = s.mOperatorNumeric;
|
||||
mIsManualNetworkSelection = s.mIsManualNetworkSelection;
|
||||
mRadioTechnology = s.mRadioTechnology;
|
||||
mRilVoiceRadioTechnology = s.mRilVoiceRadioTechnology;
|
||||
mRilDataRadioTechnology = s.mRilDataRadioTechnology;
|
||||
mCssIndicator = s.mCssIndicator;
|
||||
mNetworkId = s.mNetworkId;
|
||||
mSystemId = s.mSystemId;
|
||||
@@ -195,13 +240,15 @@ public class ServiceState implements Parcelable {
|
||||
* Construct a ServiceState object from the given parcel.
|
||||
*/
|
||||
public ServiceState(Parcel in) {
|
||||
mState = in.readInt();
|
||||
mVoiceRegState = in.readInt();
|
||||
mDataRegState = in.readInt();
|
||||
mRoaming = in.readInt() != 0;
|
||||
mOperatorAlphaLong = in.readString();
|
||||
mOperatorAlphaShort = in.readString();
|
||||
mOperatorNumeric = in.readString();
|
||||
mIsManualNetworkSelection = in.readInt() != 0;
|
||||
mRadioTechnology = in.readInt();
|
||||
mRilVoiceRadioTechnology = in.readInt();
|
||||
mRilDataRadioTechnology = in.readInt();
|
||||
mCssIndicator = (in.readInt() != 0);
|
||||
mNetworkId = in.readInt();
|
||||
mSystemId = in.readInt();
|
||||
@@ -213,13 +260,15 @@ public class ServiceState implements Parcelable {
|
||||
}
|
||||
|
||||
public void writeToParcel(Parcel out, int flags) {
|
||||
out.writeInt(mState);
|
||||
out.writeInt(mVoiceRegState);
|
||||
out.writeInt(mDataRegState);
|
||||
out.writeInt(mRoaming ? 1 : 0);
|
||||
out.writeString(mOperatorAlphaLong);
|
||||
out.writeString(mOperatorAlphaShort);
|
||||
out.writeString(mOperatorNumeric);
|
||||
out.writeInt(mIsManualNetworkSelection ? 1 : 0);
|
||||
out.writeInt(mRadioTechnology);
|
||||
out.writeInt(mRilVoiceRadioTechnology);
|
||||
out.writeInt(mRilDataRadioTechnology);
|
||||
out.writeInt(mCssIndicator ? 1 : 0);
|
||||
out.writeInt(mNetworkId);
|
||||
out.writeInt(mSystemId);
|
||||
@@ -246,15 +295,36 @@ public class ServiceState implements Parcelable {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get current service state of phone
|
||||
* Get current voice service state
|
||||
*
|
||||
* @Deprecate remove 3Q 2013, use {@link #getVoiceState}
|
||||
*/
|
||||
public int getState() {
|
||||
return getVoiceState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current voice service state
|
||||
*
|
||||
* @see #STATE_IN_SERVICE
|
||||
* @see #STATE_OUT_OF_SERVICE
|
||||
* @see #STATE_EMERGENCY_ONLY
|
||||
* @see #STATE_POWER_OFF
|
||||
*/
|
||||
public int getState() {
|
||||
return mState;
|
||||
public int getVoiceState() {
|
||||
return mVoiceRegState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current data service state
|
||||
*
|
||||
* @see #STATE_IN_SERVICE
|
||||
* @see #STATE_OUT_OF_SERVICE
|
||||
* @see #STATE_EMERGENCY_ONLY
|
||||
* @see #STATE_POWER_OFF
|
||||
*/
|
||||
public int getDataRegState() {
|
||||
return mDataRegState;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -354,7 +424,8 @@ public class ServiceState implements Parcelable {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return ((mState * 0x1234)
|
||||
return ((mVoiceRegState * 31)
|
||||
+ (mDataRegState * 37)
|
||||
+ (mRoaming ? 1 : 0)
|
||||
+ (mIsManualNetworkSelection ? 1 : 0)
|
||||
+ ((null == mOperatorAlphaLong) ? 0 : mOperatorAlphaLong.hashCode())
|
||||
@@ -379,13 +450,15 @@ public class ServiceState implements Parcelable {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (mState == s.mState
|
||||
return (mVoiceRegState == s.mVoiceRegState
|
||||
&& mDataRegState == s.mDataRegState
|
||||
&& mRoaming == s.mRoaming
|
||||
&& mIsManualNetworkSelection == s.mIsManualNetworkSelection
|
||||
&& equalsHandlesNulls(mOperatorAlphaLong, s.mOperatorAlphaLong)
|
||||
&& equalsHandlesNulls(mOperatorAlphaShort, s.mOperatorAlphaShort)
|
||||
&& equalsHandlesNulls(mOperatorNumeric, s.mOperatorNumeric)
|
||||
&& equalsHandlesNulls(mRadioTechnology, s.mRadioTechnology)
|
||||
&& equalsHandlesNulls(mRilVoiceRadioTechnology, s.mRilVoiceRadioTechnology)
|
||||
&& equalsHandlesNulls(mRilDataRadioTechnology, s.mRilDataRadioTechnology)
|
||||
&& equalsHandlesNulls(mCssIndicator, s.mCssIndicator)
|
||||
&& equalsHandlesNulls(mNetworkId, s.mNetworkId)
|
||||
&& equalsHandlesNulls(mSystemId, s.mSystemId)
|
||||
@@ -468,14 +541,16 @@ public class ServiceState implements Parcelable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String radioTechnology = rilRadioTechnologyToString(mRadioTechnology);
|
||||
String radioTechnology = rilRadioTechnologyToString(mRilVoiceRadioTechnology);
|
||||
String dataRadioTechnology = rilRadioTechnologyToString(mRilDataRadioTechnology);
|
||||
|
||||
return (mState + " " + (mRoaming ? "roaming" : "home")
|
||||
return (mVoiceRegState + " " + mDataRegState + " " + (mRoaming ? "roaming" : "home")
|
||||
+ " " + mOperatorAlphaLong
|
||||
+ " " + mOperatorAlphaShort
|
||||
+ " " + mOperatorNumeric
|
||||
+ " " + (mIsManualNetworkSelection ? "(manual)" : "")
|
||||
+ " " + radioTechnology
|
||||
+ " " + dataRadioTechnology
|
||||
+ " " + (mCssIndicator ? "CSS supported" : "CSS not supported")
|
||||
+ " " + mNetworkId
|
||||
+ " " + mSystemId
|
||||
@@ -485,13 +560,16 @@ public class ServiceState implements Parcelable {
|
||||
}
|
||||
|
||||
private void setNullState(int state) {
|
||||
mState = state;
|
||||
if (DBG) Log.d(LOG_TAG, "[ServiceState] setNullState=" + state);
|
||||
mVoiceRegState = state;
|
||||
mDataRegState = state;
|
||||
mRoaming = false;
|
||||
mOperatorAlphaLong = null;
|
||||
mOperatorAlphaShort = null;
|
||||
mOperatorNumeric = null;
|
||||
mIsManualNetworkSelection = false;
|
||||
mRadioTechnology = 0;
|
||||
mRilVoiceRadioTechnology = 0;
|
||||
mRilDataRadioTechnology = 0;
|
||||
mCssIndicator = false;
|
||||
mNetworkId = -1;
|
||||
mSystemId = -1;
|
||||
@@ -510,8 +588,20 @@ public class ServiceState implements Parcelable {
|
||||
setNullState(STATE_POWER_OFF);
|
||||
}
|
||||
|
||||
/** @Deprecated to be removed Q3 2013, use {@link #getVoiceState} */
|
||||
public void setState(int state) {
|
||||
mState = state;
|
||||
setVoiceState(state);
|
||||
if (DBG) Log.e(LOG_TAG, "[ServiceState] setState deprecated use getVoiceState()");
|
||||
}
|
||||
|
||||
public void setVoiceState(int state) {
|
||||
mVoiceRegState = state;
|
||||
if (DBG) Log.d(LOG_TAG, "[ServiceState] setState=" + mVoiceRegState);
|
||||
}
|
||||
|
||||
public void setDataRegState(int state) {
|
||||
mDataRegState = state;
|
||||
if (DBG) Log.d(LOG_TAG, "[ServiceState] setDataRegState=" + mDataRegState);
|
||||
}
|
||||
|
||||
public void setRoaming(boolean roaming) {
|
||||
@@ -592,13 +682,15 @@ public class ServiceState implements Parcelable {
|
||||
* @hide
|
||||
*/
|
||||
private void setFromNotifierBundle(Bundle m) {
|
||||
mState = m.getInt("state");
|
||||
mVoiceRegState = m.getInt("voiceRegState");
|
||||
mDataRegState = m.getInt("dataRegState");
|
||||
mRoaming = m.getBoolean("roaming");
|
||||
mOperatorAlphaLong = m.getString("operator-alpha-long");
|
||||
mOperatorAlphaShort = m.getString("operator-alpha-short");
|
||||
mOperatorNumeric = m.getString("operator-numeric");
|
||||
mIsManualNetworkSelection = m.getBoolean("manual");
|
||||
mRadioTechnology = m.getInt("radioTechnology");
|
||||
mRilVoiceRadioTechnology = m.getInt("radioTechnology");
|
||||
mRilVoiceRadioTechnology = m.getInt("dataRadioTechnology");
|
||||
mCssIndicator = m.getBoolean("cssIndicator");
|
||||
mNetworkId = m.getInt("networkId");
|
||||
mSystemId = m.getInt("systemId");
|
||||
@@ -614,13 +706,15 @@ public class ServiceState implements Parcelable {
|
||||
* @hide
|
||||
*/
|
||||
public void fillInNotifierBundle(Bundle m) {
|
||||
m.putInt("state", mState);
|
||||
m.putInt("voiceRegState", mVoiceRegState);
|
||||
m.putInt("dataRegState", mDataRegState);
|
||||
m.putBoolean("roaming", Boolean.valueOf(mRoaming));
|
||||
m.putString("operator-alpha-long", mOperatorAlphaLong);
|
||||
m.putString("operator-alpha-short", mOperatorAlphaShort);
|
||||
m.putString("operator-numeric", mOperatorNumeric);
|
||||
m.putBoolean("manual", Boolean.valueOf(mIsManualNetworkSelection));
|
||||
m.putInt("radioTechnology", mRadioTechnology);
|
||||
m.putInt("radioTechnology", mRilVoiceRadioTechnology);
|
||||
m.putInt("dataRadioTechnology", mRilDataRadioTechnology);
|
||||
m.putBoolean("cssIndicator", mCssIndicator);
|
||||
m.putInt("networkId", mNetworkId);
|
||||
m.putInt("systemId", mSystemId);
|
||||
@@ -629,10 +723,15 @@ public class ServiceState implements Parcelable {
|
||||
m.putBoolean("emergencyOnly", Boolean.valueOf(mIsEmergencyOnly));
|
||||
}
|
||||
|
||||
//***** CDMA
|
||||
/** @hide */
|
||||
public void setRadioTechnology(int state) {
|
||||
this.mRadioTechnology = state;
|
||||
public void setRilVoiceRadioTechnology(int rt) {
|
||||
this.mRilVoiceRadioTechnology = rt;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public void setRilDataRadioTechnology(int rt) {
|
||||
this.mRilDataRadioTechnology = rt;
|
||||
if (DBG) Log.d(LOG_TAG, "[ServiceState] setDataRadioTechnology=" + mRilDataRadioTechnology);
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@@ -647,17 +746,25 @@ public class ServiceState implements Parcelable {
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public int getRilRadioTechnology() {
|
||||
return this.mRadioTechnology;
|
||||
public int getRilVoiceRadioTechnology() {
|
||||
return this.mRilVoiceRadioTechnology;
|
||||
}
|
||||
/** @hide */
|
||||
public int getRilDataRadioTechnology() {
|
||||
return this.mRilDataRadioTechnology;
|
||||
}
|
||||
/**
|
||||
* @hide
|
||||
* @Deprecated to be removed Q3 2013 use {@link #getRilDataRadioTechnology} or
|
||||
* {@link #getRilVoiceRadioTechnology}
|
||||
*/
|
||||
public int getRadioTechnology() {
|
||||
return getRilRadioTechnology();
|
||||
Log.e(LOG_TAG, "ServiceState.getRadioTechnology() DEPRECATED will be removed *******");
|
||||
return getRilDataRadioTechnology();
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public int getNetworkType() {
|
||||
switch(mRadioTechnology) {
|
||||
private int rilRadioTechnologyToNetworkType(int rt) {
|
||||
switch(rt) {
|
||||
case ServiceState.RIL_RADIO_TECHNOLOGY_GPRS:
|
||||
return TelephonyManager.NETWORK_TYPE_GPRS;
|
||||
case ServiceState.RIL_RADIO_TECHNOLOGY_EDGE:
|
||||
@@ -692,6 +799,25 @@ public class ServiceState implements Parcelable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Deprecated to be removed Q3 2013 use {@link #getVoiceNetworkType}
|
||||
* @hide
|
||||
*/
|
||||
public int getNetworkType() {
|
||||
Log.e(LOG_TAG, "ServiceState.getNetworkType() DEPRECATED will be removed *******");
|
||||
return rilRadioTechnologyToNetworkType(mRilVoiceRadioTechnology);
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public int getDataNetworkType() {
|
||||
return rilRadioTechnologyToNetworkType(mRilDataRadioTechnology);
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public int getVoiceNetworkType() {
|
||||
return rilRadioTechnologyToNetworkType(mRilVoiceRadioTechnology);
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public int getCssIndicator() {
|
||||
return this.mCssIndicator ? 1 : 0;
|
||||
|
||||
@@ -556,6 +556,15 @@ public class TelephonyManager {
|
||||
/** Current network is HSPA+ */
|
||||
public static final int NETWORK_TYPE_HSPAP = 15;
|
||||
|
||||
/**
|
||||
* Returns the NETWORK_TYPE_xxxx for data transmission
|
||||
*
|
||||
* @Deprecated to be removed Q3 2013 use {@link #getDataNetworkType}.
|
||||
*/
|
||||
public int getNetworkType() {
|
||||
return getDataNetworkType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a constant indicating the radio technology (network type)
|
||||
* currently in use on the device for data transmission.
|
||||
@@ -578,11 +587,32 @@ public class TelephonyManager {
|
||||
* @see #NETWORK_TYPE_EHRPD
|
||||
* @see #NETWORK_TYPE_HSPAP
|
||||
*/
|
||||
public int getNetworkType() {
|
||||
public int getDataNetworkType() {
|
||||
try{
|
||||
ITelephony telephony = getITelephony();
|
||||
if (telephony != null) {
|
||||
return telephony.getNetworkType();
|
||||
return telephony.getDataNetworkType();
|
||||
} else {
|
||||
// This can happen when the ITelephony interface is not up yet.
|
||||
return NETWORK_TYPE_UNKNOWN;
|
||||
}
|
||||
} catch(RemoteException ex) {
|
||||
// This shouldn't happen in the normal case
|
||||
return NETWORK_TYPE_UNKNOWN;
|
||||
} catch (NullPointerException ex) {
|
||||
// This could happen before phone restarts due to crashing
|
||||
return NETWORK_TYPE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the NETWORK_TYPE_xxxx for voice
|
||||
*/
|
||||
public int getVoiceNetworkType() {
|
||||
try{
|
||||
ITelephony telephony = getITelephony();
|
||||
if (telephony != null) {
|
||||
return telephony.getVoiceNetworkType();
|
||||
} else {
|
||||
// This can happen when the ITelephony interface is not up yet.
|
||||
return NETWORK_TYPE_UNKNOWN;
|
||||
|
||||
@@ -261,10 +261,22 @@ interface ITelephony {
|
||||
int getVoiceMessageCount();
|
||||
|
||||
/**
|
||||
* Returns the network type
|
||||
* Returns the network type for data transmission
|
||||
*
|
||||
* @Deprecated to be removed Q3 2013 use {@link #getDataNetwork}.
|
||||
*/
|
||||
int getNetworkType();
|
||||
|
||||
/**
|
||||
* Returns the network type for data transmission
|
||||
*/
|
||||
int getDataNetworkType();
|
||||
|
||||
/**
|
||||
* Returns the network type for voice
|
||||
*/
|
||||
int getVoiceNetworkType();
|
||||
|
||||
/**
|
||||
* Return true if an ICC card is present
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user