1 /* 2 * Copyright (C) 2023 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.os.Bundle; 22 import android.os.Parcel; 23 24 import java.util.Objects; 25 26 /** 27 * @hide 28 */ 29 public final class BundlePolicyValue extends PolicyValue<Bundle> { 30 BundlePolicyValue(Bundle value)31 public BundlePolicyValue(Bundle value) { 32 super(value); 33 } 34 BundlePolicyValue(Parcel source)35 private BundlePolicyValue(Parcel source) { 36 this(source.readBundle()); 37 } 38 39 @Override equals(@ullable Object o)40 public boolean equals(@Nullable Object o) { 41 if (this == o) return true; 42 if (o == null || getClass() != o.getClass()) return false; 43 BundlePolicyValue other = (BundlePolicyValue) o; 44 return Objects.equals(getValue(), other.getValue()); 45 } 46 47 @Override hashCode()48 public int hashCode() { 49 return Objects.hash(getValue()); 50 } 51 52 @Override toString()53 public String toString() { 54 return "BundlePolicyValue { mValue= " + getValue() + " }"; 55 } 56 57 @Override describeContents()58 public int describeContents() { 59 return 0; 60 } 61 62 @Override writeToParcel(@onNull Parcel dest, int flags)63 public void writeToParcel(@NonNull Parcel dest, int flags) { 64 dest.writeBundle(getValue()); 65 } 66 67 @NonNull 68 public static final Creator<BundlePolicyValue> CREATOR = 69 new Creator<BundlePolicyValue>() { 70 @Override 71 public BundlePolicyValue createFromParcel(Parcel source) { 72 return new BundlePolicyValue(source); 73 } 74 75 @Override 76 public BundlePolicyValue[] newArray(int size) { 77 return new BundlePolicyValue[size]; 78 } 79 }; 80 } 81