Remove obsolete logic in SettingsActivity.

mIsShowingDashboard is always false, it used to be true when we are
displaying homepage, but now homepage is hosted in a entirely different
activity.

so all related logic can now be removed.

Test: robotests

Misc clean up: remove unused colors

Test: rebuild, color-lint
Change-Id: I1e1628c1e9606c2b7dc40ef3c21d4ed1391a8c03
This commit is contained in:
Fan Zhang
2018-11-27 13:06:44 -08:00
parent 662b209b15
commit 8e14ca0058
9 changed files with 103 additions and 400 deletions

View File

@@ -53,6 +53,8 @@ public class SearchFeatureProviderImplTest {
mActivity = Robolectric.setupActivity(Activity.class);
mProvider = new SearchFeatureProviderImpl();
mPackageManager = Shadows.shadowOf(mActivity.getPackageManager());
Settings.Global.putInt(mActivity.getContentResolver(),
Settings.Global.DEVICE_PROVISIONED, 1);
}
@Test
@@ -82,7 +84,7 @@ public class SearchFeatureProviderImplTest {
@Test
@Config(shadows = ShadowUtils.class)
public void initSearchToolbar_NotHaveResolvedInfo_shouldNotStartActivity() {
public void initSearchToolbar_noResolvedInfo_shouldNotStartActivity() {
final Toolbar toolbar = new Toolbar(mActivity);
// This ensures navigationView is created.
toolbar.setNavigationContentDescription("test");
@@ -90,9 +92,21 @@ public class SearchFeatureProviderImplTest {
toolbar.performClick();
final Intent launchIntent = Shadows.shadowOf(mActivity).getNextStartedActivity();
assertThat(Shadows.shadowOf(mActivity).getNextStartedActivity()).isNull();
}
assertThat(launchIntent).isNull();
@Test
public void initSearchToolbar_deviceNotProvisioned_shouldNotCreateSearchBar() {
final Toolbar toolbar = new Toolbar(mActivity);
// This ensures navigationView is created.
toolbar.setNavigationContentDescription("test");
Settings.Global.putInt(mActivity.getContentResolver(),
Settings.Global.DEVICE_PROVISIONED, 0);
toolbar.performClick();
assertThat(Shadows.shadowOf(mActivity).getNextStartedActivity()).isNull();
}
@Test(expected = IllegalArgumentException.class)