Christoph Studer | 05ad482 | 2014-05-16 14:16:03 +0200 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | package android.service.notification; |
| 17 | |
Chris Wren | 3ad4e3a | 2014-09-02 17:23:51 -0400 | [diff] [blame] | 18 | import android.os.Bundle; |
Christoph Studer | 05ad482 | 2014-05-16 14:16:03 +0200 | [diff] [blame] | 19 | import android.os.Parcel; |
| 20 | import android.os.Parcelable; |
| 21 | |
| 22 | /** |
| 23 | * @hide |
| 24 | */ |
| 25 | public class NotificationRankingUpdate implements Parcelable { |
| 26 | // TODO: Support incremental updates. |
| 27 | private final String[] mKeys; |
Christoph Studer | 1d599da | 2014-06-12 15:25:59 +0200 | [diff] [blame] | 28 | private final String[] mInterceptedKeys; |
Chris Wren | 3ad4e3a | 2014-09-02 17:23:51 -0400 | [diff] [blame] | 29 | private final Bundle mVisibilityOverrides; |
Julia Reynolds | f612869ae | 2015-11-05 16:48:55 -0500 | [diff] [blame] | 30 | private final Bundle mSuppressedVisualEffects; |
Chris Wren | bdf3376 | 2015-12-04 15:50:51 -0500 | [diff] [blame] | 31 | private final int[] mImportance; |
| 32 | private final Bundle mImportanceExplanation; |
Julia Reynolds | e46bb37 | 2016-03-17 11:05:58 -0400 | [diff] [blame] | 33 | private final Bundle mOverrideGroupKeys; |
Julia Reynolds | 924eed1 | 2017-01-19 09:52:07 -0500 | [diff] [blame] | 34 | private final Bundle mChannels; |
Julia Reynolds | 22f02b3 | 2016-12-01 15:05:13 -0500 | [diff] [blame] | 35 | private final Bundle mOverridePeople; |
| 36 | private final Bundle mSnoozeCriteria; |
Julia Reynolds | 924eed1 | 2017-01-19 09:52:07 -0500 | [diff] [blame] | 37 | private final Bundle mShowBadge; |
Julia Reynolds | 503ed94 | 2017-10-04 16:04:56 -0400 | [diff] [blame] | 38 | private final Bundle mUserSentiment; |
Beverly | 5a20a5e | 2018-03-06 15:02:44 -0500 | [diff] [blame] | 39 | private final Bundle mHidden; |
Tony Mak | 628cb93 | 2018-06-19 18:30:41 +0100 | [diff] [blame] | 40 | private final Bundle mSmartActions; |
Tony Mak | c9acf67 | 2018-07-20 13:58:24 +0200 | [diff] [blame] | 41 | private final Bundle mSmartReplies; |
Gus Prevas | 7306b90 | 2018-12-11 10:57:06 -0500 | [diff] [blame] | 42 | private final Bundle mLastAudiblyAlerted; |
Gus Prevas | 9abc506 | 2018-10-31 16:11:04 -0400 | [diff] [blame] | 43 | private final Bundle mNoisy; |
Julia Reynolds | 4509ce7 | 2019-01-31 13:12:43 -0500 | [diff] [blame] | 44 | private final boolean[] mCanBubble; |
Christoph Studer | 05ad482 | 2014-05-16 14:16:03 +0200 | [diff] [blame] | 45 | |
Christoph Studer | 1d599da | 2014-06-12 15:25:59 +0200 | [diff] [blame] | 46 | public NotificationRankingUpdate(String[] keys, String[] interceptedKeys, |
Julia Reynolds | 0421e6d | 2016-01-08 09:51:24 -0500 | [diff] [blame] | 47 | Bundle visibilityOverrides, Bundle suppressedVisualEffects, |
Julia Reynolds | 22f02b3 | 2016-12-01 15:05:13 -0500 | [diff] [blame] | 48 | int[] importance, Bundle explanation, Bundle overrideGroupKeys, |
Julia Reynolds | 924eed1 | 2017-01-19 09:52:07 -0500 | [diff] [blame] | 49 | Bundle channels, Bundle overridePeople, Bundle snoozeCriteria, |
Tony Mak | c9acf67 | 2018-07-20 13:58:24 +0200 | [diff] [blame] | 50 | Bundle showBadge, Bundle userSentiment, Bundle hidden, Bundle smartActions, |
Julia Reynolds | 4509ce7 | 2019-01-31 13:12:43 -0500 | [diff] [blame] | 51 | Bundle smartReplies, Bundle lastAudiblyAlerted, Bundle noisy, boolean[] canBubble) { |
Christoph Studer | 05ad482 | 2014-05-16 14:16:03 +0200 | [diff] [blame] | 52 | mKeys = keys; |
Christoph Studer | 1d599da | 2014-06-12 15:25:59 +0200 | [diff] [blame] | 53 | mInterceptedKeys = interceptedKeys; |
Chris Wren | 3ad4e3a | 2014-09-02 17:23:51 -0400 | [diff] [blame] | 54 | mVisibilityOverrides = visibilityOverrides; |
Julia Reynolds | f612869ae | 2015-11-05 16:48:55 -0500 | [diff] [blame] | 55 | mSuppressedVisualEffects = suppressedVisualEffects; |
Chris Wren | bdf3376 | 2015-12-04 15:50:51 -0500 | [diff] [blame] | 56 | mImportance = importance; |
| 57 | mImportanceExplanation = explanation; |
Julia Reynolds | e46bb37 | 2016-03-17 11:05:58 -0400 | [diff] [blame] | 58 | mOverrideGroupKeys = overrideGroupKeys; |
Julia Reynolds | 924eed1 | 2017-01-19 09:52:07 -0500 | [diff] [blame] | 59 | mChannels = channels; |
Julia Reynolds | 22f02b3 | 2016-12-01 15:05:13 -0500 | [diff] [blame] | 60 | mOverridePeople = overridePeople; |
| 61 | mSnoozeCriteria = snoozeCriteria; |
Julia Reynolds | 924eed1 | 2017-01-19 09:52:07 -0500 | [diff] [blame] | 62 | mShowBadge = showBadge; |
Julia Reynolds | 503ed94 | 2017-10-04 16:04:56 -0400 | [diff] [blame] | 63 | mUserSentiment = userSentiment; |
Beverly | 5a20a5e | 2018-03-06 15:02:44 -0500 | [diff] [blame] | 64 | mHidden = hidden; |
Tony Mak | 628cb93 | 2018-06-19 18:30:41 +0100 | [diff] [blame] | 65 | mSmartActions = smartActions; |
Tony Mak | c9acf67 | 2018-07-20 13:58:24 +0200 | [diff] [blame] | 66 | mSmartReplies = smartReplies; |
Gus Prevas | 7306b90 | 2018-12-11 10:57:06 -0500 | [diff] [blame] | 67 | mLastAudiblyAlerted = lastAudiblyAlerted; |
Gus Prevas | 9abc506 | 2018-10-31 16:11:04 -0400 | [diff] [blame] | 68 | mNoisy = noisy; |
Julia Reynolds | 4509ce7 | 2019-01-31 13:12:43 -0500 | [diff] [blame] | 69 | mCanBubble = canBubble; |
Christoph Studer | 05ad482 | 2014-05-16 14:16:03 +0200 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | public NotificationRankingUpdate(Parcel in) { |
| 73 | mKeys = in.readStringArray(); |
Christoph Studer | 1d599da | 2014-06-12 15:25:59 +0200 | [diff] [blame] | 74 | mInterceptedKeys = in.readStringArray(); |
Chris Wren | 3ad4e3a | 2014-09-02 17:23:51 -0400 | [diff] [blame] | 75 | mVisibilityOverrides = in.readBundle(); |
Julia Reynolds | f612869ae | 2015-11-05 16:48:55 -0500 | [diff] [blame] | 76 | mSuppressedVisualEffects = in.readBundle(); |
Chris Wren | bdf3376 | 2015-12-04 15:50:51 -0500 | [diff] [blame] | 77 | mImportance = new int[mKeys.length]; |
| 78 | in.readIntArray(mImportance); |
| 79 | mImportanceExplanation = in.readBundle(); |
Julia Reynolds | e46bb37 | 2016-03-17 11:05:58 -0400 | [diff] [blame] | 80 | mOverrideGroupKeys = in.readBundle(); |
Julia Reynolds | 924eed1 | 2017-01-19 09:52:07 -0500 | [diff] [blame] | 81 | mChannels = in.readBundle(); |
Julia Reynolds | 22f02b3 | 2016-12-01 15:05:13 -0500 | [diff] [blame] | 82 | mOverridePeople = in.readBundle(); |
| 83 | mSnoozeCriteria = in.readBundle(); |
Julia Reynolds | 924eed1 | 2017-01-19 09:52:07 -0500 | [diff] [blame] | 84 | mShowBadge = in.readBundle(); |
Julia Reynolds | 503ed94 | 2017-10-04 16:04:56 -0400 | [diff] [blame] | 85 | mUserSentiment = in.readBundle(); |
Beverly | 5a20a5e | 2018-03-06 15:02:44 -0500 | [diff] [blame] | 86 | mHidden = in.readBundle(); |
Tony Mak | 628cb93 | 2018-06-19 18:30:41 +0100 | [diff] [blame] | 87 | mSmartActions = in.readBundle(); |
Tony Mak | c9acf67 | 2018-07-20 13:58:24 +0200 | [diff] [blame] | 88 | mSmartReplies = in.readBundle(); |
Gus Prevas | 7306b90 | 2018-12-11 10:57:06 -0500 | [diff] [blame] | 89 | mLastAudiblyAlerted = in.readBundle(); |
Gus Prevas | 9abc506 | 2018-10-31 16:11:04 -0400 | [diff] [blame] | 90 | mNoisy = in.readBundle(); |
Julia Reynolds | 4509ce7 | 2019-01-31 13:12:43 -0500 | [diff] [blame] | 91 | mCanBubble = new boolean[mKeys.length]; |
| 92 | in.readBooleanArray(mCanBubble); |
Christoph Studer | 05ad482 | 2014-05-16 14:16:03 +0200 | [diff] [blame] | 93 | } |
| 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 Studer | 1d599da | 2014-06-12 15:25:59 +0200 | [diff] [blame] | 103 | out.writeStringArray(mInterceptedKeys); |
Chris Wren | 3ad4e3a | 2014-09-02 17:23:51 -0400 | [diff] [blame] | 104 | out.writeBundle(mVisibilityOverrides); |
Julia Reynolds | f612869ae | 2015-11-05 16:48:55 -0500 | [diff] [blame] | 105 | out.writeBundle(mSuppressedVisualEffects); |
Chris Wren | bdf3376 | 2015-12-04 15:50:51 -0500 | [diff] [blame] | 106 | out.writeIntArray(mImportance); |
| 107 | out.writeBundle(mImportanceExplanation); |
Julia Reynolds | e46bb37 | 2016-03-17 11:05:58 -0400 | [diff] [blame] | 108 | out.writeBundle(mOverrideGroupKeys); |
Julia Reynolds | 924eed1 | 2017-01-19 09:52:07 -0500 | [diff] [blame] | 109 | out.writeBundle(mChannels); |
Julia Reynolds | 22f02b3 | 2016-12-01 15:05:13 -0500 | [diff] [blame] | 110 | out.writeBundle(mOverridePeople); |
| 111 | out.writeBundle(mSnoozeCriteria); |
Julia Reynolds | 924eed1 | 2017-01-19 09:52:07 -0500 | [diff] [blame] | 112 | out.writeBundle(mShowBadge); |
Julia Reynolds | 503ed94 | 2017-10-04 16:04:56 -0400 | [diff] [blame] | 113 | out.writeBundle(mUserSentiment); |
Beverly | 5a20a5e | 2018-03-06 15:02:44 -0500 | [diff] [blame] | 114 | out.writeBundle(mHidden); |
Tony Mak | 628cb93 | 2018-06-19 18:30:41 +0100 | [diff] [blame] | 115 | out.writeBundle(mSmartActions); |
Tony Mak | c9acf67 | 2018-07-20 13:58:24 +0200 | [diff] [blame] | 116 | out.writeBundle(mSmartReplies); |
Gus Prevas | 7306b90 | 2018-12-11 10:57:06 -0500 | [diff] [blame] | 117 | out.writeBundle(mLastAudiblyAlerted); |
Gus Prevas | 9abc506 | 2018-10-31 16:11:04 -0400 | [diff] [blame] | 118 | out.writeBundle(mNoisy); |
Julia Reynolds | 4509ce7 | 2019-01-31 13:12:43 -0500 | [diff] [blame] | 119 | out.writeBooleanArray(mCanBubble); |
Christoph Studer | 05ad482 | 2014-05-16 14:16:03 +0200 | [diff] [blame] | 120 | } |
| 121 | |
Jeff Sharkey | 9e8f83d | 2019-02-28 12:06:45 -0700 | [diff] [blame] | 122 | public static final @android.annotation.NonNull Parcelable.Creator<NotificationRankingUpdate> CREATOR |
Christoph Studer | 05ad482 | 2014-05-16 14:16:03 +0200 | [diff] [blame] | 123 | = 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 Studer | 1d599da | 2014-06-12 15:25:59 +0200 | [diff] [blame] | 137 | public String[] getInterceptedKeys() { |
| 138 | return mInterceptedKeys; |
Christoph Studer | 05ad482 | 2014-05-16 14:16:03 +0200 | [diff] [blame] | 139 | } |
Chris Wren | 3ad4e3a | 2014-09-02 17:23:51 -0400 | [diff] [blame] | 140 | |
| 141 | public Bundle getVisibilityOverrides() { |
| 142 | return mVisibilityOverrides; |
| 143 | } |
Julia Reynolds | f612869ae | 2015-11-05 16:48:55 -0500 | [diff] [blame] | 144 | |
| 145 | public Bundle getSuppressedVisualEffects() { |
| 146 | return mSuppressedVisualEffects; |
| 147 | } |
Chris Wren | bdf3376 | 2015-12-04 15:50:51 -0500 | [diff] [blame] | 148 | |
| 149 | public int[] getImportance() { |
| 150 | return mImportance; |
| 151 | } |
| 152 | |
| 153 | public Bundle getImportanceExplanation() { |
| 154 | return mImportanceExplanation; |
| 155 | } |
Julia Reynolds | e46bb37 | 2016-03-17 11:05:58 -0400 | [diff] [blame] | 156 | |
| 157 | public Bundle getOverrideGroupKeys() { |
| 158 | return mOverrideGroupKeys; |
| 159 | } |
Julia Reynolds | 22f02b3 | 2016-12-01 15:05:13 -0500 | [diff] [blame] | 160 | |
Julia Reynolds | 924eed1 | 2017-01-19 09:52:07 -0500 | [diff] [blame] | 161 | public Bundle getChannels() { |
| 162 | return mChannels; |
Julia Reynolds | 22f02b3 | 2016-12-01 15:05:13 -0500 | [diff] [blame] | 163 | } |
| 164 | |
| 165 | public Bundle getOverridePeople() { |
| 166 | return mOverridePeople; |
| 167 | } |
| 168 | |
| 169 | public Bundle getSnoozeCriteria() { |
| 170 | return mSnoozeCriteria; |
| 171 | } |
Julia Reynolds | 924eed1 | 2017-01-19 09:52:07 -0500 | [diff] [blame] | 172 | |
| 173 | public Bundle getShowBadge() { |
| 174 | return mShowBadge; |
| 175 | } |
Julia Reynolds | 503ed94 | 2017-10-04 16:04:56 -0400 | [diff] [blame] | 176 | |
| 177 | public Bundle getUserSentiment() { |
| 178 | return mUserSentiment; |
| 179 | } |
Beverly | 5a20a5e | 2018-03-06 15:02:44 -0500 | [diff] [blame] | 180 | |
| 181 | public Bundle getHidden() { |
| 182 | return mHidden; |
| 183 | } |
Tony Mak | 628cb93 | 2018-06-19 18:30:41 +0100 | [diff] [blame] | 184 | |
| 185 | public Bundle getSmartActions() { |
| 186 | return mSmartActions; |
| 187 | } |
Tony Mak | c9acf67 | 2018-07-20 13:58:24 +0200 | [diff] [blame] | 188 | |
| 189 | public Bundle getSmartReplies() { |
| 190 | return mSmartReplies; |
| 191 | } |
Gus Prevas | a322649 | 2018-10-23 11:10:09 -0400 | [diff] [blame] | 192 | |
Gus Prevas | 7306b90 | 2018-12-11 10:57:06 -0500 | [diff] [blame] | 193 | public Bundle getLastAudiblyAlerted() { |
| 194 | return mLastAudiblyAlerted; |
Gus Prevas | a322649 | 2018-10-23 11:10:09 -0400 | [diff] [blame] | 195 | } |
Gus Prevas | 9abc506 | 2018-10-31 16:11:04 -0400 | [diff] [blame] | 196 | |
| 197 | public Bundle getNoisy() { |
| 198 | return mNoisy; |
| 199 | } |
Julia Reynolds | 4509ce7 | 2019-01-31 13:12:43 -0500 | [diff] [blame] | 200 | |
| 201 | public boolean[] getCanBubble() { |
| 202 | return mCanBubble; |
| 203 | } |
Christoph Studer | 05ad482 | 2014-05-16 14:16:03 +0200 | [diff] [blame] | 204 | } |