105ad48206a082057e17723d32493c153faa6881eChristoph Studer/*
205ad48206a082057e17723d32493c153faa6881eChristoph Studer * Copyright (C) 2014 The Android Open Source Project
305ad48206a082057e17723d32493c153faa6881eChristoph Studer *
405ad48206a082057e17723d32493c153faa6881eChristoph Studer * Licensed under the Apache License, Version 2.0 (the "License");
505ad48206a082057e17723d32493c153faa6881eChristoph Studer * you may not use this file except in compliance with the License.
605ad48206a082057e17723d32493c153faa6881eChristoph Studer * You may obtain a copy of the License at
705ad48206a082057e17723d32493c153faa6881eChristoph Studer *
805ad48206a082057e17723d32493c153faa6881eChristoph Studer *      http://www.apache.org/licenses/LICENSE-2.0
905ad48206a082057e17723d32493c153faa6881eChristoph Studer *
1005ad48206a082057e17723d32493c153faa6881eChristoph Studer * Unless required by applicable law or agreed to in writing, software
1105ad48206a082057e17723d32493c153faa6881eChristoph Studer * distributed under the License is distributed on an "AS IS" BASIS,
1205ad48206a082057e17723d32493c153faa6881eChristoph Studer * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1305ad48206a082057e17723d32493c153faa6881eChristoph Studer * See the License for the specific language governing permissions and
1405ad48206a082057e17723d32493c153faa6881eChristoph Studer * limitations under the License.
1505ad48206a082057e17723d32493c153faa6881eChristoph Studer */
1605ad48206a082057e17723d32493c153faa6881eChristoph Studerpackage android.service.notification;
1705ad48206a082057e17723d32493c153faa6881eChristoph Studer
183ad4e3a45bbe44129b14c4d391431e44f1e04f0cChris Wrenimport android.os.Bundle;
1905ad48206a082057e17723d32493c153faa6881eChristoph Studerimport android.os.Parcel;
2005ad48206a082057e17723d32493c153faa6881eChristoph Studerimport android.os.Parcelable;
2105ad48206a082057e17723d32493c153faa6881eChristoph Studer
2205ad48206a082057e17723d32493c153faa6881eChristoph Studer/**
2305ad48206a082057e17723d32493c153faa6881eChristoph Studer * @hide
2405ad48206a082057e17723d32493c153faa6881eChristoph Studer */
2505ad48206a082057e17723d32493c153faa6881eChristoph Studerpublic class NotificationRankingUpdate implements Parcelable {
2605ad48206a082057e17723d32493c153faa6881eChristoph Studer    // TODO: Support incremental updates.
2705ad48206a082057e17723d32493c153faa6881eChristoph Studer    private final String[] mKeys;
281d599da8424cef8d07cb4c533bd212d992d8f676Christoph Studer    private final String[] mInterceptedKeys;
2905ad48206a082057e17723d32493c153faa6881eChristoph Studer    private final int mFirstAmbientIndex;
303ad4e3a45bbe44129b14c4d391431e44f1e04f0cChris Wren    private final Bundle mVisibilityOverrides;
3105ad48206a082057e17723d32493c153faa6881eChristoph Studer
321d599da8424cef8d07cb4c533bd212d992d8f676Christoph Studer    public NotificationRankingUpdate(String[] keys, String[] interceptedKeys,
333ad4e3a45bbe44129b14c4d391431e44f1e04f0cChris Wren            Bundle visibilityOverrides, int firstAmbientIndex) {
3405ad48206a082057e17723d32493c153faa6881eChristoph Studer        mKeys = keys;
3505ad48206a082057e17723d32493c153faa6881eChristoph Studer        mFirstAmbientIndex = firstAmbientIndex;
361d599da8424cef8d07cb4c533bd212d992d8f676Christoph Studer        mInterceptedKeys = interceptedKeys;
373ad4e3a45bbe44129b14c4d391431e44f1e04f0cChris Wren        mVisibilityOverrides = visibilityOverrides;
3805ad48206a082057e17723d32493c153faa6881eChristoph Studer    }
3905ad48206a082057e17723d32493c153faa6881eChristoph Studer
4005ad48206a082057e17723d32493c153faa6881eChristoph Studer    public NotificationRankingUpdate(Parcel in) {
4105ad48206a082057e17723d32493c153faa6881eChristoph Studer        mKeys = in.readStringArray();
4205ad48206a082057e17723d32493c153faa6881eChristoph Studer        mFirstAmbientIndex = in.readInt();
431d599da8424cef8d07cb4c533bd212d992d8f676Christoph Studer        mInterceptedKeys = in.readStringArray();
443ad4e3a45bbe44129b14c4d391431e44f1e04f0cChris Wren        mVisibilityOverrides = in.readBundle();
4505ad48206a082057e17723d32493c153faa6881eChristoph Studer    }
4605ad48206a082057e17723d32493c153faa6881eChristoph Studer
4705ad48206a082057e17723d32493c153faa6881eChristoph Studer    @Override
4805ad48206a082057e17723d32493c153faa6881eChristoph Studer    public int describeContents() {
4905ad48206a082057e17723d32493c153faa6881eChristoph Studer        return 0;
5005ad48206a082057e17723d32493c153faa6881eChristoph Studer    }
5105ad48206a082057e17723d32493c153faa6881eChristoph Studer
5205ad48206a082057e17723d32493c153faa6881eChristoph Studer    @Override
5305ad48206a082057e17723d32493c153faa6881eChristoph Studer    public void writeToParcel(Parcel out, int flags) {
5405ad48206a082057e17723d32493c153faa6881eChristoph Studer        out.writeStringArray(mKeys);
5505ad48206a082057e17723d32493c153faa6881eChristoph Studer        out.writeInt(mFirstAmbientIndex);
561d599da8424cef8d07cb4c533bd212d992d8f676Christoph Studer        out.writeStringArray(mInterceptedKeys);
573ad4e3a45bbe44129b14c4d391431e44f1e04f0cChris Wren        out.writeBundle(mVisibilityOverrides);
5805ad48206a082057e17723d32493c153faa6881eChristoph Studer    }
5905ad48206a082057e17723d32493c153faa6881eChristoph Studer
6005ad48206a082057e17723d32493c153faa6881eChristoph Studer    public static final Parcelable.Creator<NotificationRankingUpdate> CREATOR
6105ad48206a082057e17723d32493c153faa6881eChristoph Studer            = new Parcelable.Creator<NotificationRankingUpdate>() {
6205ad48206a082057e17723d32493c153faa6881eChristoph Studer        public NotificationRankingUpdate createFromParcel(Parcel parcel) {
6305ad48206a082057e17723d32493c153faa6881eChristoph Studer            return new NotificationRankingUpdate(parcel);
6405ad48206a082057e17723d32493c153faa6881eChristoph Studer        }
6505ad48206a082057e17723d32493c153faa6881eChristoph Studer
6605ad48206a082057e17723d32493c153faa6881eChristoph Studer        public NotificationRankingUpdate[] newArray(int size) {
6705ad48206a082057e17723d32493c153faa6881eChristoph Studer            return new NotificationRankingUpdate[size];
6805ad48206a082057e17723d32493c153faa6881eChristoph Studer        }
6905ad48206a082057e17723d32493c153faa6881eChristoph Studer    };
7005ad48206a082057e17723d32493c153faa6881eChristoph Studer
7105ad48206a082057e17723d32493c153faa6881eChristoph Studer    public String[] getOrderedKeys() {
7205ad48206a082057e17723d32493c153faa6881eChristoph Studer        return mKeys;
7305ad48206a082057e17723d32493c153faa6881eChristoph Studer    }
7405ad48206a082057e17723d32493c153faa6881eChristoph Studer
7505ad48206a082057e17723d32493c153faa6881eChristoph Studer    public int getFirstAmbientIndex() {
7605ad48206a082057e17723d32493c153faa6881eChristoph Studer        return mFirstAmbientIndex;
7705ad48206a082057e17723d32493c153faa6881eChristoph Studer    }
7805ad48206a082057e17723d32493c153faa6881eChristoph Studer
791d599da8424cef8d07cb4c533bd212d992d8f676Christoph Studer    public String[] getInterceptedKeys() {
801d599da8424cef8d07cb4c533bd212d992d8f676Christoph Studer        return mInterceptedKeys;
8105ad48206a082057e17723d32493c153faa6881eChristoph Studer    }
823ad4e3a45bbe44129b14c4d391431e44f1e04f0cChris Wren
833ad4e3a45bbe44129b14c4d391431e44f1e04f0cChris Wren    public Bundle getVisibilityOverrides() {
843ad4e3a45bbe44129b14c4d391431e44f1e04f0cChris Wren        return mVisibilityOverrides;
853ad4e3a45bbe44129b14c4d391431e44f1e04f0cChris Wren    }
8605ad48206a082057e17723d32493c153faa6881eChristoph Studer}
87