OperationResult.java revision 45ff13ea28005b5af0caa80dbdeb09d49bd73faf
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 17package android.security.keymaster; 18 19import android.os.IBinder; 20import android.os.Parcel; 21import android.os.Parcelable; 22 23import java.util.List; 24 25/** 26 * Class for handling the parceling of return values from keymaster crypto operations 27 * (begin/update/finish). 28 * @hide 29 */ 30public class OperationResult implements Parcelable { 31 public final int resultCode; 32 public final IBinder token; 33 public final int inputConsumed; 34 public final byte[] output; 35 36 public static final Parcelable.Creator<OperationResult> CREATOR = new 37 Parcelable.Creator<OperationResult>() { 38 public OperationResult createFromParcel(Parcel in) { 39 return new OperationResult(in); 40 } 41 42 public OperationResult[] newArray(int length) { 43 return new OperationResult[length]; 44 } 45 }; 46 47 protected OperationResult(Parcel in) { 48 resultCode = in.readInt(); 49 token = in.readStrongBinder(); 50 inputConsumed = in.readInt(); 51 output = in.createByteArray(); 52 } 53 54 @Override 55 public int describeContents() { 56 return 0; 57 } 58 59 @Override 60 public void writeToParcel(Parcel out, int flags) { 61 out.writeInt(resultCode); 62 out.writeStrongBinder(token); 63 out.writeInt(inputConsumed); 64 out.writeByteArray(output); 65 } 66} 67