From 0eb053e7cf651965f17e930d41301721a56ed871 Mon Sep 17 00:00:00 2001 From: Brad Ebinger Date: Mon, 26 Nov 2018 16:10:57 -0800 Subject: Do not start init until ACTION_UCE_SERVICE_UP We were trying to get the UCE service before it was sending the correct intent, which would sometimes cause it to lock up (in certain race conditions). Remove init when starting RCS service as well as when IMS is connected. The UCE_SERVICE_UP intent is sticky, so there is no problem restarting the RcsService if it crashes. Bug: 119309891 Test: Manual Change-Id: I39eeb5ca497408893b8a3e4e5b5644cfcecadf35 --- .../src/com/android/service/ims/RcsService.java | 3 -- .../com/android/service/ims/RcsStackAdaptor.java | 32 +++++----------------- 2 files changed, 7 insertions(+), 28 deletions(-) diff --git a/rcs/rcsservice/src/com/android/service/ims/RcsService.java b/rcs/rcsservice/src/com/android/service/ims/RcsService.java index 01f9fbd..c41e092 100644 --- a/rcs/rcsservice/src/com/android/service/ims/RcsService.java +++ b/rcs/rcsservice/src/com/android/service/ims/RcsService.java @@ -379,9 +379,6 @@ public class RcsService extends Service{ @Override public void onImsConnected(int imsRadioTech) { logger.debug("onImsConnected imsRadioTech=" + imsRadioTech); - if(mRcsStackAdaptor != null) { - mRcsStackAdaptor.checkSubService(); - } if(mPublication != null) { mPublication.onImsConnected(); diff --git a/rcs/rcsservice/src/com/android/service/ims/RcsStackAdaptor.java b/rcs/rcsservice/src/com/android/service/ims/RcsStackAdaptor.java index bd0f89c..d8cd345 100644 --- a/rcs/rcsservice/src/com/android/service/ims/RcsStackAdaptor.java +++ b/rcs/rcsservice/src/com/android/service/ims/RcsStackAdaptor.java @@ -515,9 +515,8 @@ public class RcsStackAdaptor{ mStackService = mImsUceManager.getUceServiceInstance(); logger.debug("doInitImsUceService mStackService=" + mStackService); - if (mStackService != null) { - startInitPresenceTimer(0, PRESENCE_INIT_TYPE_RCS_SERVICE_AVAILABLE); - } + // Do not connect to vendor UCE stack until ACTION_UCE_SERVICE_UP is called. + // The intent is sticky, so if we crash, we will get the UCE_SERVICE_UP intent again. } } @@ -560,7 +559,8 @@ public class RcsStackAdaptor{ boolean serviceStatus = false; serviceStatus = uceService.getServiceStatus(); - if (true == serviceStatus && mStackPresService == null) {//init only once. + //init only once and ensure connection to UCE service is available. + if (true == serviceStatus && mStackPresService == null && mStackService != null) { logger.print("initAllService : serviceStatus = true "); logger.debug("Create PresService"); mStackPresenceServiceHandle = mStackService.createPresenceService( @@ -576,7 +576,9 @@ public class RcsStackAdaptor{ mStackPresService = mStackService.getPresenceService(); ret = 0; } else { - logger.error("initAllService : serviceStatus = false "); + logger.error("initAllService : serviceStatus = false - serviceStatus: " + + serviceStatus + ", mStackPresService: " + mStackPresService + + ", mStackService: " + mStackService); } } catch (RemoteException e) { logger.error("initAllServices : DeadObjectException dialog "); @@ -587,26 +589,6 @@ public class RcsStackAdaptor{ return ret; } - // Init sub service when IMS get registered. - public void checkSubService() { - logger.debug("checkSubService"); - synchronized (mSyncObj) { - if (mStackPresService == null) { - // Cancel the retry timer. - if (mIsIniting) { - if (mRetryAlarmIntent != null) { - mAlarmManager.cancel(mRetryAlarmIntent); - mRetryAlarmIntent = null; - } - mIsIniting = false; - } - - // force to init imediately. - startInitPresenceTimer(0, PRESENCE_INIT_TYPE_IMS_REGISTERED); - } - } - } - public void startInitThread(int times){ final int currentRetry = times; Thread thread = new Thread(() -> { -- cgit v1.2.3