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 android.telephony.ims; 18 19 import android.annotation.NonNull; 20 import android.annotation.SystemApi; 21 import android.os.Bundle; 22 import android.os.RemoteException; 23 import android.telephony.ims.stub.ImsUtImplBase; 24 import android.util.Log; 25 26 import com.android.ims.internal.IImsUtListener; 27 28 /** 29 * Listener interface used to receive network responses back from UT supplementary service queries 30 * made by the framework. 31 * @hide 32 */ 33 // DO NOT remove or change the existing APIs, only add new ones to this Base implementation or you 34 // will break other implementations of ImsUt maintained by other ImsServices. 35 @SystemApi 36 public class ImsUtListener { 37 38 /** 39 * The {@link Bundle} key for a Calling Line Identification Restriction (CLIR) response. The 40 * value will be an int[] with two values: 41 * int[0] contains the 'n' parameter from TS 27.007 7.7, which is the 42 * outgoing CLIR state. See {@link ImsSsInfo#CLIR_OUTGOING_DEFAULT}, 43 * {@link ImsSsInfo#CLIR_OUTGOING_INVOCATION}, and {@link ImsSsInfo#CLIR_OUTGOING_SUPPRESSION}; 44 * int[1] contains the 'm' parameter from TS 27.007 7.7, which is the CLIR interrogation status. 45 * See {@link ImsSsInfo#CLIR_STATUS_NOT_PROVISIONED}, 46 * {@link ImsSsInfo#CLIR_STATUS_PROVISIONED_PERMANENT}, {@link ImsSsInfo#CLIR_STATUS_UNKNOWN}, 47 * {@link ImsSsInfo#CLIR_STATUS_TEMPORARILY_RESTRICTED}, and 48 * {@link ImsSsInfo#CLIR_STATUS_TEMPORARILY_ALLOWED}. 49 * @deprecated Use {@link #onLineIdentificationSupplementaryServiceResponse(int, ImsSsInfo)} 50 * instead, this key has been added for backwards compatibility with older proprietary 51 * implementations only and is being phased out. 52 */ 53 @Deprecated 54 public static final String BUNDLE_KEY_CLIR = "queryClir"; 55 56 /** 57 * The {@link Bundle} key for a Calling Line Identification Presentation (CLIP), Connected Line 58 * Identification Presentation (COLP), or Connected Line Identification Restriction (COLR) 59 * response. The value will be an instance of {@link ImsSsInfo}, which contains the response to 60 * the query. 61 * @deprecated Use {@link #onLineIdentificationSupplementaryServiceResponse(int, ImsSsInfo)} 62 * instead, this key has been added for backwards compatibility with older proprietary 63 * implementations only and is being phased out. 64 */ 65 @Deprecated 66 public static final String BUNDLE_KEY_SSINFO = "imsSsInfo"; 67 68 private IImsUtListener mServiceInterface; 69 private static final String LOG_TAG = "ImsUtListener"; 70 onUtConfigurationUpdated(int id)71 public void onUtConfigurationUpdated(int id) { 72 try { 73 mServiceInterface.utConfigurationUpdated(null, id); 74 } catch (RemoteException e) { 75 Log.w(LOG_TAG, "utConfigurationUpdated: remote exception"); 76 } 77 } 78 onUtConfigurationUpdateFailed(int id, ImsReasonInfo error)79 public void onUtConfigurationUpdateFailed(int id, ImsReasonInfo error) { 80 try { 81 mServiceInterface.utConfigurationUpdateFailed(null, id, error); 82 } catch (RemoteException e) { 83 Log.w(LOG_TAG, "utConfigurationUpdateFailed: remote exception"); 84 } 85 } 86 87 /** 88 * Notify the framework of a UT configuration response to a {@link ImsUtImplBase#queryClir()}, 89 * {@link ImsUtImplBase#queryClip()}, {@link ImsUtImplBase#queryColp()}, or 90 * {@link ImsUtImplBase#queryColr()} query for the transaction ID specified. If the query fails, 91 * {@link #onUtConfigurationQueryFailed(int, ImsReasonInfo)} should be called. 92 * @param id The ID associated with this UT configuration transaction from the framework. 93 * @param configuration A {@link Bundle} containing the result of querying the UT configuration. 94 * Must contain {@link #BUNDLE_KEY_CLIR} if it is a response to 95 * {@link ImsUtImplBase#queryClir()} or 96 * {@link #BUNDLE_KEY_SSINFO} if it is a response to 97 * {@link ImsUtImplBase#queryClip()}, {@link ImsUtImplBase#queryColp()}, or 98 * {@link ImsUtImplBase#queryColr()}. 99 * @deprecated Use {@link #onLineIdentificationSupplementaryServiceResponse(int, ImsSsInfo)} 100 * instead. 101 */ 102 @Deprecated onUtConfigurationQueried(int id, Bundle configuration)103 public void onUtConfigurationQueried(int id, Bundle configuration) { 104 try { 105 mServiceInterface.utConfigurationQueried(null, id, configuration); 106 } catch (RemoteException e) { 107 Log.w(LOG_TAG, "utConfigurationQueried: remote exception"); 108 } 109 } 110 111 /** 112 * Notify the framework of a UT configuration response to a {@link ImsUtImplBase#queryClir()}, 113 * {@link ImsUtImplBase#queryClip()}, {@link ImsUtImplBase#queryColp()}, or 114 * {@link ImsUtImplBase#queryColr()} query for the transaction ID specified. If the query fails, 115 * the framework should be notified via 116 * {@link #onUtConfigurationQueryFailed(int, ImsReasonInfo)}. 117 * @param id The ID associated with this UT configuration transaction from the framework. 118 * @param configuration An {@link ImsSsInfo} instance containing the configuration for the 119 * line identification supplementary service queried. 120 */ onLineIdentificationSupplementaryServiceResponse(int id, @NonNull ImsSsInfo configuration)121 public void onLineIdentificationSupplementaryServiceResponse(int id, 122 @NonNull ImsSsInfo configuration) { 123 try { 124 mServiceInterface.lineIdentificationSupplementaryServiceResponse(id, configuration); 125 } catch (RemoteException e) { 126 e.rethrowFromSystemServer(); 127 } 128 } 129 130 /** 131 * Notify the Framework of the line identification query failure. 132 * @param id The ID associated with the UT query transaction. 133 * @param error The query failure reason. 134 */ onUtConfigurationQueryFailed(int id, ImsReasonInfo error)135 public void onUtConfigurationQueryFailed(int id, ImsReasonInfo error) { 136 try { 137 mServiceInterface.utConfigurationQueryFailed(null, id, error); 138 } catch (RemoteException e) { 139 Log.w(LOG_TAG, "utConfigurationQueryFailed: remote exception"); 140 } 141 } 142 onUtConfigurationCallBarringQueried(int id, ImsSsInfo[] cbInfo)143 public void onUtConfigurationCallBarringQueried(int id, ImsSsInfo[] cbInfo) { 144 try { 145 mServiceInterface.utConfigurationCallBarringQueried(null, id, cbInfo); 146 } catch (RemoteException e) { 147 Log.w(LOG_TAG, "utConfigurationCallBarringQueried: remote exception"); 148 } 149 } 150 onUtConfigurationCallForwardQueried(int id, ImsCallForwardInfo[] cfInfo)151 public void onUtConfigurationCallForwardQueried(int id, ImsCallForwardInfo[] cfInfo) { 152 try { 153 mServiceInterface.utConfigurationCallForwardQueried(null, id, cfInfo); 154 } catch (RemoteException e) { 155 Log.w(LOG_TAG, "utConfigurationCallForwardQueried: remote exception"); 156 } 157 } 158 onUtConfigurationCallWaitingQueried(int id, ImsSsInfo[] cwInfo)159 public void onUtConfigurationCallWaitingQueried(int id, ImsSsInfo[] cwInfo) { 160 try { 161 mServiceInterface.utConfigurationCallWaitingQueried(null, id, cwInfo); 162 } catch (RemoteException e) { 163 Log.w(LOG_TAG, "utConfigurationCallWaitingQueried: remote exception"); 164 } 165 } 166 onSupplementaryServiceIndication(ImsSsData ssData)167 public void onSupplementaryServiceIndication(ImsSsData ssData) { 168 try { 169 mServiceInterface.onSupplementaryServiceIndication(ssData); 170 } catch (RemoteException e) { 171 Log.w(LOG_TAG, "onSupplementaryServiceIndication: remote exception"); 172 } 173 } 174 175 /** 176 * @hide 177 */ ImsUtListener(IImsUtListener serviceInterface)178 public ImsUtListener(IImsUtListener serviceInterface) { 179 mServiceInterface = serviceInterface; 180 } 181 182 /** 183 * @hide 184 */ getListenerInterface()185 public IImsUtListener getListenerInterface() { 186 return mServiceInterface; 187 } 188 } 189