aboutsummaryrefslogtreecommitdiff
path: root/src/java/com/android/ims/RcsFeatureConnection.java
diff options
context:
space:
mode:
authorBrad Ebinger <breadley@google.com>2020-09-15 14:45:30 -0700
committerBrad Ebinger <breadley@google.com>2020-10-05 11:05:47 -0700
commit1e61c45c5c7c7e306ac9daede9ec63c1e6c7817c (patch)
tree0d93dccbe1d611c15d87ad0bfcb2df097836472c /src/java/com/android/ims/RcsFeatureConnection.java
parent635f3621542a394261ef77553d9f3626b0035144 (diff)
downloadims-1e61c45c5c7c7e306ac9daede9ec63c1e6c7817c.tar.gz
Move to a push model of querying ImsFeature Binders
[RESUBMISSION AFTER REVERT aosp/1426022] Instead of a polling model, allow listeners to instead listen for updates to a specific ImsFeature interface and get notified when they are available. FeatureConnectionRepository is used by the ImsServiceControllers to store new MMTEL and RCS feature binders along with the associated IMS config and registration interfaces that should be used along with them. Listeners can then register for updates to the ImsFeatures, including changes to capabilities and state. The FeatureConnector has also been refactored to listen ann update MmTel and RCS FeatureConnections in the ImsManager and RcsFeatureManager instances as Binders become available/unavailable or change when new SIM cards are inserted/removed instead of using a polling method of retrieving Binder instances. Fixes: 169864814 Test: atest ImsCommonTests Merged-In: Ie35b443ee2734c72f52d736f3980c1521a958d96 Change-Id: Ie35b443ee2734c72f52d736f3980c1521a958d96
Diffstat (limited to 'src/java/com/android/ims/RcsFeatureConnection.java')
-rw-r--r--src/java/com/android/ims/RcsFeatureConnection.java106
1 files changed, 7 insertions, 99 deletions
diff --git a/src/java/com/android/ims/RcsFeatureConnection.java b/src/java/com/android/ims/RcsFeatureConnection.java
index 62685436..b13b4027 100644
--- a/src/java/com/android/ims/RcsFeatureConnection.java
+++ b/src/java/com/android/ims/RcsFeatureConnection.java
@@ -111,45 +111,15 @@ public class RcsFeatureConnection extends FeatureConnection {
}
}
- public static @NonNull RcsFeatureConnection create(Context context , int slotId,
- IFeatureUpdate callback) {
-
- RcsFeatureConnection serviceProxy = new RcsFeatureConnection(context, slotId, callback);
-
- if (!ImsManager.isImsSupportedOnDevice(context)) {
- // Return empty service proxy in the case that IMS is not supported.
- sImsSupportedOnDevice = false;
- Rlog.w(TAG, "create: IMS is not supported");
- return serviceProxy;
- }
-
- TelephonyManager tm =
- (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
- if (tm == null) {
- Rlog.w(TAG, "create: TelephonyManager is null");
- return serviceProxy;
- }
-
- IImsRcsFeature binder = tm.getImsRcsFeatureAndListen(slotId, serviceProxy.getListener());
- if (binder != null) {
- Rlog.d(TAG, "create: set binder");
- serviceProxy.setBinder(binder.asBinder());
- // Trigger the cache to be updated for feature status.
- serviceProxy.getFeatureState();
- } else {
- Rlog.i(TAG, "create: binder is null! Slot Id: " + slotId);
- }
- return serviceProxy;
- }
-
@VisibleForTesting
public AvailabilityCallbackManager mAvailabilityCallbackManager;
@VisibleForTesting
public RegistrationCallbackManager mRegistrationCallbackManager;
- private RcsFeatureConnection(Context context, int slotId, IFeatureUpdate callback) {
- super(context, slotId);
- setStatusCallback(callback);
+ public RcsFeatureConnection(Context context, int slotId, IImsRcsFeature feature, IImsConfig c,
+ IImsRegistration r) {
+ super(context, slotId, c, r);
+ setBinder(feature.asBinder());
mAvailabilityCallbackManager = new AvailabilityCallbackManager(mContext);
mRegistrationCallbackManager = new RegistrationCallbackManager(mContext);
}
@@ -162,68 +132,12 @@ public class RcsFeatureConnection extends FeatureConnection {
@Override
protected void onRemovedOrDied() {
- removeImsFeatureCallback();
super.onRemovedOrDied();
synchronized (mLock) {
close();
}
}
- private void removeImsFeatureCallback() {
- TelephonyManager tm = getTelephonyManager();
- if (tm != null) {
- tm.unregisterImsFeatureCallback(mSlotId, ImsFeature.FEATURE_RCS, getListener());
- }
- }
-
- @Override
- @VisibleForTesting
- public void handleImsFeatureCreatedCallback(int slotId, int feature) {
- logi("IMS feature created: slotId= " + slotId + ", feature=" + feature);
- if (!isUpdateForThisFeatureAndSlot(slotId, feature)) {
- return;
- }
- synchronized(mLock) {
- if (!mIsAvailable) {
- logi("RCS enabled on slotId: " + slotId);
- mIsAvailable = true;
- }
- }
- }
-
- @Override
- @VisibleForTesting
- public void handleImsFeatureRemovedCallback(int slotId, int feature) {
- logi("IMS feature removed: slotId= " + slotId + ", feature=" + feature);
- if (!isUpdateForThisFeatureAndSlot(slotId, feature)) {
- return;
- }
- synchronized(mLock) {
- logi("Rcs UCE removed on slotId: " + slotId);
- onRemovedOrDied();
- }
- }
-
- @Override
- @VisibleForTesting
- public void handleImsStatusChangedCallback(int slotId, int feature, int status) {
- logi("IMS status changed: slotId=" + slotId + ", feature=" + feature + ", status="
- + status);
- if (!isUpdateForThisFeatureAndSlot(slotId, feature)) {
- return;
- }
- synchronized(mLock) {
- mFeatureStateCached = status;
- }
- }
-
- private boolean isUpdateForThisFeatureAndSlot(int slotId, int feature) {
- if (mSlotId == slotId && feature == ImsFeature.FEATURE_RCS) {
- return true;
- }
- return false;
- }
-
public void setRcsFeatureListener(IRcsFeatureListener listener) throws RemoteException {
synchronized (mLock) {
checkServiceIsReady();
@@ -331,15 +245,9 @@ public class RcsFeatureConnection extends FeatureConnection {
}
@Override
- protected IImsRegistration getRegistrationBinder() {
- TelephonyManager tm = getTelephonyManager();
- return tm != null ? tm.getImsRegistration(mSlotId, ImsFeature.FEATURE_RCS) : null;
- }
-
- @Override
- protected IImsConfig getConfigBinder() {
- TelephonyManager tm = getTelephonyManager();
- return tm != null ? tm.getImsConfig(mSlotId, ImsFeature.FEATURE_RCS) : null;
+ public void onFeatureCapabilitiesUpdated(long capabilities)
+ {
+ // doesn't do anything for RCS yet.
}
@VisibleForTesting