Home | History | Annotate | Download | only in notification
      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 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 mChannels;
     35     private final Bundle mOverridePeople;
     36     private final Bundle mSnoozeCriteria;
     37     private final Bundle mShowBadge;
     38     private final Bundle mUserSentiment;
     39     private final Bundle mHidden;
     40 
     41     public NotificationRankingUpdate(String[] keys, String[] interceptedKeys,
     42             Bundle visibilityOverrides, Bundle suppressedVisualEffects,
     43             int[] importance, Bundle explanation, Bundle overrideGroupKeys,
     44             Bundle channels, Bundle overridePeople, Bundle snoozeCriteria,
     45             Bundle showBadge, Bundle userSentiment, Bundle hidden) {
     46         mKeys = keys;
     47         mInterceptedKeys = interceptedKeys;
     48         mVisibilityOverrides = visibilityOverrides;
     49         mSuppressedVisualEffects = suppressedVisualEffects;
     50         mImportance = importance;
     51         mImportanceExplanation = explanation;
     52         mOverrideGroupKeys = overrideGroupKeys;
     53         mChannels = channels;
     54         mOverridePeople = overridePeople;
     55         mSnoozeCriteria = snoozeCriteria;
     56         mShowBadge = showBadge;
     57         mUserSentiment = userSentiment;
     58         mHidden = hidden;
     59     }
     60 
     61     public NotificationRankingUpdate(Parcel in) {
     62         mKeys = in.readStringArray();
     63         mInterceptedKeys = in.readStringArray();
     64         mVisibilityOverrides = in.readBundle();
     65         mSuppressedVisualEffects = in.readBundle();
     66         mImportance = new int[mKeys.length];
     67         in.readIntArray(mImportance);
     68         mImportanceExplanation = in.readBundle();
     69         mOverrideGroupKeys = in.readBundle();
     70         mChannels = in.readBundle();
     71         mOverridePeople = in.readBundle();
     72         mSnoozeCriteria = in.readBundle();
     73         mShowBadge = in.readBundle();
     74         mUserSentiment = in.readBundle();
     75         mHidden = in.readBundle();
     76     }
     77 
     78     @Override
     79     public int describeContents() {
     80         return 0;
     81     }
     82 
     83     @Override
     84     public void writeToParcel(Parcel out, int flags) {
     85         out.writeStringArray(mKeys);
     86         out.writeStringArray(mInterceptedKeys);
     87         out.writeBundle(mVisibilityOverrides);
     88         out.writeBundle(mSuppressedVisualEffects);
     89         out.writeIntArray(mImportance);
     90         out.writeBundle(mImportanceExplanation);
     91         out.writeBundle(mOverrideGroupKeys);
     92         out.writeBundle(mChannels);
     93         out.writeBundle(mOverridePeople);
     94         out.writeBundle(mSnoozeCriteria);
     95         out.writeBundle(mShowBadge);
     96         out.writeBundle(mUserSentiment);
     97         out.writeBundle(mHidden);
     98     }
     99 
    100     public static final Parcelable.Creator<NotificationRankingUpdate> CREATOR
    101             = new Parcelable.Creator<NotificationRankingUpdate>() {
    102         public NotificationRankingUpdate createFromParcel(Parcel parcel) {
    103             return new NotificationRankingUpdate(parcel);
    104         }
    105 
    106         public NotificationRankingUpdate[] newArray(int size) {
    107             return new NotificationRankingUpdate[size];
    108         }
    109     };
    110 
    111     public String[] getOrderedKeys() {
    112         return mKeys;
    113     }
    114 
    115     public String[] getInterceptedKeys() {
    116         return mInterceptedKeys;
    117     }
    118 
    119     public Bundle getVisibilityOverrides() {
    120         return mVisibilityOverrides;
    121     }
    122 
    123     public Bundle getSuppressedVisualEffects() {
    124         return mSuppressedVisualEffects;
    125     }
    126 
    127     public int[] getImportance() {
    128         return mImportance;
    129     }
    130 
    131     public Bundle getImportanceExplanation() {
    132         return mImportanceExplanation;
    133     }
    134 
    135     public Bundle getOverrideGroupKeys() {
    136         return mOverrideGroupKeys;
    137     }
    138 
    139     public Bundle getChannels() {
    140         return mChannels;
    141     }
    142 
    143     public Bundle getOverridePeople() {
    144         return mOverridePeople;
    145     }
    146 
    147     public Bundle getSnoozeCriteria() {
    148         return mSnoozeCriteria;
    149     }
    150 
    151     public Bundle getShowBadge() {
    152         return mShowBadge;
    153     }
    154 
    155     public Bundle getUserSentiment() {
    156         return mUserSentiment;
    157     }
    158 
    159     public Bundle getHidden() {
    160         return mHidden;
    161     }
    162 }
    163