1 /* 2 * Copyright (C) 2020 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.view; 18 19 import android.annotation.NonNull; 20 import android.content.ComponentName; 21 import android.os.Bundle; 22 import android.os.Parcelable; 23 import android.view.autofill.AutofillId; 24 import android.view.inputmethod.InlineSuggestionsRequest; 25 26 import com.android.internal.util.DataClass; 27 28 /** 29 * Wraps the information needed to create an {@link InlineSuggestionsRequest}. 30 * 31 * @hide 32 */ 33 @DataClass( 34 genToString = true, 35 genHiddenConstDefs = true, 36 genEqualsHashCode = true) 37 public final class InlineSuggestionsRequestInfo implements Parcelable { 38 /** 39 * The {@link ComponentName} of current app/activity 40 */ 41 private final @NonNull ComponentName mComponentName; 42 43 /** 44 * The {@link AutofillId} of currently focused field. 45 */ 46 private final @NonNull AutofillId mAutofillId; 47 48 /** 49 * The extras that contain the UI renderer related information 50 */ 51 private final @NonNull Bundle mUiExtras; 52 53 54 55 // Code below generated by codegen v1.0.14. 56 // 57 // DO NOT MODIFY! 58 // CHECKSTYLE:OFF Generated code 59 // 60 // To regenerate run: 61 // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/com/android/internal/view/InlineSuggestionsRequestInfo.java 62 // 63 // To exclude the generated code from IntelliJ auto-formatting enable (one-time): 64 // Settings > Editor > Code Style > Formatter Control 65 //@formatter:off 66 67 68 /** 69 * Creates a new InlineSuggestionsRequestInfo. 70 * 71 * @param componentName 72 * The {@link ComponentName} of current app/activity 73 * @param autofillId 74 * The {@link AutofillId} of currently focused field. 75 * @param uiExtras 76 * The extras that contain the ui renderer related information 77 */ 78 @DataClass.Generated.Member InlineSuggestionsRequestInfo( @onNull ComponentName componentName, @NonNull AutofillId autofillId, @NonNull Bundle uiExtras)79 public InlineSuggestionsRequestInfo( 80 @NonNull ComponentName componentName, 81 @NonNull AutofillId autofillId, 82 @NonNull Bundle uiExtras) { 83 this.mComponentName = componentName; 84 com.android.internal.util.AnnotationValidations.validate( 85 NonNull.class, null, mComponentName); 86 this.mAutofillId = autofillId; 87 com.android.internal.util.AnnotationValidations.validate( 88 NonNull.class, null, mAutofillId); 89 this.mUiExtras = uiExtras; 90 com.android.internal.util.AnnotationValidations.validate( 91 NonNull.class, null, mUiExtras); 92 93 // onConstructed(); // You can define this method to get a callback 94 } 95 96 /** 97 * The {@link ComponentName} of current app/activity 98 */ 99 @DataClass.Generated.Member getComponentName()100 public @NonNull ComponentName getComponentName() { 101 return mComponentName; 102 } 103 104 /** 105 * The {@link AutofillId} of currently focused field. 106 */ 107 @DataClass.Generated.Member getAutofillId()108 public @NonNull AutofillId getAutofillId() { 109 return mAutofillId; 110 } 111 112 /** 113 * The extras that contain the ui renderer related information 114 */ 115 @DataClass.Generated.Member getUiExtras()116 public @NonNull Bundle getUiExtras() { 117 return mUiExtras; 118 } 119 120 @Override 121 @DataClass.Generated.Member toString()122 public String toString() { 123 // You can override field toString logic by defining methods like: 124 // String fieldNameToString() { ... } 125 126 return "InlineSuggestionsRequestInfo { " + 127 "componentName = " + mComponentName + ", " + 128 "autofillId = " + mAutofillId + ", " + 129 "uiExtras = " + mUiExtras + 130 " }"; 131 } 132 133 @Override 134 @DataClass.Generated.Member equals(@ndroid.annotation.Nullable Object o)135 public boolean equals(@android.annotation.Nullable Object o) { 136 // You can override field equality logic by defining either of the methods like: 137 // boolean fieldNameEquals(InlineSuggestionsRequestInfo other) { ... } 138 // boolean fieldNameEquals(FieldType otherValue) { ... } 139 140 if (this == o) return true; 141 if (o == null || getClass() != o.getClass()) return false; 142 @SuppressWarnings("unchecked") 143 InlineSuggestionsRequestInfo that = (InlineSuggestionsRequestInfo) o; 144 //noinspection PointlessBooleanExpression 145 return true 146 && java.util.Objects.equals(mComponentName, that.mComponentName) 147 && java.util.Objects.equals(mAutofillId, that.mAutofillId) 148 && java.util.Objects.equals(mUiExtras, that.mUiExtras); 149 } 150 151 @Override 152 @DataClass.Generated.Member hashCode()153 public int hashCode() { 154 // You can override field hashCode logic by defining methods like: 155 // int fieldNameHashCode() { ... } 156 157 int _hash = 1; 158 _hash = 31 * _hash + java.util.Objects.hashCode(mComponentName); 159 _hash = 31 * _hash + java.util.Objects.hashCode(mAutofillId); 160 _hash = 31 * _hash + java.util.Objects.hashCode(mUiExtras); 161 return _hash; 162 } 163 164 @Override 165 @DataClass.Generated.Member writeToParcel(@onNull android.os.Parcel dest, int flags)166 public void writeToParcel(@NonNull android.os.Parcel dest, int flags) { 167 // You can override field parcelling by defining methods like: 168 // void parcelFieldName(Parcel dest, int flags) { ... } 169 170 dest.writeTypedObject(mComponentName, flags); 171 dest.writeTypedObject(mAutofillId, flags); 172 dest.writeBundle(mUiExtras); 173 } 174 175 @Override 176 @DataClass.Generated.Member describeContents()177 public int describeContents() { return 0; } 178 179 /** @hide */ 180 @SuppressWarnings({"unchecked", "RedundantCast"}) 181 @DataClass.Generated.Member InlineSuggestionsRequestInfo(@onNull android.os.Parcel in)182 /* package-private */ InlineSuggestionsRequestInfo(@NonNull android.os.Parcel in) { 183 // You can override field unparcelling by defining methods like: 184 // static FieldType unparcelFieldName(Parcel in) { ... } 185 186 ComponentName componentName = (ComponentName) in.readTypedObject(ComponentName.CREATOR); 187 AutofillId autofillId = (AutofillId) in.readTypedObject(AutofillId.CREATOR); 188 Bundle uiExtras = in.readBundle(); 189 190 this.mComponentName = componentName; 191 com.android.internal.util.AnnotationValidations.validate( 192 NonNull.class, null, mComponentName); 193 this.mAutofillId = autofillId; 194 com.android.internal.util.AnnotationValidations.validate( 195 NonNull.class, null, mAutofillId); 196 this.mUiExtras = uiExtras; 197 com.android.internal.util.AnnotationValidations.validate( 198 NonNull.class, null, mUiExtras); 199 200 // onConstructed(); // You can define this method to get a callback 201 } 202 203 @DataClass.Generated.Member 204 public static final @NonNull Parcelable.Creator<InlineSuggestionsRequestInfo> CREATOR 205 = new Parcelable.Creator<InlineSuggestionsRequestInfo>() { 206 @Override 207 public InlineSuggestionsRequestInfo[] newArray(int size) { 208 return new InlineSuggestionsRequestInfo[size]; 209 } 210 211 @Override 212 public InlineSuggestionsRequestInfo createFromParcel(@NonNull android.os.Parcel in) { 213 return new InlineSuggestionsRequestInfo(in); 214 } 215 }; 216 217 @DataClass.Generated( 218 time = 1582076613213L, 219 codegenVersion = "1.0.14", 220 sourceFile = "frameworks/base/core/java/com/android/internal/view/InlineSuggestionsRequestInfo.java", 221 inputSignatures = "private final @android.annotation.NonNull android.content.ComponentName mComponentName\nprivate final @android.annotation.NonNull android.view.autofill.AutofillId mAutofillId\nprivate final @android.annotation.NonNull android.os.Bundle mUiExtras\nclass InlineSuggestionsRequestInfo extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genHiddenConstDefs=true, genEqualsHashCode=true)") 222 @Deprecated __metadata()223 private void __metadata() {} 224 225 226 //@formatter:on 227 // End of generated code 228 229 } 230