use of com.android.settingslib.drawer.ActivityTile in project android_packages_apps_Settings by omnirom.
the class AccountDetailDashboardFragmentTest method displayTile_shouldAddUserHandleToTileIntent.
@Test
public void displayTile_shouldAddUserHandleToTileIntent() {
mFragment.mUserHandle = new UserHandle(1);
final Tile tile = new ActivityTile(mActivityInfo, CategoryKey.CATEGORY_ACCOUNT_DETAIL);
mActivityInfo.metaData.putString(METADATA_CATEGORY, CategoryKey.CATEGORY_ACCOUNT);
mActivityInfo.metaData.putString(METADATA_ACCOUNT_TYPE, "com.abc");
mFragment.displayTile(tile);
final UserHandle userHandle = tile.getIntent().getParcelableExtra(EXTRA_USER);
assertThat(userHandle.getIdentifier()).isEqualTo(1);
}
use of com.android.settingslib.drawer.ActivityTile in project android_packages_apps_Settings by omnirom.
the class SettingsSearchIndexablesProviderTest method isEligibleForIndexing_normalInjectedItem_shouldReturnTrue.
@Test
public void isEligibleForIndexing_normalInjectedItem_shouldReturnTrue() {
final ActivityInfo activityInfo = new ActivityInfo();
activityInfo.packageName = "pkg";
activityInfo.name = "class";
final ActivityTile activityTile = new ActivityTile(activityInfo, CategoryKey.CATEGORY_CONNECT);
assertThat(mProvider.isEligibleForIndexing(PACKAGE_NAME, activityTile)).isTrue();
}
use of com.android.settingslib.drawer.ActivityTile in project android_packages_apps_Settings by omnirom.
the class SettingsSearchIndexablesProviderTest method isEligibleForIndexing_isSettingsInjectedItem_shouldReturnFalse.
@Test
public void isEligibleForIndexing_isSettingsInjectedItem_shouldReturnFalse() {
final ActivityInfo activityInfo = new ActivityInfo();
activityInfo.packageName = PACKAGE_NAME;
activityInfo.name = "class";
final ActivityTile activityTile = new ActivityTile(activityInfo, CategoryKey.CATEGORY_SYSTEM);
assertThat(mProvider.isEligibleForIndexing(PACKAGE_NAME, activityTile)).isFalse();
}
use of com.android.settingslib.drawer.ActivityTile in project android_packages_apps_Settings by omnirom.
the class SettingsSearchIndexablesProviderTest method setUp.
@Before
public void setUp() {
mContext = RuntimeEnvironment.application;
mProvider = spy(new SettingsSearchIndexablesProvider());
ProviderInfo info = new ProviderInfo();
info.exported = true;
info.grantUriPermissions = true;
info.authority = PACKAGE_NAME;
info.readPermission = Manifest.permission.READ_SEARCH_INDEXABLES;
mProvider.attachInfo(RuntimeEnvironment.application, info);
final SearchFeatureProvider featureProvider = new SearchFeatureProviderImpl();
featureProvider.getSearchIndexableResources().getProviderValues().clear();
featureProvider.getSearchIndexableResources().getProviderValues().add(new SearchIndexableData(FakeSettingsFragment.class, FakeSettingsFragment.SEARCH_INDEX_DATA_PROVIDER));
mFakeFeatureFactory = FakeFeatureFactory.setupForTest();
mFakeFeatureFactory.searchFeatureProvider = featureProvider;
final ActivityInfo activityInfo = new ActivityInfo();
activityInfo.packageName = "pkg";
activityInfo.name = "class";
activityInfo.metaData = new Bundle();
activityInfo.metaData.putString(META_DATA_PREFERENCE_TITLE, "title");
final DashboardCategory category = new DashboardCategory("key");
when(mFakeFeatureFactory.dashboardFeatureProvider.getAllCategories()).thenReturn(Arrays.asList(category));
category.addTile(new ActivityTile(activityInfo, category.key));
ShadowCategoryManager.setDashboardCategory(category);
}
use of com.android.settingslib.drawer.ActivityTile in project android_packages_apps_Settings by omnirom.
the class DashboardFeatureProviderImplTest method bindPreference_hasTitleUri_shouldLoadFromContentProviderAndHaveObserver.
@Test
@Config(shadows = { ShadowTileUtils.class })
public void bindPreference_hasTitleUri_shouldLoadFromContentProviderAndHaveObserver() {
final Preference preference = new Preference(RuntimeEnvironment.application);
final Tile tile = new ActivityTile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE);
final String uriString = "content://com.android.settings/tile_title";
mActivityInfo.metaData.putString(TileUtils.META_DATA_PREFERENCE_TITLE_URI, uriString);
final List<DynamicDataObserver> observers = mImpl.bindPreferenceToTileAndGetObservers(mActivity, mForceRoundedIcon, MetricsEvent.VIEW_UNKNOWN, preference, tile, null, /*key */
Preference.DEFAULT_ORDER);
assertThat(preference.getTitle()).isEqualTo(ShadowTileUtils.MOCK_SUMMARY);
assertThat(observers.get(0).getUri().toString()).isEqualTo(uriString);
}
Aggregations