1 /*
2  * Copyright (C) 2018 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.dialer.activecalls;
18 
19 import android.support.annotation.Nullable;
20 import android.telecom.PhoneAccountHandle;
21 import com.google.auto.value.AutoValue;
22 import com.google.common.base.Optional;
23 
24 /** Info of an active call */
25 @AutoValue
26 @SuppressWarnings("Guava")
27 public abstract class ActiveCallInfo {
28 
29   /** The {@link PhoneAccountHandle} the call is made with */
phoneAccountHandle()30   public abstract Optional<PhoneAccountHandle> phoneAccountHandle();
31 
builder()32   public static Builder builder() {
33     return new AutoValue_ActiveCallInfo.Builder();
34   }
35 
36   /** Builder for {@link ActiveCallInfo}. Only In Call UI should create ActiveCallInfo */
37   @AutoValue.Builder
38   public abstract static class Builder {
39 
setPhoneAccountHandle(@ullable PhoneAccountHandle phoneAccountHandle)40     public Builder setPhoneAccountHandle(@Nullable PhoneAccountHandle phoneAccountHandle) {
41       return setPhoneAccountHandle(Optional.fromNullable(phoneAccountHandle));
42     }
43 
setPhoneAccountHandle(Optional<PhoneAccountHandle> phoneAccountHandle)44     public abstract Builder setPhoneAccountHandle(Optional<PhoneAccountHandle> phoneAccountHandle);
45 
build()46     public abstract ActiveCallInfo build();
47   }
48 }
49