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

Commit 3775a39e authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Move notification channel from record to sbn."

parents 67c8e1e6 423b9fc8
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -35000,7 +35000,7 @@ package android.service.notification {
  }
  public class StatusBarNotification implements android.os.Parcelable {
    ctor public StatusBarNotification(java.lang.String, java.lang.String, int, java.lang.String, int, int, int, android.app.Notification, android.os.UserHandle, long);
    ctor public deprecated StatusBarNotification(java.lang.String, java.lang.String, int, java.lang.String, int, int, int, android.app.Notification, android.os.UserHandle, long);
    ctor public StatusBarNotification(android.os.Parcel);
    method public android.service.notification.StatusBarNotification clone();
    method public int describeContents();
@@ -35008,6 +35008,7 @@ package android.service.notification {
    method public int getId();
    method public java.lang.String getKey();
    method public android.app.Notification getNotification();
    method public android.app.NotificationChannel getNotificationChannel();
    method public java.lang.String getOverrideGroupKey();
    method public java.lang.String getPackageName();
    method public long getPostTime();
+2 −1
Original line number Diff line number Diff line
@@ -37800,7 +37800,7 @@ package android.service.notification {
  }
  public class StatusBarNotification implements android.os.Parcelable {
    ctor public StatusBarNotification(java.lang.String, java.lang.String, int, java.lang.String, int, int, int, android.app.Notification, android.os.UserHandle, long);
    ctor public deprecated StatusBarNotification(java.lang.String, java.lang.String, int, java.lang.String, int, int, int, android.app.Notification, android.os.UserHandle, long);
    ctor public StatusBarNotification(android.os.Parcel);
    method public android.service.notification.StatusBarNotification clone();
    method public int describeContents();
@@ -37808,6 +37808,7 @@ package android.service.notification {
    method public int getId();
    method public java.lang.String getKey();
    method public android.app.Notification getNotification();
    method public android.app.NotificationChannel getNotificationChannel();
    method public java.lang.String getOverrideGroupKey();
    method public java.lang.String getPackageName();
    method public long getPostTime();
+2 −1
Original line number Diff line number Diff line
@@ -35090,7 +35090,7 @@ package android.service.notification {
  }
  public class StatusBarNotification implements android.os.Parcelable {
    ctor public StatusBarNotification(java.lang.String, java.lang.String, int, java.lang.String, int, int, int, android.app.Notification, android.os.UserHandle, long);
    ctor public deprecated StatusBarNotification(java.lang.String, java.lang.String, int, java.lang.String, int, int, int, android.app.Notification, android.os.UserHandle, long);
    ctor public StatusBarNotification(android.os.Parcel);
    method public android.service.notification.StatusBarNotification clone();
    method public int describeContents();
@@ -35098,6 +35098,7 @@ package android.service.notification {
    method public int getId();
    method public java.lang.String getKey();
    method public android.app.Notification getNotification();
    method public android.app.NotificationChannel getNotificationChannel();
    method public java.lang.String getOverrideGroupKey();
    method public java.lang.String getPackageName();
    method public long getPostTime();
+20 −12
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.service.notification;

import android.app.Notification;
import android.app.NotificationChannel;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
@@ -42,25 +43,21 @@ public class StatusBarNotification implements Parcelable {
    private final Notification notification;
    private final UserHandle user;
    private final long postTime;
    private final NotificationChannel channel;

    private Context mContext; // used for inflation & icon expansion

    /** @hide */
    public StatusBarNotification(String pkg, String opPkg, int id, String tag, int uid,
            int initialPid, int score, Notification notification, UserHandle user) {
        this(pkg, opPkg, id, tag, uid, initialPid, score, notification, user,
                System.currentTimeMillis());
    }

    /** @hide */
    public StatusBarNotification(String pkg, String opPkg, int id, String tag, int uid,
            int initialPid, Notification notification, UserHandle user, String overrideGroupKey,
            long postTime) {
    public StatusBarNotification(String pkg, String opPkg, NotificationChannel channel, int id,
            String tag, int uid, int initialPid, Notification notification, UserHandle user,
            String overrideGroupKey, long postTime) {
        if (pkg == null) throw new NullPointerException();
        if (notification == null) throw new NullPointerException();
        if (channel == null) throw new IllegalArgumentException();

        this.pkg = pkg;
        this.opPkg = opPkg;
        this.channel = channel;
        this.id = id;
        this.tag = tag;
        this.uid = uid;
@@ -73,6 +70,7 @@ public class StatusBarNotification implements Parcelable {
        this.groupKey = groupKey();
    }

    @Deprecated
    public StatusBarNotification(String pkg, String opPkg, int id, String tag, int uid,
            int initialPid, int score, Notification notification, UserHandle user,
            long postTime) {
@@ -90,6 +88,7 @@ public class StatusBarNotification implements Parcelable {
        this.postTime = postTime;
        this.key = key();
        this.groupKey = groupKey();
        this.channel = null;
    }

    public StatusBarNotification(Parcel in) {
@@ -113,6 +112,7 @@ public class StatusBarNotification implements Parcelable {
        }
        this.key = key();
        this.groupKey = groupKey();
        this.channel = NotificationChannel.CREATOR.createFromParcel(in);
    }

    private String key() {
@@ -182,6 +182,7 @@ public class StatusBarNotification implements Parcelable {
        } else {
            out.writeInt(0);
        }
        this.channel.writeToParcel(out, flags);
    }

    public int describeContents() {
@@ -208,14 +209,14 @@ public class StatusBarNotification implements Parcelable {
    public StatusBarNotification cloneLight() {
        final Notification no = new Notification();
        this.notification.cloneInto(no, false); // light copy
        return new StatusBarNotification(this.pkg, this.opPkg,
        return new StatusBarNotification(this.pkg, this.opPkg, this.channel,
                this.id, this.tag, this.uid, this.initialPid,
                no, this.user, this.overrideGroupKey, this.postTime);
    }

    @Override
    public StatusBarNotification clone() {
        return new StatusBarNotification(this.pkg, this.opPkg,
        return new StatusBarNotification(this.pkg, this.opPkg, this.channel,
                this.id, this.tag, this.uid, this.initialPid,
                this.notification.clone(), this.user, this.overrideGroupKey, this.postTime);
    }
@@ -334,6 +335,13 @@ public class StatusBarNotification implements Parcelable {
        return overrideGroupKey;
    }

    /**
     * Returns the channel this notification was posted to.
     */
    public NotificationChannel getNotificationChannel() {
        return channel;
    }

    /**
     * @hide
     */
+2 −2
Original line number Diff line number Diff line
@@ -1649,9 +1649,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
            newNotification.headsUpContentView = sbn.getNotification().headsUpContentView;

            StatusBarNotification newSbn = new StatusBarNotification(sbn.getPackageName(),
                    sbn.getOpPkg(),
                    sbn.getOpPkg(), sbn.getNotificationChannel(),
                    sbn.getId(), sbn.getTag(), sbn.getUid(), sbn.getInitialPid(),
                    0, newNotification, sbn.getUser(), sbn.getPostTime());
                    newNotification, sbn.getUser(), sbn.getOverrideGroupKey(), sbn.getPostTime());

            updateNotification(newSbn, null);
            mKeysKeptForRemoteInput.add(entry.key);
Loading