Loading src/java/com/android/ims/FeatureConnector.java +5 −18 Original line number Diff line number Diff line Loading @@ -45,11 +45,6 @@ public class FeatureConnector<T extends IFeatureConnector> extends Handler { private static final int CEILING_SERVICE_RETRY_COUNT = 6; public interface Listener<T> { /** * Check if ImsFeature supported */ boolean isSupported(); /** * Get ImsFeature manager instance */ Loading Loading @@ -96,14 +91,6 @@ public class FeatureConnector<T extends IFeatureConnector> extends Handler { } }; public FeatureConnector(Context context, int phoneId, Listener<T> listener) { mContext = context; mPhoneId = phoneId; mListener = listener; mExecutor = new HandlerExecutor(this); mLogPrefix = "?"; } public FeatureConnector(Context context, int phoneId, Listener<T> listener, String logPrefix) { mContext = context; Loading Loading @@ -157,7 +144,7 @@ public class FeatureConnector<T extends IFeatureConnector> extends Handler { // Check if this ImsFeature is supported or not. private boolean isSupported() { return mListener.isSupported(); return ImsManager.isImsSupportedOnDevice(mContext); } /** Loading @@ -178,18 +165,18 @@ public class FeatureConnector<T extends IFeatureConnector> extends Handler { private final Runnable mGetServiceRunnable = () -> { try { createImsService(); } catch (ImsException e) { } catch (android.telephony.ims.ImsException e) { int errorCode = e.getCode(); if (DBG) logw("Create IMS service error: " + errorCode); if (ImsReasonInfo.CODE_LOCAL_IMS_NOT_SUPPORTED_ON_DEVICE != errorCode) { // Retry when error is not IMS_NOT_SUPPORTED_ON_DEVICE if (android.telephony.ims.ImsException.CODE_ERROR_UNSUPPORTED_OPERATION != errorCode) { // Retry when error is not CODE_ERROR_UNSUPPORTED_OPERATION retryGetImsService(); } } }; @VisibleForTesting public void createImsService() throws ImsException { public void createImsService() throws android.telephony.ims.ImsException { synchronized (mLock) { if (DBG) log("createImsService"); mManager = mListener.getFeatureManager(); Loading src/java/com/android/ims/IFeatureConnector.java +2 −2 Original line number Diff line number Diff line Loading @@ -16,9 +16,9 @@ package com.android.ims; public interface IFeatureConnector { public interface IFeatureConnector<T> { int getImsServiceState() throws ImsException; void addNotifyStatusChangedCallbackIfAvailable(FeatureConnection.IFeatureUpdate callback) throws ImsException; throws android.telephony.ims.ImsException; void removeNotifyStatusChangedCallback(FeatureConnection.IFeatureUpdate callback); } No newline at end of file src/java/com/android/ims/ImsCallbackAdapterManager.java +6 −6 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ import java.util.Set; import java.util.stream.Collectors; public abstract class ImsCallbackAdapterManager<T extends IInterface> { private static final String TAG = "ImsCallbackAdapterManager"; private static final String TAG = "ImsCallbackAM"; private final Context mContext; private final Object mLock; Loading Loading @@ -98,8 +98,8 @@ public abstract class ImsCallbackAdapterManager<T extends IInterface> { }; } // Add a callback to the MmTelFeature associated with this manager (independent of the) // current subscription. // Add a callback to the ImsFeature associated with this manager (independent of the // current subscription). public final void addCallback(T localCallback) { synchronized (mLock) { // Skip registering to callback subscription map here, because we are registering Loading @@ -124,7 +124,7 @@ public abstract class ImsCallbackAdapterManager<T extends IInterface> { } } // Removes a callback associated with the MmTelFeature. // Removes a callback associated with the ImsFeature. public final void removeCallback(T localCallback) { Log.i(TAG + " [" + mSlotId + "]", "Local callback removed: " + localCallback); synchronized (mLock) { Loading Loading @@ -255,9 +255,9 @@ public abstract class ImsCallbackAdapterManager<T extends IInterface> { } } // A callback has been registered. Register that callback with the MmTelFeature. // A callback has been registered. Register that callback with the ImsFeature. public abstract void registerCallback(T localCallback); // A callback has been removed, unregister that callback with the MmTelFeature. // A callback has been removed, unregister that callback with the RcsFeature. public abstract void unregisterCallback(T localCallback); } src/java/com/android/ims/ImsManager.java +4 −7 Original line number Diff line number Diff line Loading @@ -1557,10 +1557,10 @@ public class ImsManager implements IFeatureConnector { @Override @VisibleForTesting public void addNotifyStatusChangedCallbackIfAvailable(FeatureConnection.IFeatureUpdate c) throws ImsException { throws android.telephony.ims.ImsException { if (!mMmTelFeatureConnection.isBinderAlive()) { throw new ImsException("Binder is not active!", ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); throw new android.telephony.ims.ImsException("Can not connect to ImsService", android.telephony.ims.ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); } if (c != null) { mStatusCallbacks.add(c); Loading Loading @@ -2277,10 +2277,7 @@ public class ImsManager implements IFeatureConnector { } /** * Binds the IMS service to make/receive the call. Supports two methods of exposing an * ImsService: * 1) com.android.ims.ImsService implementation in ServiceManager (deprecated). * 2) android.telephony.ims.ImsService implementation through ImsResolver. * Creates a connection to the ImsService associated with this slot. */ private void createImsService() { mMmTelFeatureConnection = MmTelFeatureConnection.create(mContext, mPhoneId); Loading src/java/com/android/ims/MmTelFeatureConnection.java +2 −12 Original line number Diff line number Diff line Loading @@ -240,21 +240,11 @@ public class MmTelFeatureConnection extends FeatureConnection { @Override protected void onRemovedOrDied() { synchronized (mLock) { super.onRemovedOrDied(); mRegistrationCallbackManager.close(); mCapabilityCallbackManager.close(); mProvisioningCallbackManager.close(); if (mIsAvailable) { mIsAvailable = false; // invalidate caches. mRegistrationBinder = null; mConfigBinder = null; if (mBinder != null) { mBinder.unlinkToDeath(mDeathRecipient, 0); } if (mStatusCallback != null) { mStatusCallback.notifyUnavailable(); } } } } Loading Loading
src/java/com/android/ims/FeatureConnector.java +5 −18 Original line number Diff line number Diff line Loading @@ -45,11 +45,6 @@ public class FeatureConnector<T extends IFeatureConnector> extends Handler { private static final int CEILING_SERVICE_RETRY_COUNT = 6; public interface Listener<T> { /** * Check if ImsFeature supported */ boolean isSupported(); /** * Get ImsFeature manager instance */ Loading Loading @@ -96,14 +91,6 @@ public class FeatureConnector<T extends IFeatureConnector> extends Handler { } }; public FeatureConnector(Context context, int phoneId, Listener<T> listener) { mContext = context; mPhoneId = phoneId; mListener = listener; mExecutor = new HandlerExecutor(this); mLogPrefix = "?"; } public FeatureConnector(Context context, int phoneId, Listener<T> listener, String logPrefix) { mContext = context; Loading Loading @@ -157,7 +144,7 @@ public class FeatureConnector<T extends IFeatureConnector> extends Handler { // Check if this ImsFeature is supported or not. private boolean isSupported() { return mListener.isSupported(); return ImsManager.isImsSupportedOnDevice(mContext); } /** Loading @@ -178,18 +165,18 @@ public class FeatureConnector<T extends IFeatureConnector> extends Handler { private final Runnable mGetServiceRunnable = () -> { try { createImsService(); } catch (ImsException e) { } catch (android.telephony.ims.ImsException e) { int errorCode = e.getCode(); if (DBG) logw("Create IMS service error: " + errorCode); if (ImsReasonInfo.CODE_LOCAL_IMS_NOT_SUPPORTED_ON_DEVICE != errorCode) { // Retry when error is not IMS_NOT_SUPPORTED_ON_DEVICE if (android.telephony.ims.ImsException.CODE_ERROR_UNSUPPORTED_OPERATION != errorCode) { // Retry when error is not CODE_ERROR_UNSUPPORTED_OPERATION retryGetImsService(); } } }; @VisibleForTesting public void createImsService() throws ImsException { public void createImsService() throws android.telephony.ims.ImsException { synchronized (mLock) { if (DBG) log("createImsService"); mManager = mListener.getFeatureManager(); Loading
src/java/com/android/ims/IFeatureConnector.java +2 −2 Original line number Diff line number Diff line Loading @@ -16,9 +16,9 @@ package com.android.ims; public interface IFeatureConnector { public interface IFeatureConnector<T> { int getImsServiceState() throws ImsException; void addNotifyStatusChangedCallbackIfAvailable(FeatureConnection.IFeatureUpdate callback) throws ImsException; throws android.telephony.ims.ImsException; void removeNotifyStatusChangedCallback(FeatureConnection.IFeatureUpdate callback); } No newline at end of file
src/java/com/android/ims/ImsCallbackAdapterManager.java +6 −6 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ import java.util.Set; import java.util.stream.Collectors; public abstract class ImsCallbackAdapterManager<T extends IInterface> { private static final String TAG = "ImsCallbackAdapterManager"; private static final String TAG = "ImsCallbackAM"; private final Context mContext; private final Object mLock; Loading Loading @@ -98,8 +98,8 @@ public abstract class ImsCallbackAdapterManager<T extends IInterface> { }; } // Add a callback to the MmTelFeature associated with this manager (independent of the) // current subscription. // Add a callback to the ImsFeature associated with this manager (independent of the // current subscription). public final void addCallback(T localCallback) { synchronized (mLock) { // Skip registering to callback subscription map here, because we are registering Loading @@ -124,7 +124,7 @@ public abstract class ImsCallbackAdapterManager<T extends IInterface> { } } // Removes a callback associated with the MmTelFeature. // Removes a callback associated with the ImsFeature. public final void removeCallback(T localCallback) { Log.i(TAG + " [" + mSlotId + "]", "Local callback removed: " + localCallback); synchronized (mLock) { Loading Loading @@ -255,9 +255,9 @@ public abstract class ImsCallbackAdapterManager<T extends IInterface> { } } // A callback has been registered. Register that callback with the MmTelFeature. // A callback has been registered. Register that callback with the ImsFeature. public abstract void registerCallback(T localCallback); // A callback has been removed, unregister that callback with the MmTelFeature. // A callback has been removed, unregister that callback with the RcsFeature. public abstract void unregisterCallback(T localCallback); }
src/java/com/android/ims/ImsManager.java +4 −7 Original line number Diff line number Diff line Loading @@ -1557,10 +1557,10 @@ public class ImsManager implements IFeatureConnector { @Override @VisibleForTesting public void addNotifyStatusChangedCallbackIfAvailable(FeatureConnection.IFeatureUpdate c) throws ImsException { throws android.telephony.ims.ImsException { if (!mMmTelFeatureConnection.isBinderAlive()) { throw new ImsException("Binder is not active!", ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); throw new android.telephony.ims.ImsException("Can not connect to ImsService", android.telephony.ims.ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); } if (c != null) { mStatusCallbacks.add(c); Loading Loading @@ -2277,10 +2277,7 @@ public class ImsManager implements IFeatureConnector { } /** * Binds the IMS service to make/receive the call. Supports two methods of exposing an * ImsService: * 1) com.android.ims.ImsService implementation in ServiceManager (deprecated). * 2) android.telephony.ims.ImsService implementation through ImsResolver. * Creates a connection to the ImsService associated with this slot. */ private void createImsService() { mMmTelFeatureConnection = MmTelFeatureConnection.create(mContext, mPhoneId); Loading
src/java/com/android/ims/MmTelFeatureConnection.java +2 −12 Original line number Diff line number Diff line Loading @@ -240,21 +240,11 @@ public class MmTelFeatureConnection extends FeatureConnection { @Override protected void onRemovedOrDied() { synchronized (mLock) { super.onRemovedOrDied(); mRegistrationCallbackManager.close(); mCapabilityCallbackManager.close(); mProvisioningCallbackManager.close(); if (mIsAvailable) { mIsAvailable = false; // invalidate caches. mRegistrationBinder = null; mConfigBinder = null; if (mBinder != null) { mBinder.unlinkToDeath(mDeathRecipient, 0); } if (mStatusCallback != null) { mStatusCallback.notifyUnavailable(); } } } } Loading