Merge "Can disable checkbox without tint on text" into pi-dev
diff --git a/res/xml/security_dashboard_settings.xml b/res/xml/security_dashboard_settings.xml
index 858cbaf..7519cef 100644
--- a/res/xml/security_dashboard_settings.xml
+++ b/res/xml/security_dashboard_settings.xml
@@ -41,7 +41,7 @@
         <com.android.settings.widget.GearPreference
             android:key="unlock_set_or_change"
             android:title="@string/unlock_set_unlock_launch_picker_title"
-            android:summary="@string/unlock_set_unlock_mode_none"
+            android:summary="@string/summary_placeholder"
             settings:keywords="@string/keywords_lockscreen" />
 
         <Preference
diff --git a/res/xml/sound_settings.xml b/res/xml/sound_settings.xml
index 704d553..c079807 100644
--- a/res/xml/sound_settings.xml
+++ b/res/xml/sound_settings.xml
@@ -20,7 +20,7 @@
     android:title="@string/sound_settings"
     android:key="sound_settings"
     settings:keywords="@string/keywords_sounds"
-    settings:initialExpandedChildrenCount="8">
+    settings:initialExpandedChildrenCount="9">
 
     <!-- Media volume -->
     <com.android.settings.notification.VolumeSeekBarPreference
diff --git a/src/com/android/settings/accounts/AccountPreferenceController.java b/src/com/android/settings/accounts/AccountPreferenceController.java
index b172198..d9410b2 100644
--- a/src/com/android/settings/accounts/AccountPreferenceController.java
+++ b/src/com/android/settings/accounts/AccountPreferenceController.java
@@ -40,6 +40,7 @@
 import android.support.v7.preference.Preference.OnPreferenceClickListener;
 import android.support.v7.preference.PreferenceGroup;
 import android.support.v7.preference.PreferenceScreen;
+import android.text.BidiFormatter;
 import android.util.ArrayMap;
 import android.util.Log;
 import android.util.SparseArray;
@@ -313,7 +314,7 @@
         preferenceGroup.setOrder(mAccountProfileOrder++);
         if (isSingleProfile()) {
             preferenceGroup.setTitle(context.getString(R.string.account_for_section_header,
-                userInfo.name));
+                    BidiFormatter.getInstance().unicodeWrap(userInfo.name)));
             preferenceGroup.setContentDescription(
                 mContext.getString(R.string.account_settings));
         } else if (userInfo.isManagedProfile()) {
diff --git a/src/com/android/settings/datausage/DataUsageSummaryPreference.java b/src/com/android/settings/datausage/DataUsageSummaryPreference.java
index c8d2cef..e5e83eb 100644
--- a/src/com/android/settings/datausage/DataUsageSummaryPreference.java
+++ b/src/com/android/settings/datausage/DataUsageSummaryPreference.java
@@ -187,7 +187,7 @@
             updateCarrierInfo(carrierInfo);
             if (mLaunchIntent != null) {
                 launchButton.setOnClickListener((view) -> {
-                    getContext().sendBroadcast(mLaunchIntent);
+                    getContext().startActivity(mLaunchIntent);
                 });
                 launchButton.setVisibility(View.VISIBLE);
             } else {
diff --git a/src/com/android/settings/fuelgauge/PowerUsageSummary.java b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
index 2c8f961..4c4b6e9 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageSummary.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
@@ -107,7 +107,8 @@
     BatteryHeaderPreferenceController mBatteryHeaderPreferenceController;
     @VisibleForTesting
     boolean mNeedUpdateBatteryTip;
-    private BatteryTipPreferenceController mBatteryTipPreferenceController;
+    @VisibleForTesting
+    BatteryTipPreferenceController mBatteryTipPreferenceController;
     private int mStatsType = BatteryStats.STATS_SINCE_CHARGED;
 
     @VisibleForTesting
@@ -213,8 +214,8 @@
         mAnomalySparseArray = new SparseArray<>();
 
         restartBatteryInfoLoader();
-        mNeedUpdateBatteryTip = icicle == null;
         mBatteryTipPreferenceController.restoreInstanceState(icicle);
+        updateBatteryTipFlag(icicle);
     }
 
     @Override
@@ -382,6 +383,11 @@
         }
     }
 
+    @VisibleForTesting
+    void updateBatteryTipFlag(Bundle icicle) {
+        mNeedUpdateBatteryTip = icicle == null || mBatteryTipPreferenceController.needUpdate();
+    }
+
     @Override
     public boolean onLongClick(View view) {
         showBothEstimates();
diff --git a/src/com/android/settings/fuelgauge/batterytip/BatteryTipPreferenceController.java b/src/com/android/settings/fuelgauge/batterytip/BatteryTipPreferenceController.java
index 249bf9b..784c54c 100644
--- a/src/com/android/settings/fuelgauge/batterytip/BatteryTipPreferenceController.java
+++ b/src/com/android/settings/fuelgauge/batterytip/BatteryTipPreferenceController.java
@@ -52,6 +52,7 @@
     private Map<String, BatteryTip> mBatteryTipMap;
     private SettingsActivity mSettingsActivity;
     private MetricsFeatureProvider mMetricsFeatureProvider;
+    private boolean mNeedUpdate;
     @VisibleForTesting
     PreferenceGroup mPreferenceGroup;
     @VisibleForTesting
@@ -71,6 +72,7 @@
         mFragment = fragment;
         mSettingsActivity = settingsActivity;
         mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
+        mNeedUpdate = true;
     }
 
     @Override
@@ -111,6 +113,7 @@
                 mBatteryTipMap.put(preference.getKey(), batteryTip);
                 mPreferenceGroup.addPreference(preference);
                 batteryTip.log(mContext, mMetricsFeatureProvider);
+                mNeedUpdate = batteryTip.needUpdate();
                 break;
             }
         }
@@ -153,6 +156,10 @@
         outState.putParcelableList(KEY_BATTERY_TIPS, mBatteryTips);
     }
 
+    public boolean needUpdate() {
+        return mNeedUpdate;
+    }
+
     /**
      * Listener to give the control back to target fragment
      */
diff --git a/src/com/android/settings/fuelgauge/batterytip/tips/BatteryTip.java b/src/com/android/settings/fuelgauge/batterytip/tips/BatteryTip.java
index 3c3a5c0..f02dd72 100644
--- a/src/com/android/settings/fuelgauge/batterytip/tips/BatteryTip.java
+++ b/src/com/android/settings/fuelgauge/batterytip/tips/BatteryTip.java
@@ -86,17 +86,23 @@
     protected int mType;
     protected int mState;
     protected boolean mShowDialog;
+    /**
+     * Whether we need to update battery tip when configuration change
+     */
+    protected boolean mNeedUpdate;
 
     BatteryTip(Parcel in) {
         mType = in.readInt();
         mState = in.readInt();
         mShowDialog = in.readBoolean();
+        mNeedUpdate = in.readBoolean();
     }
 
     BatteryTip(int type, int state, boolean showDialog) {
         mType = type;
         mState = state;
         mShowDialog = showDialog;
+        mNeedUpdate = true;
     }
 
     @Override
@@ -109,6 +115,7 @@
         dest.writeInt(mType);
         dest.writeInt(mState);
         dest.writeBoolean(mShowDialog);
+        dest.writeBoolean(mNeedUpdate);
     }
 
     public abstract CharSequence getTitle(Context context);
@@ -144,6 +151,10 @@
         return mShowDialog;
     }
 
+    public boolean needUpdate() {
+        return mNeedUpdate;
+    }
+
     public String getKey() {
         return KEY_PREFIX + mType;
     }
diff --git a/src/com/android/settings/fuelgauge/batterytip/tips/RestrictAppTip.java b/src/com/android/settings/fuelgauge/batterytip/tips/RestrictAppTip.java
index 8b16166..9aa8363 100644
--- a/src/com/android/settings/fuelgauge/batterytip/tips/RestrictAppTip.java
+++ b/src/com/android/settings/fuelgauge/batterytip/tips/RestrictAppTip.java
@@ -42,12 +42,14 @@
     public RestrictAppTip(@StateType int state, List<AppInfo> restrictApps) {
         super(TipType.APP_RESTRICTION, state, state == StateType.NEW /* showDialog */);
         mRestrictAppList = restrictApps;
+        mNeedUpdate = false;
     }
 
     public RestrictAppTip(@StateType int state, AppInfo appInfo) {
         super(TipType.APP_RESTRICTION, state, state == StateType.NEW /* showDialog */);
         mRestrictAppList = new ArrayList<>();
         mRestrictAppList.add(appInfo);
+        mNeedUpdate = false;
     }
 
     @VisibleForTesting
diff --git a/src/com/android/settings/notification/AppNotificationSettings.java b/src/com/android/settings/notification/AppNotificationSettings.java
index c028298..6776931 100644
--- a/src/com/android/settings/notification/AppNotificationSettings.java
+++ b/src/com/android/settings/notification/AppNotificationSettings.java
@@ -125,7 +125,7 @@
         mControllers.add(new VibrationPreferenceController(context, mBackend));
         mControllers.add(new VisibilityPreferenceController(context, new LockPatternUtils(context),
                 mBackend));
-        mControllers.add(new DndPreferenceController(context, getLifecycle(), mBackend));
+        mControllers.add(new DndPreferenceController(context, mBackend));
         mControllers.add(new AppLinkPreferenceController(context));
         mControllers.add(new DescriptionPreferenceController(context));
         mControllers.add(new NotificationsOffPreferenceController(context));
diff --git a/src/com/android/settings/notification/ChannelNotificationSettings.java b/src/com/android/settings/notification/ChannelNotificationSettings.java
index a138429..bd9771a 100644
--- a/src/com/android/settings/notification/ChannelNotificationSettings.java
+++ b/src/com/android/settings/notification/ChannelNotificationSettings.java
@@ -18,13 +18,16 @@
 
 import android.content.Context;
 import android.content.Intent;
+import android.os.Bundle;
 import android.preference.PreferenceManager;
+import android.support.v7.preference.PreferenceScreen;
 import android.text.TextUtils;
 import android.util.Log;
 
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.internal.widget.LockPatternUtils;
 import com.android.settings.R;
+import com.android.settings.applications.AppInfoBase;
 import com.android.settingslib.core.AbstractPreferenceController;
 
 import java.util.ArrayList;
@@ -39,6 +42,19 @@
     }
 
     @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        final PreferenceScreen screen = getPreferenceScreen();
+        Bundle args = getArguments();
+        // If linking to this screen from an external app, expand settings
+        if (screen != null && args != null) {
+            if (!args.getBoolean(ARG_FROM_SETTINGS, false)) {
+                screen.setInitialExpandedChildrenCount(Integer.MAX_VALUE);
+            }
+        }
+    }
+
+    @Override
     public void onResume() {
         super.onResume();
         if (mUid < 0 || TextUtils.isEmpty(mPkg) || mPkgInfo == null || mChannel == null) {
@@ -92,7 +108,7 @@
                 mBackend));
         mControllers.add(new LightsPreferenceController(context, mBackend));
         mControllers.add(new BadgePreferenceController(context, mBackend));
-        mControllers.add(new DndPreferenceController(context, getLifecycle(), mBackend));
+        mControllers.add(new DndPreferenceController(context, mBackend));
         mControllers.add(new NotificationsOffPreferenceController(context));
         return new ArrayList<>(mControllers);
     }
diff --git a/src/com/android/settings/notification/DndPreferenceController.java b/src/com/android/settings/notification/DndPreferenceController.java
index d4c7a10..899c585 100644
--- a/src/com/android/settings/notification/DndPreferenceController.java
+++ b/src/com/android/settings/notification/DndPreferenceController.java
@@ -28,17 +28,12 @@
 import com.android.settingslib.core.lifecycle.events.OnResume;
 
 public class DndPreferenceController extends NotificationPreferenceController
-        implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener,
-        LifecycleObserver {
+        implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener {
 
     private static final String KEY_BYPASS_DND = "bypass_dnd";
 
-    public DndPreferenceController(Context context, Lifecycle lifecycle,
-            NotificationBackend backend) {
+    public DndPreferenceController(Context context, NotificationBackend backend) {
         super(context, backend);
-        if (lifecycle != null) {
-            lifecycle.addObserver(this);
-        }
     }
 
     @Override
diff --git a/src/com/android/settings/notification/NotificationSettingsBase.java b/src/com/android/settings/notification/NotificationSettingsBase.java
index 6436de6..7eb0ba4 100644
--- a/src/com/android/settings/notification/NotificationSettingsBase.java
+++ b/src/com/android/settings/notification/NotificationSettingsBase.java
@@ -58,6 +58,7 @@
 abstract public class NotificationSettingsBase extends DashboardFragment {
     private static final String TAG = "NotifiSettingsBase";
     private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
+    protected static final String ARG_FROM_SETTINGS = "fromSettings";
 
     protected PackageManager mPm;
     protected NotificationBackend mBackend = new NotificationBackend();
@@ -249,6 +250,7 @@
         channelArgs.putInt(AppInfoBase.ARG_PACKAGE_UID, mUid);
         channelArgs.putString(AppInfoBase.ARG_PACKAGE_NAME, mPkg);
         channelArgs.putString(Settings.EXTRA_CHANNEL_ID, channel.getId());
+        channelArgs.putBoolean(ARG_FROM_SETTINGS, true);
         channelPref.setIntent(new SubSettingLauncher(getActivity())
                 .setDestination(ChannelNotificationSettings.class.getName())
                 .setArguments(channelArgs)
diff --git a/src/com/android/settings/slices/SettingsSliceProvider.java b/src/com/android/settings/slices/SettingsSliceProvider.java
index ab2cb82..70e9d76 100644
--- a/src/com/android/settings/slices/SettingsSliceProvider.java
+++ b/src/com/android/settings/slices/SettingsSliceProvider.java
@@ -24,6 +24,7 @@
 import android.graphics.drawable.Icon;
 import android.net.Uri;
 import android.net.wifi.WifiManager;
+import android.provider.Settings;
 import android.provider.SettingsSlicesContract;
 import android.support.annotation.VisibleForTesting;
 import android.support.v4.graphics.drawable.IconCompat;
@@ -290,13 +291,14 @@
                         .addEndItem(new SliceAction(getBroadcastIntent(ACTION_WIFI_CHANGED),
                                 null, finalWifiEnabled))
                         .setPrimaryAction(
-                                new SliceAction(getIntent(Intent.ACTION_MAIN),
+                                new SliceAction(getIntent(Settings.ACTION_WIFI_SETTINGS),
                                         (IconCompat) null, null)))
                 .build();
     }
 
     private PendingIntent getIntent(String action) {
         Intent intent = new Intent(action);
+        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
         PendingIntent pi = PendingIntent.getActivity(getContext(), 0, intent, 0);
         return pi;
     }
diff --git a/tests/robotests/src/com/android/settings/datausage/DataUsageSummaryPreferenceTest.java b/tests/robotests/src/com/android/settings/datausage/DataUsageSummaryPreferenceTest.java
index a5a1c45..876f5d1 100644
--- a/tests/robotests/src/com/android/settings/datausage/DataUsageSummaryPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/DataUsageSummaryPreferenceTest.java
@@ -26,6 +26,7 @@
 import android.net.NetworkTemplate;
 import android.os.Bundle;
 import android.support.v7.preference.PreferenceViewHolder;
+import android.telephony.SubscriptionManager;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.Button;
@@ -401,6 +402,31 @@
     }
 
     @Test
+    public void testSetAppIntent_toMdpApp_intentCorrect() {
+        final Activity activity = Robolectric.setupActivity(Activity.class);
+        final Intent intent = new Intent(SubscriptionManager.ACTION_MANAGE_SUBSCRIPTION_PLANS);
+        intent.setPackage("test-owner.example.com");
+        intent.putExtra(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX, 42);
+
+        mSummaryPreference.setUsageInfo(mCycleEnd, mUpdateTime, DUMMY_CARRIER, 0 /* numPlans */,
+                intent);
+
+        bindViewHolder();
+        assertThat(mLaunchButton.getVisibility()).isEqualTo(View.VISIBLE);
+        assertThat(mLaunchButton.getText())
+                .isEqualTo(mContext.getString(R.string.launch_mdp_app_text));
+
+        mLaunchButton.callOnClick();
+        ShadowActivity shadowActivity = Shadows.shadowOf(activity);
+        Intent startedIntent = shadowActivity.getNextStartedActivity();
+        assertThat(startedIntent.getAction())
+                .isEqualTo(SubscriptionManager.ACTION_MANAGE_SUBSCRIPTION_PLANS);
+        assertThat(startedIntent.getPackage()).isEqualTo("test-owner.example.com");
+        assertThat(startedIntent.getIntExtra(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX, -1))
+                .isEqualTo(42);
+    }
+
+    @Test
     public void testSetWifiMode_withUsageInfo_dataUsageShown() {
         final int daysLeft = 3;
         final long cycleEnd = System.currentTimeMillis() + TimeUnit.DAYS.toMillis(daysLeft)
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageSummaryTest.java b/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageSummaryTest.java
index 989c033..b20cf16 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageSummaryTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageSummaryTest.java
@@ -49,6 +49,7 @@
 import com.android.settings.SettingsActivity;
 import com.android.settings.applications.LayoutPreference;
 import com.android.settings.fuelgauge.anomaly.Anomaly;
+import com.android.settings.fuelgauge.batterytip.BatteryTipPreferenceController;
 import com.android.settings.testutils.FakeFeatureFactory;
 import com.android.settings.testutils.SettingsRobolectricTestRunner;
 import com.android.settings.testutils.XmlTestUtils;
@@ -187,7 +188,7 @@
     }
 
     @Test
-    public void testUpdateLastFullChargePreference_noAverageTime_showLastFullChargeSummary() {
+    public void updateLastFullChargePreference_noAverageTime_showLastFullChargeSummary() {
         mFragment.mBatteryInfo = null;
         when(mFragment.getContext()).thenReturn(mRealContext);
         doReturn(TIME_SINCE_LAST_FULL_CHARGE_MS).when(
@@ -200,7 +201,7 @@
     }
 
     @Test
-    public void testUpdateLastFullChargePreference_hasAverageTime_showFullChargeLastSummary() {
+    public void updateLastFullChargePreference_hasAverageTime_showFullChargeLastSummary() {
         mFragment.mBatteryInfo = mBatteryInfo;
         mBatteryInfo.averageTimeToDischarge = TIME_SINCE_LAST_FULL_CHARGE_MS;
         when(mFragment.getContext()).thenReturn(mRealContext);
@@ -212,7 +213,7 @@
     }
 
     @Test
-    public void testNonIndexableKeys_MatchPreferenceKeys() {
+    public void nonIndexableKeys_MatchPreferenceKeys() {
         final Context context = RuntimeEnvironment.application;
         final List<String> niks =
             PowerUsageSummary.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(context);
@@ -224,7 +225,7 @@
     }
 
     @Test
-    public void testPreferenceControllers_getPreferenceKeys_existInPreferenceScreen() {
+    public void preferenceControllers_getPreferenceKeys_existInPreferenceScreen() {
         final Context context = RuntimeEnvironment.application;
         final PowerUsageSummary fragment = new PowerUsageSummary();
         final List<String> preferenceScreenKeys =
@@ -239,7 +240,7 @@
     }
 
     @Test
-    public void testUpdateAnomalySparseArray() {
+    public void updateAnomalySparseArray() {
         mFragment.mAnomalySparseArray = new SparseArray<>();
         final List<Anomaly> anomalies = new ArrayList<>();
         final Anomaly anomaly1 = new Anomaly.Builder().setUid(UID).build();
@@ -256,7 +257,7 @@
     }
 
     @Test
-    public void testRestartBatteryTipLoader() {
+    public void restartBatteryTipLoader() {
         //TODO: add policy logic here when BatteryTipPolicy is implemented
         doReturn(mLoaderManager).when(mFragment).getLoaderManager();
 
@@ -267,7 +268,7 @@
     }
 
     @Test
-    public void testShowBothEstimates_summariesAreBothModified() {
+    public void showBothEstimates_summariesAreBothModified() {
         when(mFeatureFactory.powerUsageFeatureProvider.isEnhancedBatteryPredictionEnabled(any()))
             .thenReturn(true);
         doAnswer(new Answer() {
@@ -296,7 +297,7 @@
     }
 
     @Test
-    public void testDebugMode() {
+    public void debugMode() {
         doReturn(true).when(mFeatureFactory.powerUsageFeatureProvider).isEstimateDebugEnabled();
         doReturn(new TextView(mRealContext)).when(mBatteryLayoutPref).findViewById(R.id.summary2);
 
@@ -315,7 +316,7 @@
     }
 
     @Test
-    public void testRestartBatteryStatsLoader_notClearHeader_quickUpdateNotInvoked() {
+    public void restartBatteryStatsLoader_notClearHeader_quickUpdateNotInvoked() {
         mFragment.mBatteryHeaderPreferenceController = mBatteryHeaderPreferenceController;
 
         mFragment.restartBatteryStatsLoader(false /* clearHeader */);
@@ -324,7 +325,7 @@
     }
 
     @Test
-    public void testOptionsMenu_advancedPageEnabled() {
+    public void optionsMenu_advancedPageEnabled() {
         when(mFeatureFactory.powerUsageFeatureProvider.isPowerAccountingToggleEnabled())
                 .thenReturn(true);
 
@@ -335,7 +336,7 @@
     }
 
     @Test
-    public void testOptionsMenu_clickAdvancedPage_fireIntent() {
+    public void optionsMenu_clickAdvancedPage_fireIntent() {
         final ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class);
         doAnswer(invocation -> {
             // Get the intent in which it has the app info bundle
@@ -353,13 +354,27 @@
     }
 
     @Test
-    public void testRefreshUi_deviceRotate_doNotUpdateBatteryTip() {
-        mFragment.mNeedUpdateBatteryTip = false;
+    public void refreshUi_deviceRotate_doNotUpdateBatteryTip() {
+        mFragment.mBatteryTipPreferenceController = mock(BatteryTipPreferenceController.class);
+        when(mFragment.mBatteryTipPreferenceController.needUpdate()).thenReturn(false);
+        mFragment.updateBatteryTipFlag(new Bundle());
+
         mFragment.refreshUi();
 
         verify(mFragment, never()).restartBatteryTipLoader();
     }
 
+    @Test
+    public void refreshUi_tipNeedUpdate_updateBatteryTip() {
+        mFragment.mBatteryTipPreferenceController = mock(BatteryTipPreferenceController.class);
+        when(mFragment.mBatteryTipPreferenceController.needUpdate()).thenReturn(true);
+        mFragment.updateBatteryTipFlag(new Bundle());
+
+        mFragment.refreshUi();
+
+        verify(mFragment).restartBatteryTipLoader();
+    }
+
     public static class TestFragment extends PowerUsageSummary {
         private Context mContext;
 
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/batterytip/tips/BatteryTipTest.java b/tests/robotests/src/com/android/settings/fuelgauge/batterytip/tips/BatteryTipTest.java
index cee647e..405e761 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/batterytip/tips/BatteryTipTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/batterytip/tips/BatteryTipTest.java
@@ -74,6 +74,7 @@
         assertThat(parcelTip.getTitle(mContext)).isEqualTo(TITLE);
         assertThat(parcelTip.getSummary(mContext)).isEqualTo(SUMMARY);
         assertThat(parcelTip.getIconId()).isEqualTo(ICON_ID);
+        assertThat(parcelTip.needUpdate()).isTrue();
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/notification/DndPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/DndPreferenceControllerTest.java
index 54dda6a..ba612ac 100644
--- a/tests/robotests/src/com/android/settings/notification/DndPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/DndPreferenceControllerTest.java
@@ -64,8 +64,6 @@
     private UserManager mUm;
     @Mock(answer = Answers.RETURNS_DEEP_STUBS)
     private PreferenceScreen mScreen;
-    @Mock
-    private Lifecycle mLifecycle;
 
     private DndPreferenceController mController;
 
@@ -76,7 +74,7 @@
         shadowApplication.setSystemService(Context.NOTIFICATION_SERVICE, mNm);
         shadowApplication.setSystemService(Context.USER_SERVICE, mUm);
         mContext = RuntimeEnvironment.application;
-        mController = spy(new DndPreferenceController(mContext, mLifecycle, mBackend));
+        mController = spy(new DndPreferenceController(mContext, mBackend));
     }
 
     @Test