Search in sources :

Example 71 with SliceMetadata

use of androidx.slice.SliceMetadata in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class NotificationChannelSliceTest method getSlice_isSystemApp_shouldHaveNoSuggestedAppTitle.

@Test
public void getSlice_isSystemApp_shouldHaveNoSuggestedAppTitle() {
    addMockPackageToPackageManager(true, /* isRecentlyInstalled */
    ApplicationInfo.FLAG_SYSTEM);
    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));
}
Also used : Slice(androidx.slice.Slice) ParceledListSlice(android.content.pm.ParceledListSlice) SliceMetadata(androidx.slice.SliceMetadata) Test(org.junit.Test)

Example 72 with SliceMetadata

use of androidx.slice.SliceMetadata in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class NotificationChannelSliceTest method getSlice_isNotificationBanned_shouldHaveNoSuggestedAppTitle.

@Test
public void getSlice_isNotificationBanned_shouldHaveNoSuggestedAppTitle() {
    addMockPackageToPackageManager(true, /* isRecentlyInstalled */
    ApplicationInfo.FLAG_INSTALLED);
    mockNotificationBackend(CHANNEL_COUNT, NOTIFICATION_COUNT, true, /* 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));
}
Also used : Slice(androidx.slice.Slice) ParceledListSlice(android.content.pm.ParceledListSlice) SliceMetadata(androidx.slice.SliceMetadata) Test(org.junit.Test)

Example 73 with SliceMetadata

use of androidx.slice.SliceMetadata in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class NotificationChannelSliceTest method getSlice_insufficientNotificationSentCount_shouldHaveNoSuggestedAppTitle.

@Test
@Config(shadows = ShadowRestrictedLockUtilsInternal.class)
public void getSlice_insufficientNotificationSentCount_shouldHaveNoSuggestedAppTitle() {
    addMockPackageToPackageManager(true, /* isRecentlyInstalled */
    ApplicationInfo.FLAG_INSTALLED);
    mockNotificationBackend(CHANNEL_COUNT, 1, /* notificationCount */
    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));
}
Also used : Slice(androidx.slice.Slice) ParceledListSlice(android.content.pm.ParceledListSlice) SliceMetadata(androidx.slice.SliceMetadata) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 74 with SliceMetadata

use of androidx.slice.SliceMetadata in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class NotificationChannelSliceTest method getSlice_isInteractedPackage_shouldHaveNoSuggestedAppTitle.

@Test
@Config(shadows = ShadowRestrictedLockUtilsInternal.class)
public void getSlice_isInteractedPackage_shouldHaveNoSuggestedAppTitle() {
    addMockPackageToPackageManager(true, /* isRecentlyInstalled */
    ApplicationInfo.FLAG_INSTALLED);
    mockNotificationBackend(CHANNEL_COUNT, NOTIFICATION_COUNT, false, /* banned */
    false);
    doReturn(true).when(mNotificationChannelSlice).isUserInteracted(any(String.class));
    final Slice slice = mNotificationChannelSlice.getSlice();
    final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
    assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.no_suggested_app));
}
Also used : Slice(androidx.slice.Slice) ParceledListSlice(android.content.pm.ParceledListSlice) SliceMetadata(androidx.slice.SliceMetadata) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 75 with SliceMetadata

use of androidx.slice.SliceMetadata in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class NotificationChannelSliceTest method getSlice_channelCountIsMoreThanDefaultRows_subTitleShouldHaveTapToManagerAll.

@Test
@Config(shadows = ShadowRestrictedLockUtilsInternal.class)
public void getSlice_channelCountIsMoreThanDefaultRows_subTitleShouldHaveTapToManagerAll() {
    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.getString(R.string.notification_many_channel_count_summary, CHANNEL_COUNT + 1));
}
Also used : Slice(androidx.slice.Slice) ParceledListSlice(android.content.pm.ParceledListSlice) SliceMetadata(androidx.slice.SliceMetadata) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Aggregations

SliceMetadata (androidx.slice.SliceMetadata)100 Slice (androidx.slice.Slice)72 Test (org.junit.Test)72 SliceAction (androidx.slice.core.SliceAction)53 PendingIntent (android.app.PendingIntent)24 SliceItem (androidx.slice.SliceItem)23 IconCompat (androidx.core.graphics.drawable.IconCompat)18 ParceledListSlice (android.content.pm.ParceledListSlice)11 Config (org.robolectric.annotation.Config)11 PrivateStorageInfo (com.android.settingslib.deviceinfo.PrivateStorageInfo)5 MetricsFeatureProvider (com.android.settingslib.core.instrumentation.MetricsFeatureProvider)3 Uri (android.net.Uri)2 Handler (android.os.Handler)2 VisibleForTesting (androidx.annotation.VisibleForTesting)2 ListContent (androidx.slice.widget.ListContent)2 RowContent (androidx.slice.widget.RowContent)2 SliceContent (androidx.slice.widget.SliceContent)2 ShadowPrivateStorageInfo (com.android.settings.testutils.shadow.ShadowPrivateStorageInfo)2 Intent (android.content.Intent)1 FaceManager (android.hardware.face.FaceManager)1