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 */ 16 package android.service.notification; 17 18 import android.os.Bundle; 19 import android.os.Parcel; 20 import android.os.Parcelable; 21 22 /** 23 * @hide 24 */ 25 public 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 NotificationRankingUpdate(String[] keys, String[] interceptedKeys, Bundle visibilityOverrides, int firstAmbientIndex)32 public NotificationRankingUpdate(String[] keys, String[] interceptedKeys, 33 Bundle visibilityOverrides, int firstAmbientIndex) { 34 mKeys = keys; 35 mFirstAmbientIndex = firstAmbientIndex; 36 mInterceptedKeys = interceptedKeys; 37 mVisibilityOverrides = visibilityOverrides; 38 } 39 NotificationRankingUpdate(Parcel in)40 public NotificationRankingUpdate(Parcel in) { 41 mKeys = in.readStringArray(); 42 mFirstAmbientIndex = in.readInt(); 43 mInterceptedKeys = in.readStringArray(); 44 mVisibilityOverrides = in.readBundle(); 45 } 46 47 @Override describeContents()48 public int describeContents() { 49 return 0; 50 } 51 52 @Override writeToParcel(Parcel out, int flags)53 public void writeToParcel(Parcel out, int flags) { 54 out.writeStringArray(mKeys); 55 out.writeInt(mFirstAmbientIndex); 56 out.writeStringArray(mInterceptedKeys); 57 out.writeBundle(mVisibilityOverrides); 58 } 59 60 public static final Parcelable.Creator<NotificationRankingUpdate> CREATOR 61 = new Parcelable.Creator<NotificationRankingUpdate>() { 62 public NotificationRankingUpdate createFromParcel(Parcel parcel) { 63 return new NotificationRankingUpdate(parcel); 64 } 65 66 public NotificationRankingUpdate[] newArray(int size) { 67 return new NotificationRankingUpdate[size]; 68 } 69 }; 70 getOrderedKeys()71 public String[] getOrderedKeys() { 72 return mKeys; 73 } 74 getFirstAmbientIndex()75 public int getFirstAmbientIndex() { 76 return mFirstAmbientIndex; 77 } 78 getInterceptedKeys()79 public String[] getInterceptedKeys() { 80 return mInterceptedKeys; 81 } 82 getVisibilityOverrides()83 public Bundle getVisibilityOverrides() { 84 return mVisibilityOverrides; 85 } 86 } 87