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.dialer.enrichedcall; 18 19 import com.google.auto.value.AutoValue; 20 21 /** Value type holding enriched call capabilities. */ 22 @AutoValue 23 public abstract class EnrichedCallCapabilities { 24 25 public static final EnrichedCallCapabilities NO_CAPABILITIES = builder().build(); 26 27 public static final EnrichedCallCapabilities ALL_CAPABILITIES = 28 builder() 29 .setCallComposerCapable(true) 30 .setPostCallCapable(true) 31 .setVideoShareCapable(true) 32 .build(); 33 isCallComposerCapable()34 public abstract boolean isCallComposerCapable(); 35 isPostCallCapable()36 public abstract boolean isPostCallCapable(); 37 isVideoShareCapable()38 public abstract boolean isVideoShareCapable(); 39 toBuilder()40 public abstract Builder toBuilder(); 41 42 /** 43 * Returns {@code true} if these capabilities represent those of a user that is temporarily 44 * unavailable. This is an indication that capabilities should be refreshed. 45 */ isTemporarilyUnavailable()46 public abstract boolean isTemporarilyUnavailable(); 47 48 /** 49 * Creates an instance of {@link Builder}. 50 * 51 * <p>Unless otherwise set, all fields will default to false. 52 */ builder()53 public static Builder builder() { 54 return new AutoValue_EnrichedCallCapabilities.Builder() 55 .setCallComposerCapable(false) 56 .setPostCallCapable(false) 57 .setVideoShareCapable(false) 58 .setTemporarilyUnavailable(false); 59 } 60 61 /** Creates instances of {@link EnrichedCallCapabilities}. */ 62 @AutoValue.Builder 63 public abstract static class Builder { setCallComposerCapable(boolean isCapable)64 public abstract Builder setCallComposerCapable(boolean isCapable); 65 setPostCallCapable(boolean isCapable)66 public abstract Builder setPostCallCapable(boolean isCapable); 67 setVideoShareCapable(boolean isCapable)68 public abstract Builder setVideoShareCapable(boolean isCapable); 69 setTemporarilyUnavailable(boolean temporarilyUnavailable)70 public abstract Builder setTemporarilyUnavailable(boolean temporarilyUnavailable); 71 build()72 public abstract EnrichedCallCapabilities build(); 73 } 74 } 75