Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b4f6e8b authored by android-build-team Robot's avatar android-build-team Robot Committed by android-build-merger
Browse files

Merge "Enable Notifications on AndroidTV" into pi-dev

am: 8ba6a532

Change-Id: I4abea73596620d1a90437dbf0e04dba1024a5f68
parents e8f3bfe7 8ba6a532
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -5553,7 +5553,8 @@ public class Notification implements Parcelable
         *
         * @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
@@ -5595,10 +5596,14 @@ public class Notification implements Parcelable
                clone.extras.remove(EXTRA_REBUILD_HEADS_UP_CONTENT_VIEW_ACTION_COUNT);
            }
            if (isLowRam) {
                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;
        }

+2 −1
Original line number Diff line number Diff line
@@ -399,7 +399,8 @@ public class NotificationManager {

        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());
+3 −0
Original line number Diff line number Diff line
@@ -3181,6 +3181,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
+2 −0
Original line number Diff line number Diff line
@@ -2980,6 +2980,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" />
+10 −4
Original line number Diff line number Diff line
@@ -72,6 +72,8 @@ import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collectors;

/**
 * Manages the lifecycle of application-provided services bound by system server.
@@ -336,7 +338,7 @@ abstract public class ManagedServices {
        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);
@@ -361,6 +363,9 @@ abstract public class ManagedServices {
                    final int userId = XmlUtils.readIntAttribute(parser, ATT_USER_ID, 0);
                    final boolean isPrimary =
                            XmlUtils.readBooleanAttribute(parser, ATT_IS_PRIMARY, true);

                    if (allowedManagedServicePackages == null ||
                            allowedManagedServicePackages.test(getPackageName(approved))) {
                        if (mUm.getUserInfo(userId) != null) {
                            addApprovedList(approved, userId, isPrimary);
                        }
@@ -368,6 +373,7 @@ abstract public class ManagedServices {
                    }
                }
            }
        }
        rebindServices(false);
    }

Loading