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

Commit 2da70f63 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "[Settings] Avoid from crash UI when querying data usage"

parents 8adb5614 2c6d8d53
Loading
Loading
Loading
Loading
+12 −1
Original line number Original line Diff line number Diff line
@@ -37,7 +37,6 @@ import android.os.UserManager;
import android.provider.Settings;
import android.provider.Settings;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.SubscriptionManager;
import android.util.FeatureFlagUtils;
import android.util.Log;
import android.util.Log;
import android.util.SparseArray;
import android.util.SparseArray;
import android.view.View;
import android.view.View;
@@ -49,6 +48,7 @@ import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.Spinner;


import androidx.annotation.VisibleForTesting;
import androidx.annotation.VisibleForTesting;
import androidx.lifecycle.Lifecycle;
import androidx.loader.app.LoaderManager.LoaderCallbacks;
import androidx.loader.app.LoaderManager.LoaderCallbacks;
import androidx.loader.content.Loader;
import androidx.loader.content.Loader;
import androidx.preference.Preference;
import androidx.preference.Preference;
@@ -501,6 +501,17 @@ public class DataUsageList extends DataUsageBaseFragment
                        + cycle.end + "]");
                        + cycle.end + "]");
            }
            }


            // Avoid from updating UI after #onStop.
            if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) {
                return;
            }

            // Avoid from updating UI when async query still on-going.
            // This could happen when a request from #onMobileDataEnabledChange.
            if (mCycleData == null) {
                return;
            }

            // update chart to show selected cycle, and update detail data
            // update chart to show selected cycle, and update detail data
            // to match updated sweep bounds.
            // to match updated sweep bounds.
            mChart.setNetworkCycleData(mCycleData.get(position));
            mChart.setNetworkCycleData(mCycleData.get(position));