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

Commit 87e80141 authored by Rebecca Silberstein's avatar Rebecca Silberstein Committed by Christopher Wiley
Browse files

Tethering: check if configManager is null

cherry-picked from b07f1409

Before attempting to retrieve a carrier entitlement setting, first make
sure we have a carrier config manager and if we do have a carrier config
manager, the config it holds is not null.

Bug: 31929638
Test: unittests coming in follow on CL
Change-Id: Iee476c476cb3de109cdccbd955b7fb986dd4267b
parent cbb03d1a
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -404,12 +404,14 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering
        // Check carrier config for entitlement checks
        final CarrierConfigManager configManager = (CarrierConfigManager) mContext
             .getSystemService(Context.CARRIER_CONFIG_SERVICE);
        if (configManager != null && configManager.getConfig() != null) {
            // we do have a CarrierConfigManager and it has a config.
            boolean isEntitlementCheckRequired = configManager.getConfig().getBoolean(
                    CarrierConfigManager.KEY_REQUIRE_ENTITLEMENT_CHECKS_BOOL);

            if (!isEntitlementCheckRequired) {
                return false;
            }
        }
        return (provisionApp.length == 2);
    }