1 /* 2 * Copyright (c) 2015, Motorola Mobility LLC 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * - Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * - Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * - Neither the name of Motorola Mobility nor the 13 * names of its contributors may be used to endorse or promote products 14 * derived from this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 18 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MOTOROLA MOBILITY LLC BE LIABLE 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 26 * DAMAGE. 27 */ 28 29 package com.android.ims.internal; 30 31 import com.android.ims.IRcsPresenceListener; 32 33 import java.util.List; 34 35 /** 36 * @hide 37 */ 38 interface IRcsPresence { 39 /** 40 * Send the request to the server to get the capability. 41 * 1. If the presence service sent the request to network successfully 42 * then it will return the request ID (>0). It will not wait for the response from 43 * network. The response from network will be returned by callback onSuccess() or onError(). 44 * 2. If the presence service failed to send the request to network then it will return error 45 * code which is defined by RcsManager.ResultCode (<0). 46 * 3. If the network returns "200 OK" for a request then the listener.onSuccess() will be 47 * called by presence service. 48 * 4. If the network resturns "404" for a single target number then it means the target 49 * number is not VoLte capable, so the listener.onSuccess() will be called and intent 50 * ACTION_PRESENCE_CHANGED will be broadcasted by presence service. 51 * 5. If the network returns other error then the listener.onError() will be called by 52 * presence service. 53 * 6. If the network returns "200 OK" then we can expect the presence service receives notify 54 * from network. If the presence service receives notify then it will broadcast the 55 * intent ACTION_PRESENCE_CHANGED. If the notify state is "terminated" then the 56 * listener.onFinish() will be called by presence service as well. 57 * 7. If the presence service doesn't get response after "Subscribe Expiration + T1" then the 58 * listener.onTimeout() will be called by presence service. 59 * 60 * @param contactsNumber the contact number list which will be requested. 61 * @param listener the IRcsPresenceListener which will return the status and response. 62 * 63 * @return the request ID if it is >0. Or it is RcsManager.ResultCode for error. 64 * 65 * @see IRcsPresenceListener 66 * @see RcsManager.ResultCode 67 */ requestCapability(in List<String> contactsNumber, in IRcsPresenceListener listener)68 int requestCapability(in List<String> contactsNumber, 69 in IRcsPresenceListener listener); 70 71 /** 72 * Send the request to the server to get the availability. 73 * 1. If the presence service sent the request to network successfully then it will return 74 * the request ID (>0). 75 * 2. If the presence serive failed to send the request to network then it will return error 76 * code which is defined by RcsManager.ResultCode (<0). 77 * 3. If the network returns "200 OK" for a request then the listener.onSuccess() will be 78 * called by presence service. 79 * 4. If the network resturns "404" then it means the target number is not VoLte capable, 80 * so the listener.onSuccess() will be called and intent ACTION_PRESENCE_CHANGED will be 81 * broadcasted by presence service. 82 * 5. If the network returns other error code then the listener.onError() will be called by 83 * presence service. 84 * 6. If the network returns "200 OK" then we can expect the presence service receives notify 85 * from network. If the presence service receives notify then it will broadcast the intent 86 * ACTION_PRESENCE_CHANGED. If the notify state is "terminated" then the listener.onFinish() 87 * will be called by presence service as well. 88 * 7. If the presence service doesn't get response after "Subscribe Expiration + T1" then it 89 * will call listener.onTimeout(). 90 * 91 * @param contactNumber the contact which will request the availability. 92 * Only support phone number at present. 93 * @param listener the IRcsPresenceListener to get the response. 94 * 95 * @return the request ID if it is >0. Or it is RcsManager.ResultCode for error. 96 * 97 * @see IRcsPresenceListener 98 * @see RcsManager.ResultCode 99 * @see RcsPresence.ACTION_PRESENCE_CHANGED 100 */ requestAvailability(in String contactNumber, in IRcsPresenceListener listener)101 int requestAvailability(in String contactNumber, in IRcsPresenceListener listener); 102 103 /** 104 * Same as requestAvailability. but requestAvailability will consider throttle to avoid too 105 * fast call. Which means it will not send the request to network in next 60s for the same 106 * request. 107 * The error code SUBSCRIBE_TOO_FREQUENTLY will be returned under the case. 108 * But for this funcation it will always send the request to network. 109 * 110 * @see IRcsPresenceListener 111 * @see RcsManager.ResultCode 112 * @see RcsPresence.ACTION_PRESENCE_CHANGED 113 * @see ResultCode.SUBSCRIBE_TOO_FREQUENTLY 114 */ requestAvailabilityNoThrottle(in String contactNumber, in IRcsPresenceListener listener)115 int requestAvailabilityNoThrottle(in String contactNumber, in IRcsPresenceListener listener); 116 117 /** 118 * Get the latest publish state. 119 * 120 * @see RcsPresence.PublishState 121 */ getPublishState()122 int getPublishState(); 123 } 124