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