Add method in Phone interface to check whether data is enabled.

This adds isDataConnectivityEnabled to allow test methods to query the
data connectivity state.
This commit is contained in:
Wink Saville
2009-07-24 13:23:55 -07:00
parent 30b06eb8b9
commit c6d6b687af
4 changed files with 19 additions and 0 deletions

View File

@@ -1265,6 +1265,13 @@ public interface Phone {
*/
boolean disableDataConnectivity();
/**
* Report the current state of data connectivity (enabled or disabled)
* @return {@code false} if data connectivity has been explicitly disabled,
* {@code true} otherwise.
*/
boolean isDataConnectivityEnabled();
/**
* Enables the specified APN type. Only works for "special" APN types,
* i.e., not the default APN.

View File

@@ -614,6 +614,10 @@ public class PhoneProxy extends Handler implements Phone {
return mActivePhone.disableApnType(type);
}
public boolean isDataConnectivityEnabled() {
return mActivePhone.isDataConnectivityEnabled();
}
public boolean isDataConnectivityPossible() {
return mActivePhone.isDataConnectivityPossible();
}

View File

@@ -508,6 +508,10 @@ public class CDMAPhone extends PhoneBase {
return false;
}
public boolean isDataConnectivityEnabled() {
return mDataConnection.getDataEnabled();
}
public boolean isDataConnectivityPossible() {
boolean noData = mDataConnection.getDataEnabled() &&
getDataConnectionState() == DataState.DISCONNECTED;

View File

@@ -1169,6 +1169,10 @@ public class GSMPhone extends PhoneBase {
return mDataConnection.getDnsServers(apnType);
}
public boolean isDataConnectivityEnabled() {
return mDataConnection.getDataEnabled();
}
/**
* The only circumstances under which we report that data connectivity is not
* possible are