• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 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 package android.companion;
17 
18 import android.annotation.NonNull;
19 import android.annotation.Nullable;
20 import android.os.Parcel;
21 import android.os.Parcelable;
22 
23 import com.android.internal.util.DataClass;
24 
25 import java.util.Objects;
26 
27 /**
28  * A record indicating that a device with a given address was confirmed by the user to be
29  * associated to a given companion app
30  *
31  * @hide
32  */
33 @DataClass(genEqualsHashCode = true, genToString = true)
34 public class Association implements Parcelable {
35 
36     public final int userId;
37     public final @NonNull String deviceAddress;
38     public final @NonNull String companionAppPackage;
39 
40 
41 
42 
43     // Code below generated by codegen v1.0.13.
44     //
45     // DO NOT MODIFY!
46     // CHECKSTYLE:OFF Generated code
47     //
48     // To regenerate run:
49     // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/companion/Association.java
50     //
51     // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
52     //   Settings > Editor > Code Style > Formatter Control
53     //@formatter:off
54 
55 
56     @DataClass.Generated.Member
Association( int userId, @NonNull String deviceAddress, @NonNull String companionAppPackage)57     public Association(
58             int userId,
59             @NonNull String deviceAddress,
60             @NonNull String companionAppPackage) {
61         this.userId = userId;
62         this.deviceAddress = deviceAddress;
63         com.android.internal.util.AnnotationValidations.validate(
64                 NonNull.class, null, deviceAddress);
65         this.companionAppPackage = companionAppPackage;
66         com.android.internal.util.AnnotationValidations.validate(
67                 NonNull.class, null, companionAppPackage);
68 
69         // onConstructed(); // You can define this method to get a callback
70     }
71 
72     @Override
73     @DataClass.Generated.Member
toString()74     public String toString() {
75         // You can override field toString logic by defining methods like:
76         // String fieldNameToString() { ... }
77 
78         return "Association { " +
79                 "userId = " + userId + ", " +
80                 "deviceAddress = " + deviceAddress + ", " +
81                 "companionAppPackage = " + companionAppPackage +
82         " }";
83     }
84 
85     @Override
86     @DataClass.Generated.Member
equals(@ullable Object o)87     public boolean equals(@Nullable Object o) {
88         // You can override field equality logic by defining either of the methods like:
89         // boolean fieldNameEquals(Association other) { ... }
90         // boolean fieldNameEquals(FieldType otherValue) { ... }
91 
92         if (this == o) return true;
93         if (o == null || getClass() != o.getClass()) return false;
94         @SuppressWarnings("unchecked")
95         Association that = (Association) o;
96         //noinspection PointlessBooleanExpression
97         return true
98                 && userId == that.userId
99                 && Objects.equals(deviceAddress, that.deviceAddress)
100                 && Objects.equals(companionAppPackage, that.companionAppPackage);
101     }
102 
103     @Override
104     @DataClass.Generated.Member
hashCode()105     public int hashCode() {
106         // You can override field hashCode logic by defining methods like:
107         // int fieldNameHashCode() { ... }
108 
109         int _hash = 1;
110         _hash = 31 * _hash + userId;
111         _hash = 31 * _hash + Objects.hashCode(deviceAddress);
112         _hash = 31 * _hash + Objects.hashCode(companionAppPackage);
113         return _hash;
114     }
115 
116     @Override
117     @DataClass.Generated.Member
writeToParcel(@onNull Parcel dest, int flags)118     public void writeToParcel(@NonNull Parcel dest, int flags) {
119         // You can override field parcelling by defining methods like:
120         // void parcelFieldName(Parcel dest, int flags) { ... }
121 
122         dest.writeInt(userId);
123         dest.writeString(deviceAddress);
124         dest.writeString(companionAppPackage);
125     }
126 
127     @Override
128     @DataClass.Generated.Member
describeContents()129     public int describeContents() { return 0; }
130 
131     /** @hide */
132     @SuppressWarnings({"unchecked", "RedundantCast"})
133     @DataClass.Generated.Member
Association(@onNull Parcel in)134     protected Association(@NonNull Parcel in) {
135         // You can override field unparcelling by defining methods like:
136         // static FieldType unparcelFieldName(Parcel in) { ... }
137 
138         int _userId = in.readInt();
139         String _deviceAddress = in.readString();
140         String _companionAppPackage = in.readString();
141 
142         this.userId = _userId;
143         this.deviceAddress = _deviceAddress;
144         com.android.internal.util.AnnotationValidations.validate(
145                 NonNull.class, null, deviceAddress);
146         this.companionAppPackage = _companionAppPackage;
147         com.android.internal.util.AnnotationValidations.validate(
148                 NonNull.class, null, companionAppPackage);
149 
150         // onConstructed(); // You can define this method to get a callback
151     }
152 
153     @DataClass.Generated.Member
154     public static final @NonNull Parcelable.Creator<Association> CREATOR
155             = new Parcelable.Creator<Association>() {
156         @Override
157         public Association[] newArray(int size) {
158             return new Association[size];
159         }
160 
161         @Override
162         public Association createFromParcel(@NonNull Parcel in) {
163             return new Association(in);
164         }
165     };
166 
167     @DataClass.Generated(
168             time = 1573767103332L,
169             codegenVersion = "1.0.13",
170             sourceFile = "frameworks/base/core/java/android/companion/Association.java",
171             inputSignatures = "public final  int userId\npublic final @android.annotation.NonNull java.lang.String deviceAddress\npublic final @android.annotation.NonNull java.lang.String companionAppPackage\nclass Association extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true, genToString=true)")
172     @Deprecated
__metadata()173     private void __metadata() {}
174 
175 
176     //@formatter:on
177     // End of generated code
178 
179 }
180