1 /*
2  * Copyright (C) 2021 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.hardware.face;
18 
19 import android.annotation.NonNull;
20 import android.os.Parcel;
21 import android.os.Parcelable;
22 
23 /**
24  * Data model for a frame captured during face authentication.
25  *
26  * @hide
27  */
28 public final class FaceAuthenticationFrame implements Parcelable {
29     @NonNull private final FaceDataFrame mData;
30 
31     /**
32      * Data model for a frame captured during face authentication.
33      *
34      * @param data Information about the current frame.
35      */
FaceAuthenticationFrame(@onNull FaceDataFrame data)36     public FaceAuthenticationFrame(@NonNull FaceDataFrame data) {
37         mData = data;
38     }
39 
40     /**
41      * @return Information about the current frame.
42      */
43     @NonNull
getData()44     public FaceDataFrame getData() {
45         return mData;
46     }
47 
FaceAuthenticationFrame(@onNull Parcel source)48     private FaceAuthenticationFrame(@NonNull Parcel source) {
49         mData = source.readParcelable(FaceDataFrame.class.getClassLoader(), android.hardware.face.FaceDataFrame.class);
50     }
51 
52     @Override
describeContents()53     public int describeContents() {
54         return 0;
55     }
56 
57     @Override
writeToParcel(Parcel dest, int flags)58     public void writeToParcel(Parcel dest, int flags) {
59         dest.writeParcelable(mData, flags);
60     }
61 
62     public static final Creator<FaceAuthenticationFrame> CREATOR =
63             new Creator<FaceAuthenticationFrame>() {
64 
65         @Override
66         public FaceAuthenticationFrame createFromParcel(Parcel source) {
67             return new FaceAuthenticationFrame(source);
68         }
69 
70         @Override
71         public FaceAuthenticationFrame[] newArray(int size) {
72             return new FaceAuthenticationFrame[size];
73         }
74     };
75 }
76