Initialize injected Security preferences.

Previously a default "G" icon was loaded before the injected ones and
this would be visually jarring. Also the text summary would cause the
titles to shift up, so now load an empty icon and empty summary so no
more jarring visual effects.

Bug: 35994047
Test: make RunSettingsRoboTests
Change-Id: Ia06535215432fe350a3bb06f541e817a566772e0
This commit is contained in:
William Luh
2017-03-08 11:44:54 -08:00
parent 2437d3c64a
commit 91eaa85c52
2 changed files with 50 additions and 6 deletions

View File

@@ -171,6 +171,18 @@ public class SecurityFeatureProviderImplTest {
verify(screen.findPreference(MOCK_KEY), never()).setSummary(anyString());
}
@Test
public void initPreferences_shouldLoadDefaults() {
PreferenceScreen screen = getPreferenceScreen();
DashboardCategory dashboardCategory = getDashboardCategory();
dashboardCategory.getTile(0).metaData = new Bundle();
mImpl.initPreferences(mContext, screen, dashboardCategory);
verify(screen.findPreference(MOCK_KEY)).setIcon(SecurityFeatureProviderImpl.DEFAULT_ICON);
verify(screen.findPreference(MOCK_KEY))
.setSummary(SecurityFeatureProviderImpl.DEFAULT_SUMMARY);
}
private PreferenceScreen getPreferenceScreen() {
final PreferenceScreen screen = mock(PreferenceScreen.class);
final Preference pref = mock(Preference.class);