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

Commit 39624884 authored by LuK1337's avatar LuK1337
Browse files

Settings: Make NetworkScanHelper max search time customizable

Default max search time (300) fails on some devices.

Change-Id: Ia0038fac6d2000748e0aa08fd6a53f11876728d7
parent 34dec4a9
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -27,4 +27,7 @@

    <!-- Whether to show min refresh rate in display settings -->
    <bool name="config_show_min_refresh_rate_switch">false</bool>

    <!-- Max network scan search time in seconds -->
    <integer name="config_network_scan_helper_max_search_time_sec">300</integer>
</resources>
+12 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.settings.network.telephony;

import android.annotation.IntDef;
import android.content.Context;
import android.telephony.AccessNetworkConstants.AccessNetworkType;
import android.telephony.CellInfo;
import android.telephony.NetworkScan;
@@ -31,6 +32,8 @@ import androidx.annotation.VisibleForTesting;

import com.android.internal.telephony.CellNetworkScanResult;

import com.android.settings.R;

import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
@@ -129,6 +132,7 @@ public class NetworkScanHelper {
    private final TelephonyScanManager.NetworkScanCallback mInternalNetworkScanCallback;
    private final Executor mExecutor;

    private int mMaxSearchTimeSec = MAX_SEARCH_TIME_SEC;
    private NetworkScan mNetworkScanRequester;

    /** Callbacks for sync network scan */
@@ -141,6 +145,13 @@ public class NetworkScanHelper {
        mExecutor = executor;
    }

    public NetworkScanHelper(Context context, TelephonyManager tm, NetworkScanCallback callback,
            Executor executor) {
        this(tm, callback, executor);
        mMaxSearchTimeSec = context.getResources().getInteger(
                R.integer.config_network_scan_helper_max_search_time_sec);
    }

    @VisibleForTesting
    NetworkScanRequest createNetworkScanForPreferredAccessNetworks() {
        long networkTypeBitmap3gpp = mTelephonyManager.getPreferredNetworkTypeBitmask()
@@ -183,7 +194,7 @@ public class NetworkScanHelper {
                radioAccessSpecifiers.toArray(
                        new RadioAccessSpecifier[radioAccessSpecifiers.size()]),
                SEARCH_PERIODICITY_SEC,
                MAX_SEARCH_TIME_SEC,
                mMaxSearchTimeSec,
                INCREMENTAL_RESULTS,
                INCREMENTAL_RESULTS_PERIODICITY_SEC,
                null /* List of PLMN ids (MCC-MNC) */);
+1 −1
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ public class NetworkSelectSettings extends DashboardFragment {
        mTelephonyManager = getContext().getSystemService(TelephonyManager.class)
                .createForSubscriptionId(mSubId);
        mNetworkScanHelper = new NetworkScanHelper(
                mTelephonyManager, mCallback, mNetworkScanExecutor);
                getContext(), mTelephonyManager, mCallback, mNetworkScanExecutor);
        PersistableBundle bundle = ((CarrierConfigManager) getContext().getSystemService(
                Context.CARRIER_CONFIG_SERVICE)).getConfigForSubId(mSubId);
        if (bundle != null) {