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

Commit 837c1abc authored by Fabian Kozynski's avatar Fabian Kozynski
Browse files

Fix flaky test

Prevents NPE in test by inverting the order of equals.

Also, to make the test more independent, set the setting in setup

Test: atest QSTileHostTest after deleting the setting
Bug: 138516392

Change-Id: I7093cafaecaa6922c4dc07bcbdaed4b5c08aae60
parent e0a09635
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -97,6 +97,8 @@ public class QSTileHostTest extends SysuiTestCase {
                mLooper.getLooper(),
                mPluginManager, mTunerService, mAutoTiles, mDumpController);
        setUpTileFactory();
        Settings.Secure.putStringForUser(mContext.getContentResolver(), QSTileHost.TILES_SETTING,
                "", ActivityManager.getCurrentUser());
    }

    private void setUpTileFactory() {
@@ -188,7 +190,8 @@ public class QSTileHostTest extends SysuiTestCase {
            // changed
            String newSetting = Settings.Secure.getStringForUser(getContext().getContentResolver(),
                    TILES_SETTING, ActivityManager.getCurrentUser());
            if (!previousSetting.equals(newSetting)) {
            // newSetting is not null, as it has just been set.
            if (!newSetting.equals(previousSetting)) {
                onTuningChanged(TILES_SETTING, newSetting);
            }
        }