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