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

Commit 7cd5b0e7 authored by Jason Monk's avatar Jason Monk Committed by The Android Automerger
Browse files

Protect against missing subscriptions

Bug: 26676464
Change-Id: I428dd60e6774f7ca88423edb7a87e51ee8a7dadd
parent 9bb8ae75
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -77,6 +77,9 @@ public class DataUsageSummary extends DataUsageBase implements Indexable {
        addPreferencesFromResource(R.xml.data_usage);

        int defaultSubId = getDefaultSubscriptionId(getContext());
        if (defaultSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
            hasMobileData = false;
        }
        mDefaultTemplate = getDefaultTemplate(getContext(), defaultSubId);
        if (hasMobileData) {
            mLimitPreference = findPreference(KEY_LIMIT_SUMMARY);
@@ -279,7 +282,7 @@ public class DataUsageSummary extends DataUsageBase implements Indexable {
    }

    public static NetworkTemplate getDefaultTemplate(Context context, int defaultSubId) {
        if (hasMobileData(context)) {
        if (hasMobileData(context) && defaultSubId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
            TelephonyManager telephonyManager = TelephonyManager.from(context);
            NetworkTemplate mobileAll = NetworkTemplate.buildTemplateMobileAll(
                    telephonyManager.getSubscriberId(defaultSubId));