NotificationRankingUpdate.java revision 924eed1ca6d3fec5dae7eb0f9c11b8f23f628697
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 */
16package android.service.notification;
17
18import android.os.Bundle;
19import 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;
28    private final String[] mInterceptedKeys;
29    private final Bundle mVisibilityOverrides;
30    private final Bundle mSuppressedVisualEffects;
31    private final int[] mImportance;
32    private final Bundle mImportanceExplanation;
33    private final Bundle mOverrideGroupKeys;
34    private final Bundle mChannels;
35    private final Bundle mOverridePeople;
36    private final Bundle mSnoozeCriteria;
37    private final Bundle mShowBadge;
38
39    public NotificationRankingUpdate(String[] keys, String[] interceptedKeys,
40            Bundle visibilityOverrides, Bundle suppressedVisualEffects,
41            int[] importance, Bundle explanation, Bundle overrideGroupKeys,
42            Bundle channels, Bundle overridePeople, Bundle snoozeCriteria,
43            Bundle showBadge) {
44        mKeys = keys;
45        mInterceptedKeys = interceptedKeys;
46        mVisibilityOverrides = visibilityOverrides;
47        mSuppressedVisualEffects = suppressedVisualEffects;
48        mImportance = importance;
49        mImportanceExplanation = explanation;
50        mOverrideGroupKeys = overrideGroupKeys;
51        mChannels = channels;
52        mOverridePeople = overridePeople;
53        mSnoozeCriteria = snoozeCriteria;
54        mShowBadge = showBadge;
55    }
56
57    public NotificationRankingUpdate(Parcel in) {
58        mKeys = in.readStringArray();
59        mInterceptedKeys = in.readStringArray();
60        mVisibilityOverrides = in.readBundle();
61        mSuppressedVisualEffects = in.readBundle();
62        mImportance = new int[mKeys.length];
63        in.readIntArray(mImportance);
64        mImportanceExplanation = in.readBundle();
65        mOverrideGroupKeys = in.readBundle();
66        mChannels = in.readBundle();
67        mOverridePeople = in.readBundle();
68        mSnoozeCriteria = in.readBundle();
69        mShowBadge = in.readBundle();
70    }
71
72    @Override
73    public int describeContents() {
74        return 0;
75    }
76
77    @Override
78    public void writeToParcel(Parcel out, int flags) {
79        out.writeStringArray(mKeys);
80        out.writeStringArray(mInterceptedKeys);
81        out.writeBundle(mVisibilityOverrides);
82        out.writeBundle(mSuppressedVisualEffects);
83        out.writeIntArray(mImportance);
84        out.writeBundle(mImportanceExplanation);
85        out.writeBundle(mOverrideGroupKeys);
86        out.writeBundle(mChannels);
87        out.writeBundle(mOverridePeople);
88        out.writeBundle(mSnoozeCriteria);
89        out.writeBundle(mShowBadge);
90    }
91
92    public static final Parcelable.Creator<NotificationRankingUpdate> CREATOR
93            = new Parcelable.Creator<NotificationRankingUpdate>() {
94        public NotificationRankingUpdate createFromParcel(Parcel parcel) {
95            return new NotificationRankingUpdate(parcel);
96        }
97
98        public NotificationRankingUpdate[] newArray(int size) {
99            return new NotificationRankingUpdate[size];
100        }
101    };
102
103    public String[] getOrderedKeys() {
104        return mKeys;
105    }
106
107    public String[] getInterceptedKeys() {
108        return mInterceptedKeys;
109    }
110
111    public Bundle getVisibilityOverrides() {
112        return mVisibilityOverrides;
113    }
114
115    public Bundle getSuppressedVisualEffects() {
116        return mSuppressedVisualEffects;
117    }
118
119    public int[] getImportance() {
120        return mImportance;
121    }
122
123    public Bundle getImportanceExplanation() {
124        return mImportanceExplanation;
125    }
126
127    public Bundle getOverrideGroupKeys() {
128        return mOverrideGroupKeys;
129    }
130
131    public Bundle getChannels() {
132        return mChannels;
133    }
134
135    public Bundle getOverridePeople() {
136        return mOverridePeople;
137    }
138
139    public Bundle getSnoozeCriteria() {
140        return mSnoozeCriteria;
141    }
142
143    public Bundle getShowBadge() {
144        return mShowBadge;
145    }
146}
147