NotificationRankingUpdate.java revision 05ad48206a082057e17723d32493c153faa6881e
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.Parcel; 19import android.os.Parcelable; 20 21/** 22 * @hide 23 */ 24public class NotificationRankingUpdate implements Parcelable { 25 // TODO: Support incremental updates. 26 private final String[] mKeys; 27 private final String[] mDndInterceptedKeys; 28 private final int mFirstAmbientIndex; 29 30 public NotificationRankingUpdate(String[] keys, String[] dndInterceptedKeys, 31 int firstAmbientIndex) { 32 mKeys = keys; 33 mFirstAmbientIndex = firstAmbientIndex; 34 mDndInterceptedKeys = dndInterceptedKeys; 35 } 36 37 public NotificationRankingUpdate(Parcel in) { 38 mKeys = in.readStringArray(); 39 mFirstAmbientIndex = in.readInt(); 40 mDndInterceptedKeys = in.readStringArray(); 41 } 42 43 @Override 44 public int describeContents() { 45 return 0; 46 } 47 48 @Override 49 public void writeToParcel(Parcel out, int flags) { 50 out.writeStringArray(mKeys); 51 out.writeInt(mFirstAmbientIndex); 52 out.writeStringArray(mDndInterceptedKeys); 53 } 54 55 public static final Parcelable.Creator<NotificationRankingUpdate> CREATOR 56 = new Parcelable.Creator<NotificationRankingUpdate>() { 57 public NotificationRankingUpdate createFromParcel(Parcel parcel) { 58 return new NotificationRankingUpdate(parcel); 59 } 60 61 public NotificationRankingUpdate[] newArray(int size) { 62 return new NotificationRankingUpdate[size]; 63 } 64 }; 65 66 public String[] getOrderedKeys() { 67 return mKeys; 68 } 69 70 public int getFirstAmbientIndex() { 71 return mFirstAmbientIndex; 72 } 73 74 public String[] getDndInterceptedKeys() { 75 return mDndInterceptedKeys; 76 } 77} 78