OSDN Git Service

Get rid of unnecessary KEY_RESTRICT_BACKGROUND preference.
authorRajeev Kumar <rajekumar@google.com>
Mon, 25 Sep 2017 18:34:10 +0000 (11:34 -0700)
committerRajeev Kumar <rajekumar@google.com>
Mon, 25 Sep 2017 18:34:10 +0000 (11:34 -0700)
This preference is not needed for Data plan settings page. This change
fixes the NPE which happens because we try to remove a preference which
is not added to the settings preference fragment.
Test: make RunSettingsRoboTests -j40
Bug: 64068792

Change-Id: Ibbcf1637b8aed1a94542ea3786170f2f318df4a9

src/com/android/settings/datausage/DataPlanUsageSummary.java

index 0743749..1905deb 100644 (file)
@@ -53,7 +53,6 @@ import java.util.List;
 
 public class DataPlanUsageSummary extends DataUsageBase implements Indexable {
 
-    public static final String KEY_RESTRICT_BACKGROUND = "restrict_background";
     public static final String KEY_DATA_PLAN_USAGE = "data_plan_usage";
 
     public static final String KEY_STATUS_HEADER = "status_header";
@@ -100,10 +99,6 @@ public class DataPlanUsageSummary extends DataUsageBase implements Indexable {
         }
         mDefaultTemplate = DataUsageUtils.getDefaultTemplate(context, defaultSubId);
 
-        if (!hasMobileData || !isAdmin()) {
-            removePreference(KEY_RESTRICT_BACKGROUND);
-        }
-
         if (hasMobileData) {
             addDataPlanSection(defaultSubId);
         }