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

Commit 0de6eb9d authored by Christoph Studer's avatar Christoph Studer Committed by Android Git Automerger
Browse files

am 572532d0: Merge "Strip RemoteViews from Notifications, re-create them in SysUI" into lmp-dev

* commit '572532d089d15057c5e00a1d7fcf926d7555299f':
  Strip RemoteViews from Notifications, re-create them in SysUI
parents f875fdf4 4579fd2d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4637,6 +4637,7 @@ package android.app {
    field public static final int DEFAULT_SOUND = 1; // 0x1
    field public static final int DEFAULT_VIBRATE = 2; // 0x2
    field public static final java.lang.String EXTRA_BACKGROUND_IMAGE_URI = "android.backgroundImageUri";
    field public static final java.lang.String EXTRA_BIG_TEXT = "android.bigText";
    field public static final java.lang.String EXTRA_COMPACT_ACTIONS = "android.compactActions";
    field public static final java.lang.String EXTRA_INFO_TEXT = "android.infoText";
    field public static final java.lang.String EXTRA_LARGE_ICON = "android.largeIcon";
@@ -4825,7 +4826,6 @@ package android.app {
  public static class Notification.MediaStyle extends android.app.Notification.Style {
    ctor public Notification.MediaStyle();
    ctor public Notification.MediaStyle(android.app.Notification.Builder);
    method public android.app.Notification buildStyled(android.app.Notification);
    method public android.app.Notification.MediaStyle setMediaSession(android.media.session.MediaSession.Token);
    method public android.app.Notification.MediaStyle setShowActionsInCompactView(int...);
  }
+510 −26

File changed.

Preview size limit exceeded, changes collapsed.

+7 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.app;

import android.app.Notification.Builder;
import android.content.Context;
import android.os.Handler;
import android.os.IBinder;
@@ -132,9 +133,11 @@ public class NotificationManager
            }
        }
        if (localLOGV) Log.v(TAG, pkg + ": notify(" + id + ", " + notification + ")");
        Notification stripped = notification.clone();
        Builder.stripForDelivery(stripped);
        try {
            service.enqueueNotificationWithTag(pkg, mContext.getOpPackageName(), tag, id,
                    notification, idOut, UserHandle.myUserId());
                    stripped, idOut, UserHandle.myUserId());
            if (id != idOut[0]) {
                Log.w(TAG, "notify: id corrupted: sent " + id + ", got back " + idOut[0]);
            }
@@ -157,9 +160,11 @@ public class NotificationManager
            }
        }
        if (localLOGV) Log.v(TAG, pkg + ": notify(" + id + ", " + notification + ")");
        Notification stripped = notification.clone();
        Builder.stripForDelivery(stripped);
        try {
            service.enqueueNotificationWithTag(pkg, mContext.getOpPackageName(), tag, id,
                    notification, idOut, user.getIdentifier());
                    stripped, idOut, user.getIdentifier());
            if (id != idOut[0]) {
                Log.w(TAG, "notify: id corrupted: sent " + id + ", got back " + idOut[0]);
            }
+28 −3
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@ package android.service.notification;
import android.annotation.SystemApi;
import android.annotation.SdkConstant;
import android.app.INotificationManager;
import android.app.Notification;
import android.app.Notification.Builder;
import android.app.Service;
import android.content.ComponentName;
import android.content.Context;
@@ -70,6 +72,11 @@ public abstract class NotificationListenerService extends Service {
    /** Only valid after a successful call to (@link registerAsService}. */
    private int mCurrentUser;


    // This context is required for system services since NotificationListenerService isn't
    // started as a real Service and hence no context is available.
    private Context mSystemContext;

    /**
     * The {@link Intent} that must be declared as handled by the service.
     */
@@ -290,7 +297,13 @@ public abstract class NotificationListenerService extends Service {
            ParceledListSlice<StatusBarNotification> parceledList =
                    getNotificationInterface().getActiveNotificationsFromListener(mWrapper);
            List<StatusBarNotification> list = parceledList.getList();
            return list.toArray(new StatusBarNotification[list.size()]);

            int N = list.size();
            for (int i = 0; i < N; i++) {
                Notification notification = list.get(i).getNotification();
                Builder.rebuild(getContext(), notification);
            }
            return list.toArray(new StatusBarNotification[N]);
        } catch (android.os.RemoteException ex) {
            Log.v(TAG, "Unable to contact notification manager", ex);
        }
@@ -379,13 +392,16 @@ public abstract class NotificationListenerService extends Service {
     * <p>Only system services may use this call. It will fail for non-system callers.
     * Apps should ask the user to add their listener in Settings.
     *
     * @param context Context required for accessing resources. Since this service isn't
     *    launched as a real Service when using this method, a context has to be passed in.
     * @param componentName the component that will consume the notification information
     * @param currentUser the user to use as the stream filter
     * @hide
     */
    @SystemApi
    public void registerAsSystemService(ComponentName componentName, int currentUser)
            throws RemoteException {
    public void registerAsSystemService(Context context, ComponentName componentName,
            int currentUser) throws RemoteException {
        mSystemContext = context;
        if (mWrapper == null) {
            mWrapper = new INotificationListenerWrapper();
        }
@@ -413,6 +429,8 @@ public abstract class NotificationListenerService extends Service {
        @Override
        public void onNotificationPosted(StatusBarNotification sbn,
                NotificationRankingUpdate update) {
            Notification.Builder.rebuild(getContext(), sbn.getNotification());

            // protect subclass from concurrent modifications of (@link mNotificationKeys}.
            synchronized (mWrapper) {
                applyUpdate(update);
@@ -475,6 +493,13 @@ public abstract class NotificationListenerService extends Service {
        mRankingMap = new RankingMap(update);
    }

    private Context getContext() {
        if (mSystemContext != null) {
            return mSystemContext;
        }
        return this;
    }

    /**
     * Stores ranking related information on a currently active notification.
     *
+9 −0
Original line number Diff line number Diff line
@@ -2575,6 +2575,15 @@ public class RemoteViews implements Parcelable, Filter {
        return c;
    }

    /**
     * Returns the number of actions in this RemoteViews. Can be used as a sequence number.
     *
     * @hide
     */
    public int getSequenceNumber() {
        return (mActions == null) ? 0 : mActions.size();
    }

    /* (non-Javadoc)
     * Used to restrict the views which can be inflated
     *
Loading