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 android.content.pm.verify.domain; 18 19 import android.annotation.NonNull; 20 import android.annotation.SystemApi; 21 import android.content.Intent; 22 import android.os.Parcel; 23 import android.os.Parcelable; 24 25 import com.android.internal.util.DataClass; 26 import com.android.internal.util.Parcelling; 27 28 import java.util.Set; 29 30 /** 31 * Request object sent in the {@link Intent} that's broadcast to the domain verification agent, 32 * retrieved through {@link DomainVerificationManager#EXTRA_VERIFICATION_REQUEST}. 33 * <p> 34 * This contains the set of packages which have been invalidated and will require re-verification. 35 * The exact domains can be retrieved with 36 * {@link DomainVerificationManager#getDomainVerificationInfo(String)} 37 * 38 * @hide 39 */ 40 @SuppressWarnings("DefaultAnnotationParam") 41 @DataClass(genHiddenConstructor = true, genAidl = false, genEqualsHashCode = true) 42 @SystemApi 43 public final class DomainVerificationRequest implements Parcelable { 44 45 /** 46 * The package names of the apps that need to be verified. The receiver should call {@link 47 * DomainVerificationManager#getDomainVerificationInfo(String)} with each of these values to get 48 * the actual set of domains that need to be acted on. 49 */ 50 @NonNull 51 @DataClass.ParcelWith(Parcelling.BuiltIn.ForStringSet.class) 52 private final Set<String> mPackageNames; 53 parcelPackageNames(@onNull Parcel dest, @SuppressWarnings(R) int flags)54 private void parcelPackageNames(@NonNull Parcel dest, @SuppressWarnings("unused") int flags) { 55 DomainVerificationUtils.writeHostSet(dest, mPackageNames); 56 } 57 unparcelPackageNames(@onNull Parcel in)58 private Set<String> unparcelPackageNames(@NonNull Parcel in) { 59 return DomainVerificationUtils.readHostSet(in); 60 } 61 62 63 64 // Code below generated by codegen v1.0.22. 65 // 66 // DO NOT MODIFY! 67 // CHECKSTYLE:OFF Generated code 68 // 69 // To regenerate run: 70 // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/content/pm/verify/domain 71 // /DomainVerificationRequest.java 72 // 73 // To exclude the generated code from IntelliJ auto-formatting enable (one-time): 74 // Settings > Editor > Code Style > Formatter Control 75 //@formatter:off 76 77 78 /** 79 * Creates a new DomainVerificationRequest. 80 * 81 * @param packageNames 82 * The package names of the apps that need to be verified. The receiver should call {@link 83 * DomainVerificationManager#getDomainVerificationInfo(String)} with each of these values to get 84 * the actual set of domains that need to be acted on. 85 * @hide 86 */ 87 @DataClass.Generated.Member DomainVerificationRequest( @onNull Set<String> packageNames)88 public DomainVerificationRequest( 89 @NonNull Set<String> packageNames) { 90 this.mPackageNames = packageNames; 91 com.android.internal.util.AnnotationValidations.validate( 92 NonNull.class, null, mPackageNames); 93 94 // onConstructed(); // You can define this method to get a callback 95 } 96 97 /** 98 * The package names of the apps that need to be verified. The receiver should call {@link 99 * DomainVerificationManager#getDomainVerificationInfo(String)} with each of these values to get 100 * the actual set of domains that need to be acted on. 101 */ 102 @DataClass.Generated.Member getPackageNames()103 public @NonNull Set<String> getPackageNames() { 104 return mPackageNames; 105 } 106 107 @Override 108 @DataClass.Generated.Member equals(@ndroid.annotation.Nullable Object o)109 public boolean equals(@android.annotation.Nullable Object o) { 110 // You can override field equality logic by defining either of the methods like: 111 // boolean fieldNameEquals(DomainVerificationRequest other) { ... } 112 // boolean fieldNameEquals(FieldType otherValue) { ... } 113 114 if (this == o) return true; 115 if (o == null || getClass() != o.getClass()) return false; 116 @SuppressWarnings("unchecked") 117 DomainVerificationRequest that = (DomainVerificationRequest) o; 118 //noinspection PointlessBooleanExpression 119 return true 120 && java.util.Objects.equals(mPackageNames, that.mPackageNames); 121 } 122 123 @Override 124 @DataClass.Generated.Member hashCode()125 public int hashCode() { 126 // You can override field hashCode logic by defining methods like: 127 // int fieldNameHashCode() { ... } 128 129 int _hash = 1; 130 _hash = 31 * _hash + java.util.Objects.hashCode(mPackageNames); 131 return _hash; 132 } 133 134 @DataClass.Generated.Member 135 static Parcelling<Set<String>> sParcellingForPackageNames = 136 Parcelling.Cache.get( 137 Parcelling.BuiltIn.ForStringSet.class); 138 static { 139 if (sParcellingForPackageNames == null) { 140 sParcellingForPackageNames = Parcelling.Cache.put( 141 new Parcelling.BuiltIn.ForStringSet()); 142 } 143 } 144 145 @Override 146 @DataClass.Generated.Member writeToParcel(@onNull Parcel dest, int flags)147 public void writeToParcel(@NonNull Parcel dest, int flags) { 148 // You can override field parcelling by defining methods like: 149 // void parcelFieldName(Parcel dest, int flags) { ... } 150 151 parcelPackageNames(dest, flags); 152 } 153 154 @Override 155 @DataClass.Generated.Member describeContents()156 public int describeContents() { return 0; } 157 158 /** @hide */ 159 @SuppressWarnings({"unchecked", "RedundantCast"}) 160 @DataClass.Generated.Member DomainVerificationRequest(@onNull Parcel in)161 /* package-private */ DomainVerificationRequest(@NonNull Parcel in) { 162 // You can override field unparcelling by defining methods like: 163 // static FieldType unparcelFieldName(Parcel in) { ... } 164 165 Set<String> packageNames = unparcelPackageNames(in); 166 167 this.mPackageNames = packageNames; 168 com.android.internal.util.AnnotationValidations.validate( 169 NonNull.class, null, mPackageNames); 170 171 // onConstructed(); // You can define this method to get a callback 172 } 173 174 @DataClass.Generated.Member 175 public static final @NonNull Parcelable.Creator<DomainVerificationRequest> CREATOR 176 = new Parcelable.Creator<DomainVerificationRequest>() { 177 @Override 178 public DomainVerificationRequest[] newArray(int size) { 179 return new DomainVerificationRequest[size]; 180 } 181 182 @Override 183 public DomainVerificationRequest createFromParcel(@NonNull Parcel in) { 184 return new DomainVerificationRequest(in); 185 } 186 }; 187 188 @DataClass.Generated( 189 time = 1613169505495L, 190 codegenVersion = "1.0.22", 191 sourceFile = "frameworks/base/core/java/android/content/pm/verify/domain/DomainVerificationRequest.java", 192 inputSignatures = "private final @android.annotation.NonNull @com.android.internal.util.DataClass.ParcelWith(com.android.internal.util.Parcelling.BuiltIn.ForStringSet.class) java.util.Set<java.lang.String> mPackageNames\nprivate void parcelPackageNames(android.os.Parcel,int)\nprivate java.util.Set<java.lang.String> unparcelPackageNames(android.os.Parcel)\nclass DomainVerificationRequest extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genHiddenConstructor=true, genAidl=false, genEqualsHashCode=true)") 193 @Deprecated __metadata()194 private void __metadata() {} 195 196 197 //@formatter:on 198 // End of generated code 199 200 } 201