Merge "[RCS] Create the new IMS RCS registration apis in AIDL ImsRcsController"

This commit is contained in:
James Lin
2020-01-10 01:45:56 +00:00
committed by Gerrit Code Review
2 changed files with 72 additions and 9 deletions

View File

@@ -35,6 +35,8 @@ import android.telephony.ims.feature.RcsFeature;
import android.telephony.ims.stub.ImsRegistrationImplBase; import android.telephony.ims.stub.ImsRegistrationImplBase;
import android.util.Log; import android.util.Log;
import com.android.internal.telephony.IIntegerConsumer;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import java.util.function.Consumer; import java.util.function.Consumer;
@@ -154,9 +156,20 @@ public class ImsRcsManager implements RegistrationManager {
if (executor == null) { if (executor == null) {
throw new IllegalArgumentException("Must include a non-null Executor."); throw new IllegalArgumentException("Must include a non-null Executor.");
} }
IImsRcsController imsRcsController = getIImsRcsController();
if (imsRcsController == null) {
Log.e(TAG, "Register registration callback: IImsRcsController is null");
throw new ImsException("Cannot find remote IMS service",
ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
}
c.setExecutor(executor); c.setExecutor(executor);
throw new UnsupportedOperationException("registerImsRegistrationCallback is not" try {
+ "supported."); imsRcsController.registerImsRegistrationCallback(mSubId, c.getBinder());
} catch (RemoteException | IllegalStateException e) {
throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
}
} }
/**{@inheritDoc}*/ /**{@inheritDoc}*/
@@ -167,8 +180,18 @@ public class ImsRcsManager implements RegistrationManager {
if (c == null) { if (c == null) {
throw new IllegalArgumentException("Must include a non-null RegistrationCallback."); throw new IllegalArgumentException("Must include a non-null RegistrationCallback.");
} }
throw new UnsupportedOperationException("unregisterImsRegistrationCallback is not"
+ "supported."); IImsRcsController imsRcsController = getIImsRcsController();
if (imsRcsController == null) {
Log.e(TAG, "Unregister registration callback: IImsRcsController is null");
throw new IllegalStateException("Cannot find remote IMS service");
}
try {
imsRcsController.unregisterImsRegistrationCallback(mSubId, c.getBinder());
} catch (RemoteException e) {
throw e.rethrowAsRuntimeException();
}
} }
/**{@inheritDoc}*/ /**{@inheritDoc}*/
@@ -182,8 +205,23 @@ public class ImsRcsManager implements RegistrationManager {
if (executor == null) { if (executor == null) {
throw new IllegalArgumentException("Must include a non-null Executor."); throw new IllegalArgumentException("Must include a non-null Executor.");
} }
throw new UnsupportedOperationException("getRegistrationState is not"
+ "supported."); IImsRcsController imsRcsController = getIImsRcsController();
if (imsRcsController == null) {
Log.e(TAG, "Get registration state error: IImsRcsController is null");
throw new IllegalStateException("Cannot find remote IMS service");
}
try {
imsRcsController.getImsRcsRegistrationState(mSubId, new IIntegerConsumer.Stub() {
@Override
public void accept(int result) {
executor.execute(() -> stateCallback.accept(result));
}
});
} catch (RemoteException e) {
throw e.rethrowAsRuntimeException();
}
} }
/**{@inheritDoc}*/ /**{@inheritDoc}*/
@@ -198,10 +236,25 @@ public class ImsRcsManager implements RegistrationManager {
if (executor == null) { if (executor == null) {
throw new IllegalArgumentException("Must include a non-null Executor."); throw new IllegalArgumentException("Must include a non-null Executor.");
} }
throw new UnsupportedOperationException("getRegistrationTransportType is not"
+ "supported.");
}
IImsRcsController imsRcsController = getIImsRcsController();
if (imsRcsController == null) {
Log.e(TAG, "Get registration transport type error: IImsRcsController is null");
throw new IllegalStateException("Cannot find remote IMS service");
}
try {
imsRcsController.getImsRcsRegistrationTransportType(mSubId,
new IIntegerConsumer.Stub() {
@Override
public void accept(int result) {
executor.execute(() -> transportTypeCallback.accept(result));
}
});
} catch (RemoteException e) {
throw e.rethrowAsRuntimeException();
}
}
/** /**
* Registers an {@link AvailabilityCallback} with the system, which will provide RCS * Registers an {@link AvailabilityCallback} with the system, which will provide RCS

View File

@@ -19,6 +19,9 @@ package android.telephony.ims.aidl;
import android.net.Uri; import android.net.Uri;
import android.telephony.ims.aidl.IImsCapabilityCallback; import android.telephony.ims.aidl.IImsCapabilityCallback;
import android.telephony.ims.aidl.IRcsUceControllerCallback; import android.telephony.ims.aidl.IRcsUceControllerCallback;
import android.telephony.ims.aidl.IImsRegistrationCallback;
import com.android.internal.telephony.IIntegerConsumer;
/** /**
* Interface used to interact with the Telephony IMS. * Interface used to interact with the Telephony IMS.
@@ -26,6 +29,13 @@ import android.telephony.ims.aidl.IRcsUceControllerCallback;
* {@hide} * {@hide}
*/ */
interface IImsRcsController { interface IImsRcsController {
// IMS RCS registration commands
void registerImsRegistrationCallback(int subId, IImsRegistrationCallback c);
void unregisterImsRegistrationCallback(int subId, IImsRegistrationCallback c);
void getImsRcsRegistrationState(int subId, IIntegerConsumer consumer);
void getImsRcsRegistrationTransportType(int subId, IIntegerConsumer consumer);
// IMS RCS capability commands
void registerRcsAvailabilityCallback(int subId, IImsCapabilityCallback c); void registerRcsAvailabilityCallback(int subId, IImsCapabilityCallback c);
void unregisterRcsAvailabilityCallback(int subId, IImsCapabilityCallback c); void unregisterRcsAvailabilityCallback(int subId, IImsCapabilityCallback c);
boolean isCapable(int subId, int capability, int radioTech); boolean isCapable(int subId, int capability, int radioTech);