1 /* 2 * Copyright (C) 2012 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 android.content.pm; 18 19 import android.os.Parcel; 20 import android.os.Parcelable; 21 22 /** @hide */ 23 public class PackageCleanItem { 24 public final int userId; 25 public final String packageName; 26 public final boolean andCode; 27 28 public PackageCleanItem(int userId, String packageName, boolean andCode) { 29 this.userId = userId; 30 this.packageName = packageName; 31 this.andCode = andCode; 32 } 33 34 @Override 35 public boolean equals(Object obj) { 36 if (this == obj) { 37 return true; 38 } 39 try { 40 if (obj != null) { 41 PackageCleanItem other = (PackageCleanItem)obj; 42 return userId == other.userId && packageName.equals(other.packageName) 43 && andCode == other.andCode; 44 } 45 } catch (ClassCastException e) { 46 } 47 return false; 48 } 49 50 @Override 51 public int hashCode() { 52 int result = 17; 53 result = 31 * result + userId; 54 result = 31 * result + packageName.hashCode(); 55 result = 31 * result + (andCode ? 1 : 0); 56 return result; 57 } 58 59 public int describeContents() { 60 return 0; 61 } 62 63 public void writeToParcel(Parcel dest, int parcelableFlags) { 64 dest.writeInt(userId); 65 dest.writeString(packageName); 66 dest.writeInt(andCode ? 1 : 0); 67 } 68 69 public static final Parcelable.Creator<PackageCleanItem> CREATOR 70 = new Parcelable.Creator<PackageCleanItem>() { 71 public PackageCleanItem createFromParcel(Parcel source) { 72 return new PackageCleanItem(source); 73 } 74 75 public PackageCleanItem[] newArray(int size) { 76 return new PackageCleanItem[size]; 77 } 78 }; 79 80 private PackageCleanItem(Parcel source) { 81 userId = source.readInt(); 82 packageName = source.readString(); 83 andCode = source.readInt() != 0; 84 } 85 } 86