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.nearby; 18 19 import android.annotation.NonNull; 20 import android.os.Parcel; 21 import android.os.Parcelable; 22 23 /** 24 * A wrapper of {@link BroadcastRequest} that is parcelable. 25 * 26 * @hide 27 */ 28 public class BroadcastRequestParcelable implements Parcelable { 29 private final BroadcastRequest mBroadcastRequest; 30 31 public static final Creator<BroadcastRequestParcelable> CREATOR = 32 new Creator<BroadcastRequestParcelable>() { 33 @Override 34 public BroadcastRequestParcelable createFromParcel(Parcel in) { 35 return new BroadcastRequestParcelable(BroadcastRequest.createFromParcel(in)); 36 } 37 38 @Override 39 public BroadcastRequestParcelable[] newArray(int size) { 40 return new BroadcastRequestParcelable[size]; 41 } 42 }; 43 BroadcastRequestParcelable(BroadcastRequest broadcastRequest)44 BroadcastRequestParcelable(BroadcastRequest broadcastRequest) { 45 mBroadcastRequest = broadcastRequest; 46 } 47 48 /** 49 * Returns the broadcastRequest. 50 */ getBroadcastRequest()51 public BroadcastRequest getBroadcastRequest() { 52 return mBroadcastRequest; 53 } 54 55 @Override describeContents()56 public int describeContents() { 57 return 0; 58 } 59 60 @Override writeToParcel(@onNull Parcel dest, int flags)61 public void writeToParcel(@NonNull Parcel dest, int flags) { 62 mBroadcastRequest.writeToParcel(dest, flags); 63 } 64 } 65