1 /* 2 * Copyright (C) 2016 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 com.android.incallui.incall.protocol; 18 19 import android.os.Parcel; 20 import android.os.Parcelable; 21 import com.android.dialer.common.LogUtil; 22 import java.util.Locale; 23 24 /** Information about the secondary call. */ 25 public class SecondaryInfo implements Parcelable { 26 public final boolean shouldShow; 27 public final String name; 28 public final boolean nameIsNumber; 29 public final String label; 30 public final String providerLabel; 31 public final boolean isConference; 32 public final boolean isVideoCall; 33 public final boolean isFullscreen; 34 createEmptySecondaryInfo(boolean isFullScreen)35 public static SecondaryInfo createEmptySecondaryInfo(boolean isFullScreen) { 36 return new SecondaryInfo(false, null, false, null, null, false, false, isFullScreen); 37 } 38 SecondaryInfo( boolean shouldShow, String name, boolean nameIsNumber, String label, String providerLabel, boolean isConference, boolean isVideoCall, boolean isFullscreen)39 public SecondaryInfo( 40 boolean shouldShow, 41 String name, 42 boolean nameIsNumber, 43 String label, 44 String providerLabel, 45 boolean isConference, 46 boolean isVideoCall, 47 boolean isFullscreen) { 48 this.shouldShow = shouldShow; 49 this.name = name; 50 this.nameIsNumber = nameIsNumber; 51 this.label = label; 52 this.providerLabel = providerLabel; 53 this.isConference = isConference; 54 this.isVideoCall = isVideoCall; 55 this.isFullscreen = isFullscreen; 56 } 57 58 @Override toString()59 public String toString() { 60 return String.format( 61 Locale.US, 62 "SecondaryInfo, show: %b, name: %s, label: %s, " + "providerLabel: %s", 63 shouldShow, 64 LogUtil.sanitizePii(name), 65 label, 66 providerLabel); 67 } 68 SecondaryInfo(Parcel in)69 protected SecondaryInfo(Parcel in) { 70 shouldShow = in.readByte() != 0; 71 name = in.readString(); 72 nameIsNumber = in.readByte() != 0; 73 label = in.readString(); 74 providerLabel = in.readString(); 75 isConference = in.readByte() != 0; 76 isVideoCall = in.readByte() != 0; 77 isFullscreen = in.readByte() != 0; 78 } 79 80 public static final Creator<SecondaryInfo> CREATOR = 81 new Creator<SecondaryInfo>() { 82 @Override 83 public SecondaryInfo createFromParcel(Parcel in) { 84 return new SecondaryInfo(in); 85 } 86 87 @Override 88 public SecondaryInfo[] newArray(int size) { 89 return new SecondaryInfo[size]; 90 } 91 }; 92 93 @Override describeContents()94 public int describeContents() { 95 return 0; 96 } 97 98 @Override writeToParcel(Parcel dest, int flags)99 public void writeToParcel(Parcel dest, int flags) { 100 dest.writeByte((byte) (shouldShow ? 1 : 0)); 101 dest.writeString(name); 102 dest.writeByte((byte) (nameIsNumber ? 1 : 0)); 103 dest.writeString(label); 104 dest.writeString(providerLabel); 105 dest.writeByte((byte) (isConference ? 1 : 0)); 106 dest.writeByte((byte) (isVideoCall ? 1 : 0)); 107 dest.writeByte((byte) (isFullscreen ? 1 : 0)); 108 } 109 } 110