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

Commit fd33d54f authored by Jack Yu's avatar Jack Yu
Browse files

Added IWLAN handover rules support

Support the new IWLAN handover rules to
allow/disallow handover based on different
scenarios.

Bug: 196597630
Test: atest DataNetworkControllerTest
Change-Id: Ic5584908131d4c8e0940f3d60def2dc74a7405d9
parent 456b39de
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.telephony;

import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.hardware.radio.V1_5.AccessNetwork;

@@ -28,6 +29,8 @@ import java.lang.annotation.RetentionPolicy;
 */
public final class AccessNetworkConstants {

    private static final String TAG = AccessNetworkConstants.class.getSimpleName();

    /**
     * Wireless transportation type
     *
@@ -108,6 +111,21 @@ public final class AccessNetworkConstants {
                default: return Integer.toString(type);
            }
        }

        /** @hide */
        public static @RadioAccessNetworkType int fromString(@NonNull String str) {
            switch (str.toUpperCase()) {
                case "GERAN" : return GERAN;
                case "UTRAN" : return UTRAN;
                case "EUTRAN" : return EUTRAN;
                case "CDMA2000" : return CDMA2000;
                case "IWLAN" : return IWLAN;
                case "NGRAN" : return NGRAN;
                default:
                    Rlog.e(TAG, "Invalid access network type " + str);
                    return UNKNOWN;
            }
        }
    }

    /**
+31 −0
Original line number Diff line number Diff line
@@ -5381,6 +5381,34 @@ public class CarrierConfigManager {
    public static final String KEY_UNTHROTTLE_DATA_RETRY_WHEN_TAC_CHANGES_BOOL =
            "unthrottle_data_retry_when_tac_changes_bool";

    /**
     * IWLAN handover rules that determine whether handover is allowed or disallowed between
     * cellular and IWLAN.
     *
     * The handover rules will be matched in the order. Here are some sample rules.
     * <string-array name="iwlan_handover_rules" num="5">
     *     <!-- Handover from IWLAN to 2G/3G is not allowed -->
     *     <item value="source=IWLAN, target=GERAN|UTRAN, type=disallowed"/>
     *     <!-- Handover from 2G/3G to IWLAN is not allowed -->
     *     <item value="source=GERAN|UTRAN, target:IWLAN, type=disallowed"/>
     *     <!-- Handover from IWLAN to 3G/4G/5G is not allowed if the device is roaming. -->
     *     <item value="source=IWLAN, target=UTRAN|EUTRAN|NGRAN, roaming=true, type=disallowed"/>
     *     <!-- Handover from 4G to IWLAN is not allowed -->
     *     <item value="source=EUTRAN, target=IWLAN, type=disallowed"/>
     *     <!-- Handover is always allowed in any condition. -->
     *     <item value="source=GERAN|UTRAN|EUTRAN|NGRAN|IWLAN,
     *         target=GERAN|UTRAN|EUTRAN|NGRAN|IWLAN, type=allowed"/>
     * </string-array>
     *
     * When handover is not allowed, frameworks will tear down the data network on source transport,
     * and then setup a new one on the target transport when Qualified Network Service changes the
     * preferred access networks for particular APN types.
     *
     * @hide
     */
    public static final String KEY_IWLAN_HANDOVER_POLICY_STRING_ARRAY =
            "iwlan_handover_policy_string_array";

    /** The default value for every variable. */
    private final static PersistableBundle sDefaults;

@@ -6043,6 +6071,9 @@ public class CarrierConfigManager {
        sDefaults.putBoolean(KEY_UNTHROTTLE_DATA_RETRY_WHEN_TAC_CHANGES_BOOL, false);
        sDefaults.putBoolean(KEY_VONR_SETTING_VISIBILITY_BOOL, true);
        sDefaults.putBoolean(KEY_VONR_ENABLED_BOOL, false);
        sDefaults.putStringArray(KEY_IWLAN_HANDOVER_POLICY_STRING_ARRAY, new String[]{
                "source=GERAN|UTRAN|EUTRAN|NGRAN|IWLAN, "
                        + "target=GERAN|UTRAN|EUTRAN|NGRAN|IWLAN, type=allowed"});
    }

    /**