am 80a19e67: Merge "Promote Telephony\'s isDataPossible." into honeycomb-LTE
* commit '80a19e67d1cd3710dbbfa52767a994512d20f694': Promote Telephony's isDataPossible.
This commit is contained in:
@@ -509,7 +509,6 @@ public abstract class DataConnectionTracker extends Handler {
|
|||||||
protected abstract void onVoiceCallEnded();
|
protected abstract void onVoiceCallEnded();
|
||||||
protected abstract void onCleanUpConnection(boolean tearDown, int apnId, String reason);
|
protected abstract void onCleanUpConnection(boolean tearDown, int apnId, String reason);
|
||||||
protected abstract void onCleanUpAllConnections(String cause);
|
protected abstract void onCleanUpAllConnections(String cause);
|
||||||
protected abstract boolean isDataPossible();
|
|
||||||
protected abstract boolean isDataPossible(String apnType);
|
protected abstract boolean isDataPossible(String apnType);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -752,7 +751,7 @@ public abstract class DataConnectionTracker extends Handler {
|
|||||||
protected void notifyDataAvailability(String reason) {
|
protected void notifyDataAvailability(String reason) {
|
||||||
// note that we either just turned all off because we lost availability
|
// 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
|
// 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) {
|
public boolean isApnTypeEnabled(String apnType) {
|
||||||
@@ -968,11 +967,7 @@ public abstract class DataConnectionTracker extends Handler {
|
|||||||
sendMessage(msg);
|
sendMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAnyActiveDataConnections() {
|
public abstract boolean isAnyActiveDataConnections();
|
||||||
// TODO: Remember if there are any connected or
|
|
||||||
// loop asking each DC/APN?
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void onSetDataEnabled(boolean enable) {
|
protected void onSetDataEnabled(boolean enable) {
|
||||||
boolean prevEnabled = getAnyDataEnabled();
|
boolean prevEnabled = getAnyDataEnabled();
|
||||||
|
|||||||
@@ -1023,7 +1023,7 @@ public abstract class PhoneBase extends Handler implements Phone {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDataConnectivityPossible() {
|
public boolean isDataConnectivityPossible() {
|
||||||
return ((mDataConnectionTracker != null) && (mDataConnectionTracker.isDataPossible()));
|
return isDataConnectivityPossible(Phone.APN_TYPE_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDataConnectivityPossible(String apnType) {
|
public boolean isDataConnectivityPossible(String apnType) {
|
||||||
|
|||||||
@@ -654,7 +654,7 @@ public class PhoneProxy extends Handler implements Phone {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDataConnectivityPossible() {
|
public boolean isDataConnectivityPossible() {
|
||||||
return mActivePhone.isDataConnectivityPossible();
|
return mActivePhone.isDataConnectivityPossible(Phone.APN_TYPE_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDataConnectivityPossible(String apnType) {
|
public boolean isDataConnectivityPossible(String apnType) {
|
||||||
|
|||||||
@@ -214,35 +214,15 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
|||||||
return allowed;
|
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
|
@Override
|
||||||
protected boolean isDataPossible() {
|
protected boolean isDataPossible(String apnType) {
|
||||||
boolean dataAllowed = isDataAllowed();
|
boolean possible = isDataAllowed() && !(getAnyDataEnabled() &&
|
||||||
boolean anyDataEnabled = getAnyDataEnabled();
|
(mState == State.FAILED || mState == State.IDLE));
|
||||||
boolean possible = (dataAllowed
|
if (!possible && DBG && isDataAllowed()) {
|
||||||
&& !(anyDataEnabled && (mState == State.FAILED || mState == State.IDLE)));
|
log("Data not possible. No coverage: dataState = " + mState);
|
||||||
if (!possible && DBG) {
|
|
||||||
log("isDataPossible() " + possible + ", dataAllowed=" + dataAllowed +
|
|
||||||
" anyDataEnabled=" + anyDataEnabled + " dataState=" + mState);
|
|
||||||
}
|
}
|
||||||
return possible;
|
return possible;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isDataPossible(String apnType) {
|
|
||||||
return isDataPossible();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private boolean trySetupData(String reason) {
|
private boolean trySetupData(String reason) {
|
||||||
if (DBG) log("***trySetupData due to " + (reason == null ? "(unspecified)" : reason));
|
if (DBG) log("***trySetupData due to " + (reason == null ? "(unspecified)" : reason));
|
||||||
|
|||||||
@@ -205,28 +205,6 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
return (apnContext.getDataConnection() != null);
|
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
|
@Override
|
||||||
protected boolean isDataPossible(String apnType) {
|
protected boolean isDataPossible(String apnType) {
|
||||||
ApnContext apnContext = mApnContexts.get(apnType);
|
ApnContext apnContext = mApnContexts.get(apnType);
|
||||||
|
|||||||
Reference in New Issue
Block a user