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

Commit 161ff18a authored by Fan Zhang's avatar Fan Zhang Committed by Android (Google) Code Review
Browse files

Merge "Remove getExtraAction() from DashboardFeatureProvider."

parents e3ba5f6d d011d45d
Loading
Loading
Loading
Loading
+3 −9
Original line number Diff line number Diff line
@@ -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);
            }
+0 −5
Original line number Diff line number Diff line
@@ -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.
     */
+1 −6
Original line number Diff line number Diff line
@@ -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) {
+0 −5
Original line number Diff line number Diff line
@@ -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);