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

Commit 973b5c88 authored by Chiachang Wang's avatar Chiachang Wang Committed by Automerger Merge Worker
Browse files

Merge "Use location mcc to load the array config resource" am: 6d62f62a am:...

Merge "Use location mcc to load the array config resource" am: 6d62f62a am: fcf4c599 am: 1995a4cd

Change-Id: I4106e1791c6ac315afbd06aeb5fa0a39dc958512
parents 276fc8dc 1995a4cd
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -1608,7 +1608,8 @@ public class NetworkMonitor extends StateMachine {
                settingProviderUrls = new URL[0];
            }

            return getArrayConfig(settingProviderUrls, R.array.config_captive_portal_fallback_urls,
            return getProbeUrlArrayConfig(settingProviderUrls,
                    R.array.config_captive_portal_fallback_urls,
                    R.array.default_captive_portal_fallback_urls, this::makeURL);
        } catch (Exception e) {
            // Don't let a misconfiguration bootloop the system.
@@ -1627,7 +1628,8 @@ public class NetworkMonitor extends StateMachine {
                    ? emptySpecs
                    : parseCaptivePortalProbeSpecs(settingsValue).toArray(emptySpecs);

            return getArrayConfig(providerValue, R.array.config_captive_portal_fallback_probe_specs,
            return getProbeUrlArrayConfig(providerValue,
                    R.array.config_captive_portal_fallback_probe_specs,
                    R.array.default_captive_portal_fallback_probe_specs,
                    CaptivePortalProbeSpec::parseSpecOrNull);
        } catch (Exception e) {
@@ -1674,9 +1676,9 @@ public class NetworkMonitor extends StateMachine {
     * @param resourceConverter Converter from the resource strings to stored setting class. Null
     *                          return values are ignored.
     */
    private <T> T[] getArrayConfig(@NonNull T[] providerValue, @ArrayRes int configResId,
    private <T> T[] getProbeUrlArrayConfig(@NonNull T[] providerValue, @ArrayRes int configResId,
            @ArrayRes int defaultResId, @NonNull Function<String, T> resourceConverter) {
        final Resources res = mContext.getResources();
        final Resources res = getContextByMccIfNoSimCardOrDefault().getResources();
        String[] configValue = res.getStringArray(configResId);

        if (configValue.length == 0) {