Call on urls changed callback when callback added
Now calling onSubscriberAssociatedUriChanged on IImsRegistrationCallback when the callback is first added to ImsRegistrationImplBase. Bug: 159301697 Test: Made phone call Test: Added unit test Change-Id: Ibfcb8aaae9d410a09ec98e57d77eccd34fcc222f
This commit is contained in:
@@ -29,6 +29,7 @@ import android.util.Log;
|
|||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.internal.telephony.util.RemoteCallbackListExt;
|
import com.android.internal.telephony.util.RemoteCallbackListExt;
|
||||||
|
import com.android.internal.util.ArrayUtils;
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
@@ -105,6 +106,11 @@ public class ImsRegistrationImplBase {
|
|||||||
// Locked on mLock, create unspecified disconnect cause.
|
// Locked on mLock, create unspecified disconnect cause.
|
||||||
private ImsReasonInfo mLastDisconnectCause = new ImsReasonInfo();
|
private ImsReasonInfo mLastDisconnectCause = new ImsReasonInfo();
|
||||||
|
|
||||||
|
// We hold onto the uris each time they change so that we can send it to a callback when its
|
||||||
|
// first added.
|
||||||
|
private Uri[] mUris = new Uri[0];
|
||||||
|
private boolean mUrisSet = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
@@ -208,19 +214,27 @@ public class ImsRegistrationImplBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The this device's subscriber associated {@link Uri}s have changed, which are used to filter
|
* Invoked when the {@link Uri}s associated to this device's subscriber have changed.
|
||||||
* out this device's {@link Uri}s during conference calling.
|
* These {@link Uri}s' are filtered out during conference calls.
|
||||||
* @param uris
|
*
|
||||||
|
* The {@link Uri}s are not guaranteed to be different between subsequent calls.
|
||||||
|
* @param uris changed uris
|
||||||
*/
|
*/
|
||||||
public final void onSubscriberAssociatedUriChanged(Uri[] uris) {
|
public final void onSubscriberAssociatedUriChanged(Uri[] uris) {
|
||||||
mCallbacks.broadcastAction((c) -> {
|
synchronized (mLock) {
|
||||||
try {
|
mUris = ArrayUtils.cloneOrNull(uris);
|
||||||
c.onSubscriberAssociatedUriChanged(uris);
|
mUrisSet = true;
|
||||||
} catch (RemoteException e) {
|
}
|
||||||
Log.w(LOG_TAG, e + " " + "onSubscriberAssociatedUriChanged() - Skipping " +
|
mCallbacks.broadcastAction((c) -> onSubscriberAssociatedUriChanged(c, uris));
|
||||||
"callback.");
|
}
|
||||||
|
|
||||||
|
private void onSubscriberAssociatedUriChanged(IImsRegistrationCallback callback, Uri[] uris) {
|
||||||
|
try {
|
||||||
|
callback.onSubscriberAssociatedUriChanged(uris);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Log.w(LOG_TAG, e + " " + "onSubscriberAssociatedUriChanged() - Skipping "
|
||||||
|
+ "callback.");
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateToState(@ImsRegistrationTech int connType, int newState) {
|
private void updateToState(@ImsRegistrationTech int connType, int newState) {
|
||||||
@@ -233,6 +247,10 @@ public class ImsRegistrationImplBase {
|
|||||||
|
|
||||||
private void updateToDisconnectedState(ImsReasonInfo info) {
|
private void updateToDisconnectedState(ImsReasonInfo info) {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
|
//We don't want to send this info over if we are disconnected
|
||||||
|
mUrisSet = false;
|
||||||
|
mUris = null;
|
||||||
|
|
||||||
updateToState(REGISTRATION_TECH_NONE,
|
updateToState(REGISTRATION_TECH_NONE,
|
||||||
RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED);
|
RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED);
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
@@ -260,12 +278,17 @@ public class ImsRegistrationImplBase {
|
|||||||
* @param c the newly registered callback that will be updated with the current registration
|
* @param c the newly registered callback that will be updated with the current registration
|
||||||
* state.
|
* state.
|
||||||
*/
|
*/
|
||||||
private void updateNewCallbackWithState(IImsRegistrationCallback c) throws RemoteException {
|
private void updateNewCallbackWithState(IImsRegistrationCallback c)
|
||||||
|
throws RemoteException {
|
||||||
int state;
|
int state;
|
||||||
ImsReasonInfo disconnectInfo;
|
ImsReasonInfo disconnectInfo;
|
||||||
|
boolean urisSet;
|
||||||
|
Uri[] uris;
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
state = mRegistrationState;
|
state = mRegistrationState;
|
||||||
disconnectInfo = mLastDisconnectCause;
|
disconnectInfo = mLastDisconnectCause;
|
||||||
|
urisSet = mUrisSet;
|
||||||
|
uris = mUris;
|
||||||
}
|
}
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED: {
|
case RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED: {
|
||||||
@@ -285,5 +308,8 @@ public class ImsRegistrationImplBase {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (urisSet) {
|
||||||
|
onSubscriberAssociatedUriChanged(c, uris);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user