• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2015 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.security.keymaster;
18 
19 import android.annotation.UnsupportedAppUsage;
20 import android.os.Parcel;
21 import android.os.Parcelable;
22 
23 /**
24  * Class for handling parceling the return values from keymaster's export operation.
25  * @hide
26  */
27 public class ExportResult implements Parcelable {
28     public final int resultCode;
29     public final byte[] exportData;
30 
ExportResult(int resultCode)31     public ExportResult(int resultCode) {
32         this.resultCode = resultCode;
33         this.exportData = new byte[0];
34     }
35 
36     @UnsupportedAppUsage
37     public static final @android.annotation.NonNull Parcelable.Creator<ExportResult> CREATOR = new
38             Parcelable.Creator<ExportResult>() {
39                 public ExportResult createFromParcel(Parcel in) {
40                     return new ExportResult(in);
41                 }
42 
43                 public ExportResult[] newArray(int length) {
44                     return new ExportResult[length];
45                 }
46             };
47 
ExportResult(Parcel in)48     protected ExportResult(Parcel in) {
49         resultCode = in.readInt();
50         exportData = in.createByteArray();
51     }
52 
53     @Override
describeContents()54     public int describeContents() {
55         return 0;
56     }
57 
58     @Override
writeToParcel(Parcel out, int flags)59     public void writeToParcel(Parcel out, int flags) {
60         out.writeInt(resultCode);
61         out.writeByteArray(exportData);
62     }
63 };
64