1 /* 2 * Copyright (C) 2023 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 17 package com.android.settings.localepicker; 18 19 import java.util.Objects; 20 import java.util.Set; 21 22 class NotificationInfo { 23 private Set<Integer> mUidCollection; 24 private int mNotificationCount; 25 private int mDismissCount; 26 private long mLastNotificationTimeMs; 27 private int mNotificationId; 28 NotificationInfo()29 private NotificationInfo() { 30 } 31 NotificationInfo(Set<Integer> uidCollection, int notificationCount, int dismissCount, long lastNotificationTimeMs, int notificationId)32 NotificationInfo(Set<Integer> uidCollection, int notificationCount, int dismissCount, 33 long lastNotificationTimeMs, int notificationId) { 34 this.mUidCollection = uidCollection; 35 this.mNotificationCount = notificationCount; 36 this.mDismissCount = dismissCount; 37 this.mLastNotificationTimeMs = lastNotificationTimeMs; 38 this.mNotificationId = notificationId; 39 } 40 getUidCollection()41 public Set<Integer> getUidCollection() { 42 return mUidCollection; 43 } 44 getNotificationCount()45 public int getNotificationCount() { 46 return mNotificationCount; 47 } 48 getDismissCount()49 public int getDismissCount() { 50 return mDismissCount; 51 } 52 getLastNotificationTimeMs()53 public long getLastNotificationTimeMs() { 54 return mLastNotificationTimeMs; 55 } 56 getNotificationId()57 public int getNotificationId() { 58 return mNotificationId; 59 } 60 setUidCollection(Set<Integer> uidCollection)61 public void setUidCollection(Set<Integer> uidCollection) { 62 this.mUidCollection = uidCollection; 63 } 64 setNotificationCount(int notificationCount)65 public void setNotificationCount(int notificationCount) { 66 this.mNotificationCount = notificationCount; 67 } 68 setDismissCount(int dismissCount)69 public void setDismissCount(int dismissCount) { 70 this.mDismissCount = dismissCount; 71 } 72 setLastNotificationTimeMs(long lastNotificationTimeMs)73 public void setLastNotificationTimeMs(long lastNotificationTimeMs) { 74 this.mLastNotificationTimeMs = lastNotificationTimeMs; 75 } 76 setNotificationId(int notificationId)77 public void setNotificationId(int notificationId) { 78 this.mNotificationId = notificationId; 79 } 80 81 @Override equals(Object o)82 public boolean equals(Object o) { 83 if (o == null) return false; 84 if (this == o) return true; 85 if (!(o instanceof NotificationInfo)) return false; 86 NotificationInfo that = (NotificationInfo) o; 87 return (mUidCollection.equals(that.mUidCollection)) 88 && (mDismissCount == that.mDismissCount) 89 && (mNotificationCount == that.mNotificationCount) 90 && (mLastNotificationTimeMs == that.mLastNotificationTimeMs) 91 && (mNotificationId == that.mNotificationId); 92 } 93 94 @Override hashCode()95 public int hashCode() { 96 return Objects.hash(mUidCollection, mDismissCount, mNotificationCount, 97 mLastNotificationTimeMs, mNotificationId); 98 } 99 } 100