NotificationRankingUpdate.java revision f612869ae1190e0885b58a3c33b23d36d7732f06
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 int mFirstAmbientIndex;
30    private final Bundle mVisibilityOverrides;
31    private final Bundle mSuppressedVisualEffects;
32
33    public NotificationRankingUpdate(String[] keys, String[] interceptedKeys,
34            Bundle visibilityOverrides, int firstAmbientIndex, Bundle suppressedVisualEffects) {
35        mKeys = keys;
36        mFirstAmbientIndex = firstAmbientIndex;
37        mInterceptedKeys = interceptedKeys;
38        mVisibilityOverrides = visibilityOverrides;
39        mSuppressedVisualEffects = suppressedVisualEffects;
40    }
41
42    public NotificationRankingUpdate(Parcel in) {
43        mKeys = in.readStringArray();
44        mFirstAmbientIndex = in.readInt();
45        mInterceptedKeys = in.readStringArray();
46        mVisibilityOverrides = in.readBundle();
47        mSuppressedVisualEffects = in.readBundle();
48    }
49
50    @Override
51    public int describeContents() {
52        return 0;
53    }
54
55    @Override
56    public void writeToParcel(Parcel out, int flags) {
57        out.writeStringArray(mKeys);
58        out.writeInt(mFirstAmbientIndex);
59        out.writeStringArray(mInterceptedKeys);
60        out.writeBundle(mVisibilityOverrides);
61        out.writeBundle(mSuppressedVisualEffects);
62    }
63
64    public static final Parcelable.Creator<NotificationRankingUpdate> CREATOR
65            = new Parcelable.Creator<NotificationRankingUpdate>() {
66        public NotificationRankingUpdate createFromParcel(Parcel parcel) {
67            return new NotificationRankingUpdate(parcel);
68        }
69
70        public NotificationRankingUpdate[] newArray(int size) {
71            return new NotificationRankingUpdate[size];
72        }
73    };
74
75    public String[] getOrderedKeys() {
76        return mKeys;
77    }
78
79    public int getFirstAmbientIndex() {
80        return mFirstAmbientIndex;
81    }
82
83    public String[] getInterceptedKeys() {
84        return mInterceptedKeys;
85    }
86
87    public Bundle getVisibilityOverrides() {
88        return mVisibilityOverrides;
89    }
90
91    public Bundle getSuppressedVisualEffects() {
92        return mSuppressedVisualEffects;
93    }
94}
95