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.service.ims; 30 31 import android.content.Context; 32 import android.content.Intent; 33 import android.os.Handler; 34 import android.os.Looper; 35 import android.os.Message; 36 import android.os.Parcel; 37 import android.os.RemoteException; 38 import android.telephony.ims.RcsContactUceCapability; 39 import android.text.TextUtils; 40 import android.util.Log; 41 42 import com.android.ims.RcsManager; 43 import com.android.ims.RcsPresenceInfo; 44 import com.android.ims.internal.Logger; 45 import com.android.ims.internal.uce.common.StatusCode; 46 import com.android.ims.internal.uce.presence.IPresenceListener; 47 import com.android.ims.internal.uce.presence.PresCmdId; 48 import com.android.ims.internal.uce.presence.PresCmdStatus; 49 import com.android.ims.internal.uce.presence.PresPublishTriggerType; 50 import com.android.ims.internal.uce.presence.PresResInfo; 51 import com.android.ims.internal.uce.presence.PresRlmiInfo; 52 import com.android.ims.internal.uce.presence.PresSipResponse; 53 import com.android.ims.internal.uce.presence.PresSubscriptionState; 54 import com.android.ims.internal.uce.presence.PresTupleInfo; 55 import com.android.service.ims.presence.PresencePublication; 56 import com.android.service.ims.presence.PresenceSubscriber; 57 58 import java.util.ArrayList; 59 import java.util.Arrays; 60 61 public class StackListener extends Handler{ 62 /* 63 * The logger 64 */ 65 private Logger logger = Logger.getLogger(this.getClass().getName()); 66 67 Context mContext; 68 private PresencePublication mPresencePublication = null; 69 private PresenceSubscriber mPresenceSubscriber = null; 70 71 // RCS stack notify the AP to publish the presence. 72 private static final short PRESENCE_IMS_UNSOL_PUBLISH_TRIGGER = 1; 73 // PUBLISH CMD status changed 74 private static final short PRESENCE_IMS_UNSOL_PUBLISH_CMDSTATUS = 2; 75 // Received the SIP response for publish 76 private static final short PRESENCE_IMS_UNSOL_PUBLISH_SIPRESPONSE = 3; 77 // Received the presence for single contact 78 private static final short PRESENCE_IMS_UNSOL_NOTIFY_UPDATE = 4; 79 // Received the presence for contacts. 80 private static final short PRESENCE_IMS_UNSOL_NOTIFY_LIST_UPDATE = 5; 81 // Received the CMD status for capability/availability request 82 private static final short PRESENCE_IMS_UNSOL_NOTIFY_UPDATE_CMDSTATUS = 6; 83 // Received the SIP response for capability/availability request 84 private static final short PRESENCE_IMS_UNSOL_NOTIFY_UPDATE_SIPRESPONSE = 7; 85 86 private final Object mSyncObj = new Object(); 87 StackListener(Context context, Looper looper)88 public StackListener(Context context, Looper looper) { 89 super(looper); 90 mContext = context; 91 } 92 setPresencePublication(PresencePublication presencePublication)93 public void setPresencePublication(PresencePublication presencePublication) { 94 mPresencePublication = presencePublication; 95 } 96 setPresenceSubscriber(PresenceSubscriber presenceSubscriber)97 public void setPresenceSubscriber(PresenceSubscriber presenceSubscriber){ 98 mPresenceSubscriber = presenceSubscriber; 99 } 100 101 @Override handleMessage(Message msg)102 public void handleMessage(Message msg) { 103 super.handleMessage(msg); 104 105 logger.debug( "Thread=" + Thread.currentThread().getName() + " received " 106 + msg); 107 if(msg == null){ 108 logger.error("msg=null"); 109 return; 110 } 111 112 switch (msg.what) { 113 // RCS stack notify the AP to publish the presence. 114 case PRESENCE_IMS_UNSOL_PUBLISH_TRIGGER: 115 { 116 PresPublishTriggerType val = (PresPublishTriggerType) msg.obj; 117 if(mPresencePublication == null || val == null){ 118 logger.error("mPresencePublication=" + mPresencePublication + " val=" + val); 119 return; 120 } 121 122 mPresencePublication.onStackPublishRequested( 123 convertToStackPublishTriggerType(val.getPublishTrigeerType())); 124 break; 125 } 126 127 // RCS stack tell AP that the CMD status changed. 128 case PRESENCE_IMS_UNSOL_PUBLISH_CMDSTATUS: 129 { 130 PresCmdStatus pCmdStatus = (PresCmdStatus) msg.obj; 131 if(mPresencePublication == null || pCmdStatus == null) { 132 logger.error("mPresencePublication=" + mPresencePublication + 133 " pCmdStatus=" + pCmdStatus); 134 return; 135 } 136 137 int commandResult = RcsUtils.statusCodeToResultCode( 138 pCmdStatus.getStatus().getStatusCode()); 139 mPresencePublication.onCommandStatusUpdated(pCmdStatus.getUserData(), 140 pCmdStatus.getRequestId(), commandResult); 141 } 142 break; 143 144 // RCS stack tells AP that the CMD status changed. 145 case PRESENCE_IMS_UNSOL_NOTIFY_UPDATE_CMDSTATUS: 146 { 147 PresCmdStatus pCmdStatus = (PresCmdStatus) msg.obj; 148 if(mPresenceSubscriber == null || pCmdStatus == null){ 149 logger.error("mPresenceSubcriber=" + mPresenceSubscriber + 150 " pCmdStatus=" + pCmdStatus); 151 return; 152 } 153 int commandResult = RcsUtils.statusCodeToResultCode( 154 pCmdStatus.getStatus().getStatusCode()); 155 mPresenceSubscriber.onCommandStatusUpdated(pCmdStatus.getUserData(), 156 pCmdStatus.getRequestId(), commandResult); 157 break; 158 } 159 160 // RCS stack tells AP that the SIP response has been received. 161 case PRESENCE_IMS_UNSOL_PUBLISH_SIPRESPONSE: 162 { 163 PresSipResponse pSipResponse = (PresSipResponse) msg.obj; 164 if(mPresencePublication == null || pSipResponse == null) { 165 logger.error("mPresencePublication=" + mPresencePublication + 166 "pSipResponse=" +pSipResponse); 167 return; 168 } 169 170 mPresencePublication.onSipResponse(pSipResponse.getRequestId(), 171 pSipResponse.getSipResponseCode(), pSipResponse.getReasonPhrase()); 172 break; 173 } 174 175 // RCS stack tells AP that the SIP response has been received. 176 case PRESENCE_IMS_UNSOL_NOTIFY_UPDATE_SIPRESPONSE: 177 { 178 PresSipResponse pSipResponse = (PresSipResponse) msg.obj; 179 if(mPresenceSubscriber == null || pSipResponse == null){ 180 logger.error("mPresenceSubscriber=" + mPresenceSubscriber + 181 " pSipResponse=" + pSipResponse); 182 return; 183 } 184 185 mPresenceSubscriber.onSipResponse(pSipResponse.getRequestId(), 186 pSipResponse.getSipResponseCode(), pSipResponse.getReasonPhrase()); 187 break; 188 } 189 190 // RCS stack tells AP that the presence data has been received. 191 case PRESENCE_IMS_UNSOL_NOTIFY_UPDATE: 192 { 193 NotifyData notifyData = (NotifyData) msg.obj; 194 if(mPresenceSubscriber == null || notifyData == null){ 195 logger.error("mPresenceSubscriber=" + mPresenceSubscriber + 196 " notifyData=" + notifyData); 197 return; 198 } 199 RcsPresenceInfo rcsPresenceInfo = PresenceInfoParser.getPresenceInfoFromTuple( 200 notifyData.getUri(), notifyData.getTupleInfo()); 201 if(rcsPresenceInfo == null || TextUtils.isEmpty( 202 rcsPresenceInfo.getContactNumber())){ 203 logger.error("rcsPresenceInfo is null or " + 204 "TextUtils.isEmpty(rcsPresenceInfo.getContactNumber()"); 205 return; 206 } 207 mPresenceSubscriber.updatePresence( 208 PresenceInfoParser.getUceCapability(rcsPresenceInfo)); 209 break; 210 } 211 212 case PRESENCE_IMS_UNSOL_NOTIFY_LIST_UPDATE: 213 { 214 NotifyListData notifyListData = (NotifyListData) msg.obj; 215 logger.debug("Received PRESENCE_IMS_UNSOL_NOTIFY_LIST_UPDATE"); 216 if(mPresenceSubscriber==null || notifyListData == null){ 217 logger.error("mPresenceSubscriber=" + mPresenceSubscriber + 218 " notifyListData=" + notifyListData); 219 return; 220 } 221 222 RcsPresenceInfo[] rcsPresenceInfos = PresenceInfoParser. 223 getPresenceInfosFromPresenceRes(notifyListData.getRlmiInfo(), 224 notifyListData.getResInfo()); 225 if(rcsPresenceInfos == null){ 226 logger.error("updatePresences: rcsPresenceInfos == null"); 227 return; 228 } 229 230 PresRlmiInfo info = notifyListData.getRlmiInfo(); 231 boolean isTerminated = false; 232 if (info.getPresSubscriptionState() != null) { 233 if (info.getPresSubscriptionState().getPresSubscriptionStateValue() == 234 PresSubscriptionState.UCE_PRES_SUBSCRIPTION_STATE_TERMINATED) { 235 isTerminated = true; 236 } 237 } 238 239 ArrayList<RcsContactUceCapability> capabilities = new ArrayList<>(); 240 241 for (int i=0; i < rcsPresenceInfos.length; i++) { 242 if(rcsPresenceInfos[i] != null && TextUtils.isEmpty( 243 rcsPresenceInfos[i].getContactNumber())){ 244 continue; 245 } 246 RcsContactUceCapability capability = PresenceInfoParser.getUceCapability( 247 rcsPresenceInfos[i]); 248 if(capability != null && (capability.getContactUri() != null)){ 249 logger.debug("capability=" + capability); 250 capabilities.add(capability); 251 } 252 } 253 254 mPresenceSubscriber.updatePresences(info.getRequestId(), capabilities, isTerminated, 255 info.getSubscriptionTerminatedReason()); 256 break; 257 } 258 259 default: 260 logger.debug("Unknown mesg " + msg.what + " recieved."); 261 } 262 } 263 264 public class NotifyData{ 265 private String mUri; 266 private PresTupleInfo[] mTupleInfo; 267 NotifyData()268 NotifyData(){ 269 mUri = null; 270 mTupleInfo = null; 271 } 272 NotifyData(String uri, PresTupleInfo[] pTupleInfo)273 NotifyData(String uri, PresTupleInfo[] pTupleInfo){ 274 mUri = uri; 275 mTupleInfo = pTupleInfo; 276 } 277 getUri()278 public String getUri(){ 279 return mUri; 280 } 281 getTupleInfo()282 public PresTupleInfo[] getTupleInfo(){ 283 return mTupleInfo; 284 } 285 } 286 287 public class NotifyListData{ 288 private PresRlmiInfo mRlmiInfo; 289 private PresResInfo[] mResInfo; 290 NotifyListData()291 NotifyListData(){ 292 mRlmiInfo = null; 293 mResInfo = null; 294 } 295 NotifyListData(PresRlmiInfo pRlmiInfo, PresResInfo[] pResInfo)296 NotifyListData(PresRlmiInfo pRlmiInfo, PresResInfo[] pResInfo){ 297 mRlmiInfo = pRlmiInfo; 298 mResInfo = pResInfo; 299 } 300 getRlmiInfo()301 public PresRlmiInfo getRlmiInfo(){ 302 return mRlmiInfo; 303 } 304 getResInfo()305 public PresResInfo[] getResInfo(){ 306 return mResInfo; 307 } 308 } 309 310 public IPresenceListener mPresenceListener = new IPresenceListener.Stub() { 311 public boolean onTransact(int code, Parcel data, Parcel reply, int flags) 312 throws RemoteException{ 313 try{ 314 return super.onTransact(code, data, reply, flags); 315 } catch (RemoteException e) { 316 Log.w("ListenerHandler", "Unexpected remote exception", e); 317 e.printStackTrace(); 318 throw e; 319 } 320 } 321 322 public void getVersionCb(String pVersion) { 323 logger.debug("pVersion=" + pVersion); 324 } 325 326 public void sipResponseReceived(PresSipResponse pSipResponse) throws RemoteException { 327 synchronized(mSyncObj){ 328 if(pSipResponse == null){ 329 logger.error("ISipResponseReceived pSipResponse=null"); 330 return; 331 } 332 333 logger.debug("pSipResponse.getCmdId() "+ 334 pSipResponse.getCmdId().getCmdId()); 335 logger.debug("getReasonPhrase() "+pSipResponse.getReasonPhrase()); 336 logger.debug("getsRequestID() "+pSipResponse.getRequestId()); 337 logger.debug("getsSipResponseCode() "+pSipResponse.getSipResponseCode()); 338 339 switch (pSipResponse.getCmdId().getCmdId()) { 340 case PresCmdId.UCE_PRES_CMD_PUBLISHMYCAP: 341 { 342 Message updateMesgSipPub = StackListener.this.obtainMessage( 343 PRESENCE_IMS_UNSOL_PUBLISH_SIPRESPONSE, 344 pSipResponse); 345 StackListener.this.sendMessage(updateMesgSipPub); 346 break; 347 } 348 349 case PresCmdId.UCE_PRES_CMD_GETCONTACTCAP: 350 case PresCmdId.UCE_PRES_CMD_GETCONTACTLISTCAP: 351 { 352 Message updateMesgSipPub = StackListener.this.obtainMessage( 353 PRESENCE_IMS_UNSOL_NOTIFY_UPDATE_SIPRESPONSE, 354 pSipResponse); 355 StackListener.this.sendMessage(updateMesgSipPub); 356 357 break; 358 } 359 360 case PresCmdId.UCE_PRES_CMD_SETNEWFEATURETAG: 361 { 362 logger.debug("UCE_PRES_CMD_SETNEWFEATURETAG, doesn't care it"); 363 break; 364 } 365 366 default: 367 logger.debug("CMD ID for unknown value=" + 368 pSipResponse.getCmdId().getCmdId()); 369 } 370 } 371 } 372 373 public void serviceUnAvailable(StatusCode statusCode) throws RemoteException { 374 synchronized(mSyncObj){ 375 if(statusCode == null){ 376 logger.error("statusCode=null"); 377 }else{ 378 logger.debug("IServiceUnAvailable statusCode " + 379 statusCode.getStatusCode()); 380 } 381 logger.debug("QPresListener_ServiceUnAvailable"); 382 383 RcsStackAdaptor rcsStackAdaptor = RcsStackAdaptor.getInstance(null); 384 if (rcsStackAdaptor != null) { 385 rcsStackAdaptor.setImsEnableState(false); 386 } 387 388 Intent intent = new Intent(RcsManager.ACTION_RCS_SERVICE_UNAVAILABLE); 389 mContext.sendBroadcast(intent, 390 "com.android.ims.rcs.permission.STATUS_CHANGED"); 391 } 392 } 393 394 public void serviceAvailable(StatusCode statusCode) throws RemoteException { 395 synchronized(mSyncObj){ 396 if(statusCode == null){ 397 logger.error("statusCode=null"); 398 }else{ 399 logger.debug("IServiceAvailable statusCode " + 400 statusCode.getStatusCode()); 401 } 402 403 logger.debug("QPresListener_ServiceAvailable"); 404 405 RcsStackAdaptor rcsStackAdaptor = RcsStackAdaptor.getInstance(null); 406 if (rcsStackAdaptor != null) { 407 rcsStackAdaptor.setImsEnableState(true); 408 } 409 410 // Handle the cached trigger which got from stack 411 if(mPresencePublication != null) { 412 logger.debug("publish for cached trigger"); 413 mPresencePublication.onStackAvailable(); 414 } 415 416 Intent intent = new Intent(RcsManager.ACTION_RCS_SERVICE_AVAILABLE); 417 mContext.sendBroadcast(intent, 418 "com.android.ims.rcs.permission.STATUS_CHANGED"); 419 } 420 } 421 422 public void publishTriggering(PresPublishTriggerType publishTrigger) 423 throws RemoteException { 424 if(publishTrigger == null){ 425 logger.error("publishTrigger=null"); 426 }else{ 427 logger.debug("getPublishTrigeerType() "+ 428 publishTrigger.getPublishTrigeerType()); 429 } 430 logger.debug("ListenerHandler : PublishTriggering"); 431 432 Message publishTrigerMsg = StackListener.this.obtainMessage( 433 PRESENCE_IMS_UNSOL_PUBLISH_TRIGGER, publishTrigger); 434 StackListener.this.sendMessage(publishTrigerMsg); 435 } 436 437 public void listCapInfoReceived(PresRlmiInfo pRlmiInfo, PresResInfo[] pResInfo) 438 throws RemoteException { 439 if(pRlmiInfo == null || pResInfo == null){ 440 logger.error("pRlmiInfo=" + pRlmiInfo + " pResInfo=" + Arrays.toString(pResInfo)); 441 }else{ 442 logger.debug("pRlmiInfo.getListName "+pRlmiInfo.getListName()); 443 logger.debug("pRlmiInfo.isFullState "+pRlmiInfo.isFullState()); 444 logger.debug("pRlmiInfo.getUri "+pRlmiInfo.getUri()); 445 logger.debug("pRlmiInfo.getVersion "+pRlmiInfo.getVersion()); 446 logger.debug("pRlmiInfo.getSubscriptionTerminatedReason " + 447 pRlmiInfo.getSubscriptionTerminatedReason()); 448 logger.debug("pRlmiInfo.getPresSubscriptionState " + 449 pRlmiInfo.getPresSubscriptionState()); 450 logger.debug("pRlmiInfo.getRequestID=" + pRlmiInfo.getRequestId()); 451 for(int i=0; i < pResInfo.length; i++ ){ 452 if(pResInfo[i] == null){ 453 logger.debug("ignoring, pResInfo[" + i + "]=null"); 454 continue; 455 } 456 457 logger.debug(".getDisplayName() "+pResInfo[i].getDisplayName()); 458 logger.debug("getResUri() "+pResInfo[i].getResUri()); 459 if(pResInfo[i].getInstanceInfo() != null){ 460 logger.debug("getInstanceInfo().getPresentityUri() "+ 461 pResInfo[i].getInstanceInfo().getPresentityUri()); 462 logger.debug("getInstanceInfo().getResId() "+ 463 pResInfo[i].getInstanceInfo().getResId()); 464 logger.debug("getInstanceInfo().getsReason() "+ 465 pResInfo[i].getInstanceInfo().getReason()); 466 logger.debug("getInstanceInfo().getResInstanceState() "+ 467 pResInfo[i].getInstanceInfo().getResInstanceState()); 468 if(pResInfo[i].getInstanceInfo().getTupleInfo() == null){ 469 logger.debug("pResInfo[" + i +"].getInstanceInfo().getTupleInfo()=null"); 470 continue; 471 } 472 473 logger.debug("getTupleInfo().length "+ 474 pResInfo[i].getInstanceInfo().getTupleInfo().length); 475 if(pResInfo[i].getInstanceInfo().getTupleInfo() != null){ 476 for(int j = 0; j < pResInfo[i].getInstanceInfo().getTupleInfo().length; 477 j++) 478 { 479 if(pResInfo[i].getInstanceInfo().getTupleInfo() == null){ 480 logger.debug("ignoring, pResInfo[" + i + 481 "].getInstanceInfo().getTupleInfo()[" +j + "]"); 482 continue; 483 } 484 485 logger.debug("getFeatureTag "+ 486 pResInfo[i].getInstanceInfo().getTupleInfo()[j]. 487 getFeatureTag()); 488 logger.debug("getsContactUri "+ 489 pResInfo[i].getInstanceInfo().getTupleInfo()[j]. 490 getContactUri()); 491 logger.debug("getsTimestamp "+ 492 pResInfo[i].getInstanceInfo().getTupleInfo()[j]. 493 getTimestamp()); 494 } 495 } 496 } 497 } 498 } 499 500 Message notifyListReceivedMsg = StackListener.this.obtainMessage( 501 PRESENCE_IMS_UNSOL_NOTIFY_LIST_UPDATE, 502 new NotifyListData(pRlmiInfo, pResInfo)); 503 logger.debug("Send PRESENCE_IMS_UNSOL_NOTIFY_LIST_UPDATE"); 504 505 StackListener.this.sendMessage(notifyListReceivedMsg); 506 } 507 508 public void capInfoReceived(String presentityURI, PresTupleInfo[] pTupleInfo) 509 throws RemoteException { 510 logger.debug("ListenerHandler : CapInfoReceived"); 511 if(presentityURI == null) { 512 logger.error("presentityURI=null"); 513 return; 514 } 515 516 logger.debug("ListenerHandler : CapInfoReceived : presentityURI "+ presentityURI); 517 518 Message notifyReceivedMsg = StackListener.this.obtainMessage( 519 PRESENCE_IMS_UNSOL_NOTIFY_UPDATE, 520 new NotifyData(presentityURI, pTupleInfo)); 521 StackListener.this.sendMessage(notifyReceivedMsg); 522 } 523 524 public void cmdStatus(PresCmdStatus pCmdStatus) throws RemoteException { 525 synchronized(mSyncObj){ 526 if(pCmdStatus == null || pCmdStatus.getCmdId() == null){ 527 logger.debug( "ICMDStatus error, pCmdStatus="+ pCmdStatus); 528 return; 529 } 530 531 logger.debug("ListenerHandler : CMDStatus"); 532 logger.debug("ListenerHandler : CMDStatus : pCmdStatus.getRequestID() "+ 533 pCmdStatus.getRequestId()); 534 logger.debug("ListenerHandler : CMDStatus : pCmdStatus.getUserData() "+ 535 pCmdStatus.getUserData()); 536 logger.debug("ListenerHandler : CMDStatus : pCmdStatus.getCmdId() "+ 537 pCmdStatus.getCmdId().getCmdId()); 538 if(pCmdStatus.getStatus() != null){ 539 logger.debug("ListenerHandler : CMDStatus : pCmdStatus.getStatus() "+ 540 pCmdStatus.getStatus().getStatusCode()); 541 } 542 543 switch (pCmdStatus.getCmdId().getCmdId()) { 544 case PresCmdId.UCE_PRES_CMD_PUBLISHMYCAP: 545 Message publishCmdMsg = StackListener.this.obtainMessage( 546 PRESENCE_IMS_UNSOL_PUBLISH_CMDSTATUS, 547 pCmdStatus); 548 StackListener.this.sendMessage(publishCmdMsg); 549 break; 550 551 case PresCmdId.UCE_PRES_CMD_GETCONTACTCAP: 552 case PresCmdId.UCE_PRES_CMD_GETCONTACTLISTCAP: 553 Message notifyUpdateCmdMsg = StackListener.this.obtainMessage( 554 PRESENCE_IMS_UNSOL_NOTIFY_UPDATE_CMDSTATUS, 555 pCmdStatus); 556 StackListener.this.sendMessage(notifyUpdateCmdMsg); 557 break; 558 559 case PresCmdId.UCE_PRES_CMD_SETNEWFEATURETAG: 560 logger.debug("UCE_PRES_CMD_SETNEWFEATURETAG: app does not care it"); 561 break; 562 563 default: 564 logger.debug("CMD ID for unknown value=" + 565 pCmdStatus.getCmdId().getCmdId()); 566 } 567 } 568 } 569 570 public void unpublishMessageSent() { 571 logger.debug("unpublishMessageSent()"); 572 } 573 }; 574 575 @PresencePublication.StackPublishTriggerType convertToStackPublishTriggerType(int presPublishTriggerType)576 private static int convertToStackPublishTriggerType(int presPublishTriggerType) { 577 switch (presPublishTriggerType) { 578 case PresPublishTriggerType.UCE_PRES_PUBLISH_TRIGGER_ETAG_EXPIRED: 579 return PresencePublication.UCE_PRES_PUBLISH_TRIGGER_ETAG_EXPIRED; 580 case PresPublishTriggerType.UCE_PRES_PUBLISH_TRIGGER_MOVE_TO_LTE_VOPS_DISABLED: 581 return PresencePublication.UCE_PRES_PUBLISH_TRIGGER_MOVE_TO_LTE_VOPS_DISABLED; 582 case PresPublishTriggerType.UCE_PRES_PUBLISH_TRIGGER_MOVE_TO_LTE_VOPS_ENABLED: 583 return PresencePublication.UCE_PRES_PUBLISH_TRIGGER_MOVE_TO_LTE_VOPS_ENABLED; 584 case PresPublishTriggerType.UCE_PRES_PUBLISH_TRIGGER_MOVE_TO_EHRPD: 585 return PresencePublication.UCE_PRES_PUBLISH_TRIGGER_MOVE_TO_EHRPD; 586 case PresPublishTriggerType.UCE_PRES_PUBLISH_TRIGGER_MOVE_TO_HSPAPLUS: 587 return PresencePublication.UCE_PRES_PUBLISH_TRIGGER_MOVE_TO_HSPAPLUS; 588 case PresPublishTriggerType.UCE_PRES_PUBLISH_TRIGGER_MOVE_TO_3G: 589 return PresencePublication.UCE_PRES_PUBLISH_TRIGGER_MOVE_TO_3G; 590 case PresPublishTriggerType.UCE_PRES_PUBLISH_TRIGGER_MOVE_TO_2G: 591 return PresencePublication.UCE_PRES_PUBLISH_TRIGGER_MOVE_TO_2G; 592 case PresPublishTriggerType.UCE_PRES_PUBLISH_TRIGGER_MOVE_TO_WLAN: 593 return PresencePublication.UCE_PRES_PUBLISH_TRIGGER_MOVE_TO_WLAN; 594 case PresPublishTriggerType.UCE_PRES_PUBLISH_TRIGGER_MOVE_TO_IWLAN: 595 return PresencePublication.UCE_PRES_PUBLISH_TRIGGER_MOVE_TO_IWLAN; 596 } 597 return PresencePublication.UCE_PRES_PUBLISH_TRIGGER_UNKNOWN; 598 } 599 } 600 601