Enable Notifications on AndroidTV
Also fix some tests that were broken on TV.
Test: runtest systemui-notification
Change-Id: Icf4e5a1e02c3075b466305023c986ada52e9ec93
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 8ee443b..6e38e28 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -5427,7 +5427,8 @@
*
* @hide
*/
- public static Notification maybeCloneStrippedForDelivery(Notification n, boolean isLowRam) {
+ public static Notification maybeCloneStrippedForDelivery(Notification n, boolean isLowRam,
+ Context context) {
String templateClass = n.extras.getString(EXTRA_TEMPLATE);
// Only strip views for known Styles because we won't know how to
@@ -5469,9 +5470,13 @@
clone.extras.remove(EXTRA_REBUILD_HEADS_UP_CONTENT_VIEW_ACTION_COUNT);
}
if (isLowRam) {
- clone.extras.remove(Notification.TvExtender.EXTRA_TV_EXTENDER);
- clone.extras.remove(WearableExtender.EXTRA_WEARABLE_EXTENSIONS);
- clone.extras.remove(CarExtender.EXTRA_CAR_EXTENDER);
+ String[] allowedServices = context.getResources().getStringArray(
+ R.array.config_allowedManagedServicesOnLowRamDevices);
+ if (allowedServices.length == 0) {
+ clone.extras.remove(Notification.TvExtender.EXTRA_TV_EXTENDER);
+ clone.extras.remove(WearableExtender.EXTRA_WEARABLE_EXTENSIONS);
+ clone.extras.remove(CarExtender.EXTRA_CAR_EXTENDER);
+ }
}
return clone;
}
diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java
index 757fc64..a77a011 100644
--- a/core/java/android/app/NotificationManager.java
+++ b/core/java/android/app/NotificationManager.java
@@ -399,7 +399,8 @@
ActivityManager am = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
boolean isLowRam = am.isLowRamDevice();
- final Notification copy = Builder.maybeCloneStrippedForDelivery(notification, isLowRam);
+ final Notification copy = Builder.maybeCloneStrippedForDelivery(notification, isLowRam,
+ mContext);
try {
service.enqueueNotificationWithTag(pkg, mContext.getOpPackageName(), tag, id,
copy, user.getIdentifier());
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index fc030ca..20dfb4a 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -3175,6 +3175,9 @@
<!-- An array of packages for which notifications cannot be blocked. -->
<string-array translatable="false" name="config_nonBlockableNotificationPackages" />
+ <!-- An array of packages which can listen for notifications on low ram devices. -->
+ <string-array translatable="false" name="config_allowedManagedServicesOnLowRamDevices" />
+
<!-- The default value for transition animation scale found in developer settings.
1.0 corresponds to 1x animator scale, 0 means that there will be no transition
animations. Note that this is only a default and will be overridden by a
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 0de2cb0..8c6f117 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2970,6 +2970,8 @@
<java-symbol type="array" name="config_nonBlockableNotificationPackages" />
+ <java-symbol type="array" name="config_allowedManagedServicesOnLowRamDevices" />
+
<!-- Screen-size-dependent modes for picker dialogs. -->
<java-symbol type="integer" name="time_picker_mode" />
<java-symbol type="integer" name="date_picker_mode" />
diff --git a/services/core/java/com/android/server/notification/ManagedServices.java b/services/core/java/com/android/server/notification/ManagedServices.java
index 4c8b91b..1491a8b 100644
--- a/services/core/java/com/android/server/notification/ManagedServices.java
+++ b/services/core/java/com/android/server/notification/ManagedServices.java
@@ -73,6 +73,7 @@
import java.util.List;
import java.util.Objects;
import java.util.Set;
+import java.util.function.Predicate;
import java.util.stream.Collectors;
/**
@@ -338,7 +339,7 @@
loadAllowedComponentsFromSettings();
}
- public void readXml(XmlPullParser parser)
+ public void readXml(XmlPullParser parser, Predicate<String> allowedManagedServicePackages)
throws XmlPullParserException, IOException {
// upgrade xml
int xmlVersion = XmlUtils.readIntAttribute(parser, ATT_VERSION, 0);
@@ -363,10 +364,14 @@
final int userId = XmlUtils.readIntAttribute(parser, ATT_USER_ID, 0);
final boolean isPrimary =
XmlUtils.readBooleanAttribute(parser, ATT_IS_PRIMARY, true);
- if (mUm.getUserInfo(userId) != null) {
- addApprovedList(approved, userId, isPrimary);
+
+ if (allowedManagedServicePackages == null ||
+ allowedManagedServicePackages.test(getPackageName(approved))) {
+ if (mUm.getUserInfo(userId) != null) {
+ addApprovedList(approved, userId, isPrimary);
+ }
+ mUseXml = true;
}
- mUseXml = true;
}
}
}
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 8a64308..c765ea0 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -235,6 +235,7 @@
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.TimeUnit;
+import java.util.function.Predicate;
/** {@hide} */
public class NotificationManagerService extends SystemService {
@@ -400,6 +401,7 @@
private boolean mIsTelevision;
private MetricsLogger mMetricsLogger;
+ private Predicate<String> mAllowedManagedServicePackages;
private static class Archive {
final int mBufferSize;
@@ -521,18 +523,15 @@
} else if (RankingHelper.TAG_RANKING.equals(parser.getName())){
mRankingHelper.readXml(parser, forRestore);
}
- // No non-system managed services are allowed on low ram devices
- if (canUseManagedServices()) {
- if (mListeners.getConfig().xmlTag.equals(parser.getName())) {
- mListeners.readXml(parser);
- migratedManagedServices = true;
- } else if (mAssistants.getConfig().xmlTag.equals(parser.getName())) {
- mAssistants.readXml(parser);
- migratedManagedServices = true;
- } else if (mConditionProviders.getConfig().xmlTag.equals(parser.getName())) {
- mConditionProviders.readXml(parser);
- migratedManagedServices = true;
- }
+ if (mListeners.getConfig().xmlTag.equals(parser.getName())) {
+ mListeners.readXml(parser, mAllowedManagedServicePackages);
+ migratedManagedServices = true;
+ } else if (mAssistants.getConfig().xmlTag.equals(parser.getName())) {
+ mAssistants.readXml(parser, mAllowedManagedServicePackages);
+ migratedManagedServices = true;
+ } else if (mConditionProviders.getConfig().xmlTag.equals(parser.getName())) {
+ mConditionProviders.readXml(parser, mAllowedManagedServicePackages);
+ migratedManagedServices = true;
}
}
@@ -1428,6 +1427,9 @@
// This is a MangedServices object that keeps track of the assistant.
mAssistants = notificationAssistants;
+ // Needs to be set before loadPolicyFile
+ mAllowedManagedServicePackages = this::canUseManagedServices;
+
mPolicyFile = policyFile;
loadPolicyFile();
@@ -3212,7 +3214,7 @@
checkCallerIsSystemOrShell();
final long identity = Binder.clearCallingIdentity();
try {
- if (canUseManagedServices()) {
+ if (mAllowedManagedServicePackages.test(pkg)) {
mConditionProviders.setPackageOrComponentEnabled(
pkg, userId, true, granted);
@@ -3344,7 +3346,7 @@
checkCallerIsSystemOrShell();
final long identity = Binder.clearCallingIdentity();
try {
- if (canUseManagedServices()) {
+ if (mAllowedManagedServicePackages.test(listener.getPackageName())) {
mConditionProviders.setPackageOrComponentEnabled(listener.flattenToString(),
userId, false, granted);
mListeners.setPackageOrComponentEnabled(listener.flattenToString(),
@@ -3370,7 +3372,7 @@
checkCallerIsSystemOrShell();
final long identity = Binder.clearCallingIdentity();
try {
- if (canUseManagedServices()) {
+ if (mAllowedManagedServicePackages.test(assistant.getPackageName())) {
mConditionProviders.setPackageOrComponentEnabled(assistant.flattenToString(),
userId, false, granted);
mAssistants.setPackageOrComponentEnabled(assistant.flattenToString(),
@@ -6073,9 +6075,19 @@
}
}
- private boolean canUseManagedServices() {
- return !mActivityManager.isLowRamDevice()
+ @VisibleForTesting
+ boolean canUseManagedServices(String pkg) {
+ boolean canUseManagedServices = !mActivityManager.isLowRamDevice()
|| mPackageManagerClient.hasSystemFeature(PackageManager.FEATURE_WATCH);
+
+ for (String whitelisted : getContext().getResources().getStringArray(
+ R.array.config_allowedManagedServicesOnLowRamDevices)) {
+ if (whitelisted.equals(pkg)) {
+ canUseManagedServices = true;
+ }
+ }
+
+ return canUseManagedServices;
}
private class TrimCache {
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/ManagedServicesTest.java b/services/tests/uiservicestests/src/com/android/server/notification/ManagedServicesTest.java
index 9ef0ec7..895bbb1 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/ManagedServicesTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/ManagedServicesTest.java
@@ -317,7 +317,7 @@
parser.setInput(new BufferedInputStream(
new ByteArrayInputStream(baos.toByteArray())), null);
parser.nextTag();
- service.readXml(parser);
+ service.readXml(parser, null);
verifyExpectedApprovedEntries(service);
assertFalse(service.isPackageOrComponentAllowed("this.is.a.package.name", 0));
@@ -639,7 +639,7 @@
parser.setInput(new BufferedInputStream(
new ByteArrayInputStream(xml.toString().getBytes())), null);
parser.nextTag();
- service.readXml(parser);
+ service.readXml(parser, null);
}
private void addExpectedServices(final ManagedServices service, final List<String> packages,
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationAssistantsTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationAssistantsTest.java
index a8b9dff..f9a4f78 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationAssistantsTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationAssistantsTest.java
@@ -124,7 +124,7 @@
parser.setInput(new BufferedInputStream(
new ByteArrayInputStream(xml.toString().getBytes())), null);
parser.nextTag();
- mAssistants.readXml(parser);
+ mAssistants.readXml(parser, null);
verify(mNm, never()).readDefaultAssistant(anyInt());
verify(mAssistants, times(1)).addApprovedList(
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationComparatorTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationComparatorTest.java
index 30fae01..7ee0501 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationComparatorTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationComparatorTest.java
@@ -138,12 +138,14 @@
mRecordInlineReply.setUserImportance(NotificationManager.IMPORTANCE_HIGH);
mRecordInlineReply.setPackagePriority(Notification.PRIORITY_MAX);
- Notification n5 = new Notification.Builder(mContext, TEST_CHANNEL_ID)
- .setCategory(Notification.CATEGORY_MESSAGE).build();
- mRecordSms = new NotificationRecord(mContext, new StatusBarNotification(smsPkg,
- smsPkg, 1, "sms", smsUid, smsUid, n5, new UserHandle(userId),
- "", 1299), getDefaultChannel());
- mRecordSms.setUserImportance(NotificationManager.IMPORTANCE_DEFAULT);
+ if (smsPkg != null) {
+ Notification n5 = new Notification.Builder(mContext, TEST_CHANNEL_ID)
+ .setCategory(Notification.CATEGORY_MESSAGE).build();
+ mRecordSms = new NotificationRecord(mContext, new StatusBarNotification(smsPkg,
+ smsPkg, 1, "sms", smsUid, smsUid, n5, new UserHandle(userId),
+ "", 1299), getDefaultChannel());
+ mRecordSms.setUserImportance(NotificationManager.IMPORTANCE_DEFAULT);
+ }
Notification n6 = new Notification.Builder(mContext, TEST_CHANNEL_ID).build();
mRecordStarredContact = new NotificationRecord(mContext, new StatusBarNotification(pkg2,
@@ -230,7 +232,9 @@
expected.add(mRecordColorized);
expected.add(mRecordHighCall);
expected.add(mRecordInlineReply);
- expected.add(mRecordSms);
+ if (mRecordSms != null) {
+ expected.add(mRecordSms);
+ }
expected.add(mRecordStarredContact);
expected.add(mRecordContact);
expected.add(mRecordEmail);
@@ -253,7 +257,9 @@
public void testMessaging() throws Exception {
NotificationComparator comp = new NotificationComparator(mContext);
assertTrue(comp.isImportantMessaging(mRecordInlineReply));
- assertTrue(comp.isImportantMessaging(mRecordSms));
+ if (mRecordSms != null) {
+ assertTrue(comp.isImportantMessaging(mRecordSms));
+ }
assertFalse(comp.isImportantMessaging(mRecordEmail));
assertFalse(comp.isImportantMessaging(mRecordCheater));
}
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
index 9d5d263..32fa726 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
@@ -79,6 +79,7 @@
import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
import android.content.pm.ParceledListSlice;
+import android.content.res.Resources;
import android.graphics.Color;
import android.media.AudioManager;
import android.net.Uri;
@@ -102,6 +103,7 @@
import android.util.ArrayMap;
import android.util.AtomicFile;
+import com.android.internal.R;
import com.android.internal.statusbar.NotificationVisibility;
import com.android.server.UiServiceTestCase;
import com.android.server.lights.Light;
@@ -157,6 +159,8 @@
@Mock
ActivityManager mActivityManager;
NotificationManagerService.WorkerHandler mHandler;
+ @Mock
+ Resources mResources;
private NotificationChannel mTestNotificationChannel = new NotificationChannel(
TEST_CHANNEL_ID, TEST_CHANNEL_ID, NotificationManager.IMPORTANCE_DEFAULT);
@@ -388,7 +392,7 @@
public void testCreateNotificationChannels_NullChannelThrowsException() throws Exception {
try {
mBinderService.createNotificationChannels(PKG,
- new ParceledListSlice(Arrays.asList(null)));
+ new ParceledListSlice(Arrays.asList((Object[])null)));
fail("Exception should be thrown immediately.");
} catch (NullPointerException e) {
// pass
@@ -2202,9 +2206,9 @@
+ "</notification-policy>";
mService.readPolicyXml(
new BufferedInputStream(new ByteArrayInputStream(upgradeXml.getBytes())), false);
- verify(mListeners, times(1)).readXml(any());
- verify(mConditionProviders, times(1)).readXml(any());
- verify(mAssistants, times(1)).readXml(any());
+ verify(mListeners, times(1)).readXml(any(), any());
+ verify(mConditionProviders, times(1)).readXml(any(), any());
+ verify(mAssistants, times(1)).readXml(any(), any());
// numbers are inflated for setup
verify(mListeners, times(1)).migrateToXml();
@@ -2221,9 +2225,9 @@
+ "</notification-policy>";
mService.readPolicyXml(
new BufferedInputStream(new ByteArrayInputStream(preupgradeXml.getBytes())), false);
- verify(mListeners, never()).readXml(any());
- verify(mConditionProviders, never()).readXml(any());
- verify(mAssistants, never()).readXml(any());
+ verify(mListeners, never()).readXml(any(), any());
+ verify(mConditionProviders, never()).readXml(any(), any());
+ verify(mAssistants, never()).readXml(any(), any());
// numbers are inflated for setup
verify(mListeners, times(2)).migrateToXml();
@@ -2784,4 +2788,70 @@
verify(mListeners, times(1)).notifyHiddenLocked(captor.capture());
assertEquals(0, captor.getValue().size());
}
+
+ @Test
+ public void testCanUseManagedServicesLowRamNoWatchNullPkg() {
+ when(mPackageManagerClient.hasSystemFeature(FEATURE_WATCH)).thenReturn(false);
+ when(mActivityManager.isLowRamDevice()).thenReturn(true);
+ when(mResources.getStringArray(R.array.config_allowedManagedServicesOnLowRamDevices))
+ .thenReturn(new String[] {"a", "b", "c"});
+ when(mContext.getResources()).thenReturn(mResources);
+
+ assertEquals(false, mService.canUseManagedServices(null));
+ }
+
+ @Test
+ public void testCanUseManagedServicesLowRamNoWatchValidPkg() {
+ when(mPackageManagerClient.hasSystemFeature(FEATURE_WATCH)).thenReturn(false);
+ when(mActivityManager.isLowRamDevice()).thenReturn(true);
+ when(mResources.getStringArray(R.array.config_allowedManagedServicesOnLowRamDevices))
+ .thenReturn(new String[] {"a", "b", "c"});
+ when(mContext.getResources()).thenReturn(mResources);
+
+ assertEquals(true, mService.canUseManagedServices("b"));
+ }
+
+ @Test
+ public void testCanUseManagedServicesLowRamNoWatchNoValidPkg() {
+ when(mPackageManagerClient.hasSystemFeature(FEATURE_WATCH)).thenReturn(false);
+ when(mActivityManager.isLowRamDevice()).thenReturn(true);
+ when(mResources.getStringArray(R.array.config_allowedManagedServicesOnLowRamDevices))
+ .thenReturn(new String[] {"a", "b", "c"});
+ when(mContext.getResources()).thenReturn(mResources);
+
+ assertEquals(false, mService.canUseManagedServices("d"));
+ }
+
+ @Test
+ public void testCanUseManagedServicesLowRamWatchNoValidPkg() {
+ when(mPackageManagerClient.hasSystemFeature(FEATURE_WATCH)).thenReturn(true);
+ when(mActivityManager.isLowRamDevice()).thenReturn(true);
+ when(mResources.getStringArray(R.array.config_allowedManagedServicesOnLowRamDevices))
+ .thenReturn(new String[] {"a", "b", "c"});
+ when(mContext.getResources()).thenReturn(mResources);
+
+ assertEquals(true, mService.canUseManagedServices("d"));
+ }
+
+ @Test
+ public void testCanUseManagedServicesNoLowRamNoWatchValidPkg() {
+ when(mPackageManagerClient.hasSystemFeature(FEATURE_WATCH)).thenReturn(false);
+ when(mActivityManager.isLowRamDevice()).thenReturn(false);
+ when(mResources.getStringArray(R.array.config_allowedManagedServicesOnLowRamDevices))
+ .thenReturn(new String[] {"a", "b", "c"});
+ when(mContext.getResources()).thenReturn(mResources);
+
+ assertEquals(true, mService.canUseManagedServices("d"));
+ }
+
+ @Test
+ public void testCanUseManagedServicesNoLowRamWatchValidPkg() {
+ when(mPackageManagerClient.hasSystemFeature(FEATURE_WATCH)).thenReturn(true);
+ when(mActivityManager.isLowRamDevice()).thenReturn(false);
+ when(mResources.getStringArray(R.array.config_allowedManagedServicesOnLowRamDevices))
+ .thenReturn(new String[] {"a", "b", "c"});
+ when(mContext.getResources()).thenReturn(mResources);
+
+ assertEquals(true, mService.canUseManagedServices("d"));
+ }
}
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationTest.java
index 9f7205b..d846d21 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationTest.java
@@ -25,6 +25,8 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyInt;
import android.app.ActivityManager;
import android.app.Notification;
@@ -33,6 +35,8 @@
import android.app.RemoteInput;
import android.content.Context;
import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.Icon;
@@ -57,20 +61,29 @@
@Mock
ActivityManager mAm;
+ @Mock
+ Resources mResources;
+
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
}
@Test
- public void testStripsExtendersInLowRamMode() {
+ public void testStripsExtendersInLowRamModeNoWhitelistNoTv() {
Notification.Builder nb = new Notification.Builder(mContext, "channel");
nb.extend(new Notification.CarExtender().setColor(Color.RED));
nb.extend(new Notification.TvExtender().setChannelId("different channel"));
nb.extend(new Notification.WearableExtender().setDismissalId("dismiss"));
Notification before = nb.build();
- Notification after = Notification.Builder.maybeCloneStrippedForDelivery(before, true);
+ // No whitelist
+ Context context = spy(getContext());
+ when(context.getResources()).thenReturn(mResources);
+ when(mResources.getStringArray(anyInt())).thenReturn(new String[0]);
+
+ Notification after = Notification.Builder.maybeCloneStrippedForDelivery(before, true,
+ context);
assertEquals("different channel", new Notification.TvExtender(before).getChannelId());
assertNull(new Notification.TvExtender(after).getChannelId());
@@ -83,8 +96,34 @@
}
@Test
+ public void testStripsExtendersInLowRamModeHasWhitelist() {
+ Notification.Builder nb = new Notification.Builder(mContext, "channel");
+ nb.extend(new Notification.CarExtender().setColor(Color.RED));
+ nb.extend(new Notification.TvExtender().setChannelId("different channel"));
+ nb.extend(new Notification.WearableExtender().setDismissalId("dismiss"));
+ Notification before = nb.build();
+
+ // Has whitelist
+ Context context = spy(mContext);
+ when(context.getResources()).thenReturn(mResources);
+ when(mResources.getStringArray(anyInt())).thenReturn(new String[1]);
+
+ Notification after = Notification.Builder.maybeCloneStrippedForDelivery(before, true,
+ context);
+
+ assertEquals("different channel", new Notification.TvExtender(before).getChannelId());
+ assertEquals("different channel", new Notification.TvExtender(after).getChannelId());
+
+ assertEquals(Color.RED, new Notification.CarExtender(before).getColor());
+ assertEquals(Color.RED, new Notification.CarExtender(after).getColor());
+
+ assertEquals("dismiss", new Notification.WearableExtender(before).getDismissalId());
+ assertEquals("dismiss", new Notification.WearableExtender(after).getDismissalId());
+ }
+
+ @Test
public void testStripsRemoteViewsInLowRamMode() {
- Context context = spy(getContext());
+ Context context = spy(mContext);
ApplicationInfo ai = new ApplicationInfo();
ai.targetSdkVersion = Build.VERSION_CODES.M;
when(context.getApplicationInfo()).thenReturn(ai);
@@ -97,7 +136,8 @@
.setStyle(style)
.build();
- Notification after = Notification.Builder.maybeCloneStrippedForDelivery(before, true);
+ Notification after = Notification.Builder.maybeCloneStrippedForDelivery(before, true,
+ mContext);
assertNotNull(before.contentView);
assertNotNull(before.bigContentView);
assertNotNull(before.headsUpContentView);
@@ -113,7 +153,8 @@
nb.extend(new Notification.TvExtender().setChannelId("different channel"));
nb.extend(new Notification.WearableExtender().setDismissalId("dismiss"));
Notification before = nb.build();
- Notification after = Notification.Builder.maybeCloneStrippedForDelivery(before, false);
+ Notification after = Notification.Builder.maybeCloneStrippedForDelivery(before, false,
+ mContext);
assertTrue(before == after);