1 /* 2 * Copyright (C) 2017 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.server.timezone; 18 19 /** 20 * Package version information about the time zone updater and time zone data application packages. 21 */ 22 final class PackageVersions { 23 24 final long mUpdateAppVersion; 25 final long mDataAppVersion; 26 PackageVersions(long updateAppVersion, long dataAppVersion)27 PackageVersions(long updateAppVersion, long dataAppVersion) { 28 this.mUpdateAppVersion = updateAppVersion; 29 this.mDataAppVersion = dataAppVersion; 30 } 31 32 @Override equals(Object o)33 public boolean equals(Object o) { 34 if (this == o) { 35 return true; 36 } 37 if (o == null || getClass() != o.getClass()) { 38 return false; 39 } 40 41 PackageVersions that = (PackageVersions) o; 42 43 if (mUpdateAppVersion != that.mUpdateAppVersion) { 44 return false; 45 } 46 return mDataAppVersion == that.mDataAppVersion; 47 } 48 49 @Override hashCode()50 public int hashCode() { 51 int result = Long.hashCode(mUpdateAppVersion); 52 result = 31 * result + Long.hashCode(mDataAppVersion); 53 return result; 54 } 55 56 @Override toString()57 public String toString() { 58 return "PackageVersions{" + 59 "mUpdateAppVersion=" + mUpdateAppVersion + 60 ", mDataAppVersion=" + mDataAppVersion + 61 '}'; 62 } 63 } 64