Integrate IMS Registration API

Integrates the new IMS Registration API into the framework
and add two APIs for feature parity.

1) Moves ImsRegistrationImplBase to the android.telephony.ims
namespace
2) Expose ImsRegistration AIDL in TelephonyManager as hidden
API.
3) Adds onVoicemailCountUpdate and
onSubscriberAssociatedUriChanged APIs for feature parity.

Bug: 63987047
Test: Telephony unit tests, manual IMS tests
Change-Id: I51a8ae5cf58b81708c21adc1b26a9eb59f6280fd
This commit is contained in:
Brad Ebinger
2017-12-14 14:22:27 -08:00
parent e1daf52b92
commit 1fb6121035
14 changed files with 112 additions and 26 deletions

View File

@@ -471,8 +471,6 @@ java_library {
"telephony/java/android/telephony/ims/internal/aidl/IImsMmTelFeature.aidl",
"telephony/java/android/telephony/ims/internal/aidl/IImsMmTelListener.aidl",
"telephony/java/android/telephony/ims/internal/aidl/IImsRcsFeature.aidl",
"telephony/java/android/telephony/ims/internal/aidl/IImsRegistration.aidl",
"telephony/java/android/telephony/ims/internal/aidl/IImsRegistrationCallback.aidl",
"telephony/java/android/telephony/ims/internal/aidl/IImsServiceController.aidl",
"telephony/java/android/telephony/ims/internal/aidl/IImsServiceControllerListener.aidl",
"telephony/java/android/telephony/ims/internal/aidl/IImsSmsListener.aidl",
@@ -492,6 +490,8 @@ java_library {
"telephony/java/com/android/ims/internal/IImsFeatureStatusCallback.aidl",
"telephony/java/com/android/ims/internal/IImsMMTelFeature.aidl",
"telephony/java/com/android/ims/internal/IImsMultiEndpoint.aidl",
"telephony/java/com/android/ims/internal/IImsRegistration.aidl",
"telephony/java/com/android/ims/internal/IImsRegistrationCallback.aidl",
"telephony/java/com/android/ims/internal/IImsRcsFeature.aidl",
"telephony/java/com/android/ims/internal/IImsService.aidl",
"telephony/java/com/android/ims/internal/IImsServiceController.aidl",

View File

@@ -53,6 +53,7 @@ import android.util.Log;
import com.android.ims.internal.IImsMMTelFeature;
import com.android.ims.internal.IImsRcsFeature;
import com.android.ims.internal.IImsRegistration;
import com.android.ims.internal.IImsServiceFeatureCallback;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telecom.ITelecomService;
@@ -4931,6 +4932,25 @@ public class TelephonyManager {
return null;
}
/**
* @return the {@IImsRegistration} interface that corresponds with the slot index and feature.
* @param slotIndex The SIM slot corresponding to the ImsService ImsRegistration is active for.
* @param feature An integer indicating the feature that we wish to get the ImsRegistration for.
* Corresponds to features defined in ImsFeature.
* @hide
*/
public @Nullable IImsRegistration getImsRegistration(int slotIndex, int feature) {
try {
ITelephony telephony = getITelephony();
if (telephony != null) {
return telephony.getImsRegistration(slotIndex, feature);
}
} catch (RemoteException e) {
Rlog.e(TAG, "getImsRegistration, RemoteException: " + e.getMessage());
}
return null;
}
/**
* Set IMS registration state
*

View File

@@ -26,12 +26,14 @@ import android.telephony.CarrierConfigManager;
import android.telephony.ims.feature.ImsFeature;
import android.telephony.ims.feature.MMTelFeature;
import android.telephony.ims.feature.RcsFeature;
import android.telephony.ims.stub.ImsRegistrationImplBase;
import android.util.Log;
import android.util.SparseArray;
import com.android.ims.internal.IImsFeatureStatusCallback;
import com.android.ims.internal.IImsMMTelFeature;
import com.android.ims.internal.IImsRcsFeature;
import com.android.ims.internal.IImsRegistration;
import com.android.ims.internal.IImsServiceController;
import com.android.internal.annotations.VisibleForTesting;
@@ -113,6 +115,12 @@ public class ImsService extends Service {
throws RemoteException {
ImsService.this.removeImsFeature(slotId, featureType, c);
}
@Override
public IImsRegistration getRegistration(int slotId) throws RemoteException {
ImsRegistrationImplBase r = ImsService.this.getRegistration(slotId);
return r != null ? r.getBinder() : null;
}
};
/**
@@ -174,6 +182,8 @@ public class ImsService extends Service {
f.setSlotId(slotId);
f.addImsFeatureStatusCallback(c);
addImsFeature(slotId, featureType, f);
// TODO: Remove once new onFeatureReady AIDL is merged in.
f.onFeatureReady();
}
private void addImsFeature(int slotId, int featureType, ImsFeature f) {
@@ -236,4 +246,13 @@ public class ImsService extends Service {
public @Nullable RcsFeature onCreateRcsFeature(int slotId) {
return null;
}
/**
* @param slotId The slot that is associated with the IMS Registration.
* @return the ImsRegistration implementation associated with the slot.
* @hide
*/
public ImsRegistrationImplBase getRegistration(int slotId) {
return new ImsRegistrationImplBase();
}
}

View File

@@ -96,7 +96,7 @@ public abstract class ImsFeature {
new WeakHashMap<IImsFeatureStatusCallback, Boolean>());
private @ImsState int mState = STATE_NOT_AVAILABLE;
private int mSlotId = SubscriptionManager.INVALID_SIM_SLOT_INDEX;
private Context mContext;
protected Context mContext;
public void setContext(Context context) {
mContext = context;

View File

@@ -24,7 +24,6 @@ import android.telephony.CarrierConfigManager;
import android.telephony.ims.internal.aidl.IImsConfig;
import android.telephony.ims.internal.aidl.IImsMmTelFeature;
import android.telephony.ims.internal.aidl.IImsRcsFeature;
import android.telephony.ims.internal.aidl.IImsRegistration;
import android.telephony.ims.internal.aidl.IImsServiceController;
import android.telephony.ims.internal.aidl.IImsServiceControllerListener;
import android.telephony.ims.internal.feature.ImsFeature;
@@ -32,11 +31,12 @@ import android.telephony.ims.internal.feature.MmTelFeature;
import android.telephony.ims.internal.feature.RcsFeature;
import android.telephony.ims.internal.stub.ImsConfigImplBase;
import android.telephony.ims.internal.stub.ImsFeatureConfiguration;
import android.telephony.ims.internal.stub.ImsRegistrationImplBase;
import android.telephony.ims.stub.ImsRegistrationImplBase;
import android.util.Log;
import android.util.SparseArray;
import com.android.ims.internal.IImsFeatureStatusCallback;
import com.android.ims.internal.IImsRegistration;
import com.android.internal.annotations.VisibleForTesting;
/**

View File

@@ -24,4 +24,5 @@ import com.android.ims.internal.IImsCallSession;
*/
oneway interface IImsMmTelListener {
void onIncomingCall(IImsCallSession c);
void onVoiceMessageCountUpdate(int count);
}

View File

@@ -18,12 +18,12 @@ package android.telephony.ims.internal.aidl;
import android.telephony.ims.internal.aidl.IImsMmTelFeature;
import android.telephony.ims.internal.aidl.IImsRcsFeature;
import android.telephony.ims.internal.aidl.IImsRegistration;
import android.telephony.ims.internal.aidl.IImsConfig;
import android.telephony.ims.internal.aidl.IImsServiceControllerListener;
import android.telephony.ims.internal.stub.ImsFeatureConfiguration;
import com.android.ims.internal.IImsFeatureStatusCallback;
import com.android.ims.internal.IImsRegistration;
/**
* See ImsService and MmTelFeature for more information.

View File

@@ -18,7 +18,7 @@ package android.telephony.ims.internal.feature;
import android.os.Parcel;
import android.os.Parcelable;
import android.telephony.ims.internal.stub.ImsRegistrationImplBase;
import android.telephony.ims.stub.ImsRegistrationImplBase;
import android.util.ArraySet;
import java.util.ArrayList;

View File

@@ -28,8 +28,8 @@ import android.telephony.ims.internal.aidl.IImsCallSessionListener;
import android.telephony.ims.internal.aidl.IImsCapabilityCallback;
import android.telephony.ims.internal.aidl.IImsMmTelFeature;
import android.telephony.ims.internal.aidl.IImsMmTelListener;
import android.telephony.ims.internal.stub.ImsRegistrationImplBase;
import android.telephony.ims.internal.aidl.IImsSmsListener;
import android.telephony.ims.stub.ImsRegistrationImplBase;
import android.telephony.ims.stub.ImsEcbmImplBase;
import android.telephony.ims.stub.ImsMultiEndpointImplBase;
import android.telephony.ims.stub.ImsUtImplBase;
@@ -261,6 +261,15 @@ public class MmTelFeature extends ImsFeature {
onIncomingCall(new ImsCallSession(c));
}
/**
* Updates the Listener when the voice message count for IMS has changed.
* @param count an integer representing the new message count.
*/
@Override
public void onVoiceMessageCountUpdate(int count) {
}
/**
* Called when the IMS provider receives an incoming call.
* @param c The {@link ImsCallSession} associated with the new call.

View File

@@ -14,16 +14,19 @@
* limitations under the License
*/
package android.telephony.ims.internal.stub;
package android.telephony.ims.stub;
import android.annotation.IntDef;
import android.net.Uri;
import android.os.IBinder;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
import android.telephony.ims.internal.aidl.IImsRegistration;
import android.telephony.ims.internal.aidl.IImsRegistrationCallback;
import android.util.Log;
import com.android.ims.ImsReasonInfo;
import com.android.ims.internal.IImsRegistration;
import com.android.ims.internal.IImsRegistrationCallback;
import com.android.internal.annotations.VisibleForTesting;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -62,23 +65,25 @@ public class ImsRegistrationImplBase {
// Registration states, used to notify new ImsRegistrationImplBase#Callbacks of the current
// state.
// The unknown state is set as the initialization state. This is so that we do not call back
// with NOT_REGISTERED in the case where the ImsService has not updated the registration state
// yet.
private static final int REGISTRATION_STATE_UNKNOWN = -1;
private static final int REGISTRATION_STATE_NOT_REGISTERED = 0;
private static final int REGISTRATION_STATE_REGISTERING = 1;
private static final int REGISTRATION_STATE_REGISTERED = 2;
/**
* Callback class for receiving Registration callback events.
* @hide
*/
public static class Callback extends IImsRegistrationCallback.Stub {
public static class Callback {
/**
* Notifies the framework when the IMS Provider is connected to the IMS network.
*
* @param imsRadioTech the radio access technology. Valid values are defined in
* {@link ImsRegistrationTech}.
*/
@Override
public void onRegistered(@ImsRegistrationTech int imsRadioTech) {
}
@@ -88,7 +93,6 @@ public class ImsRegistrationImplBase {
* @param imsRadioTech the radio access technology. Valid values are defined in
* {@link ImsRegistrationTech}.
*/
@Override
public void onRegistering(@ImsRegistrationTech int imsRadioTech) {
}
@@ -97,7 +101,6 @@ public class ImsRegistrationImplBase {
*
* @param info the {@link ImsReasonInfo} associated with why registration was disconnected.
*/
@Override
public void onDeregistered(ImsReasonInfo info) {
}
@@ -108,10 +111,19 @@ public class ImsRegistrationImplBase {
* @param imsRadioTech The {@link ImsRegistrationTech} type that has failed
* @param info A {@link ImsReasonInfo} that identifies the reason for failure.
*/
@Override
public void onTechnologyChangeFailed(@ImsRegistrationTech int imsRadioTech,
ImsReasonInfo info) {
}
/**
* Returns a list of subscriber {@link Uri}s associated with this IMS subscription when
* it changes.
* @param uris new array of subscriber {@link Uri}s that are associated with this IMS
* subscription.
*/
public void onSubscriberAssociatedUriChanged(Uri[] uris) {
}
}
private final IImsRegistration mBinder = new IImsRegistration.Stub() {
@@ -139,9 +151,9 @@ public class ImsRegistrationImplBase {
private @ImsRegistrationTech
int mConnectionType = REGISTRATION_TECH_NONE;
// Locked on mLock
private int mRegistrationState = REGISTRATION_STATE_NOT_REGISTERED;
// Locked on mLock
private ImsReasonInfo mLastDisconnectCause;
private int mRegistrationState = REGISTRATION_STATE_UNKNOWN;
// Locked on mLock, create unspecified disconnect cause.
private ImsReasonInfo mLastDisconnectCause = new ImsReasonInfo();
public final IImsRegistration getBinder() {
return mBinder;
@@ -221,6 +233,17 @@ public class ImsRegistrationImplBase {
});
}
public final void onSubscriberAssociatedUriChanged(Uri[] uris) {
mCallbacks.broadcast((c) -> {
try {
c.onSubscriberAssociatedUriChanged(uris);
} catch (RemoteException e) {
Log.w(LOG_TAG, e + " " + "onSubscriberAssociatedUriChanged() - Skipping " +
"callback.");
}
});
}
private void updateToState(@ImsRegistrationTech int connType, int newState) {
synchronized (mLock) {
mConnectionType = connType;
@@ -241,7 +264,8 @@ public class ImsRegistrationImplBase {
}
}
private @ImsRegistrationTech int getConnectionType() {
@VisibleForTesting
public final @ImsRegistrationTech int getConnectionType() {
synchronized (mLock) {
return mConnectionType;
}
@@ -271,6 +295,10 @@ public class ImsRegistrationImplBase {
c.onRegistered(getConnectionType());
break;
}
case REGISTRATION_STATE_UNKNOWN: {
// Do not callback if the state has not been updated yet by the ImsService.
break;
}
}
}
}

View File

@@ -15,10 +15,9 @@
*/
package android.telephony.ims.internal.aidl;
package com.android.ims.internal;
import android.telephony.ims.internal.aidl.IImsRegistrationCallback;
import android.telephony.ims.internal.stub.ImsFeatureConfiguration;
import com.android.ims.internal.IImsRegistrationCallback;
/**
* See ImsRegistration for more information.

View File

@@ -15,8 +15,9 @@
*/
package android.telephony.ims.internal.aidl;
package com.android.ims.internal;
import android.net.Uri;
import android.telephony.ims.internal.stub.ImsFeatureConfiguration;
import com.android.ims.ImsReasonInfo;
@@ -31,4 +32,5 @@ oneway interface IImsRegistrationCallback {
void onRegistering(int imsRadioTech);
void onDeregistered(in ImsReasonInfo info);
void onTechnologyChangeFailed(int imsRadioTech, in ImsReasonInfo info);
void onSubscriberAssociatedUriChanged(in Uri[] uris);
}

View File

@@ -18,6 +18,7 @@ package com.android.ims.internal;
import com.android.ims.internal.IImsFeatureStatusCallback;
import com.android.ims.internal.IImsMMTelFeature;
import com.android.ims.internal.IImsRegistration;
import com.android.ims.internal.IImsRcsFeature;
/**
@@ -29,4 +30,5 @@ interface IImsServiceController {
IImsMMTelFeature createMMTelFeature(int slotId, in IImsFeatureStatusCallback c);
IImsRcsFeature createRcsFeature(int slotId, in IImsFeatureStatusCallback c);
void removeImsFeature(int slotId, int featureType, in IImsFeatureStatusCallback c);
IImsRegistration getRegistration(int slotId);
}

View File

@@ -40,6 +40,7 @@ import android.telephony.TelephonyHistogram;
import android.telephony.VisualVoicemailSmsFilterSettings;
import com.android.ims.internal.IImsMMTelFeature;
import com.android.ims.internal.IImsRcsFeature;
import com.android.ims.internal.IImsRegistration;
import com.android.ims.internal.IImsServiceFeatureCallback;
import com.android.internal.telephony.CellNetworkScanResult;
import com.android.internal.telephony.OperatorInfo;
@@ -807,6 +808,11 @@ interface ITelephony {
*/
IImsRcsFeature getRcsFeatureAndListen(int slotId, in IImsServiceFeatureCallback callback);
/**
* Returns the IImsRegistration associated with the slot and feature specified.
*/
IImsRegistration getImsRegistration(int slotId, int feature);
/**
* Set the network selection mode to automatic.
*