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

Commit 9999edf8 authored by David van Tonder's avatar David van Tonder Committed by Gerrit Code Review
Browse files

Merge "Revert "Framework: Fixes mms automatic retrieval (2/2)"" into jellybean

parents 98f22ee1 7cfd18a4
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -181,18 +181,6 @@ public interface TelephonyProperties
     */
    static final String PROPERTY_SMS_SEND = "telephony.sms.send";

    /**
     * Set to false to disable MMS automatic retrieval of content,
     * default is true
     */
    static final String PROPERTY_MMS_AUTO_RETRIEVAL = "persist.sys.mms_auto_retrieval";

    /**
     * Set to false to disable MMS automatic retrieval during roaming,
     * default is false
     */
    static final String PROPERTY_MMS_AUTO_RETRIEVAL_ON_ROAMING = "persist.sys.mms_auto_on_roaming";

    /**
     * Set to true to indicate a test CSIM card is used in the device.
     * This property is for testing purpose only. This should not be defined
+3 −38
Original line number Diff line number Diff line
@@ -63,7 +63,6 @@ import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneBase;
import com.android.internal.telephony.RILConstants;
import com.android.internal.telephony.RetryManager;
import com.android.internal.telephony.TelephonyProperties;
import com.android.internal.util.AsyncChannel;

import java.io.FileDescriptor;
@@ -758,7 +757,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {

        boolean desiredPowerState = mPhone.getServiceStateTracker().getDesiredPowerState();

        if (canSetupData(apnContext)) {
        if ((apnContext.getState() == State.IDLE || apnContext.getState() == State.SCANNING) &&
                isDataAllowed(apnContext) && getAnyDataEnabled() && !isEmergency()) {

            if (apnContext.getState() == State.IDLE) {
                ArrayList<ApnSetting> waitingApns = buildWaitingApns(apnContext.getApnType());
@@ -793,41 +793,6 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
        }
    }

    /**
     * Report on whether data connectivity can be setup for any APN.
     * APN_TYPE_MMS connectivity can always be setup, except on roaming with data disabled
     * @param apnContext The apnContext
     * @return boolean
     */
    private boolean canSetupData(ApnContext apnContext) {
        if (apnContext.getState() != State.IDLE && apnContext.getState() != State.SCANNING) {
            return false;
        }

        if (isDataAllowed(apnContext) && getAnyDataEnabled() && !isEmergency()) {
            return true;
        }

        boolean mmsAutoRetrieval = SystemProperties.getBoolean(
                TelephonyProperties.PROPERTY_MMS_AUTO_RETRIEVAL, true);
        boolean mmsRetrievalRoaming = SystemProperties.getBoolean(
                TelephonyProperties.PROPERTY_MMS_AUTO_RETRIEVAL_ON_ROAMING, false);

        // Allow automatic Mms connections if user has enabled it system-wide
        if (mmsAutoRetrieval && apnContext.getApnType().equals(Phone.APN_TYPE_MMS)) {
            /* don't allow MMS connections on roaming if data roaming is disabled (in Settings
             * and in the Mms application) */
            TelephonyManager tm = (TelephonyManager)
                    mPhone.getContext().getSystemService(Context.TELEPHONY_SERVICE);
            if (tm.isNetworkRoaming() && !mPhone.getDataRoamingEnabled() && !mmsRetrievalRoaming)
                return false;

            return true;
        }

        return false;
    }

    @Override
    // Disabled apn's still need avail/unavail notificiations - send them out
    protected void notifyOffApnsOfAvailability(String reason) {