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.incallui.speakeasy; 18 19 import android.content.Context; 20 import android.support.annotation.NonNull; 21 import android.support.v4.app.Fragment; 22 import com.android.incallui.call.DialerCall; 23 import com.google.common.util.concurrent.ListenableFuture; 24 import java.util.Optional; 25 26 /** Provides operations necessary to SpeakEasy. */ 27 public interface SpeakEasyCallManager { 28 29 /** 30 * Returns the Fragment used to display data. 31 * 32 * <p>An absent optional indicates the feature is unavailable. 33 */ getSpeakEasyFragment(@onNull DialerCall call)34 Optional<Fragment> getSpeakEasyFragment(@NonNull DialerCall call); 35 36 /** 37 * Indicates a call has been removed. 38 * 39 * @param call The call which has been removed. 40 */ onCallRemoved(@onNull DialerCall call)41 void onCallRemoved(@NonNull DialerCall call); 42 43 /** 44 * Indicates there is a new incoming call that is about to be answered. 45 * 46 * @param call The call which is about to become active. 47 */ onNewIncomingCall(@onNull DialerCall call)48 ListenableFuture<Void> onNewIncomingCall(@NonNull DialerCall call); 49 50 /** 51 * Indicates the feature is available. 52 * 53 * @param context The application context. 54 */ isAvailable(@onNull Context context)55 boolean isAvailable(@NonNull Context context); 56 57 /** 58 * Optional: Performs work necessary to happen-before callers use other methods on this interface. 59 * 60 * @apiNote Use of this API is completely optional, and callers are NOT required to invoke this 61 * method prior to using other methods on the interface. 62 * @implSpec Other members of this interface always promise to do any required initialization work 63 * at the time they are invoked. This method will always be idempotent. 64 */ performManualInitialization()65 default void performManualInitialization() {} 66 67 /** Returns the config provider flag associated with the feature. */ 68 @NonNull getConfigProviderFlag()69 String getConfigProviderFlag(); 70 } 71