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.net.Uri; 22 23 import com.android.adservices.ondevicepersonalization.flags.Flags; 24 import com.android.ondevicepersonalization.internal.util.AnnotationValidations; 25 import com.android.ondevicepersonalization.internal.util.DataClass; 26 27 /** 28 * The input data for 29 * {@link IsolatedWorker#onWebTrigger(WebTriggerInput, android.os.OutcomeReceiver)}. 30 */ 31 @FlaggedApi(Flags.FLAG_ON_DEVICE_PERSONALIZATION_APIS_ENABLED) 32 @DataClass(genBuilder = false, genHiddenConstructor = true, genEqualsHashCode = true) 33 public final class WebTriggerInput { 34 /** The destination URL (landing page) where the trigger event occurred. */ 35 @NonNull private Uri mDestinationUrl; 36 37 /** The app where the trigger event occurred */ 38 @NonNull private String mAppPackageName; 39 40 /** 41 * Additional data returned by the server as part of the web trigger registration 42 * to be sent to the {@link IsolatedService}. This can be {@code null} if the server 43 * does not need to send data to the service for processing web triggers. 44 */ 45 @NonNull private byte[] mData; 46 47 /** @hide */ WebTriggerInput(@onNull WebTriggerInputParcel parcel)48 public WebTriggerInput(@NonNull WebTriggerInputParcel parcel) { 49 this(parcel.getDestinationUrl(), parcel.getAppPackageName(), parcel.getData()); 50 } 51 52 53 54 // Code below generated by codegen v1.0.23. 55 // 56 // DO NOT MODIFY! 57 // CHECKSTYLE:OFF Generated code 58 // 59 // To regenerate run: 60 // $ codegen $ANDROID_BUILD_TOP/packages/modules/OnDevicePersonalization/framework/java/android/adservices/ondevicepersonalization/WebTriggerInput.java 61 // 62 // To exclude the generated code from IntelliJ auto-formatting enable (one-time): 63 // Settings > Editor > Code Style > Formatter Control 64 //@formatter:off 65 66 67 /** 68 * Creates a new WebTriggerInput. 69 * 70 * @param destinationUrl 71 * The destination URL (landing page) where the trigger event occurred. 72 * @param appPackageName 73 * The app where the trigger event occurred 74 * @param data 75 * Additional data returned by the server as part of the web trigger registration 76 * to be sent to the {@link IsolatedService}. This can be {@code null} if the server 77 * does not need to send data to the service for processing web triggers. 78 * @hide 79 */ 80 @DataClass.Generated.Member WebTriggerInput( @onNull Uri destinationUrl, @NonNull String appPackageName, @NonNull byte[] data)81 public WebTriggerInput( 82 @NonNull Uri destinationUrl, 83 @NonNull String appPackageName, 84 @NonNull byte[] data) { 85 this.mDestinationUrl = destinationUrl; 86 AnnotationValidations.validate( 87 NonNull.class, null, mDestinationUrl); 88 this.mAppPackageName = appPackageName; 89 AnnotationValidations.validate( 90 NonNull.class, null, mAppPackageName); 91 this.mData = data; 92 AnnotationValidations.validate( 93 NonNull.class, null, mData); 94 95 // onConstructed(); // You can define this method to get a callback 96 } 97 98 /** 99 * The destination URL (landing page) where the trigger event occurred. 100 */ 101 @DataClass.Generated.Member getDestinationUrl()102 public @NonNull Uri getDestinationUrl() { 103 return mDestinationUrl; 104 } 105 106 /** 107 * The app where the trigger event occurred 108 */ 109 @DataClass.Generated.Member getAppPackageName()110 public @NonNull String getAppPackageName() { 111 return mAppPackageName; 112 } 113 114 /** 115 * Additional data returned by the server as part of the web trigger registration 116 * to be sent to the {@link IsolatedService}. This can be {@code null} if the server 117 * does not need to send data to the service for processing web triggers. 118 */ 119 @DataClass.Generated.Member getData()120 public @NonNull byte[] getData() { 121 return mData; 122 } 123 124 @Override 125 @DataClass.Generated.Member equals(@ndroid.annotation.Nullable Object o)126 public boolean equals(@android.annotation.Nullable Object o) { 127 // You can override field equality logic by defining either of the methods like: 128 // boolean fieldNameEquals(WebTriggerInput other) { ... } 129 // boolean fieldNameEquals(FieldType otherValue) { ... } 130 131 if (this == o) return true; 132 if (o == null || getClass() != o.getClass()) return false; 133 @SuppressWarnings("unchecked") 134 WebTriggerInput that = (WebTriggerInput) o; 135 //noinspection PointlessBooleanExpression 136 return true 137 && java.util.Objects.equals(mDestinationUrl, that.mDestinationUrl) 138 && java.util.Objects.equals(mAppPackageName, that.mAppPackageName) 139 && java.util.Arrays.equals(mData, that.mData); 140 } 141 142 @Override 143 @DataClass.Generated.Member hashCode()144 public int hashCode() { 145 // You can override field hashCode logic by defining methods like: 146 // int fieldNameHashCode() { ... } 147 148 int _hash = 1; 149 _hash = 31 * _hash + java.util.Objects.hashCode(mDestinationUrl); 150 _hash = 31 * _hash + java.util.Objects.hashCode(mAppPackageName); 151 _hash = 31 * _hash + java.util.Arrays.hashCode(mData); 152 return _hash; 153 } 154 155 @DataClass.Generated( 156 time = 1707513068642L, 157 codegenVersion = "1.0.23", 158 sourceFile = "packages/modules/OnDevicePersonalization/framework/java/android/adservices/ondevicepersonalization/WebTriggerInput.java", 159 inputSignatures = "private @android.annotation.NonNull android.net.Uri mDestinationUrl\nprivate @android.annotation.NonNull java.lang.String mAppPackageName\nprivate @android.annotation.NonNull byte[] mData\nclass WebTriggerInput extends java.lang.Object implements []\n@com.android.ondevicepersonalization.internal.util.DataClass(genBuilder=false, genHiddenConstructor=true, genEqualsHashCode=true)") 160 @Deprecated __metadata()161 private void __metadata() {} 162 163 164 //@formatter:on 165 // End of generated code 166 167 } 168