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

Commit 5050fd31 authored by Fan Zhang's avatar Fan Zhang
Browse files

Remove extraAction param when querying TileUtils.

The param is always set to null so it's essentially useless.

Bug: 77600770
Test: robotests
Change-Id: I9cb75b9cf0cd149bda09dbd306e2e6490d7cdb36
parent c892e59d
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -205,12 +205,9 @@ public class TileUtils {

    /**
     * Build a list of DashboardCategory.
     *
     * @param extraAction additional intent filter action to be usetileutild to build the dashboard
     *                    categories
     */
    public static List<DashboardCategory> getCategories(Context context,
            Map<Pair<String, String>, Tile> cache, String extraAction) {
            Map<Pair<String, String>, Tile> cache) {
        final long startTime = System.currentTimeMillis();
        boolean setup = Global.getInt(context.getContentResolver(), Global.DEVICE_PROVISIONED, 0)
                != 0;
@@ -229,9 +226,6 @@ public class TileUtils {
            if (setup) {
                getTilesForAction(context, user, EXTRA_SETTINGS_ACTION, cache, null, tiles, false);
                getTilesForAction(context, user, IA_SETTINGS_ACTION, cache, null, tiles, false);
                if (extraAction != null) {
                    getTilesForAction(context, user, extraAction, cache, null, tiles, false);
                }
            }
        }

+1 −22
Original line number Diff line number Diff line
@@ -151,27 +151,6 @@ public class TileUtilsTest {
        assertThat(outTiles.isEmpty()).isTrue();
    }

    @Test
    public void getCategories_shouldHandleExtraIntentAction() {
        final String testCategory = "category1";
        final String testAction = "action1";
        Map<Pair<String, String>, Tile> cache = new ArrayMap<>();
        List<ResolveInfo> info = new ArrayList<>();
        info.add(newInfo(true, testCategory));
        Global.putInt(mContext.getContentResolver(), Global.DEVICE_PROVISIONED, 1);
        when(mContext.getSystemService(Context.USER_SERVICE)).thenReturn(mUserManager);
        List<UserHandle> userHandleList = new ArrayList<>();
        userHandleList.add(UserHandle.CURRENT);
        when(mUserManager.getUserProfiles()).thenReturn(userHandleList);

        when(mPackageManager.queryIntentActivitiesAsUser(argThat(
                event -> testAction.equals(event.getAction())), anyInt(), anyInt()))
                .thenReturn(info);

        List<DashboardCategory> categoryList = TileUtils.getCategories(mContext, cache, testAction);
        assertThat(categoryList.get(0).getTile(0).getCategory()).isEqualTo(testCategory);
    }

    @Test
    public void getCategories_withPackageName() {
        ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
@@ -183,7 +162,7 @@ public class TileUtilsTest {
        userHandleList.add(new UserHandle(ActivityManager.getCurrentUser()));
        when(mUserManager.getUserProfiles()).thenReturn(userHandleList);

        TileUtils.getCategories(mContext, cache, null /* action */);
        TileUtils.getCategories(mContext, cache);
        verify(mPackageManager, atLeastOnce()).queryIntentActivitiesAsUser(
                intentCaptor.capture(), anyInt(), anyInt());