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.app.admin; 18 19 import android.annotation.NonNull; 20 import android.annotation.Nullable; 21 import android.annotation.TestApi; 22 import android.os.Parcel; 23 import android.os.Parcelable; 24 25 import java.util.Set; 26 27 /** 28 * Class to identify a union resolution mechanism for {@code Set<String>} policies, it's used to 29 * resolve the enforced policy when being set by multiple admins (see 30 * {@link PolicyState#getResolutionMechanism()}). 31 * 32 * @hide 33 */ 34 @TestApi 35 public final class StringSetUnion extends ResolutionMechanism<Set<String>> { 36 37 /** 38 * Union resolution for policies represented {@code Set<String>} which resolves as the union of 39 * all sets. 40 */ 41 @NonNull 42 public static final StringSetUnion STRING_SET_UNION = new StringSetUnion(); 43 44 @Override equals(@ullable Object o)45 public boolean equals(@Nullable Object o) { 46 if (this == o) return true; 47 return o != null && getClass() == o.getClass(); 48 } 49 @Override hashCode()50 public int hashCode() { 51 return 0; 52 } 53 54 @Override toString()55 public String toString() { 56 return "StringSetUnion {}"; 57 } 58 59 @Override describeContents()60 public int describeContents() { 61 return 0; 62 } 63 64 @Override writeToParcel(@onNull Parcel dest, int flags)65 public void writeToParcel(@NonNull Parcel dest, int flags) {} 66 67 @NonNull 68 public static final Parcelable.Creator<StringSetUnion> CREATOR = 69 new Parcelable.Creator<StringSetUnion>() { 70 @Override 71 public StringSetUnion createFromParcel(Parcel source) { 72 return new StringSetUnion(); 73 } 74 75 @Override 76 public StringSetUnion[] newArray(int size) { 77 return new StringSetUnion[size]; 78 } 79 }; 80 } 81