1 /* 2 * Copyright (C) 2023 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.service.assist.classification; 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.ArrayList; 28 import java.util.List; 29 import java.util.Set; 30 31 32 /** 33 * Represents a response from detection service. 34 * @hide 35 */ 36 @SystemApi 37 @DataClass( 38 genToString = true 39 ) 40 public final class FieldClassificationResponse implements Parcelable { 41 42 /** 43 * List of classified fields 44 */ 45 private final @NonNull Set<FieldClassification> mClassifications; 46 unparcelClassifications(Parcel in)47 static Set<FieldClassification> unparcelClassifications(Parcel in) { 48 List<FieldClassification> detections = new java.util.ArrayList<>(); 49 in.readParcelableList( 50 detections, FieldClassification.class.getClassLoader(), FieldClassification.class); 51 return new ArraySet<>(detections); 52 } 53 parcelClassifications(Parcel dest, int flags)54 void parcelClassifications(Parcel dest, int flags) { 55 dest.writeParcelableList(new ArrayList<>(mClassifications), flags); 56 } 57 58 59 60 // Code below generated by codegen v1.0.23. 61 // 62 // DO NOT MODIFY! 63 // CHECKSTYLE:OFF Generated code 64 // 65 // To regenerate run: 66 // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/service/assist/classification/FieldClassificationResponse.java 67 // 68 // To exclude the generated code from IntelliJ auto-formatting enable (one-time): 69 // Settings > Editor > Code Style > Formatter Control 70 //@formatter:off 71 72 73 /** 74 * Creates a new FieldClassificationResponse. 75 * 76 * @param classifications 77 * List of classified fields 78 */ 79 @DataClass.Generated.Member FieldClassificationResponse( @onNull Set<FieldClassification> classifications)80 public FieldClassificationResponse( 81 @NonNull Set<FieldClassification> classifications) { 82 this.mClassifications = classifications; 83 com.android.internal.util.AnnotationValidations.validate( 84 NonNull.class, null, mClassifications); 85 86 // onConstructed(); // You can define this method to get a callback 87 } 88 89 /** 90 * List of classified fields 91 */ 92 @DataClass.Generated.Member getClassifications()93 public @NonNull Set<FieldClassification> getClassifications() { 94 return mClassifications; 95 } 96 97 @Override 98 @DataClass.Generated.Member toString()99 public String toString() { 100 // You can override field toString logic by defining methods like: 101 // String fieldNameToString() { ... } 102 103 return "FieldClassificationResponse { " + 104 "classifications = " + mClassifications + 105 " }"; 106 } 107 108 @Override 109 @DataClass.Generated.Member writeToParcel(@onNull Parcel dest, int flags)110 public void writeToParcel(@NonNull Parcel dest, int flags) { 111 // You can override field parcelling by defining methods like: 112 // void parcelFieldName(Parcel dest, int flags) { ... } 113 114 parcelClassifications(dest, flags); 115 } 116 117 @Override 118 @DataClass.Generated.Member describeContents()119 public int describeContents() { return 0; } 120 121 /** @hide */ 122 @SuppressWarnings({"unchecked", "RedundantCast"}) 123 @DataClass.Generated.Member FieldClassificationResponse(@onNull Parcel in)124 /* package-private */ FieldClassificationResponse(@NonNull Parcel in) { 125 // You can override field unparcelling by defining methods like: 126 // static FieldType unparcelFieldName(Parcel in) { ... } 127 128 Set<FieldClassification> classifications = unparcelClassifications(in); 129 130 this.mClassifications = classifications; 131 com.android.internal.util.AnnotationValidations.validate( 132 NonNull.class, null, mClassifications); 133 134 // onConstructed(); // You can define this method to get a callback 135 } 136 137 @DataClass.Generated.Member 138 public static final @NonNull Parcelable.Creator<FieldClassificationResponse> CREATOR 139 = new Parcelable.Creator<FieldClassificationResponse>() { 140 @Override 141 public FieldClassificationResponse[] newArray(int size) { 142 return new FieldClassificationResponse[size]; 143 } 144 145 @Override 146 public FieldClassificationResponse createFromParcel(@NonNull Parcel in) { 147 return new FieldClassificationResponse(in); 148 } 149 }; 150 151 @DataClass.Generated( 152 time = 1675320458276L, 153 codegenVersion = "1.0.23", 154 sourceFile = "frameworks/base/core/java/android/service/assist/classification/FieldClassificationResponse.java", 155 inputSignatures = "private final @android.annotation.NonNull java.util.Set<android.service.assist.classification.FieldClassification> mClassifications\nstatic java.util.Set<android.service.assist.classification.FieldClassification> unparcelClassifications(android.os.Parcel)\n void parcelClassifications(android.os.Parcel,int)\nclass FieldClassificationResponse extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true)") 156 @Deprecated __metadata()157 private void __metadata() {} 158 159 160 //@formatter:on 161 // End of generated code 162 163 } 164