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