blob: c5c70f808325ff3090486ff84a82063e0dd63424 [file] [log] [blame]
Christoph Studer05ad4822014-05-16 14:16:03 +02001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package android.service.notification;
17
Chris Wren3ad4e3a2014-09-02 17:23:51 -040018import android.os.Bundle;
Christoph Studer05ad4822014-05-16 14:16:03 +020019import android.os.Parcel;
20import android.os.Parcelable;
21
22/**
23 * @hide
24 */
25public class NotificationRankingUpdate implements Parcelable {
26 // TODO: Support incremental updates.
27 private final String[] mKeys;
Christoph Studer1d599da2014-06-12 15:25:59 +020028 private final String[] mInterceptedKeys;
Chris Wren3ad4e3a2014-09-02 17:23:51 -040029 private final Bundle mVisibilityOverrides;
Julia Reynoldsf612869ae2015-11-05 16:48:55 -050030 private final Bundle mSuppressedVisualEffects;
Chris Wrenbdf33762015-12-04 15:50:51 -050031 private final int[] mImportance;
32 private final Bundle mImportanceExplanation;
Julia Reynoldse46bb372016-03-17 11:05:58 -040033 private final Bundle mOverrideGroupKeys;
Julia Reynolds924eed12017-01-19 09:52:07 -050034 private final Bundle mChannels;
Julia Reynolds22f02b32016-12-01 15:05:13 -050035 private final Bundle mOverridePeople;
36 private final Bundle mSnoozeCriteria;
Julia Reynolds924eed12017-01-19 09:52:07 -050037 private final Bundle mShowBadge;
Julia Reynolds503ed942017-10-04 16:04:56 -040038 private final Bundle mUserSentiment;
Beverly5a20a5e2018-03-06 15:02:44 -050039 private final Bundle mHidden;
Tony Mak628cb932018-06-19 18:30:41 +010040 private final Bundle mSmartActions;
Tony Makc9acf672018-07-20 13:58:24 +020041 private final Bundle mSmartReplies;
Gus Prevas7306b902018-12-11 10:57:06 -050042 private final Bundle mLastAudiblyAlerted;
Gus Prevas9abc5062018-10-31 16:11:04 -040043 private final Bundle mNoisy;
Julia Reynolds4509ce72019-01-31 13:12:43 -050044 private final boolean[] mCanBubble;
Christoph Studer05ad4822014-05-16 14:16:03 +020045
Christoph Studer1d599da2014-06-12 15:25:59 +020046 public NotificationRankingUpdate(String[] keys, String[] interceptedKeys,
Julia Reynolds0421e6d2016-01-08 09:51:24 -050047 Bundle visibilityOverrides, Bundle suppressedVisualEffects,
Julia Reynolds22f02b32016-12-01 15:05:13 -050048 int[] importance, Bundle explanation, Bundle overrideGroupKeys,
Julia Reynolds924eed12017-01-19 09:52:07 -050049 Bundle channels, Bundle overridePeople, Bundle snoozeCriteria,
Tony Makc9acf672018-07-20 13:58:24 +020050 Bundle showBadge, Bundle userSentiment, Bundle hidden, Bundle smartActions,
Julia Reynolds4509ce72019-01-31 13:12:43 -050051 Bundle smartReplies, Bundle lastAudiblyAlerted, Bundle noisy, boolean[] canBubble) {
Christoph Studer05ad4822014-05-16 14:16:03 +020052 mKeys = keys;
Christoph Studer1d599da2014-06-12 15:25:59 +020053 mInterceptedKeys = interceptedKeys;
Chris Wren3ad4e3a2014-09-02 17:23:51 -040054 mVisibilityOverrides = visibilityOverrides;
Julia Reynoldsf612869ae2015-11-05 16:48:55 -050055 mSuppressedVisualEffects = suppressedVisualEffects;
Chris Wrenbdf33762015-12-04 15:50:51 -050056 mImportance = importance;
57 mImportanceExplanation = explanation;
Julia Reynoldse46bb372016-03-17 11:05:58 -040058 mOverrideGroupKeys = overrideGroupKeys;
Julia Reynolds924eed12017-01-19 09:52:07 -050059 mChannels = channels;
Julia Reynolds22f02b32016-12-01 15:05:13 -050060 mOverridePeople = overridePeople;
61 mSnoozeCriteria = snoozeCriteria;
Julia Reynolds924eed12017-01-19 09:52:07 -050062 mShowBadge = showBadge;
Julia Reynolds503ed942017-10-04 16:04:56 -040063 mUserSentiment = userSentiment;
Beverly5a20a5e2018-03-06 15:02:44 -050064 mHidden = hidden;
Tony Mak628cb932018-06-19 18:30:41 +010065 mSmartActions = smartActions;
Tony Makc9acf672018-07-20 13:58:24 +020066 mSmartReplies = smartReplies;
Gus Prevas7306b902018-12-11 10:57:06 -050067 mLastAudiblyAlerted = lastAudiblyAlerted;
Gus Prevas9abc5062018-10-31 16:11:04 -040068 mNoisy = noisy;
Julia Reynolds4509ce72019-01-31 13:12:43 -050069 mCanBubble = canBubble;
Christoph Studer05ad4822014-05-16 14:16:03 +020070 }
71
72 public NotificationRankingUpdate(Parcel in) {
73 mKeys = in.readStringArray();
Christoph Studer1d599da2014-06-12 15:25:59 +020074 mInterceptedKeys = in.readStringArray();
Chris Wren3ad4e3a2014-09-02 17:23:51 -040075 mVisibilityOverrides = in.readBundle();
Julia Reynoldsf612869ae2015-11-05 16:48:55 -050076 mSuppressedVisualEffects = in.readBundle();
Chris Wrenbdf33762015-12-04 15:50:51 -050077 mImportance = new int[mKeys.length];
78 in.readIntArray(mImportance);
79 mImportanceExplanation = in.readBundle();
Julia Reynoldse46bb372016-03-17 11:05:58 -040080 mOverrideGroupKeys = in.readBundle();
Julia Reynolds924eed12017-01-19 09:52:07 -050081 mChannels = in.readBundle();
Julia Reynolds22f02b32016-12-01 15:05:13 -050082 mOverridePeople = in.readBundle();
83 mSnoozeCriteria = in.readBundle();
Julia Reynolds924eed12017-01-19 09:52:07 -050084 mShowBadge = in.readBundle();
Julia Reynolds503ed942017-10-04 16:04:56 -040085 mUserSentiment = in.readBundle();
Beverly5a20a5e2018-03-06 15:02:44 -050086 mHidden = in.readBundle();
Tony Mak628cb932018-06-19 18:30:41 +010087 mSmartActions = in.readBundle();
Tony Makc9acf672018-07-20 13:58:24 +020088 mSmartReplies = in.readBundle();
Gus Prevas7306b902018-12-11 10:57:06 -050089 mLastAudiblyAlerted = in.readBundle();
Gus Prevas9abc5062018-10-31 16:11:04 -040090 mNoisy = in.readBundle();
Julia Reynolds4509ce72019-01-31 13:12:43 -050091 mCanBubble = new boolean[mKeys.length];
92 in.readBooleanArray(mCanBubble);
Christoph Studer05ad4822014-05-16 14:16:03 +020093 }
94
95 @Override
96 public int describeContents() {
97 return 0;
98 }
99
100 @Override
101 public void writeToParcel(Parcel out, int flags) {
102 out.writeStringArray(mKeys);
Christoph Studer1d599da2014-06-12 15:25:59 +0200103 out.writeStringArray(mInterceptedKeys);
Chris Wren3ad4e3a2014-09-02 17:23:51 -0400104 out.writeBundle(mVisibilityOverrides);
Julia Reynoldsf612869ae2015-11-05 16:48:55 -0500105 out.writeBundle(mSuppressedVisualEffects);
Chris Wrenbdf33762015-12-04 15:50:51 -0500106 out.writeIntArray(mImportance);
107 out.writeBundle(mImportanceExplanation);
Julia Reynoldse46bb372016-03-17 11:05:58 -0400108 out.writeBundle(mOverrideGroupKeys);
Julia Reynolds924eed12017-01-19 09:52:07 -0500109 out.writeBundle(mChannels);
Julia Reynolds22f02b32016-12-01 15:05:13 -0500110 out.writeBundle(mOverridePeople);
111 out.writeBundle(mSnoozeCriteria);
Julia Reynolds924eed12017-01-19 09:52:07 -0500112 out.writeBundle(mShowBadge);
Julia Reynolds503ed942017-10-04 16:04:56 -0400113 out.writeBundle(mUserSentiment);
Beverly5a20a5e2018-03-06 15:02:44 -0500114 out.writeBundle(mHidden);
Tony Mak628cb932018-06-19 18:30:41 +0100115 out.writeBundle(mSmartActions);
Tony Makc9acf672018-07-20 13:58:24 +0200116 out.writeBundle(mSmartReplies);
Gus Prevas7306b902018-12-11 10:57:06 -0500117 out.writeBundle(mLastAudiblyAlerted);
Gus Prevas9abc5062018-10-31 16:11:04 -0400118 out.writeBundle(mNoisy);
Julia Reynolds4509ce72019-01-31 13:12:43 -0500119 out.writeBooleanArray(mCanBubble);
Christoph Studer05ad4822014-05-16 14:16:03 +0200120 }
121
Jeff Sharkey9e8f83d2019-02-28 12:06:45 -0700122 public static final @android.annotation.NonNull Parcelable.Creator<NotificationRankingUpdate> CREATOR
Christoph Studer05ad4822014-05-16 14:16:03 +0200123 = new Parcelable.Creator<NotificationRankingUpdate>() {
124 public NotificationRankingUpdate createFromParcel(Parcel parcel) {
125 return new NotificationRankingUpdate(parcel);
126 }
127
128 public NotificationRankingUpdate[] newArray(int size) {
129 return new NotificationRankingUpdate[size];
130 }
131 };
132
133 public String[] getOrderedKeys() {
134 return mKeys;
135 }
136
Christoph Studer1d599da2014-06-12 15:25:59 +0200137 public String[] getInterceptedKeys() {
138 return mInterceptedKeys;
Christoph Studer05ad4822014-05-16 14:16:03 +0200139 }
Chris Wren3ad4e3a2014-09-02 17:23:51 -0400140
141 public Bundle getVisibilityOverrides() {
142 return mVisibilityOverrides;
143 }
Julia Reynoldsf612869ae2015-11-05 16:48:55 -0500144
145 public Bundle getSuppressedVisualEffects() {
146 return mSuppressedVisualEffects;
147 }
Chris Wrenbdf33762015-12-04 15:50:51 -0500148
149 public int[] getImportance() {
150 return mImportance;
151 }
152
153 public Bundle getImportanceExplanation() {
154 return mImportanceExplanation;
155 }
Julia Reynoldse46bb372016-03-17 11:05:58 -0400156
157 public Bundle getOverrideGroupKeys() {
158 return mOverrideGroupKeys;
159 }
Julia Reynolds22f02b32016-12-01 15:05:13 -0500160
Julia Reynolds924eed12017-01-19 09:52:07 -0500161 public Bundle getChannels() {
162 return mChannels;
Julia Reynolds22f02b32016-12-01 15:05:13 -0500163 }
164
165 public Bundle getOverridePeople() {
166 return mOverridePeople;
167 }
168
169 public Bundle getSnoozeCriteria() {
170 return mSnoozeCriteria;
171 }
Julia Reynolds924eed12017-01-19 09:52:07 -0500172
173 public Bundle getShowBadge() {
174 return mShowBadge;
175 }
Julia Reynolds503ed942017-10-04 16:04:56 -0400176
177 public Bundle getUserSentiment() {
178 return mUserSentiment;
179 }
Beverly5a20a5e2018-03-06 15:02:44 -0500180
181 public Bundle getHidden() {
182 return mHidden;
183 }
Tony Mak628cb932018-06-19 18:30:41 +0100184
185 public Bundle getSmartActions() {
186 return mSmartActions;
187 }
Tony Makc9acf672018-07-20 13:58:24 +0200188
189 public Bundle getSmartReplies() {
190 return mSmartReplies;
191 }
Gus Prevasa3226492018-10-23 11:10:09 -0400192
Gus Prevas7306b902018-12-11 10:57:06 -0500193 public Bundle getLastAudiblyAlerted() {
194 return mLastAudiblyAlerted;
Gus Prevasa3226492018-10-23 11:10:09 -0400195 }
Gus Prevas9abc5062018-10-31 16:11:04 -0400196
197 public Bundle getNoisy() {
198 return mNoisy;
199 }
Julia Reynolds4509ce72019-01-31 13:12:43 -0500200
201 public boolean[] getCanBubble() {
202 return mCanBubble;
203 }
Christoph Studer05ad4822014-05-16 14:16:03 +0200204}