NotificationRankingUpdate.java revision 1d599da8424cef8d07cb4c533bd212d992d8f676
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
1805ad48206a082057e17723d32493c153faa6881eChristoph Studerimport android.os.Parcel;
1905ad48206a082057e17723d32493c153faa6881eChristoph Studerimport android.os.Parcelable;
2005ad48206a082057e17723d32493c153faa6881eChristoph Studer
2105ad48206a082057e17723d32493c153faa6881eChristoph Studer/**
2205ad48206a082057e17723d32493c153faa6881eChristoph Studer * @hide
2305ad48206a082057e17723d32493c153faa6881eChristoph Studer */
2405ad48206a082057e17723d32493c153faa6881eChristoph Studerpublic class NotificationRankingUpdate implements Parcelable {
2505ad48206a082057e17723d32493c153faa6881eChristoph Studer    // TODO: Support incremental updates.
2605ad48206a082057e17723d32493c153faa6881eChristoph Studer    private final String[] mKeys;
271d599da8424cef8d07cb4c533bd212d992d8f676Christoph Studer    private final String[] mInterceptedKeys;
2805ad48206a082057e17723d32493c153faa6881eChristoph Studer    private final int mFirstAmbientIndex;
2905ad48206a082057e17723d32493c153faa6881eChristoph Studer
301d599da8424cef8d07cb4c533bd212d992d8f676Christoph Studer    public NotificationRankingUpdate(String[] keys, String[] interceptedKeys,
3105ad48206a082057e17723d32493c153faa6881eChristoph Studer                                     int firstAmbientIndex) {
3205ad48206a082057e17723d32493c153faa6881eChristoph Studer        mKeys = keys;
3305ad48206a082057e17723d32493c153faa6881eChristoph Studer        mFirstAmbientIndex = firstAmbientIndex;
341d599da8424cef8d07cb4c533bd212d992d8f676Christoph Studer        mInterceptedKeys = interceptedKeys;
3505ad48206a082057e17723d32493c153faa6881eChristoph Studer    }
3605ad48206a082057e17723d32493c153faa6881eChristoph Studer
3705ad48206a082057e17723d32493c153faa6881eChristoph Studer    public NotificationRankingUpdate(Parcel in) {
3805ad48206a082057e17723d32493c153faa6881eChristoph Studer        mKeys = in.readStringArray();
3905ad48206a082057e17723d32493c153faa6881eChristoph Studer        mFirstAmbientIndex = in.readInt();
401d599da8424cef8d07cb4c533bd212d992d8f676Christoph Studer        mInterceptedKeys = in.readStringArray();
4105ad48206a082057e17723d32493c153faa6881eChristoph Studer    }
4205ad48206a082057e17723d32493c153faa6881eChristoph Studer
4305ad48206a082057e17723d32493c153faa6881eChristoph Studer    @Override
4405ad48206a082057e17723d32493c153faa6881eChristoph Studer    public int describeContents() {
4505ad48206a082057e17723d32493c153faa6881eChristoph Studer        return 0;
4605ad48206a082057e17723d32493c153faa6881eChristoph Studer    }
4705ad48206a082057e17723d32493c153faa6881eChristoph Studer
4805ad48206a082057e17723d32493c153faa6881eChristoph Studer    @Override
4905ad48206a082057e17723d32493c153faa6881eChristoph Studer    public void writeToParcel(Parcel out, int flags) {
5005ad48206a082057e17723d32493c153faa6881eChristoph Studer        out.writeStringArray(mKeys);
5105ad48206a082057e17723d32493c153faa6881eChristoph Studer        out.writeInt(mFirstAmbientIndex);
521d599da8424cef8d07cb4c533bd212d992d8f676Christoph Studer        out.writeStringArray(mInterceptedKeys);
5305ad48206a082057e17723d32493c153faa6881eChristoph Studer    }
5405ad48206a082057e17723d32493c153faa6881eChristoph Studer
5505ad48206a082057e17723d32493c153faa6881eChristoph Studer    public static final Parcelable.Creator<NotificationRankingUpdate> CREATOR
5605ad48206a082057e17723d32493c153faa6881eChristoph Studer            = new Parcelable.Creator<NotificationRankingUpdate>() {
5705ad48206a082057e17723d32493c153faa6881eChristoph Studer        public NotificationRankingUpdate createFromParcel(Parcel parcel) {
5805ad48206a082057e17723d32493c153faa6881eChristoph Studer            return new NotificationRankingUpdate(parcel);
5905ad48206a082057e17723d32493c153faa6881eChristoph Studer        }
6005ad48206a082057e17723d32493c153faa6881eChristoph Studer
6105ad48206a082057e17723d32493c153faa6881eChristoph Studer        public NotificationRankingUpdate[] newArray(int size) {
6205ad48206a082057e17723d32493c153faa6881eChristoph Studer            return new NotificationRankingUpdate[size];
6305ad48206a082057e17723d32493c153faa6881eChristoph Studer        }
6405ad48206a082057e17723d32493c153faa6881eChristoph Studer    };
6505ad48206a082057e17723d32493c153faa6881eChristoph Studer
6605ad48206a082057e17723d32493c153faa6881eChristoph Studer    public String[] getOrderedKeys() {
6705ad48206a082057e17723d32493c153faa6881eChristoph Studer        return mKeys;
6805ad48206a082057e17723d32493c153faa6881eChristoph Studer    }
6905ad48206a082057e17723d32493c153faa6881eChristoph Studer
7005ad48206a082057e17723d32493c153faa6881eChristoph Studer    public int getFirstAmbientIndex() {
7105ad48206a082057e17723d32493c153faa6881eChristoph Studer        return mFirstAmbientIndex;
7205ad48206a082057e17723d32493c153faa6881eChristoph Studer    }
7305ad48206a082057e17723d32493c153faa6881eChristoph Studer
741d599da8424cef8d07cb4c533bd212d992d8f676Christoph Studer    public String[] getInterceptedKeys() {
751d599da8424cef8d07cb4c533bd212d992d8f676Christoph Studer        return mInterceptedKeys;
7605ad48206a082057e17723d32493c153faa6881eChristoph Studer    }
7705ad48206a082057e17723d32493c153faa6881eChristoph Studer}
78