1 /* 2 * Copyright (c) 2020 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.ims.rcs.uce.request; 18 19 import android.annotation.IntDef; 20 import android.net.Uri; 21 22 import java.lang.annotation.Retention; 23 import java.lang.annotation.RetentionPolicy; 24 import java.util.List; 25 26 /** 27 * The interface of the UCE request to request the capabilities from the carrier network. 28 */ 29 public interface UceRequest { 30 /** The request type: CAPABILITY */ 31 int REQUEST_TYPE_CAPABILITY = 1; 32 33 /** The request type: AVAILABILITY */ 34 int REQUEST_TYPE_AVAILABILITY = 2; 35 36 /**@hide*/ 37 @Retention(RetentionPolicy.SOURCE) 38 @IntDef(prefix = "REQUEST_TYPE_", value = { 39 REQUEST_TYPE_CAPABILITY, 40 REQUEST_TYPE_AVAILABILITY 41 }) 42 @interface UceRequestType {} 43 44 /** 45 * Set the UceRequestCoordinator ID associated with this request. 46 */ setRequestCoordinatorId(long coordinatorId)47 void setRequestCoordinatorId(long coordinatorId); 48 49 /** 50 * @return Return the UceRequestCoordinator ID associated with this request. 51 */ getRequestCoordinatorId()52 long getRequestCoordinatorId(); 53 54 /** 55 * @return Return the task ID of this request. 56 */ getTaskId()57 long getTaskId(); 58 59 /** 60 * Notify that the request is finish. 61 */ onFinish()62 void onFinish(); 63 64 /** 65 * Set the contact URIs associated with this request. 66 */ setContactUri(List<Uri> uris)67 void setContactUri(List<Uri> uris); 68 69 /** 70 * Execute the request. 71 */ executeRequest()72 void executeRequest(); 73 74 /** 75 * @return The number of retries for the current request. 76 */ getRetryCount()77 default int getRetryCount() { 78 return 0; 79 }; 80 81 /** 82 * Set the number of retries for the current request. 83 */ setRetryCount(int retries)84 default void setRetryCount(int retries) { 85 }; 86 87 /** 88 * @return The whether to allow request retry. 89 */ isRetryEnabled()90 default boolean isRetryEnabled() { 91 return false; 92 }; 93 94 /** 95 * Set whether to allow request retry. 96 */ setRetryEnabled(boolean enabled)97 default void setRetryEnabled(boolean enabled) { 98 }; 99 } 100