Debian Codegraph @

core/java/android/service/quickaccesswallet/WalletServiceEvent.java

raw symbols SCIP
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.IntDef;
20 import android.annotation.NonNull;
21 import android.os.Parcel;
22 import android.os.Parcelable;
23
24 import java.lang.annotation.Retention;
25 import java.lang.annotation.RetentionPolicy;
26
27 /**
28 * Represents a request from the {@link QuickAccessWalletService wallet app} to the Quick Access
29 * Wallet in System UI. Background events may necessitate that the Quick Access Wallet update its
30 * view. For example, if the wallet application handles an NFC payment while the Quick Access Wallet
31 * is being shown, it needs to tell the Quick Access Wallet so that the wallet can be dismissed and
32 * Activity showing the payment can be displayed to the user.
33 */
34 public final class WalletServiceEvent implements Parcelable {
35
36 /**
37 * An NFC payment has started. If the Quick Access Wallet is in a system window, it will need to
38 * be dismissed so that an Activity showing the payment can be displayed.
39 */
40 public static final int TYPE_NFC_PAYMENT_STARTED = 1;
41
42 /**
43 * Indicates that the wallet cards have changed and should be refreshed.
44 * @hide
45 */
46 public static final int TYPE_WALLET_CARDS_UPDATED = 2;
47
48 /**
49 * @hide
50 */
51 @Retention(RetentionPolicy.SOURCE)
52 @IntDef({TYPE_NFC_PAYMENT_STARTED, TYPE_WALLET_CARDS_UPDATED})
53 public @interface EventType {
54 }
55
56 @EventType
57 private final int mEventType;
58
59 /**
60 * Creates a new DismissWalletRequest.
61 */
62 public WalletServiceEvent(@EventType int eventType) {
63 this.mEventType = eventType;
64 }
65
66 @Override
67 public int describeContents() {
68 return 0;
69 }
70
71 @Override
72 public void writeToParcel(@NonNull Parcel dest, int flags) {
73 dest.writeInt(mEventType);
74 }
75
76 @NonNull
77 public static final Creator<WalletServiceEvent> CREATOR =
78 new Creator<WalletServiceEvent>() {
79 @Override
80 public WalletServiceEvent createFromParcel(Parcel source) {
81 int eventType = source.readInt();
82 return new WalletServiceEvent(eventType);
83 }
84
85 @Override
86 public WalletServiceEvent[] newArray(int size) {
87 return new WalletServiceEvent[size];
88 }
89 };
90
91 /**
92 * @return the event type
93 */
94 @EventType
95 public int getEventType() {
96 return mEventType;
97 }
98 }