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

Commit 3c48f29c authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Add preferredDataProfile teardown check"

parents c1eeb4e1 6d7b06f1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1539,7 +1539,8 @@ public class DataNetworkController extends Handler {

        // If users switch preferred profile in APN editor, we need to tear down network.
        if (dataNetwork.isInternetSupported()
                && !mDataProfileManager.isDataProfilePreferred(dataProfile)) {
                && !mDataProfileManager.isDataProfilePreferred(dataProfile)
                && mDataProfileManager.isAnyPreferredDataProfileExisting()) {
            evaluation.addDataDisallowedReason(DataDisallowedReason.DATA_PROFILE_NOT_PREFERRED);
        }

+12 −0
Original line number Diff line number Diff line
@@ -698,6 +698,18 @@ public class DataProfileManager extends Handler {
        return dataProfile.equals(mPreferredDataProfile);
    }

    /**
     * Check if any preferred data profile exists.
     *
     * @return {@code true} if any preferred data profile exists
     */
    public boolean isAnyPreferredDataProfileExisting() {
        for (DataProfile dataProfile : mAllDataProfiles) {
            if (dataProfile.isPreferred()) return true;
        }
        return false;
    }

    /**
     * Dedupe the similar data profiles.
     */