Merge "Add the ability to send the feature tags associated with IMS registration"
This commit is contained in:
@@ -42166,6 +42166,15 @@ package android.telephony.ims {
|
|||||||
field public static final int EXTRA_CODE_CALL_RETRY_SILENT_REDIAL = 2; // 0x2
|
field public static final int EXTRA_CODE_CALL_RETRY_SILENT_REDIAL = 2; // 0x2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final class ImsRegistrationAttributes implements android.os.Parcelable {
|
||||||
|
method public int describeContents();
|
||||||
|
method public int getAttributeFlags();
|
||||||
|
method @NonNull public java.util.Set<java.lang.String> getFeatureTags();
|
||||||
|
method public int getTransportType();
|
||||||
|
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||||
|
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsRegistrationAttributes> CREATOR;
|
||||||
|
}
|
||||||
|
|
||||||
public class RcsUceAdapter {
|
public class RcsUceAdapter {
|
||||||
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isUceSettingEnabled() throws android.telephony.ims.ImsException;
|
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isUceSettingEnabled() throws android.telephony.ims.ImsException;
|
||||||
}
|
}
|
||||||
@@ -42182,8 +42191,10 @@ package android.telephony.ims {
|
|||||||
|
|
||||||
public static class RegistrationManager.RegistrationCallback {
|
public static class RegistrationManager.RegistrationCallback {
|
||||||
ctor public RegistrationManager.RegistrationCallback();
|
ctor public RegistrationManager.RegistrationCallback();
|
||||||
method public void onRegistered(int);
|
method @Deprecated public void onRegistered(int);
|
||||||
method public void onRegistering(int);
|
method public void onRegistered(@NonNull android.telephony.ims.ImsRegistrationAttributes);
|
||||||
|
method @Deprecated public void onRegistering(int);
|
||||||
|
method public void onRegistering(@NonNull android.telephony.ims.ImsRegistrationAttributes);
|
||||||
method public void onTechnologyChangeFailed(int, @NonNull android.telephony.ims.ImsReasonInfo);
|
method public void onTechnologyChangeFailed(int, @NonNull android.telephony.ims.ImsReasonInfo);
|
||||||
method public void onUnregistered(@NonNull android.telephony.ims.ImsReasonInfo);
|
method public void onUnregistered(@NonNull android.telephony.ims.ImsReasonInfo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11552,6 +11552,8 @@ package android.telephony.ims {
|
|||||||
|
|
||||||
@Deprecated public static class ImsMmTelManager.RegistrationCallback extends android.telephony.ims.RegistrationManager.RegistrationCallback {
|
@Deprecated public static class ImsMmTelManager.RegistrationCallback extends android.telephony.ims.RegistrationManager.RegistrationCallback {
|
||||||
ctor @Deprecated public ImsMmTelManager.RegistrationCallback();
|
ctor @Deprecated public ImsMmTelManager.RegistrationCallback();
|
||||||
|
method @Deprecated public void onRegistered(int);
|
||||||
|
method @Deprecated public void onRegistering(int);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ImsRcsManager {
|
public class ImsRcsManager {
|
||||||
@@ -11569,6 +11571,16 @@ package android.telephony.ims {
|
|||||||
field public static final String EXTRA_MSG_SERVICE_NOT_AUTHORIZED = "Forbidden. Not Authorized for Service";
|
field public static final String EXTRA_MSG_SERVICE_NOT_AUTHORIZED = "Forbidden. Not Authorized for Service";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final class ImsRegistrationAttributes implements android.os.Parcelable {
|
||||||
|
method public int getRegistrationTechnology();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final class ImsRegistrationAttributes.Builder {
|
||||||
|
ctor public ImsRegistrationAttributes.Builder(int);
|
||||||
|
method @NonNull public android.telephony.ims.ImsRegistrationAttributes build();
|
||||||
|
method @NonNull public android.telephony.ims.ImsRegistrationAttributes.Builder setFeatureTags(@NonNull java.util.Set<java.lang.String>);
|
||||||
|
}
|
||||||
|
|
||||||
public class ImsService extends android.app.Service {
|
public class ImsService extends android.app.Service {
|
||||||
ctor public ImsService();
|
ctor public ImsService();
|
||||||
method public android.telephony.ims.feature.MmTelFeature createMmTelFeature(int);
|
method public android.telephony.ims.feature.MmTelFeature createMmTelFeature(int);
|
||||||
@@ -12352,7 +12364,9 @@ package android.telephony.ims.stub {
|
|||||||
ctor public ImsRegistrationImplBase();
|
ctor public ImsRegistrationImplBase();
|
||||||
method public final void onDeregistered(android.telephony.ims.ImsReasonInfo);
|
method public final void onDeregistered(android.telephony.ims.ImsReasonInfo);
|
||||||
method public final void onRegistered(int);
|
method public final void onRegistered(int);
|
||||||
|
method public final void onRegistered(@NonNull android.telephony.ims.ImsRegistrationAttributes);
|
||||||
method public final void onRegistering(int);
|
method public final void onRegistering(int);
|
||||||
|
method public final void onRegistering(@NonNull android.telephony.ims.ImsRegistrationAttributes);
|
||||||
method public final void onSubscriberAssociatedUriChanged(android.net.Uri[]);
|
method public final void onSubscriberAssociatedUriChanged(android.net.Uri[]);
|
||||||
method public final void onTechnologyChangeFailed(int, android.telephony.ims.ImsReasonInfo);
|
method public final void onTechnologyChangeFailed(int, android.telephony.ims.ImsReasonInfo);
|
||||||
method public void triggerFullNetworkRegistration(@IntRange(from=100, to=699) int, @Nullable String);
|
method public void triggerFullNetworkRegistration(@IntRange(from=100, to=699) int, @Nullable String);
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2021 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package android.telephony.ims;
|
||||||
|
|
||||||
|
parcelable ImsRegistrationAttributes;
|
||||||
@@ -0,0 +1,219 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package android.telephony.ims;
|
||||||
|
|
||||||
|
import android.annotation.NonNull;
|
||||||
|
import android.annotation.Nullable;
|
||||||
|
import android.annotation.SystemApi;
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
import android.telephony.AccessNetworkConstants;
|
||||||
|
import android.telephony.ims.stub.ImsRegistrationImplBase;
|
||||||
|
import android.util.ArraySet;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains the attributes associated with the current IMS registration.
|
||||||
|
*/
|
||||||
|
public final class ImsRegistrationAttributes implements Parcelable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builder for creating {@link ImsRegistrationAttributes} instances.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@SystemApi
|
||||||
|
public static final class Builder {
|
||||||
|
private final int mRegistrationTech;
|
||||||
|
private Set<String> mFeatureTags = Collections.emptySet();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build a new instance of {@link ImsRegistrationAttributes}.
|
||||||
|
*
|
||||||
|
* @param registrationTech The Radio Access Technology that IMS is registered on.
|
||||||
|
*/
|
||||||
|
public Builder(@ImsRegistrationImplBase.ImsRegistrationTech int registrationTech) {
|
||||||
|
mRegistrationTech = registrationTech;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Optional IMS feature tags included in this IMS registration.
|
||||||
|
* @param tags A set of Strings containing the MMTEL and RCS feature tags associated with
|
||||||
|
* the IMS registration. This information is used for services such as the UCE
|
||||||
|
* service to ascertain the complete IMS registration state to ensure the SIP
|
||||||
|
* PUBLISH is accurate. The format of the set of feature tags must be one feature
|
||||||
|
* tag key and value per entry. Each feature tag will contain the feature tag name
|
||||||
|
* and string value (if applicable), even if they have the same feature tag name.
|
||||||
|
* For example,
|
||||||
|
* {@code +g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.oma.cpm.msg,
|
||||||
|
* urn%3Aurn-7%3A3gpp-service.ims.icsi.oma.cpm.session", +g.gsma.callcomposer} must
|
||||||
|
* be split into three feature tag entries:
|
||||||
|
* {@code {+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.oma.cpm.msg",
|
||||||
|
* +g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.oma.cpm.session",
|
||||||
|
* +g.gsma.callcomposer}}.
|
||||||
|
*/
|
||||||
|
public @NonNull Builder setFeatureTags(@NonNull Set<String> tags) {
|
||||||
|
if (tags == null) {
|
||||||
|
throw new IllegalArgumentException("feature tag set must not be null");
|
||||||
|
}
|
||||||
|
mFeatureTags = new ArraySet<>(tags);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return A new instance created from this builder.
|
||||||
|
*/
|
||||||
|
public @NonNull ImsRegistrationAttributes build() {
|
||||||
|
return new ImsRegistrationAttributes(mRegistrationTech,
|
||||||
|
RegistrationManager.getAccessType(mRegistrationTech),
|
||||||
|
0 /* No attributes in AOSP */, mFeatureTags);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private final int mRegistrationTech;
|
||||||
|
private final int mTransportType;
|
||||||
|
private final int mImsAttributeFlags;
|
||||||
|
private final ArrayList<String> mFeatureTags;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new {@link ImsRegistrationAttributes} instance.
|
||||||
|
*
|
||||||
|
* @param registrationTech The technology that IMS has been registered on.
|
||||||
|
* @param transportType The transport type that IMS has been registered on.
|
||||||
|
* @param imsAttributeFlags The attributes associated with the IMS registration.
|
||||||
|
* @param featureTags The feature tags included in the IMS registration.
|
||||||
|
* @see Builder
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public ImsRegistrationAttributes(
|
||||||
|
@ImsRegistrationImplBase.ImsRegistrationTech int registrationTech,
|
||||||
|
@AccessNetworkConstants.TransportType int transportType,
|
||||||
|
int imsAttributeFlags,
|
||||||
|
@Nullable Set<String> featureTags) {
|
||||||
|
mRegistrationTech = registrationTech;
|
||||||
|
mTransportType = transportType;
|
||||||
|
mImsAttributeFlags = imsAttributeFlags;
|
||||||
|
mFeatureTags = new ArrayList<>(featureTags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**@hide*/
|
||||||
|
public ImsRegistrationAttributes(Parcel source) {
|
||||||
|
mRegistrationTech = source.readInt();
|
||||||
|
mTransportType = source.readInt();
|
||||||
|
mImsAttributeFlags = source.readInt();
|
||||||
|
mFeatureTags = new ArrayList<>();
|
||||||
|
source.readList(mFeatureTags, null /*classloader*/);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The Radio Access Technology that the IMS registration has been registered over.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@SystemApi
|
||||||
|
public @ImsRegistrationImplBase.ImsRegistrationTech int getRegistrationTechnology() {
|
||||||
|
return mRegistrationTech;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The access network transport type that IMS has been registered over.
|
||||||
|
*/
|
||||||
|
public @AccessNetworkConstants.TransportType int getTransportType() {
|
||||||
|
return mTransportType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return A bit-mask containing attributes associated with the IMS registration.
|
||||||
|
*/
|
||||||
|
public int getAttributeFlags() {
|
||||||
|
return mImsAttributeFlags;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Set of feature tags associated with the current IMS registration, if the IMS
|
||||||
|
* service supports supplying this information.
|
||||||
|
* <p>
|
||||||
|
* The format of the set of feature tags will be one feature tag key and value per entry and
|
||||||
|
* will potentially contain MMTEL and RCS feature tags, depending the configuration of the IMS
|
||||||
|
* service associated with the registration indications. Each feature tag will contain the
|
||||||
|
* feature tag name and string value (if applicable), even if they have the same feature tag
|
||||||
|
* name. For example, {@code +g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.oma.cpm.msg,
|
||||||
|
* urn%3Aurn-7%3A3gpp-service.ims.icsi.oma.cpm.session", +g.gsma.callcomposer} will be split
|
||||||
|
* into three feature tag entries:
|
||||||
|
* {@code {+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.oma.cpm.msg",
|
||||||
|
* +g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.oma.cpm.session",
|
||||||
|
* +g.gsma.callcomposer}}.
|
||||||
|
* @return The Set of feature tags associated with the current IMS registration.
|
||||||
|
*/
|
||||||
|
public @NonNull Set<String> getFeatureTags() {
|
||||||
|
if (mFeatureTags == null) {
|
||||||
|
return Collections.emptySet();
|
||||||
|
}
|
||||||
|
return new ArraySet<>(mFeatureTags);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||||
|
dest.writeInt(mRegistrationTech);
|
||||||
|
dest.writeInt(mTransportType);
|
||||||
|
dest.writeInt(mImsAttributeFlags);
|
||||||
|
dest.writeList(mFeatureTags);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final @NonNull Creator<ImsRegistrationAttributes> CREATOR =
|
||||||
|
new Creator<ImsRegistrationAttributes>() {
|
||||||
|
@Override
|
||||||
|
public ImsRegistrationAttributes createFromParcel(Parcel source) {
|
||||||
|
return new ImsRegistrationAttributes(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ImsRegistrationAttributes[] newArray(int size) {
|
||||||
|
return new ImsRegistrationAttributes[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
ImsRegistrationAttributes that = (ImsRegistrationAttributes) o;
|
||||||
|
return mRegistrationTech == that.mRegistrationTech
|
||||||
|
&& mTransportType == that.mTransportType
|
||||||
|
&& mImsAttributeFlags == that.mImsAttributeFlags
|
||||||
|
&& Objects.equals(mFeatureTags, that.mFeatureTags);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(mRegistrationTech, mTransportType, mImsAttributeFlags, mFeatureTags);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ImsRegistrationAttributes { transportType= " + mTransportType + ", attributeFlags="
|
||||||
|
+ mImsAttributeFlags + ", featureTags=[" + mFeatureTags + "]}";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -71,7 +71,6 @@ public interface RegistrationManager {
|
|||||||
*/
|
*/
|
||||||
int REGISTRATION_STATE_REGISTERED = 2;
|
int REGISTRATION_STATE_REGISTERED = 2;
|
||||||
|
|
||||||
|
|
||||||
/**@hide*/
|
/**@hide*/
|
||||||
// Translate ImsRegistrationImplBase API to new AccessNetworkConstant because WLAN
|
// Translate ImsRegistrationImplBase API to new AccessNetworkConstant because WLAN
|
||||||
// and WWAN are more accurate constants.
|
// and WWAN are more accurate constants.
|
||||||
@@ -79,7 +78,8 @@ public interface RegistrationManager {
|
|||||||
new HashMap<Integer, Integer>() {{
|
new HashMap<Integer, Integer>() {{
|
||||||
// Map NONE to -1 to make sure that we handle the REGISTRATION_TECH_NONE
|
// Map NONE to -1 to make sure that we handle the REGISTRATION_TECH_NONE
|
||||||
// case, since it is defined.
|
// case, since it is defined.
|
||||||
put(ImsRegistrationImplBase.REGISTRATION_TECH_NONE, -1);
|
put(ImsRegistrationImplBase.REGISTRATION_TECH_NONE,
|
||||||
|
AccessNetworkConstants.TRANSPORT_TYPE_INVALID);
|
||||||
put(ImsRegistrationImplBase.REGISTRATION_TECH_LTE,
|
put(ImsRegistrationImplBase.REGISTRATION_TECH_LTE,
|
||||||
AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
|
AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
|
||||||
put(ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN,
|
put(ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN,
|
||||||
@@ -102,6 +102,20 @@ public interface RegistrationManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param regtech The registration technology.
|
||||||
|
* @return The Access Network type from registration technology.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
static int getAccessType(int regtech) {
|
||||||
|
if (!RegistrationManager.IMS_REG_TO_ACCESS_TYPE_MAP.containsKey(regtech)) {
|
||||||
|
Log.w("RegistrationManager", "getAccessType - invalid regType returned: "
|
||||||
|
+ regtech);
|
||||||
|
return AccessNetworkConstants.TRANSPORT_TYPE_INVALID;
|
||||||
|
}
|
||||||
|
return RegistrationManager.IMS_REG_TO_ACCESS_TYPE_MAP.get(regtech);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback class for receiving IMS network Registration callback events.
|
* Callback class for receiving IMS network Registration callback events.
|
||||||
* @see #registerImsRegistrationCallback(Executor, RegistrationCallback)
|
* @see #registerImsRegistrationCallback(Executor, RegistrationCallback)
|
||||||
@@ -119,26 +133,24 @@ public interface RegistrationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRegistered(int imsRadioTech) {
|
public void onRegistered(ImsRegistrationAttributes attr) {
|
||||||
if (mLocalCallback == null) return;
|
if (mLocalCallback == null) return;
|
||||||
|
|
||||||
long callingIdentity = Binder.clearCallingIdentity();
|
long callingIdentity = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
mExecutor.execute(() ->
|
mExecutor.execute(() -> mLocalCallback.onRegistered(attr));
|
||||||
mLocalCallback.onRegistered(getAccessType(imsRadioTech)));
|
|
||||||
} finally {
|
} finally {
|
||||||
restoreCallingIdentity(callingIdentity);
|
restoreCallingIdentity(callingIdentity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRegistering(int imsRadioTech) {
|
public void onRegistering(ImsRegistrationAttributes attr) {
|
||||||
if (mLocalCallback == null) return;
|
if (mLocalCallback == null) return;
|
||||||
|
|
||||||
long callingIdentity = Binder.clearCallingIdentity();
|
long callingIdentity = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
mExecutor.execute(() ->
|
mExecutor.execute(() -> mLocalCallback.onRegistering(attr));
|
||||||
mLocalCallback.onRegistering(getAccessType(imsRadioTech)));
|
|
||||||
} finally {
|
} finally {
|
||||||
restoreCallingIdentity(callingIdentity);
|
restoreCallingIdentity(callingIdentity);
|
||||||
}
|
}
|
||||||
@@ -183,15 +195,6 @@ public interface RegistrationManager {
|
|||||||
private void setExecutor(Executor executor) {
|
private void setExecutor(Executor executor) {
|
||||||
mExecutor = executor;
|
mExecutor = executor;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getAccessType(int regType) {
|
|
||||||
if (!RegistrationManager.IMS_REG_TO_ACCESS_TYPE_MAP.containsKey(regType)) {
|
|
||||||
Log.w("RegistrationManager", "RegistrationBinder - invalid regType returned: "
|
|
||||||
+ regType);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return RegistrationManager.IMS_REG_TO_ACCESS_TYPE_MAP.get(regType);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final RegistrationBinder mBinder = new RegistrationBinder(this);
|
private final RegistrationBinder mBinder = new RegistrationBinder(this);
|
||||||
@@ -200,18 +203,41 @@ public interface RegistrationManager {
|
|||||||
* Notifies the framework when the IMS Provider is registered to the IMS network.
|
* Notifies the framework when the IMS Provider is registered to the IMS network.
|
||||||
*
|
*
|
||||||
* @param imsTransportType the radio access technology.
|
* @param imsTransportType the radio access technology.
|
||||||
|
* @deprecated Use {@link #onRegistered(ImsRegistrationAttributes)} instead.
|
||||||
*/
|
*/
|
||||||
public void onRegistered(@AccessNetworkConstants.TransportType int imsTransportType) {
|
public void onRegistered(@AccessNetworkConstants.TransportType int imsTransportType) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies the framework when the IMS Provider is registered to the IMS network
|
||||||
|
* with corresponding attributes.
|
||||||
|
*
|
||||||
|
* @param attributes The attributes associated with this IMS registration.
|
||||||
|
*/
|
||||||
|
public void onRegistered(@NonNull ImsRegistrationAttributes attributes) {
|
||||||
|
// Default impl to keep backwards compatibility with old implementations
|
||||||
|
onRegistered(attributes.getTransportType());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifies the framework when the IMS Provider is trying to register the IMS network.
|
* Notifies the framework when the IMS Provider is trying to register the IMS network.
|
||||||
*
|
*
|
||||||
* @param imsTransportType the radio access technology.
|
* @param imsTransportType the radio access technology.
|
||||||
|
* @deprecated Use {@link #onRegistering(ImsRegistrationAttributes)} instead.
|
||||||
*/
|
*/
|
||||||
public void onRegistering(@AccessNetworkConstants.TransportType int imsTransportType) {
|
public void onRegistering(@AccessNetworkConstants.TransportType int imsTransportType) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies the framework when the IMS Provider is trying to register the IMS network.
|
||||||
|
*
|
||||||
|
* @param attributes The attributes associated with this IMS registration.
|
||||||
|
*/
|
||||||
|
public void onRegistering(@NonNull ImsRegistrationAttributes attributes) {
|
||||||
|
// Default impl to keep backwards compatibility with old implementations
|
||||||
|
onRegistering(attributes.getTransportType());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifies the framework when the IMS Provider is unregistered from the IMS network.
|
* Notifies the framework when the IMS Provider is unregistered from the IMS network.
|
||||||
*
|
*
|
||||||
@@ -298,10 +324,10 @@ public interface RegistrationManager {
|
|||||||
* @param executor The {@link Executor} that will be used to call the IMS registration state
|
* @param executor The {@link Executor} that will be used to call the IMS registration state
|
||||||
* callback.
|
* callback.
|
||||||
* @param stateCallback A callback called on the supplied {@link Executor} that will contain the
|
* @param stateCallback A callback called on the supplied {@link Executor} that will contain the
|
||||||
* registration state of the IMS service, which will be one of the
|
* registration state of the IMS service, which will be one of the
|
||||||
* following: {@link #REGISTRATION_STATE_NOT_REGISTERED},
|
* following: {@link #REGISTRATION_STATE_NOT_REGISTERED},
|
||||||
* {@link #REGISTRATION_STATE_REGISTERING}, or
|
* {@link #REGISTRATION_STATE_REGISTERING}, or
|
||||||
* {@link #REGISTRATION_STATE_REGISTERED}.
|
* {@link #REGISTRATION_STATE_REGISTERED}.
|
||||||
*/
|
*/
|
||||||
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||||
void getRegistrationState(@NonNull @CallbackExecutor Executor executor,
|
void getRegistrationState(@NonNull @CallbackExecutor Executor executor,
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import android.net.Uri;
|
|||||||
import android.telephony.ims.stub.ImsFeatureConfiguration;
|
import android.telephony.ims.stub.ImsFeatureConfiguration;
|
||||||
|
|
||||||
import android.telephony.ims.ImsReasonInfo;
|
import android.telephony.ims.ImsReasonInfo;
|
||||||
|
import android.telephony.ims.ImsRegistrationAttributes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See {@link ImsManager#RegistrationCallback} for more information.
|
* See {@link ImsManager#RegistrationCallback} for more information.
|
||||||
@@ -28,8 +29,8 @@ import android.telephony.ims.ImsReasonInfo;
|
|||||||
* {@hide}
|
* {@hide}
|
||||||
*/
|
*/
|
||||||
oneway interface IImsRegistrationCallback {
|
oneway interface IImsRegistrationCallback {
|
||||||
void onRegistered(int imsRadioTech);
|
void onRegistered(in ImsRegistrationAttributes attr);
|
||||||
void onRegistering(int imsRadioTech);
|
void onRegistering(in ImsRegistrationAttributes attr);
|
||||||
void onDeregistered(in ImsReasonInfo info);
|
void onDeregistered(in ImsReasonInfo info);
|
||||||
void onTechnologyChangeFailed(int imsRadioTech, in ImsReasonInfo info);
|
void onTechnologyChangeFailed(int imsRadioTech, in ImsReasonInfo info);
|
||||||
void onSubscriberAssociatedUriChanged(in Uri[] uris);
|
void onSubscriberAssociatedUriChanged(in Uri[] uris);
|
||||||
|
|||||||
@@ -18,17 +18,18 @@ package android.telephony.ims.stub;
|
|||||||
|
|
||||||
import android.annotation.IntDef;
|
import android.annotation.IntDef;
|
||||||
import android.annotation.IntRange;
|
import android.annotation.IntRange;
|
||||||
|
import android.annotation.NonNull;
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.annotation.SystemApi;
|
import android.annotation.SystemApi;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.telephony.ims.ImsReasonInfo;
|
import android.telephony.ims.ImsReasonInfo;
|
||||||
|
import android.telephony.ims.ImsRegistrationAttributes;
|
||||||
import android.telephony.ims.RegistrationManager;
|
import android.telephony.ims.RegistrationManager;
|
||||||
import android.telephony.ims.aidl.IImsRegistration;
|
import android.telephony.ims.aidl.IImsRegistration;
|
||||||
import android.telephony.ims.aidl.IImsRegistrationCallback;
|
import android.telephony.ims.aidl.IImsRegistrationCallback;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
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 com.android.internal.util.ArrayUtils;
|
||||||
|
|
||||||
@@ -83,7 +84,10 @@ public class ImsRegistrationImplBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @ImsRegistrationTech int getRegistrationTechnology() throws RemoteException {
|
public @ImsRegistrationTech int getRegistrationTechnology() throws RemoteException {
|
||||||
return getConnectionType();
|
synchronized (mLock) {
|
||||||
|
return (mRegistrationAttributes == null) ? REGISTRATION_TECH_NONE
|
||||||
|
: mRegistrationAttributes.getRegistrationTechnology();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -116,8 +120,7 @@ public class ImsRegistrationImplBase {
|
|||||||
new RemoteCallbackListExt<>();
|
new RemoteCallbackListExt<>();
|
||||||
private final Object mLock = new Object();
|
private final Object mLock = new Object();
|
||||||
// Locked on mLock
|
// Locked on mLock
|
||||||
private @ImsRegistrationTech
|
private ImsRegistrationAttributes mRegistrationAttributes;
|
||||||
int mConnectionType = REGISTRATION_TECH_NONE;
|
|
||||||
// Locked on mLock
|
// Locked on mLock
|
||||||
private int mRegistrationState = REGISTRATION_STATE_UNKNOWN;
|
private int mRegistrationState = REGISTRATION_STATE_UNKNOWN;
|
||||||
// Locked on mLock, create unspecified disconnect cause.
|
// Locked on mLock, create unspecified disconnect cause.
|
||||||
@@ -195,17 +198,24 @@ public class ImsRegistrationImplBase {
|
|||||||
/**
|
/**
|
||||||
* Notify the framework that the device is connected to the IMS network.
|
* Notify the framework that the device is connected to the IMS network.
|
||||||
*
|
*
|
||||||
* @param imsRadioTech the radio access technology. Valid values are defined as
|
* @param imsRadioTech the radio access technology.
|
||||||
* {@link #REGISTRATION_TECH_LTE} and {@link #REGISTRATION_TECH_IWLAN}.
|
|
||||||
*/
|
*/
|
||||||
public final void onRegistered(@ImsRegistrationTech int imsRadioTech) {
|
public final void onRegistered(@ImsRegistrationTech int imsRadioTech) {
|
||||||
updateToState(imsRadioTech, RegistrationManager.REGISTRATION_STATE_REGISTERED);
|
onRegistered(new ImsRegistrationAttributes.Builder(imsRadioTech).build());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify the framework that the device is connected to the IMS network.
|
||||||
|
*
|
||||||
|
* @param attributes The attributes associated with the IMS registration.
|
||||||
|
*/
|
||||||
|
public final void onRegistered(@NonNull ImsRegistrationAttributes attributes) {
|
||||||
|
updateToState(attributes, RegistrationManager.REGISTRATION_STATE_REGISTERED);
|
||||||
mCallbacks.broadcastAction((c) -> {
|
mCallbacks.broadcastAction((c) -> {
|
||||||
try {
|
try {
|
||||||
c.onRegistered(imsRadioTech);
|
c.onRegistered(attributes);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.w(LOG_TAG, e + " " + "onRegistrationConnected() - Skipping " +
|
Log.w(LOG_TAG, e + "onRegistered(int, Set) - Skipping callback.");
|
||||||
"callback.");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -213,17 +223,24 @@ public class ImsRegistrationImplBase {
|
|||||||
/**
|
/**
|
||||||
* Notify the framework that the device is trying to connect the IMS network.
|
* Notify the framework that the device is trying to connect the IMS network.
|
||||||
*
|
*
|
||||||
* @param imsRadioTech the radio access technology. Valid values are defined as
|
* @param imsRadioTech the radio access technology.
|
||||||
* {@link #REGISTRATION_TECH_LTE} and {@link #REGISTRATION_TECH_IWLAN}.
|
|
||||||
*/
|
*/
|
||||||
public final void onRegistering(@ImsRegistrationTech int imsRadioTech) {
|
public final void onRegistering(@ImsRegistrationTech int imsRadioTech) {
|
||||||
updateToState(imsRadioTech, RegistrationManager.REGISTRATION_STATE_REGISTERING);
|
onRegistering(new ImsRegistrationAttributes.Builder(imsRadioTech).build());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify the framework that the device is trying to connect the IMS network.
|
||||||
|
*
|
||||||
|
* @param attributes The attributes associated with the IMS registration.
|
||||||
|
*/
|
||||||
|
public final void onRegistering(@NonNull ImsRegistrationAttributes attributes) {
|
||||||
|
updateToState(attributes, RegistrationManager.REGISTRATION_STATE_REGISTERING);
|
||||||
mCallbacks.broadcastAction((c) -> {
|
mCallbacks.broadcastAction((c) -> {
|
||||||
try {
|
try {
|
||||||
c.onRegistering(imsRadioTech);
|
c.onRegistering(attributes);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.w(LOG_TAG, e + " " + "onRegistrationProcessing() - Skipping " +
|
Log.w(LOG_TAG, e + "onRegistering(int, Set) - Skipping callback.");
|
||||||
"callback.");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -252,8 +269,7 @@ public class ImsRegistrationImplBase {
|
|||||||
try {
|
try {
|
||||||
c.onDeregistered(reasonInfo);
|
c.onDeregistered(reasonInfo);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.w(LOG_TAG, e + " " + "onRegistrationDisconnected() - Skipping " +
|
Log.w(LOG_TAG, e + "onDeregistered() - Skipping callback.");
|
||||||
"callback.");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -272,8 +288,7 @@ public class ImsRegistrationImplBase {
|
|||||||
try {
|
try {
|
||||||
c.onTechnologyChangeFailed(imsRadioTech, reasonInfo);
|
c.onTechnologyChangeFailed(imsRadioTech, reasonInfo);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.w(LOG_TAG, e + " " + "onRegistrationChangeFailed() - Skipping " +
|
Log.w(LOG_TAG, e + "onTechnologyChangeFailed() - Skipping callback.");
|
||||||
"callback.");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -297,14 +312,13 @@ public class ImsRegistrationImplBase {
|
|||||||
try {
|
try {
|
||||||
callback.onSubscriberAssociatedUriChanged(uris);
|
callback.onSubscriberAssociatedUriChanged(uris);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.w(LOG_TAG, e + " " + "onSubscriberAssociatedUriChanged() - Skipping "
|
Log.w(LOG_TAG, e + "onSubscriberAssociatedUriChanged() - Skipping callback.");
|
||||||
+ "callback.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateToState(@ImsRegistrationTech int connType, int newState) {
|
private void updateToState(ImsRegistrationAttributes attributes, int newState) {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
mConnectionType = connType;
|
mRegistrationAttributes = attributes;
|
||||||
mRegistrationState = newState;
|
mRegistrationState = newState;
|
||||||
mLastDisconnectCause = null;
|
mLastDisconnectCause = null;
|
||||||
}
|
}
|
||||||
@@ -316,7 +330,7 @@ public class ImsRegistrationImplBase {
|
|||||||
mUrisSet = false;
|
mUrisSet = false;
|
||||||
mUris = null;
|
mUris = null;
|
||||||
|
|
||||||
updateToState(REGISTRATION_TECH_NONE,
|
updateToState(new ImsRegistrationAttributes.Builder(REGISTRATION_TECH_NONE).build(),
|
||||||
RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED);
|
RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED);
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
mLastDisconnectCause = info;
|
mLastDisconnectCause = info;
|
||||||
@@ -327,18 +341,6 @@ public class ImsRegistrationImplBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the current registration connection type. Valid values are
|
|
||||||
* {@link #REGISTRATION_TECH_LTE} and {@link #REGISTRATION_TECH_IWLAN}
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@VisibleForTesting
|
|
||||||
public final @ImsRegistrationTech int getConnectionType() {
|
|
||||||
synchronized (mLock) {
|
|
||||||
return mConnectionType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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.
|
||||||
@@ -346,11 +348,13 @@ public class ImsRegistrationImplBase {
|
|||||||
private void updateNewCallbackWithState(IImsRegistrationCallback c)
|
private void updateNewCallbackWithState(IImsRegistrationCallback c)
|
||||||
throws RemoteException {
|
throws RemoteException {
|
||||||
int state;
|
int state;
|
||||||
|
ImsRegistrationAttributes attributes;
|
||||||
ImsReasonInfo disconnectInfo;
|
ImsReasonInfo disconnectInfo;
|
||||||
boolean urisSet;
|
boolean urisSet;
|
||||||
Uri[] uris;
|
Uri[] uris;
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
state = mRegistrationState;
|
state = mRegistrationState;
|
||||||
|
attributes = mRegistrationAttributes;
|
||||||
disconnectInfo = mLastDisconnectCause;
|
disconnectInfo = mLastDisconnectCause;
|
||||||
urisSet = mUrisSet;
|
urisSet = mUrisSet;
|
||||||
uris = mUris;
|
uris = mUris;
|
||||||
@@ -361,11 +365,11 @@ public class ImsRegistrationImplBase {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case RegistrationManager.REGISTRATION_STATE_REGISTERING: {
|
case RegistrationManager.REGISTRATION_STATE_REGISTERING: {
|
||||||
c.onRegistering(getConnectionType());
|
c.onRegistering(attributes);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case RegistrationManager.REGISTRATION_STATE_REGISTERED: {
|
case RegistrationManager.REGISTRATION_STATE_REGISTERED: {
|
||||||
c.onRegistered(getConnectionType());
|
c.onRegistered(attributes);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case REGISTRATION_STATE_UNKNOWN: {
|
case REGISTRATION_STATE_UNKNOWN: {
|
||||||
|
|||||||
Reference in New Issue
Block a user