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 android.car.vms;
18 
19 import android.annotation.NonNull;
20 import android.annotation.SystemApi;
21 import android.os.Parcel;
22 import android.os.Parcelable;
23 import android.util.ArraySet;
24 
25 import com.android.internal.util.DataClass;
26 
27 import java.util.Collections;
28 import java.util.Set;
29 
30 /**
31  * A Vehicle Map Service layer offering for a single publisher.
32  *
33  * Contains all layers the publisher can offer, and the layers that offering depends on.
34  *
35  * A layer will not be advertised to subscribers unless all of its dependencies are met.
36  *
37  * @deprecated Use {@link VmsClient#setProviderOfferings(int, Set)} instead
38  *
39  * @hide
40  */
41 @Deprecated
42 @SystemApi
43 @DataClass(genAidl = true, genEqualsHashCode = true, genToString = true)
44 public final class VmsLayersOffering implements Parcelable {
45     /**
46      * Layers and dependencies in the offering
47      */
48     private @NonNull Set<VmsLayerDependency> mDependencies;
49 
50     /**
51      * ID of the publisher making the offering
52      */
53     private final int mPublisherId;
54 
onConstructed()55     private void onConstructed() {
56         mDependencies = Collections.unmodifiableSet(mDependencies);
57     }
58 
parcelDependencies(Parcel dest, int flags)59     private void parcelDependencies(Parcel dest, int flags) {
60         dest.writeArraySet(new ArraySet<>(mDependencies));
61     }
62 
63     @SuppressWarnings("unchecked")
unparcelDependencies(Parcel in)64     private Set<VmsLayerDependency> unparcelDependencies(Parcel in) {
65         return (Set<VmsLayerDependency>) in.readArraySet(VmsLayerDependency.class.getClassLoader());
66     }
67 
68 
69 
70     // Code below generated by codegen v1.0.14.
71     //
72     // DO NOT MODIFY!
73     // CHECKSTYLE:OFF Generated code
74     //
75     // To regenerate run:
76     // $ codegen $ANDROID_BUILD_TOP/packages/services/Car/car-lib/src/android/car/vms/VmsLayersOffering.java
77     //
78     // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
79     //   Settings > Editor > Code Style > Formatter Control
80     //@formatter:off
81 
82 
83     /**
84      * Creates a new VmsLayersOffering.
85      *
86      * @param dependencies
87      *   Layers and dependencies in the offering
88      * @param publisherId
89      *   ID of the publisher making the offering
90      */
91     @DataClass.Generated.Member
VmsLayersOffering( @onNull Set<VmsLayerDependency> dependencies, int publisherId)92     public VmsLayersOffering(
93             @NonNull Set<VmsLayerDependency> dependencies,
94             int publisherId) {
95         this.mDependencies = dependencies;
96         com.android.internal.util.AnnotationValidations.validate(
97                 NonNull.class, null, mDependencies);
98         this.mPublisherId = publisherId;
99 
100         onConstructed();
101     }
102 
103     /**
104      * Layers and dependencies in the offering
105      */
106     @DataClass.Generated.Member
getDependencies()107     public @NonNull Set<VmsLayerDependency> getDependencies() {
108         return mDependencies;
109     }
110 
111     /**
112      * ID of the publisher making the offering
113      */
114     @DataClass.Generated.Member
getPublisherId()115     public int getPublisherId() {
116         return mPublisherId;
117     }
118 
119     @Override
120     @DataClass.Generated.Member
toString()121     public String toString() {
122         // You can override field toString logic by defining methods like:
123         // String fieldNameToString() { ... }
124 
125         return "VmsLayersOffering { " +
126                 "dependencies = " + mDependencies + ", " +
127                 "publisherId = " + mPublisherId +
128         " }";
129     }
130 
131     @Override
132     @DataClass.Generated.Member
equals(@ndroid.annotation.Nullable Object o)133     public boolean equals(@android.annotation.Nullable Object o) {
134         // You can override field equality logic by defining either of the methods like:
135         // boolean fieldNameEquals(VmsLayersOffering other) { ... }
136         // boolean fieldNameEquals(FieldType otherValue) { ... }
137 
138         if (this == o) return true;
139         if (o == null || getClass() != o.getClass()) return false;
140         @SuppressWarnings("unchecked")
141         VmsLayersOffering that = (VmsLayersOffering) o;
142         //noinspection PointlessBooleanExpression
143         return true
144                 && java.util.Objects.equals(mDependencies, that.mDependencies)
145                 && mPublisherId == that.mPublisherId;
146     }
147 
148     @Override
149     @DataClass.Generated.Member
hashCode()150     public int hashCode() {
151         // You can override field hashCode logic by defining methods like:
152         // int fieldNameHashCode() { ... }
153 
154         int _hash = 1;
155         _hash = 31 * _hash + java.util.Objects.hashCode(mDependencies);
156         _hash = 31 * _hash + mPublisherId;
157         return _hash;
158     }
159 
160     @Override
161     @DataClass.Generated.Member
writeToParcel(@onNull Parcel dest, int flags)162     public void writeToParcel(@NonNull Parcel dest, int flags) {
163         // You can override field parcelling by defining methods like:
164         // void parcelFieldName(Parcel dest, int flags) { ... }
165 
166         parcelDependencies(dest, flags);
167         dest.writeInt(mPublisherId);
168     }
169 
170     @Override
171     @DataClass.Generated.Member
describeContents()172     public int describeContents() { return 0; }
173 
174     /** @hide */
175     @SuppressWarnings({"unchecked", "RedundantCast"})
176     @DataClass.Generated.Member
VmsLayersOffering(@onNull Parcel in)177     /* package-private */ VmsLayersOffering(@NonNull Parcel in) {
178         // You can override field unparcelling by defining methods like:
179         // static FieldType unparcelFieldName(Parcel in) { ... }
180 
181         Set<VmsLayerDependency> dependencies = unparcelDependencies(in);
182         int publisherId = in.readInt();
183 
184         this.mDependencies = dependencies;
185         com.android.internal.util.AnnotationValidations.validate(
186                 NonNull.class, null, mDependencies);
187         this.mPublisherId = publisherId;
188 
189         onConstructed();
190     }
191 
192     @DataClass.Generated.Member
193     public static final @NonNull Parcelable.Creator<VmsLayersOffering> CREATOR
194             = new Parcelable.Creator<VmsLayersOffering>() {
195         @Override
196         public VmsLayersOffering[] newArray(int size) {
197             return new VmsLayersOffering[size];
198         }
199 
200         @Override
201         public VmsLayersOffering createFromParcel(@NonNull Parcel in) {
202             return new VmsLayersOffering(in);
203         }
204     };
205 
206     @DataClass.Generated(
207             time = 1582065871728L,
208             codegenVersion = "1.0.14",
209             sourceFile = "packages/services/Car/car-lib/src/android/car/vms/VmsLayersOffering.java",
210             inputSignatures = "private @android.annotation.NonNull java.util.Set<android.car.vms.VmsLayerDependency> mDependencies\nprivate final  int mPublisherId\nprivate  void onConstructed()\nprivate  void parcelDependencies(android.os.Parcel,int)\nprivate @java.lang.SuppressWarnings(\"unchecked\") java.util.Set<android.car.vms.VmsLayerDependency> unparcelDependencies(android.os.Parcel)\nclass VmsLayersOffering extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genAidl=true, genEqualsHashCode=true, genToString=true)")
211     @Deprecated
__metadata()212     private void __metadata() {}
213 
214 
215     //@formatter:on
216     // End of generated code
217 
218 }
219