NotificationRankingUpdate.java revision 0421e6d58635f347f785ae4c78e8b2a5da327138
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
34    public NotificationRankingUpdate(String[] keys, String[] interceptedKeys,
35            Bundle visibilityOverrides, Bundle suppressedVisualEffects,
36            int[] importance, Bundle explanation) {
37        mKeys = keys;
38        mInterceptedKeys = interceptedKeys;
39        mVisibilityOverrides = visibilityOverrides;
40        mSuppressedVisualEffects = suppressedVisualEffects;
41        mImportance = importance;
42        mImportanceExplanation = explanation;
43    }
44
45    public NotificationRankingUpdate(Parcel in) {
46        mKeys = in.readStringArray();
47        mInterceptedKeys = in.readStringArray();
48        mVisibilityOverrides = in.readBundle();
49        mSuppressedVisualEffects = in.readBundle();
50        mImportance = new int[mKeys.length];
51        in.readIntArray(mImportance);
52        mImportanceExplanation = in.readBundle();
53    }
54
55    @Override
56    public int describeContents() {
57        return 0;
58    }
59
60    @Override
61    public void writeToParcel(Parcel out, int flags) {
62        out.writeStringArray(mKeys);
63        out.writeStringArray(mInterceptedKeys);
64        out.writeBundle(mVisibilityOverrides);
65        out.writeBundle(mSuppressedVisualEffects);
66        out.writeIntArray(mImportance);
67        out.writeBundle(mImportanceExplanation);
68    }
69
70    public static final Parcelable.Creator<NotificationRankingUpdate> CREATOR
71            = new Parcelable.Creator<NotificationRankingUpdate>() {
72        public NotificationRankingUpdate createFromParcel(Parcel parcel) {
73            return new NotificationRankingUpdate(parcel);
74        }
75
76        public NotificationRankingUpdate[] newArray(int size) {
77            return new NotificationRankingUpdate[size];
78        }
79    };
80
81    public String[] getOrderedKeys() {
82        return mKeys;
83    }
84
85    public String[] getInterceptedKeys() {
86        return mInterceptedKeys;
87    }
88
89    public Bundle getVisibilityOverrides() {
90        return mVisibilityOverrides;
91    }
92
93    public Bundle getSuppressedVisualEffects() {
94        return mSuppressedVisualEffects;
95    }
96
97    public int[] getImportance() {
98        return mImportance;
99    }
100
101    public Bundle getImportanceExplanation() {
102        return mImportanceExplanation;
103    }
104}
105