Switch class hierarchy of ImsServiceProxy and compat
The compat class should be a subclass of the
ImsServiceProxy, not the other way around.
Test: Manual
Change-Id: I2a2d37edaa6b68815c99988882957bf913236f25
diff --git a/telephony/java/android/telephony/ims/ImsServiceProxy.java b/telephony/java/android/telephony/ims/ImsServiceProxy.java
index 31d3db4..a1471db 100644
--- a/telephony/java/android/telephony/ims/ImsServiceProxy.java
+++ b/telephony/java/android/telephony/ims/ImsServiceProxy.java
@@ -20,6 +20,7 @@
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 @@
* @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 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 @@
}
}
- @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 @@
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 @@
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 7ec9229..96471b6 100644
--- a/telephony/java/android/telephony/ims/ImsServiceProxyCompat.java
+++ b/telephony/java/android/telephony/ims/ImsServiceProxyCompat.java
@@ -40,16 +40,12 @@
* @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 @@
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.");
- }
- }
}