use of androidx.slice.Slice in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NotificationChannelSliceTest method getSlice_noRecentlyInstalledApp_shouldHaveNoSuggestedAppTitle.
@Test
public void getSlice_noRecentlyInstalledApp_shouldHaveNoSuggestedAppTitle() {
addMockPackageToPackageManager(false, /* isRecentlyInstalled */
ApplicationInfo.FLAG_INSTALLED);
mockNotificationBackend(CHANNEL_COUNT, NOTIFICATION_COUNT, false, /* banned */
false);
final Slice slice = mNotificationChannelSlice.getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.no_suggested_app));
}
use of androidx.slice.Slice in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NotificationChannelSliceTest method getSlice_noMultiChannelApp_shouldHaveNoSuggestedAppTitle.
@Test
public void getSlice_noMultiChannelApp_shouldHaveNoSuggestedAppTitle() {
addMockPackageToPackageManager(true, /* isRecentlyInstalled */
ApplicationInfo.FLAG_INSTALLED);
mockNotificationBackend(1, /* channelCount */
NOTIFICATION_COUNT, false, /* banned */
false);
final Slice slice = mNotificationChannelSlice.getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.no_suggested_app));
}
use of androidx.slice.Slice in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NotificationChannelSliceTest method getSlice_exceedDefaultRowCount_shouldOnlyShowDefaultRows.
@Test
@Config(shadows = ShadowRestrictedLockUtilsInternal.class)
public void getSlice_exceedDefaultRowCount_shouldOnlyShowDefaultRows() {
addMockPackageToPackageManager(true, /* isRecentlyInstalled */
ApplicationInfo.FLAG_INSTALLED);
mockNotificationBackend(NotificationChannelSlice.DEFAULT_EXPANDED_ROW_COUNT * 2, NOTIFICATION_COUNT, false, /* banned */
false);
final Slice slice = mNotificationChannelSlice.getSlice();
// Get the number of RowBuilders from Slice.
final int rows = SliceQuery.findAll(slice, FORMAT_SLICE, HINT_LIST_ITEM, null).size();
// The header of this slice is built by RowBuilder. Hence, the row count will contain it.
assertThat(rows).isEqualTo(NotificationChannelSlice.DEFAULT_EXPANDED_ROW_COUNT + 1);
}
use of androidx.slice.Slice in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NotificationChannelSliceTest method getSlice_channelCountIsLessThanDefaultRows_subTitleShouldNotHaveTapToManagerAll.
@Test
@Config(shadows = ShadowRestrictedLockUtilsInternal.class)
public void getSlice_channelCountIsLessThanDefaultRows_subTitleShouldNotHaveTapToManagerAll() {
addMockPackageToPackageManager(true, /* isRecentlyInstalled */
ApplicationInfo.FLAG_INSTALLED);
mockNotificationBackend(CHANNEL_COUNT - 1, NOTIFICATION_COUNT, false, /* banned */
false);
final Slice slice = mNotificationChannelSlice.getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
assertThat(metadata.getSubtitle()).isEqualTo(mContext.getResources().getQuantityString(R.plurals.notification_few_channel_count_summary, CHANNEL_COUNT - 1, CHANNEL_COUNT - 1));
}
use of androidx.slice.Slice in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DeviceInfoSliceTest method getSlice_hasSubscriptionInfo_shouldBeCorrectSliceContent.
@Test
public void getSlice_hasSubscriptionInfo_shouldBeCorrectSliceContent() {
final String phoneNumber = "1111111111";
doReturn(mSubscriptionInfo).when(mDeviceInfoSlice).getFirstSubscriptionInfo();
doReturn(phoneNumber).when(mDeviceInfoSlice).getPhoneNumber();
final Slice slice = mDeviceInfoSlice.getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.device_info_label));
final SliceAction primaryAction = metadata.getPrimaryAction();
final IconCompat expectedIcon = IconCompat.createWithResource(mContext, R.drawable.ic_info_outline_24dp);
assertThat(primaryAction.getIcon().toString()).isEqualTo(expectedIcon.toString());
final List<SliceItem> sliceItems = slice.getItems();
SliceTester.assertAnySliceItemContainsTitle(sliceItems, phoneNumber);
}
Aggregations