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;
}