1 /* 2 * Copyright (C) 2022 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.adservices.ondevicepersonalization; 18 19 import android.annotation.FlaggedApi; 20 import android.annotation.NonNull; 21 import android.annotation.Nullable; 22 23 import com.android.adservices.ondevicepersonalization.flags.Flags; 24 import com.android.ondevicepersonalization.internal.util.DataClass; 25 26 /** 27 * The input data for 28 * {@link IsolatedWorker#onRender(RenderInput, android.os.OutcomeReceiver)}. 29 * 30 */ 31 @FlaggedApi(Flags.FLAG_ON_DEVICE_PERSONALIZATION_APIS_ENABLED) 32 @DataClass(genBuilder = false, genHiddenConstructor = true, genEqualsHashCode = true) 33 public final class RenderInput { 34 /** The width of the slot. */ 35 private int mWidth = 0; 36 37 /** The height of the slot. */ 38 private int mHeight = 0; 39 40 /** 41 * A {@link RenderingConfig} within an {@link ExecuteOutput} that was returned by 42 * {@link IsolatedWorker#onExecute(ExecuteInput, android.os.OutcomeReceiver)}. 43 */ 44 @Nullable RenderingConfig mRenderingConfig = null; 45 46 /** @hide */ RenderInput(@onNull RenderInputParcel parcel)47 public RenderInput(@NonNull RenderInputParcel parcel) { 48 this(parcel.getWidth(), parcel.getHeight(), parcel.getRenderingConfig()); 49 } 50 51 52 53 // Code below generated by codegen v1.0.23. 54 // 55 // DO NOT MODIFY! 56 // CHECKSTYLE:OFF Generated code 57 // 58 // To regenerate run: 59 // $ codegen $ANDROID_BUILD_TOP/packages/modules/OnDevicePersonalization/framework/java/android/adservices/ondevicepersonalization/RenderInput.java 60 // 61 // To exclude the generated code from IntelliJ auto-formatting enable (one-time): 62 // Settings > Editor > Code Style > Formatter Control 63 //@formatter:off 64 65 66 /** 67 * Creates a new RenderInput. 68 * 69 * @param width 70 * The width of the slot. 71 * @param height 72 * The height of the slot. 73 * @param renderingConfig 74 * A {@link RenderingConfig} within an {@link ExecuteOutput} that was returned by 75 * {@link IsolatedWorker#onExecute(ExecuteInput, android.os.OutcomeReceiver)}. 76 * @hide 77 */ 78 @DataClass.Generated.Member RenderInput( int width, int height, @Nullable RenderingConfig renderingConfig)79 public RenderInput( 80 int width, 81 int height, 82 @Nullable RenderingConfig renderingConfig) { 83 this.mWidth = width; 84 this.mHeight = height; 85 this.mRenderingConfig = renderingConfig; 86 87 // onConstructed(); // You can define this method to get a callback 88 } 89 90 /** 91 * The width of the slot. 92 */ 93 @DataClass.Generated.Member getWidth()94 public int getWidth() { 95 return mWidth; 96 } 97 98 /** 99 * The height of the slot. 100 */ 101 @DataClass.Generated.Member getHeight()102 public int getHeight() { 103 return mHeight; 104 } 105 106 /** 107 * A {@link RenderingConfig} within an {@link ExecuteOutput} that was returned by 108 * {@link IsolatedWorker#onExecute(ExecuteInput, android.os.OutcomeReceiver)}. 109 */ 110 @DataClass.Generated.Member getRenderingConfig()111 public @Nullable RenderingConfig getRenderingConfig() { 112 return mRenderingConfig; 113 } 114 115 @Override 116 @DataClass.Generated.Member equals(@ullable Object o)117 public boolean equals(@Nullable Object o) { 118 // You can override field equality logic by defining either of the methods like: 119 // boolean fieldNameEquals(RenderInput other) { ... } 120 // boolean fieldNameEquals(FieldType otherValue) { ... } 121 122 if (this == o) return true; 123 if (o == null || getClass() != o.getClass()) return false; 124 @SuppressWarnings("unchecked") 125 RenderInput that = (RenderInput) o; 126 //noinspection PointlessBooleanExpression 127 return true 128 && mWidth == that.mWidth 129 && mHeight == that.mHeight 130 && java.util.Objects.equals(mRenderingConfig, that.mRenderingConfig); 131 } 132 133 @Override 134 @DataClass.Generated.Member hashCode()135 public int hashCode() { 136 // You can override field hashCode logic by defining methods like: 137 // int fieldNameHashCode() { ... } 138 139 int _hash = 1; 140 _hash = 31 * _hash + mWidth; 141 _hash = 31 * _hash + mHeight; 142 _hash = 31 * _hash + java.util.Objects.hashCode(mRenderingConfig); 143 return _hash; 144 } 145 146 @DataClass.Generated( 147 time = 1704831946167L, 148 codegenVersion = "1.0.23", 149 sourceFile = "packages/modules/OnDevicePersonalization/framework/java/android/adservices/ondevicepersonalization/RenderInput.java", 150 inputSignatures = "private int mWidth\nprivate int mHeight\n @android.annotation.Nullable android.adservices.ondevicepersonalization.RenderingConfig mRenderingConfig\nclass RenderInput extends java.lang.Object implements []\n@com.android.ondevicepersonalization.internal.util.DataClass(genBuilder=false, genHiddenConstructor=true, genEqualsHashCode=true)") 151 @Deprecated __metadata()152 private void __metadata() {} 153 154 155 //@formatter:on 156 // End of generated code 157 158 } 159