Debian Codegraph @

core/java/com/android/internal/content/ReferrerIntent.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2014 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.internal.content;
18
19 import android.compat.annotation.UnsupportedAppUsage;
20 import android.content.Intent;
21 import android.os.Parcel;
22
23 import java.util.Objects;
24
25 /**
26 * Subclass of Intent that also contains referrer (as a package name) information.
27 */
28 public class ReferrerIntent extends Intent {
29 @UnsupportedAppUsage
30 public final String mReferrer;
31
32 @UnsupportedAppUsage
33 public ReferrerIntent(Intent baseIntent, String referrer) {
34 super(baseIntent);
35 mReferrer = referrer;
36 }
37
38 public void writeToParcel(Parcel dest, int parcelableFlags) {
39 super.writeToParcel(dest, parcelableFlags);
40 dest.writeString(mReferrer);
41 }
42
43 ReferrerIntent(Parcel in) {
44 readFromParcel(in);
45 mReferrer = in.readString();
46 }
47
48 public static final Creator<ReferrerIntent> CREATOR = new Creator<ReferrerIntent>() {
49 public ReferrerIntent createFromParcel(Parcel source) {
50 return new ReferrerIntent(source);
51 }
52 public ReferrerIntent[] newArray(int size) {
53 return new ReferrerIntent[size];
54 }
55 };
56
57 @Override
58 public boolean equals(Object obj) {
59 if (obj == null || !(obj instanceof ReferrerIntent)) {
60 return false;
61 }
62 final ReferrerIntent other = (ReferrerIntent) obj;
63 return filterEquals(other) && Objects.equals(mReferrer, other.mReferrer);
64 }
65
66 @Override
67 public int hashCode() {
68 int result = 17;
69 result = 31 * result + filterHashCode();
70 result = 31 * result + Objects.hashCode(mReferrer);
71 return result;
72 }
73 }