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.service.quickaccesswallet; 18 19 import android.annotation.NonNull; 20 import android.os.Parcel; 21 import android.os.Parcelable; 22 23 /** 24 * Represents a request to a {@link QuickAccessWalletService} to select a particular {@link 25 * WalletCard walletCard}. Card selection events are transmitted to the WalletService so that the 26 * selected card may be used by the NFC payment service. 27 */ 28 public final class SelectWalletCardRequest implements Parcelable { 29 30 private final String mCardId; 31 32 /** 33 * Creates a new GetWalletCardsRequest. 34 * 35 * @param cardId The {@link WalletCard#getCardId() cardId} of the wallet card that is currently 36 * selected. 37 */ SelectWalletCardRequest(@onNull String cardId)38 public SelectWalletCardRequest(@NonNull String cardId) { 39 this.mCardId = cardId; 40 } 41 42 @Override describeContents()43 public int describeContents() { 44 return 0; 45 } 46 47 @Override writeToParcel(@onNull Parcel dest, int flags)48 public void writeToParcel(@NonNull Parcel dest, int flags) { 49 dest.writeString(mCardId); 50 } 51 52 @NonNull 53 public static final Creator<SelectWalletCardRequest> CREATOR = 54 new Creator<SelectWalletCardRequest>() { 55 @Override 56 public SelectWalletCardRequest createFromParcel(Parcel source) { 57 String cardId = source.readString(); 58 return new SelectWalletCardRequest(cardId); 59 } 60 61 @Override 62 public SelectWalletCardRequest[] newArray(int size) { 63 return new SelectWalletCardRequest[size]; 64 } 65 }; 66 67 /** 68 * The {@link WalletCard#getCardId() cardId} of the wallet card that is currently selected. 69 */ 70 @NonNull getCardId()71 public String getCardId() { 72 return mCardId; 73 } 74 } 75