PrimaryCallState.java revision cded3beaf28a703e1ef8f71bbc6836e6806c3736
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
17package com.android.incallui.incall.protocol;
18
19import android.graphics.drawable.Drawable;
20import android.telecom.DisconnectCause;
21import com.android.incallui.call.DialerCall;
22import com.android.incallui.videotech.utils.SessionModificationState;
23import java.util.Locale;
24
25/** State of the primary call. */
26public class PrimaryCallState {
27  public final int state;
28  public final boolean isVideoCall;
29  @SessionModificationState public final int sessionModificationState;
30  public final DisconnectCause disconnectCause;
31  public final String connectionLabel;
32  public final Drawable connectionIcon;
33  public final String gatewayNumber;
34  public final String callSubject;
35  public final String callbackNumber;
36  public final boolean isWifi;
37  public final boolean isConference;
38  public final boolean isWorkCall;
39  public final boolean isHdAttempting;
40  public final boolean isHdAudioCall;
41  public final boolean isForwardedNumber;
42  public final boolean shouldShowContactPhoto;
43  public final long connectTimeMillis;
44  public final boolean isVoiceMailNumber;
45  public final boolean isRemotelyHeld;
46  public final boolean isBusinessNumber;
47
48  // TODO: Convert to autovalue. b/34502119
49  public static PrimaryCallState createEmptyPrimaryCallState() {
50    return new PrimaryCallState(
51        DialerCall.State.IDLE,
52        false, /* isVideoCall */
53        SessionModificationState.NO_REQUEST,
54        new DisconnectCause(DisconnectCause.UNKNOWN),
55        null, /* connectionLabel */
56        null, /* connectionIcon */
57        null, /* gatewayNumber */
58        null, /* callSubject */
59        null, /* callbackNumber */
60        false /* isWifi */,
61        false /* isConference */,
62        false /* isWorkCall */,
63        false /* isHdAttempting */,
64        false /* isHdAudioCall */,
65        false /* isForwardedNumber */,
66        false /* shouldShowContactPhoto */,
67        0,
68        false /* isVoiceMailNumber */,
69        false /* isRemotelyHeld */,
70        false /* isBusinessNumber */);
71  }
72
73  public PrimaryCallState(
74      int state,
75      boolean isVideoCall,
76      @SessionModificationState int sessionModificationState,
77      DisconnectCause disconnectCause,
78      String connectionLabel,
79      Drawable connectionIcon,
80      String gatewayNumber,
81      String callSubject,
82      String callbackNumber,
83      boolean isWifi,
84      boolean isConference,
85      boolean isWorkCall,
86      boolean isHdAttempting,
87      boolean isHdAudioCall,
88      boolean isForwardedNumber,
89      boolean shouldShowContactPhoto,
90      long connectTimeMillis,
91      boolean isVoiceMailNumber,
92      boolean isRemotelyHeld,
93      boolean isBusinessNumber) {
94    this.state = state;
95    this.isVideoCall = isVideoCall;
96    this.sessionModificationState = sessionModificationState;
97    this.disconnectCause = disconnectCause;
98    this.connectionLabel = connectionLabel;
99    this.connectionIcon = connectionIcon;
100    this.gatewayNumber = gatewayNumber;
101    this.callSubject = callSubject;
102    this.callbackNumber = callbackNumber;
103    this.isWifi = isWifi;
104    this.isConference = isConference;
105    this.isWorkCall = isWorkCall;
106    this.isHdAttempting = isHdAttempting;
107    this.isHdAudioCall = isHdAudioCall;
108    this.isForwardedNumber = isForwardedNumber;
109    this.shouldShowContactPhoto = shouldShowContactPhoto;
110    this.connectTimeMillis = connectTimeMillis;
111    this.isVoiceMailNumber = isVoiceMailNumber;
112    this.isRemotelyHeld = isRemotelyHeld;
113    this.isBusinessNumber = isBusinessNumber;
114  }
115
116  @Override
117  public String toString() {
118    return String.format(
119        Locale.US, "PrimaryCallState, state: %d, connectionLabel: %s", state, connectionLabel);
120  }
121}
122