1 /* 2 * Copyright (C) 2024 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.telecom.cts.apps; 18 19 import android.os.Parcel; 20 import android.os.Parcelable; 21 22 import androidx.annotation.NonNull; 23 24 public final class CallStateTransitionOperation implements Parcelable { 25 public static final int OPERATION_ANSWER = 0; 26 public static final int OPERATION_HOLD = 1; 27 public static final int OPERATION_UNHOLD = 2; 28 public static final int OPERATION_DISCONNECT = 3; 29 public static final String[] OPERATION_STRING_MAP = new String[] {"ANSWER", "HOLD", "UNHOLD", 30 "DISCONNECT"}; 31 public final int operationType; 32 public final long creationTimeMs; CallStateTransitionOperation(int type, long creationTime)33 public CallStateTransitionOperation(int type, long creationTime) { 34 operationType = type; 35 creationTimeMs = creationTime; 36 } 37 getCreationTimeMs()38 public long getCreationTimeMs() { 39 return creationTimeMs; 40 } 41 42 @Override describeContents()43 public int describeContents() { 44 return 0; 45 } 46 47 @Override writeToParcel(@onNull Parcel dest, int flags)48 public void writeToParcel(@NonNull Parcel dest, int flags) { 49 dest.writeInt(operationType); 50 dest.writeLong(creationTimeMs); 51 } 52 53 public static final Creator<CallStateTransitionOperation> CREATOR = new Creator<>() { 54 @Override 55 public CallStateTransitionOperation createFromParcel(Parcel in) { 56 return new CallStateTransitionOperation(in.readInt(), in.readLong()); 57 } 58 59 @Override 60 public CallStateTransitionOperation[] newArray(int size) { 61 return new CallStateTransitionOperation[size]; 62 } 63 }; 64 65 @Override toString()66 public String toString() { 67 return "CallStateTransitionOperation{" 68 + "operationType=" + OPERATION_STRING_MAP[operationType] 69 + ", creationTimeMs=" + creationTimeMs 70 + '}'; 71 } 72 } 73