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

Commit 9cc1ecdd authored by Ling Ma's avatar Ling Ma
Browse files

Add preferredDataProfile teardown check

Test: manual
Bug: 222311623
Change-Id: I24e0a7d4ba1b4587ed89eae94562c1a9afdfe606
parent f06705f9
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -1523,7 +1523,8 @@ public class DataNetworkController extends Handler {


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


+12 −0
Original line number Original line Diff line number Diff line
@@ -667,6 +667,18 @@ public class DataProfileManager extends Handler {
        return null != getDataProfileForNetworkRequest(networkRequest, networkType);
        return null != getDataProfileForNetworkRequest(networkRequest, networkType);
    }
    }


     /**
     * 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.
     * Dedupe the similar data profiles.
     */
     */