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

Commit bfd99e29 authored by Nagendra Prasad Nagarle Basavaraju's avatar Nagendra Prasad Nagarle Basavaraju Committed by Android (Google) Code Review
Browse files

Merge "[Bootstrap SIM Data Limit] Support bootstrap sim data usage re-evaluation" into main

parents 9f3a7999 06ac4467
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

/**
@@ -163,6 +164,13 @@ public class DataConfigManager extends Handler {
    /** Network type NR_SA_MMWAVE. Should not be used outside of DataConfigManager. */
    private static final String DATA_CONFIG_NETWORK_TYPE_NR_SA_MMWAVE = "NR_SA_MMWAVE";

    /**
     * The delay in milliseconds to re-evaluate existing data networks for bootstrap sim data usage
     * limit.
     */
    private static final long REEVALUATE_BOOTSTRAP_SIM_DATA_USAGE_MILLIS =
            TimeUnit.SECONDS.toMillis(60);

    @StringDef(prefix = {"DATA_CONFIG_NETWORK_TYPE_"}, value = {
            DATA_CONFIG_NETWORK_TYPE_GPRS,
            DATA_CONFIG_NETWORK_TYPE_EDGE,
@@ -877,6 +885,21 @@ public class DataConfigManager extends Handler {
                com.android.internal.R.integer.config_esim_bootstrap_data_limit_bytes);
    }

    /**
     * @return the interval in millisecond used to re-evaluate bootstrap sim data usage during esim
     * bootstrap activation
     */
    public long getReevaluateBootstrapSimDataUsageMillis() {
        long bootStrapSimDataUsageReevaluateInterval = mResources.getInteger(
                com.android.internal.R.integer.config_reevaluate_bootstrap_sim_data_usage_millis);

        if (bootStrapSimDataUsageReevaluateInterval <= 0) {
            bootStrapSimDataUsageReevaluateInterval = REEVALUATE_BOOTSTRAP_SIM_DATA_USAGE_MILLIS;
        }

        return bootStrapSimDataUsageReevaluateInterval;
    }

    /**
     * Update the TCP buffer sizes from the resource overlays.
     */
+2 −9
Original line number Diff line number Diff line
@@ -245,13 +245,6 @@ public class DataNetworkController extends Handler {
    private static final long REEVALUATE_UNSATISFIED_NETWORK_REQUESTS_AFTER_DETACHED_DELAY_MILLIS =
            TimeUnit.SECONDS.toMillis(1);

    /**
     * The delay in milliseconds to re-evaluate existing data networks for bootstrap sim data usage
     * limit.
     */
    private static final long REEVALUATE_BOOTSTRAP_SIM_DATA_USAGE_MILLIS =
            TimeUnit.SECONDS.toMillis(60);

    /**
     * The guard timer in milliseconds to limit querying the data usage api stats frequently
     */
@@ -1942,7 +1935,7 @@ public class DataNetworkController extends Handler {
                if (!hasMessages(EVENT_REEVALUATE_EXISTING_DATA_NETWORKS)) {
                    sendMessageDelayed(obtainMessage(EVENT_REEVALUATE_EXISTING_DATA_NETWORKS,
                            DataEvaluationReason.CHECK_DATA_USAGE),
                            REEVALUATE_BOOTSTRAP_SIM_DATA_USAGE_MILLIS);
                            mDataConfigManager.getReevaluateBootstrapSimDataUsageMillis());
                } else {
                    log("skip scheduling evaluating existing data networks since already"
                            + "scheduled");
@@ -3052,7 +3045,7 @@ public class DataNetworkController extends Handler {
        if (isEsimBootStrapProvisioningActivated()) {
            sendMessageDelayed(obtainMessage(EVENT_REEVALUATE_EXISTING_DATA_NETWORKS,
                    DataEvaluationReason.CHECK_DATA_USAGE),
                    REEVALUATE_BOOTSTRAP_SIM_DATA_USAGE_MILLIS);
                    mDataConfigManager.getReevaluateBootstrapSimDataUsageMillis());
        }
    }

+2 −0
Original line number Diff line number Diff line
@@ -855,6 +855,8 @@ public class DataNetworkControllerTest extends TelephonyTest {
        mContextFixture.putStringArrayResource(com.android.internal.R.array
                .config_force_cellular_transport_capabilities,
                new String[] {"ims", "eims", "xcap"});
        mContextFixture.putIntResource(com.android.internal.R.integer
                .config_reevaluate_bootstrap_sim_data_usage_millis, 60000);
    }

    @Before