Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 89c1eb8e authored by Robert Greenwalt's avatar Robert Greenwalt Committed by Android Git Automerger
Browse files

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

* commit '80a19e67':
  Promote Telephony's isDataPossible.
parents 0b1923ce 80a19e67
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -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();
+1 −1
Original line number Diff line number Diff line
@@ -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) {
+1 −1
Original line number Diff line number Diff line
@@ -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) {
+5 −25
Original line number Diff line number Diff line
@@ -214,36 +214,16 @@ 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));

+0 −22
Original line number Diff line number Diff line
@@ -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);