am 80a19e67: Merge "Promote Telephony\'s isDataPossible." into honeycomb-LTE

* commit '80a19e67d1cd3710dbbfa52767a994512d20f694':
  Promote Telephony's isDataPossible.
This commit is contained in:
Robert Greenwalt
2011-06-03 15:46:08 -07:00
committed by Android Git Automerger
5 changed files with 9 additions and 56 deletions

View File

@@ -509,7 +509,6 @@ public abstract class DataConnectionTracker extends Handler {
protected abstract void onVoiceCallEnded();
protected abstract void onCleanUpConnection(boolean tearDown, int apnId, String reason);
protected abstract void onCleanUpAllConnections(String cause);
protected abstract boolean isDataPossible();
protected abstract boolean isDataPossible(String apnType);
@Override
@@ -752,7 +751,7 @@ public abstract class DataConnectionTracker extends Handler {
protected void notifyDataAvailability(String reason) {
// note that we either just turned all off because we lost availability
// or all were off and could now go on, so only have off apns to worry about
notifyOffApnsOfAvailability(reason, isDataPossible());
notifyOffApnsOfAvailability(reason, isDataPossible(Phone.APN_TYPE_DEFAULT));
}
public boolean isApnTypeEnabled(String apnType) {
@@ -968,11 +967,7 @@ public abstract class DataConnectionTracker extends Handler {
sendMessage(msg);
}
public boolean isAnyActiveDataConnections() {
// TODO: Remember if there are any connected or
// loop asking each DC/APN?
return true;
}
public abstract boolean isAnyActiveDataConnections();
protected void onSetDataEnabled(boolean enable) {
boolean prevEnabled = getAnyDataEnabled();

View File

@@ -1023,7 +1023,7 @@ public abstract class PhoneBase extends Handler implements Phone {
}
public boolean isDataConnectivityPossible() {
return ((mDataConnectionTracker != null) && (mDataConnectionTracker.isDataPossible()));
return isDataConnectivityPossible(Phone.APN_TYPE_DEFAULT);
}
public boolean isDataConnectivityPossible(String apnType) {

View File

@@ -654,7 +654,7 @@ public class PhoneProxy extends Handler implements Phone {
}
public boolean isDataConnectivityPossible() {
return mActivePhone.isDataConnectivityPossible();
return mActivePhone.isDataConnectivityPossible(Phone.APN_TYPE_DEFAULT);
}
public boolean isDataConnectivityPossible(String apnType) {

View File

@@ -214,35 +214,15 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
return allowed;
}
/**
* The only circumstances under which we report that data connectivity is not
* possible are
* <ul>
* <li>Data is disallowed (roaming, power state, voice call, etc).</li>
* <li>The current data state is {@code DISCONNECTED} for a reason other than
* having explicitly disabled connectivity. In other words, data is not available
* because the phone is out of coverage or some like reason.</li>
* </ul>
* @return {@code true} if data connectivity is possible, {@code false} otherwise.
*/
@Override
protected boolean isDataPossible() {
boolean dataAllowed = isDataAllowed();
boolean anyDataEnabled = getAnyDataEnabled();
boolean possible = (dataAllowed
&& !(anyDataEnabled && (mState == State.FAILED || mState == State.IDLE)));
if (!possible && DBG) {
log("isDataPossible() " + possible + ", dataAllowed=" + dataAllowed +
" anyDataEnabled=" + anyDataEnabled + " dataState=" + mState);
protected boolean isDataPossible(String apnType) {
boolean possible = isDataAllowed() && !(getAnyDataEnabled() &&
(mState == State.FAILED || mState == State.IDLE));
if (!possible && DBG && isDataAllowed()) {
log("Data not possible. No coverage: dataState = " + mState);
}
return possible;
}
@Override
protected boolean isDataPossible(String apnType) {
return isDataPossible();
}
private boolean trySetupData(String reason) {
if (DBG) log("***trySetupData due to " + (reason == null ? "(unspecified)" : reason));

View File

@@ -205,28 +205,6 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
return (apnContext.getDataConnection() != null);
}
/**
* The only circumstances under which we report that data connectivity is not
* possible are
* <ul>
* <li>Data is disallowed (roaming, power state, voice call, etc).</li>
* <li>The current data state is {@code DISCONNECTED} for a reason other than
* having explicitly disabled connectivity. In other words, data is not available
* because the phone is out of coverage or some like reason.</li>
* </ul>
* @return {@code true} if data connectivity is possible, {@code false} otherwise.
* TODO - do per-apn notifications of availability using dependencyMet values.
*/
@Override
protected boolean isDataPossible() {
boolean possible = (isDataAllowed()
&& !(getAnyDataEnabled() && (getOverallState() == State.FAILED)));
if (!possible && DBG && isDataAllowed()) {
if (DBG) log("Data not possible. No coverage: dataState = " + getOverallState());
}
return possible;
}
@Override
protected boolean isDataPossible(String apnType) {
ApnContext apnContext = mApnContexts.get(apnType);