Merge "Remove getExtraAction() from DashboardFeatureProvider."

This commit is contained in:
Fan Zhang
2018-08-21 23:13:56 +00:00
committed by Android (Google) Code Review
4 changed files with 4 additions and 25 deletions

View File

@@ -51,25 +51,19 @@ public class CategoryManager {
private final Map<String, DashboardCategory> mCategoryByKeyMap;
private List<DashboardCategory> mCategories;
private String mExtraAction;
public static CategoryManager get(Context context) {
return get(context, null);
}
public static CategoryManager get(Context context, String action) {
if (sInstance == null) {
sInstance = new CategoryManager(context, action);
sInstance = new CategoryManager(context);
}
return sInstance;
}
CategoryManager(Context context, String action) {
CategoryManager(Context context) {
mTileByComponentCache = new ArrayMap<>();
mCategoryByKeyMap = new ArrayMap<>();
mInterestingConfigChanges = new InterestingConfigChanges();
mInterestingConfigChanges.applyNewConfig(context.getResources());
mExtraAction = action;
}
public synchronized DashboardCategory getTilesByCategory(Context context, String categoryKey) {
@@ -117,7 +111,7 @@ public class CategoryManager {
mTileByComponentCache.clear();
}
mCategoryByKeyMap.clear();
mCategories = TileUtils.getCategories(context, mTileByComponentCache, mExtraAction);
mCategories = TileUtils.getCategories(context, mTileByComponentCache);
for (DashboardCategory category : mCategories) {
mCategoryByKeyMap.put(category.key, category);
}

View File

@@ -58,11 +58,6 @@ public interface DashboardFeatureProvider {
void bindPreferenceToTile(FragmentActivity activity, boolean forceRoundedIcon,
int sourceMetricsCategory, Preference pref, Tile tile, String key, int baseOrder);
/**
* Returns additional intent filter action for dashboard tiles
*/
String getExtraIntentAction();
/**
* Opens a tile to its destination intent.
*/

View File

@@ -71,7 +71,7 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
public DashboardFeatureProviderImpl(Context context) {
mContext = context.getApplicationContext();
mCategoryManager = CategoryManager.get(context, getExtraIntentAction());
mCategoryManager = CategoryManager.get(context);
mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
mPackageManager = context.getPackageManager();
}
@@ -151,11 +151,6 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
}
}
@Override
public String getExtraIntentAction() {
return null;
}
@Override
public void openTileIntent(FragmentActivity activity, Tile tile) {
if (tile == null) {

View File

@@ -365,11 +365,6 @@ public class DashboardFeatureProviderImplTest {
assertThat(launchIntent).isNull();
}
@Test
public void testGetExtraIntentAction_shouldReturnNull() {
assertThat(mImpl.getExtraIntentAction()).isNull();
}
@Test
public void openTileIntent_profileSelectionDialog_shouldShow() {
final Tile tile = new Tile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE);