| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.app.job; |
| 18 |
|
| 19 |
import android.annotation.NonNull; |
| 20 |
import android.os.Parcel; |
| 21 |
import android.os.Parcelable; |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
public class UserVisibleJobSummary implements Parcelable { |
| 29 |
private final int mCallingUid; |
| 30 |
private final int mSourceUserId; |
| 31 |
@NonNull |
| 32 |
private final String mSourcePackageName; |
| 33 |
private final int mJobId; |
| 34 |
|
| 35 |
public UserVisibleJobSummary(int callingUid, int sourceUserId, |
| 36 |
@NonNull String sourcePackageName, int jobId) { |
| 37 |
mCallingUid = callingUid; |
| 38 |
mSourceUserId = sourceUserId; |
| 39 |
mSourcePackageName = sourcePackageName; |
| 40 |
mJobId = jobId; |
| 41 |
} |
| 42 |
|
| 43 |
protected UserVisibleJobSummary(Parcel in) { |
| 44 |
mCallingUid = in.readInt(); |
| 45 |
mSourceUserId = in.readInt(); |
| 46 |
mSourcePackageName = in.readString(); |
| 47 |
mJobId = in.readInt(); |
| 48 |
} |
| 49 |
|
| 50 |
public int getCallingUid() { |
| 51 |
return mCallingUid; |
| 52 |
} |
| 53 |
|
| 54 |
public int getJobId() { |
| 55 |
return mJobId; |
| 56 |
} |
| 57 |
|
| 58 |
public int getSourceUserId() { |
| 59 |
return mSourceUserId; |
| 60 |
} |
| 61 |
|
| 62 |
public String getSourcePackageName() { |
| 63 |
return mSourcePackageName; |
| 64 |
} |
| 65 |
|
| 66 |
@Override |
| 67 |
public boolean equals(Object o) { |
| 68 |
if (this == o) return true; |
| 69 |
if (!(o instanceof UserVisibleJobSummary)) return false; |
| 70 |
UserVisibleJobSummary that = (UserVisibleJobSummary) o; |
| 71 |
return mCallingUid == that.mCallingUid |
| 72 |
&& mSourceUserId == that.mSourceUserId |
| 73 |
&& mSourcePackageName.equals(that.mSourcePackageName) |
| 74 |
&& mJobId == that.mJobId; |
| 75 |
} |
| 76 |
|
| 77 |
@Override |
| 78 |
public int hashCode() { |
| 79 |
int result = 0; |
| 80 |
result = 31 * result + mCallingUid; |
| 81 |
result = 31 * result + mSourceUserId; |
| 82 |
result = 31 * result + mSourcePackageName.hashCode(); |
| 83 |
result = 31 * result + mJobId; |
| 84 |
return result; |
| 85 |
} |
| 86 |
|
| 87 |
@Override |
| 88 |
public String toString() { |
| 89 |
return "UserVisibleJobSummary{" |
| 90 |
+ "callingUid=" + mCallingUid |
| 91 |
+ ", sourceUserId=" + mSourceUserId |
| 92 |
+ ", sourcePackageName='" + mSourcePackageName + "'" |
| 93 |
+ ", jobId=" + mJobId |
| 94 |
+ "}"; |
| 95 |
} |
| 96 |
|
| 97 |
@Override |
| 98 |
public int describeContents() { |
| 99 |
return 0; |
| 100 |
} |
| 101 |
|
| 102 |
@Override |
| 103 |
public void writeToParcel(Parcel dest, int flags) { |
| 104 |
dest.writeInt(mCallingUid); |
| 105 |
dest.writeInt(mSourceUserId); |
| 106 |
dest.writeString(mSourcePackageName); |
| 107 |
dest.writeInt(mJobId); |
| 108 |
} |
| 109 |
|
| 110 |
public static final Creator<UserVisibleJobSummary> CREATOR = |
| 111 |
new Creator<UserVisibleJobSummary>() { |
| 112 |
@Override |
| 113 |
public UserVisibleJobSummary createFromParcel(Parcel in) { |
| 114 |
return new UserVisibleJobSummary(in); |
| 115 |
} |
| 116 |
|
| 117 |
@Override |
| 118 |
public UserVisibleJobSummary[] newArray(int size) { |
| 119 |
return new UserVisibleJobSummary[size]; |
| 120 |
} |
| 121 |
}; |
| 122 |
} |