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

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

Merge "Remove Notification Topics." into nyc-dev

parents ea168d22 ef37f284
Loading
Loading
Loading
Loading
+1 −14
Original line number Diff line number Diff line
@@ -4880,7 +4880,6 @@ package android.app {
    method public android.graphics.drawable.Icon getLargeIcon();
    method public android.graphics.drawable.Icon getSmallIcon();
    method public java.lang.String getSortKey();
    method public android.app.Notification.Topic getTopic();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.media.AudioAttributes AUDIO_ATTRIBUTES_DEFAULT;
    field public static final java.lang.String CATEGORY_ALARM = "alarm";
@@ -4944,7 +4943,6 @@ package android.app {
    field public static final int PRIORITY_MAX = 2; // 0x2
    field public static final int PRIORITY_MIN = -2; // 0xfffffffe
    field public static final deprecated int STREAM_DEFAULT = -1; // 0xffffffff
    field public static final java.lang.String TOPIC_DEFAULT = "system_default_topic";
    field public static final int VISIBILITY_PRIVATE = 0; // 0x0
    field public static final int VISIBILITY_PUBLIC = 1; // 0x1
    field public static final int VISIBILITY_SECRET = -1; // 0xffffffff
@@ -5096,7 +5094,6 @@ package android.app {
    method public android.app.Notification.Builder setSubText(java.lang.CharSequence);
    method public android.app.Notification.Builder setTicker(java.lang.CharSequence);
    method public deprecated android.app.Notification.Builder setTicker(java.lang.CharSequence, android.widget.RemoteViews);
    method public android.app.Notification.Builder setTopic(android.app.Notification.Topic);
    method public android.app.Notification.Builder setUsesChronometer(boolean);
    method public android.app.Notification.Builder setVibrate(long[]);
    method public android.app.Notification.Builder setVisibility(int);
@@ -5164,16 +5161,6 @@ package android.app {
    field protected android.app.Notification.Builder mBuilder;
  }
  public static class Notification.Topic implements android.os.Parcelable {
    ctor public Notification.Topic(java.lang.String, java.lang.CharSequence);
    method public android.app.Notification.Topic clone();
    method public int describeContents();
    method public java.lang.String getId();
    method public java.lang.CharSequence getLabel();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.app.Notification.Topic> CREATOR;
  }
  public static final class Notification.WearableExtender implements android.app.Notification.Extender {
    ctor public Notification.WearableExtender();
    ctor public Notification.WearableExtender(android.app.Notification);
@@ -5236,7 +5223,7 @@ package android.app {
    method public android.app.AutomaticZenRule getAutomaticZenRule(java.lang.String);
    method public java.util.List<android.app.AutomaticZenRule> getAutomaticZenRules();
    method public final int getCurrentInterruptionFilter();
    method public int getImportance(java.lang.String);
    method public int getImportance();
    method public android.app.NotificationManager.Policy getNotificationPolicy();
    method public boolean isNotificationPolicyAccessGranted();
    method public void notify(int, android.app.Notification);
+3 −17
Original line number Diff line number Diff line
@@ -5012,7 +5012,6 @@ package android.app {
    method public android.graphics.drawable.Icon getLargeIcon();
    method public android.graphics.drawable.Icon getSmallIcon();
    method public java.lang.String getSortKey();
    method public android.app.Notification.Topic getTopic();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.media.AudioAttributes AUDIO_ATTRIBUTES_DEFAULT;
    field public static final java.lang.String CATEGORY_ALARM = "alarm";
@@ -5076,7 +5075,6 @@ package android.app {
    field public static final int PRIORITY_MAX = 2; // 0x2
    field public static final int PRIORITY_MIN = -2; // 0xfffffffe
    field public static final deprecated int STREAM_DEFAULT = -1; // 0xffffffff
    field public static final java.lang.String TOPIC_DEFAULT = "system_default_topic";
    field public static final int VISIBILITY_PRIVATE = 0; // 0x0
    field public static final int VISIBILITY_PUBLIC = 1; // 0x1
    field public static final int VISIBILITY_SECRET = -1; // 0xffffffff
@@ -5228,7 +5226,6 @@ package android.app {
    method public android.app.Notification.Builder setSubText(java.lang.CharSequence);
    method public android.app.Notification.Builder setTicker(java.lang.CharSequence);
    method public deprecated android.app.Notification.Builder setTicker(java.lang.CharSequence, android.widget.RemoteViews);
    method public android.app.Notification.Builder setTopic(android.app.Notification.Topic);
    method public android.app.Notification.Builder setUsesChronometer(boolean);
    method public android.app.Notification.Builder setVibrate(long[]);
    method public android.app.Notification.Builder setVisibility(int);
@@ -5296,16 +5293,6 @@ package android.app {
    field protected android.app.Notification.Builder mBuilder;
  }
  public static class Notification.Topic implements android.os.Parcelable {
    ctor public Notification.Topic(java.lang.String, java.lang.CharSequence);
    method public android.app.Notification.Topic clone();
    method public int describeContents();
    method public java.lang.String getId();
    method public java.lang.CharSequence getLabel();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.app.Notification.Topic> CREATOR;
  }
  public static final class Notification.WearableExtender implements android.app.Notification.Extender {
    ctor public Notification.WearableExtender();
    ctor public Notification.WearableExtender(android.app.Notification);
@@ -5368,7 +5355,7 @@ package android.app {
    method public android.app.AutomaticZenRule getAutomaticZenRule(java.lang.String);
    method public java.util.List<android.app.AutomaticZenRule> getAutomaticZenRules();
    method public final int getCurrentInterruptionFilter();
    method public int getImportance(java.lang.String);
    method public int getImportance();
    method public android.app.NotificationManager.Policy getNotificationPolicy();
    method public boolean isNotificationPolicyAccessGranted();
    method public void notify(int, android.app.Notification);
@@ -36984,9 +36971,8 @@ package android.service.notification {
    field public static final int REASON_LISTENER_CANCEL_ALL = 11; // 0xb
    field public static final int REASON_PACKAGE_BANNED = 7; // 0x7
    field public static final int REASON_PACKAGE_CHANGED = 5; // 0x5
    field public static final int REASON_PACKAGE_SUSPENDED = 15; // 0xf
    field public static final int REASON_PROFILE_TURNED_OFF = 16; // 0x10
    field public static final int REASON_TOPIC_BANNED = 14; // 0xe
    field public static final int REASON_PACKAGE_SUSPENDED = 14; // 0xe
    field public static final int REASON_PROFILE_TURNED_OFF = 15; // 0xf
    field public static final int REASON_USER_STOPPED = 6; // 0x6
    field public static final java.lang.String SERVICE_INTERFACE = "android.service.notification.NotificationAssistantService";
  }
+1 −14
Original line number Diff line number Diff line
@@ -4880,7 +4880,6 @@ package android.app {
    method public android.graphics.drawable.Icon getLargeIcon();
    method public android.graphics.drawable.Icon getSmallIcon();
    method public java.lang.String getSortKey();
    method public android.app.Notification.Topic getTopic();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.media.AudioAttributes AUDIO_ATTRIBUTES_DEFAULT;
    field public static final java.lang.String CATEGORY_ALARM = "alarm";
@@ -4944,7 +4943,6 @@ package android.app {
    field public static final int PRIORITY_MAX = 2; // 0x2
    field public static final int PRIORITY_MIN = -2; // 0xfffffffe
    field public static final deprecated int STREAM_DEFAULT = -1; // 0xffffffff
    field public static final java.lang.String TOPIC_DEFAULT = "system_default_topic";
    field public static final int VISIBILITY_PRIVATE = 0; // 0x0
    field public static final int VISIBILITY_PUBLIC = 1; // 0x1
    field public static final int VISIBILITY_SECRET = -1; // 0xffffffff
@@ -5096,7 +5094,6 @@ package android.app {
    method public android.app.Notification.Builder setSubText(java.lang.CharSequence);
    method public android.app.Notification.Builder setTicker(java.lang.CharSequence);
    method public deprecated android.app.Notification.Builder setTicker(java.lang.CharSequence, android.widget.RemoteViews);
    method public android.app.Notification.Builder setTopic(android.app.Notification.Topic);
    method public android.app.Notification.Builder setUsesChronometer(boolean);
    method public android.app.Notification.Builder setVibrate(long[]);
    method public android.app.Notification.Builder setVisibility(int);
@@ -5164,16 +5161,6 @@ package android.app {
    field protected android.app.Notification.Builder mBuilder;
  }
  public static class Notification.Topic implements android.os.Parcelable {
    ctor public Notification.Topic(java.lang.String, java.lang.CharSequence);
    method public android.app.Notification.Topic clone();
    method public int describeContents();
    method public java.lang.String getId();
    method public java.lang.CharSequence getLabel();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.app.Notification.Topic> CREATOR;
  }
  public static final class Notification.WearableExtender implements android.app.Notification.Extender {
    ctor public Notification.WearableExtender();
    ctor public Notification.WearableExtender(android.app.Notification);
@@ -5236,7 +5223,7 @@ package android.app {
    method public android.app.AutomaticZenRule getAutomaticZenRule(java.lang.String);
    method public java.util.List<android.app.AutomaticZenRule> getAutomaticZenRules();
    method public final int getCurrentInterruptionFilter();
    method public int getImportance(java.lang.String);
    method public int getImportance();
    method public android.app.NotificationManager.Policy getNotificationPolicy();
    method public boolean isNotificationPolicyAccessGranted();
    method public void notify(int, android.app.Notification);
+7 −10
Original line number Diff line number Diff line
@@ -48,16 +48,13 @@ interface INotificationManager
    boolean areNotificationsEnabledForPackage(String pkg, int uid);
    boolean areNotificationsEnabled(String pkg);

    ParceledListSlice getTopics(String pkg, int uid);
    void setVisibilityOverride(String pkg, int uid, in Notification.Topic topic, int visibility);
    int getVisibilityOverride(String pkg, int uid, in Notification.Topic topic);
    void setPriority(String pkg, int uid, in Notification.Topic topic, int priority);
    int getPriority(String pkg, int uid, in Notification.Topic topic);
    void setImportance(String pkg, int uid, in Notification.Topic topic, int importance);
    int getImportance(String pkg, int uid, in Notification.Topic topic);
    int getTopicImportance(String pkg, String topicId);
    boolean doesUserUseTopics(String pkg, int uid);
    boolean hasBannedTopics(String pkg, int uid);
    void setVisibilityOverride(String pkg, int uid, int visibility);
    int getVisibilityOverride(String pkg, int uid);
    void setPriority(String pkg, int uid, int priority);
    int getPriority(String pkg, int uid);
    void setImportance(String pkg, int uid, int importance);
    int getImportance(String pkg, int uid);
    int getPackageImportance(String pkg);

    // TODO: Remove this when callers have been migrated to the equivalent
    // INotificationListener method.
+0 −124
Original line number Diff line number Diff line
@@ -1365,98 +1365,6 @@ public class Notification implements Parcelable
     */
    public Notification publicVersion;

    /**
     * Structure to encapsulate a topic that is shown in Notification settings.
     * It must include an id and label.
     */
    public static class Topic implements Parcelable {
        private final String id;
        private final CharSequence label;

        public Topic(String id, CharSequence label) {
            this.id = id;
            this.label = safeCharSequence(label);
        }

        private Topic(Parcel in) {
            if (in.readInt() != 0) {
                id = in.readString();
            } else {
                id = null;
            }
            label = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
        }

        public String getId() {
            return id;
        }

        public CharSequence getLabel() {
            return label;
        }

        @Override
        public String toString() {
            return new StringBuilder(Topic.class.getSimpleName()).append('[')
                    .append("id=").append(id)
                    .append(",label=").append(label)
                    .append(']').toString();
        }

        @Override
        public boolean equals(Object o) {
            if (!(o instanceof Topic)) return false;
            if (o == this) return true;
            final Topic other = (Topic) o;
            return Objects.equals(other.id, id)
                    && Objects.equals(other.label, label);
        }

        @Override
        public int hashCode() {
            return Objects.hash(id, label);
        }

        @Override
        public Topic clone() {
            return new Topic(id, label);
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel out, int flags) {
            if (id != null) {
                out.writeInt(1);
                out.writeString(id);
            } else {
                out.writeInt(0);
            }
            TextUtils.writeToParcel(label, out, flags);
        }
        public static final Parcelable.Creator<Topic> CREATOR =
                new Parcelable.Creator<Topic>() {
                    public Topic createFromParcel(Parcel in) {
                        return new Topic(in);
                    }
                    public Topic[] newArray(int size) {
                        return new Topic[size];
                    }
                };
    }

    @SystemApi
    public static final String TOPIC_DEFAULT = "system_default_topic";

    private Topic topic;

    public Topic getTopic() {
        return topic;
    }

    /**
     * Constructs a Notification object with default values.
     * You might want to consider using {@link Builder} instead.
@@ -1583,10 +1491,6 @@ public class Notification implements Parcelable
        }

        color = parcel.readInt();

        if (parcel.readInt() != 0) {
            topic = Topic.CREATOR.createFromParcel(parcel);
        }
    }

    @Override
@@ -1687,10 +1591,6 @@ public class Notification implements Parcelable

        that.color = this.color;

        if (this.topic != null) {
            that.topic = this.topic.clone();
        }

        if (!heavy) {
            that.lightenPayload(); // will clean out extras
        }
@@ -1871,13 +1771,6 @@ public class Notification implements Parcelable
        }

        parcel.writeInt(color);

        if (topic != null) {
            parcel.writeInt(1);
            topic.writeToParcel(parcel, 0);
        } else {
            parcel.writeInt(0);
        }
    }

    /**
@@ -2020,10 +1913,6 @@ public class Notification implements Parcelable
            sb.append(" publicVersion=");
            sb.append(publicVersion.toString());
        }
        if (topic != null) {
            sb.append("topic=");
            sb.append(topic.toString());
        }
        sb.append(")");
        return sb.toString();
    }
@@ -2995,19 +2884,6 @@ public class Notification implements Parcelable
            return this;
        }

        /**
         * Sets the topic of this notification. Topics are typically displayed in Notification
         * settings.
         * <p>
         * Every topic must have an id and a textual label.
         *
         * @param topic The topic to add.
         */
        public Builder setTopic(Topic topic) {
            mN.topic = topic;
            return this;
        }

        private Drawable getProfileBadgeDrawable() {
            // Note: This assumes that the current user can read the profile badge of the
            // originating user.
Loading