Search in sources :

Example 41 with ActivityTile

use of com.android.settingslib.drawer.ActivityTile in project android_packages_apps_Settings by omnirom.

the class CategoryManagerTest method backwardCompatCleanupForCategory_shouldNotChangeCategoryForMixedKeys.

@Test
public void backwardCompatCleanupForCategory_shouldNotChangeCategoryForMixedKeys() {
    final Tile tile1 = new ActivityTile(mActivityInfo, CategoryKey.CATEGORY_ACCOUNT);
    final String oldCategory = "com.android.settings.category.wireless";
    final Tile tile2 = new ActivityTile(mActivityInfo, oldCategory);
    final DashboardCategory category1 = new DashboardCategory(CategoryKey.CATEGORY_ACCOUNT);
    category1.addTile(tile1);
    final DashboardCategory category2 = new DashboardCategory(oldCategory);
    category2.addTile(tile2);
    mCategoryByKeyMap.put(CategoryKey.CATEGORY_ACCOUNT, category1);
    mCategoryByKeyMap.put(oldCategory, category2);
    mTileByComponentCache.put(new Pair<>("PACKAGE", "CLASS1"), tile1);
    mTileByComponentCache.put(new Pair<>("PACKAGE", "CLASS2"), tile2);
    mCategoryManager.backwardCompatCleanupForCategory(mTileByComponentCache, mCategoryByKeyMap);
    assertThat(mCategoryByKeyMap.size()).isEqualTo(2);
    assertThat(mCategoryByKeyMap.get(CategoryKey.CATEGORY_ACCOUNT).getTilesCount()).isEqualTo(1);
    assertThat(mCategoryByKeyMap.get(oldCategory).getTilesCount()).isEqualTo(1);
}
Also used : DashboardCategory(com.android.settingslib.drawer.DashboardCategory) ActivityTile(com.android.settingslib.drawer.ActivityTile) ProviderTile(com.android.settingslib.drawer.ProviderTile) Tile(com.android.settingslib.drawer.Tile) ActivityTile(com.android.settingslib.drawer.ActivityTile) Test(org.junit.Test)

Aggregations

ActivityTile (com.android.settingslib.drawer.ActivityTile)41 Test (org.junit.Test)37 Tile (com.android.settingslib.drawer.Tile)35 ProviderTile (com.android.settingslib.drawer.ProviderTile)29 Preference (androidx.preference.Preference)20 SwitchPreference (androidx.preference.SwitchPreference)19 Intent (android.content.Intent)11 UserHandle (android.os.UserHandle)10 ArrayList (java.util.ArrayList)7 ActivityInfo (android.content.pm.ActivityInfo)5 DashboardCategory (com.android.settingslib.drawer.DashboardCategory)5 Config (org.robolectric.annotation.Config)5 Bundle (android.os.Bundle)4 FragmentActivity (androidx.fragment.app.FragmentActivity)3 ProviderInfo (android.content.pm.ProviderInfo)2 ResolveInfo (android.content.pm.ResolveInfo)2 Bitmap (android.graphics.Bitmap)2 Drawable (android.graphics.drawable.Drawable)2 Before (org.junit.Before)2 ShadowActivity (org.robolectric.shadows.ShadowActivity)2