diff options
| -rw-r--r-- | telephony/java/android/telephony/ims/ImsServiceProxy.java | 39 | ||||
| -rw-r--r-- | telephony/java/android/telephony/ims/ImsServiceProxyCompat.java | 36 |
2 files changed, 37 insertions, 38 deletions
diff --git a/telephony/java/android/telephony/ims/ImsServiceProxy.java b/telephony/java/android/telephony/ims/ImsServiceProxy.java index 31d3db44d6fe..a1471db85084 100644 --- a/telephony/java/android/telephony/ims/ImsServiceProxy.java +++ b/telephony/java/android/telephony/ims/ImsServiceProxy.java @@ -20,6 +20,7 @@ import android.app.PendingIntent; import android.os.IBinder; import android.os.Message; import android.os.RemoteException; +import android.telephony.ims.feature.IMMTelFeature; import android.telephony.ims.feature.IRcsFeature; import android.telephony.ims.feature.ImsFeature; import android.util.Log; @@ -41,9 +42,11 @@ import com.android.ims.internal.IImsUt; * @hide */ -public class ImsServiceProxy extends ImsServiceProxyCompat implements IRcsFeature { +public class ImsServiceProxy implements IMMTelFeature, IRcsFeature { protected String LOG_TAG = "ImsServiceProxy"; + protected final int mSlotId; + protected IBinder mBinder; private final int mSupportedFeature; // Start by assuming the proxy is available for usage. @@ -99,13 +102,13 @@ public class ImsServiceProxy extends ImsServiceProxyCompat implements IRcsFeatur }; public ImsServiceProxy(int slotId, IBinder binder, int featureType) { - super(slotId, binder); + mSlotId = slotId; + mBinder = binder; mSupportedFeature = featureType; } public ImsServiceProxy(int slotId, int featureType) { - super(slotId, null /*IBinder*/); - mSupportedFeature = featureType; + this(slotId, null, featureType); } public IImsServiceFeatureListener getListener() { @@ -263,7 +266,10 @@ public class ImsServiceProxy extends ImsServiceProxyCompat implements IRcsFeatur } } - @Override + /** + * @return an integer describing the current Feature Status, defined in + * {@link ImsFeature.ImsState}. + */ public int getFeatureStatus() { synchronized (mLock) { if (isBinderAlive() && mFeatureStatusCached != null) { @@ -305,7 +311,22 @@ public class ImsServiceProxy extends ImsServiceProxyCompat implements IRcsFeatur mStatusCallback = c; } - @Override + /** + * @return Returns true if the ImsService is ready to take commands, false otherwise. If this + * method returns false, it doesn't mean that the Binder connection is not available (use + * {@link #isBinderReady()} to check that), but that the ImsService is not accepting commands + * at this time. + * + * For example, for DSDS devices, only one slot can be {@link ImsFeature#STATE_READY} to take + * commands at a time, so the other slot must stay at {@link ImsFeature#STATE_NOT_AVAILABLE}. + */ + public boolean isBinderReady() { + return isBinderAlive() && getFeatureStatus() == ImsFeature.STATE_READY; + } + + /** + * @return false if the binder connection is no longer alive. + */ public boolean isBinderAlive() { return mIsAvailable && mBinder != null && mBinder.isBinderAlive(); } @@ -319,4 +340,10 @@ public class ImsServiceProxy extends ImsServiceProxyCompat implements IRcsFeatur private IImsServiceController getServiceInterface(IBinder b) { return IImsServiceController.Stub.asInterface(b); } + + protected void checkBinderConnection() throws RemoteException { + if (!isBinderAlive()) { + throw new RemoteException("ImsServiceProxy is not available for that feature."); + } + } } diff --git a/telephony/java/android/telephony/ims/ImsServiceProxyCompat.java b/telephony/java/android/telephony/ims/ImsServiceProxyCompat.java index 7ec92296448f..96471b658bf2 100644 --- a/telephony/java/android/telephony/ims/ImsServiceProxyCompat.java +++ b/telephony/java/android/telephony/ims/ImsServiceProxyCompat.java @@ -40,16 +40,12 @@ import com.android.ims.internal.IImsUt; * @hide */ -public class ImsServiceProxyCompat implements IMMTelFeature { +public class ImsServiceProxyCompat extends ImsServiceProxy { private static final int SERVICE_ID = ImsFeature.MMTEL; - protected final int mSlotId; - protected IBinder mBinder; - public ImsServiceProxyCompat(int slotId, IBinder binder) { - mSlotId = slotId; - mBinder = binder; + super(slotId, binder, SERVICE_ID); } @Override @@ -156,41 +152,17 @@ public class ImsServiceProxyCompat implements IMMTelFeature { checkBinderConnection(); return getServiceInterface(mBinder).getMultiEndpointInterface(SERVICE_ID); } - - /** - * Base implementation, always returns READY for compatibility with old ImsService. - */ + @Override public int getFeatureStatus() { return ImsFeature.STATE_READY; } - /** - * @return false if the binder connection is no longer alive. - */ + @Override public boolean isBinderAlive() { return mBinder != null && mBinder.isBinderAlive(); } - /** - * @return Returns true if the ImsService is ready to take commands, false otherwise. If this - * method returns false, it doesn't mean that the Binder connection is not available (use - * {@link #isBinderReady()} to check that), but that the ImsService is not accepting commands - * at this time. - * - * For example, for DSDS devices, only one slot can be {@link ImsFeature#STATE_READY} to take - * commands at a time, so the other slot must stay at {@link ImsFeature#STATE_NOT_AVAILABLE}. - */ - public boolean isBinderReady() { - return isBinderAlive() && getFeatureStatus() == ImsFeature.STATE_READY; - } - private IImsService getServiceInterface(IBinder b) { return IImsService.Stub.asInterface(b); } - - protected void checkBinderConnection() throws RemoteException { - if (!isBinderAlive()) { - throw new RemoteException("ImsServiceProxy is not available for that feature."); - } - } } |