Loading src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java +3 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,9 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider { if (tile == null || tile.intent == null) { return null; } if (!TextUtils.isEmpty(tile.key)) { return tile.key; } final StringBuilder sb = new StringBuilder(DASHBOARD_TILE_PREF_KEY_PREFIX); final ComponentName component = tile.intent.getComponent(); sb.append(component.getClassName()); Loading tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -144,6 +144,20 @@ public class DashboardFeatureProviderImplTest { assertThat(preference.getOrder()).isEqualTo(Preference.DEFAULT_ORDER); } @Test public void bindPreference_withNullKeyTileKey_shouldUseTileKey() { final Preference preference = new Preference( ShadowApplication.getInstance().getApplicationContext()); final Tile tile = new Tile(); tile.key = "key"; tile.intent = new Intent(); tile.intent.setComponent(new ComponentName("pkg", "class")); mImpl.bindPreferenceToTile(mActivity, preference, tile, null /* key */ , Preference.DEFAULT_ORDER); assertThat(preference.getKey()).isEqualTo(tile.key); } @Test public void bindPreference_withBaseOrder_shouldOffsetPriority() { final int baseOrder = 100; Loading Loading
src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java +3 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,9 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider { if (tile == null || tile.intent == null) { return null; } if (!TextUtils.isEmpty(tile.key)) { return tile.key; } final StringBuilder sb = new StringBuilder(DASHBOARD_TILE_PREF_KEY_PREFIX); final ComponentName component = tile.intent.getComponent(); sb.append(component.getClassName()); Loading
tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -144,6 +144,20 @@ public class DashboardFeatureProviderImplTest { assertThat(preference.getOrder()).isEqualTo(Preference.DEFAULT_ORDER); } @Test public void bindPreference_withNullKeyTileKey_shouldUseTileKey() { final Preference preference = new Preference( ShadowApplication.getInstance().getApplicationContext()); final Tile tile = new Tile(); tile.key = "key"; tile.intent = new Intent(); tile.intent.setComponent(new ComponentName("pkg", "class")); mImpl.bindPreferenceToTile(mActivity, preference, tile, null /* key */ , Preference.DEFAULT_ORDER); assertThat(preference.getKey()).isEqualTo(tile.key); } @Test public void bindPreference_withBaseOrder_shouldOffsetPriority() { final int baseOrder = 100; Loading