Loading core/api/current.txt +17 −0 Original line number Diff line number Diff line Loading @@ -43648,8 +43648,10 @@ package android.telephony.ims { method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public boolean isVoWiFiSettingEnabled(); method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public boolean isVtSettingEnabled(); method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public void registerImsRegistrationCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.RegistrationManager.RegistrationCallback) throws android.telephony.ims.ImsException; method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRECISE_PHONE_STATE, "android.permission.READ_PRIVILEGED_PHONE_STATE"}) public void registerImsStateCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.ImsStateCallback) throws android.telephony.ims.ImsException; method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public void registerMmTelCapabilityCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.ImsMmTelManager.CapabilityCallback) throws android.telephony.ims.ImsException; method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public void unregisterImsRegistrationCallback(@NonNull android.telephony.ims.RegistrationManager.RegistrationCallback); method public void unregisterImsStateCallback(@NonNull android.telephony.ims.ImsStateCallback); method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public void unregisterMmTelCapabilityCallback(@NonNull android.telephony.ims.ImsMmTelManager.CapabilityCallback); field public static final int WIFI_MODE_CELLULAR_PREFERRED = 1; // 0x1 field public static final int WIFI_MODE_WIFI_ONLY = 0; // 0x0 Loading @@ -43666,7 +43668,9 @@ package android.telephony.ims { method @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void getRegistrationTransportType(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>); method @NonNull public android.telephony.ims.RcsUceAdapter getUceAdapter(); method @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void registerImsRegistrationCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.RegistrationManager.RegistrationCallback) throws android.telephony.ims.ImsException; method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRECISE_PHONE_STATE, "android.permission.READ_PRIVILEGED_PHONE_STATE", "android.permission.ACCESS_RCS_USER_CAPABILITY_EXCHANGE"}) public void registerImsStateCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.ImsStateCallback) throws android.telephony.ims.ImsException; method @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void unregisterImsRegistrationCallback(@NonNull android.telephony.ims.RegistrationManager.RegistrationCallback); method public void unregisterImsStateCallback(@NonNull android.telephony.ims.ImsStateCallback); field public static final String ACTION_SHOW_CAPABILITY_DISCOVERY_OPT_IN = "android.telephony.ims.action.SHOW_CAPABILITY_DISCOVERY_OPT_IN"; } Loading Loading @@ -43865,6 +43869,19 @@ package android.telephony.ims { field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsRegistrationAttributes> CREATOR; } public abstract class ImsStateCallback { ctor public ImsStateCallback(); method public abstract void onAvailable(); method public abstract void onError(); method public abstract void onUnavailable(int); field public static final int REASON_IMS_SERVICE_DISCONNECTED = 3; // 0x3 field public static final int REASON_IMS_SERVICE_NOT_READY = 6; // 0x6 field public static final int REASON_NO_IMS_SERVICE_CONFIGURED = 4; // 0x4 field public static final int REASON_SUBSCRIPTION_INACTIVE = 5; // 0x5 field public static final int REASON_UNKNOWN_PERMANENT_ERROR = 2; // 0x2 field public static final int REASON_UNKNOWN_TEMPORARY_ERROR = 1; // 0x1 } public class RcsUceAdapter { method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isUceSettingEnabled() throws android.telephony.ims.ImsException; } core/api/system-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -13953,7 +13953,9 @@ package android.telephony.ims { method @RequiresPermission(android.Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION) public void createSipDelegate(@NonNull android.telephony.ims.DelegateRequest, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.stub.DelegateConnectionStateCallback, @NonNull android.telephony.ims.stub.DelegateConnectionMessageCallback) throws android.telephony.ims.ImsException; method @RequiresPermission(android.Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION) public void destroySipDelegate(@NonNull android.telephony.ims.SipDelegateConnection, int); method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION}) public boolean isSupported() throws android.telephony.ims.ImsException; method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION}) public void registerImsStateCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.ImsStateCallback) throws android.telephony.ims.ImsException; method @RequiresPermission(android.Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION) public void triggerFullNetworkRegistration(@NonNull android.telephony.ims.SipDelegateConnection, @IntRange(from=100, to=699) int, @Nullable String); method public void unregisterImsStateCallback(@NonNull android.telephony.ims.ImsStateCallback); field public static final int DENIED_REASON_INVALID = 4; // 0x4 field public static final int DENIED_REASON_IN_USE_BY_ANOTHER_DELEGATE = 1; // 0x1 field public static final int DENIED_REASON_NOT_ALLOWED = 2; // 0x2 telephony/java/android/telephony/ImsManager.java +2 −2 Original line number Diff line number Diff line Loading @@ -119,7 +119,7 @@ public class ImsManager { throw new IllegalArgumentException("Invalid subscription ID: " + subscriptionId); } return new ImsRcsManager(mContext, subscriptionId, sRcsCache); return new ImsRcsManager(mContext, subscriptionId, sRcsCache, sTelephonyCache); } /** Loading Loading @@ -157,7 +157,7 @@ public class ImsManager { throw new IllegalArgumentException("Invalid subscription ID: " + subscriptionId); } return new SipDelegateManager(mContext, subscriptionId, sRcsCache); return new SipDelegateManager(mContext, subscriptionId, sRcsCache, sTelephonyCache); } private static IImsRcsController getIImsRcsControllerInterface() { Loading telephony/java/android/telephony/ims/ImsMmTelManager.java +60 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import com.android.internal.telephony.ITelephony; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Objects; import java.util.concurrent.Executor; import java.util.function.Consumer; Loading Loading @@ -1482,6 +1483,65 @@ public class ImsMmTelManager implements RegistrationManager { } } /** * Register a new callback, which is used to notify the registrant of changes to * the state of the underlying IMS service that is attached to telephony to * implement IMS functionality. If the manager is created for * the {@link SubscriptionManager#DEFAULT_SUBSCRIPTION_ID}, * this throws an {@link ImsException}. * * <p>Requires Permission: * {@link android.Manifest.permission#READ_PRECISE_PHONE_STATE READ_PRECISE_PHONE_STATE} * or that the calling app has carrier privileges * (see {@link android.telephony.TelephonyManager#hasCarrierPrivileges}). * * @param executor the Executor that will be used to call the {@link ImsStateCallback}. * @param callback The callback instance being registered. * @throws ImsException in the case that the callback can not be registered. * See {@link ImsException#getCode} for more information on when this is called. */ @RequiresPermission(anyOf = {Manifest.permission.READ_PRECISE_PHONE_STATE, Manifest.permission.READ_PRIVILEGED_PHONE_STATE}) public void registerImsStateCallback(@NonNull Executor executor, @NonNull ImsStateCallback callback) throws ImsException { Objects.requireNonNull(callback, "Must include a non-null ImsStateCallback."); Objects.requireNonNull(executor, "Must include a non-null Executor."); callback.init(executor); ITelephony telephony = mBinderCache.listenOnBinder(callback, callback::binderDied); if (telephony == null) { throw new ImsException("Telephony server is down", ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); } try { telephony.registerImsStateCallback( mSubId, ImsFeature.FEATURE_MMTEL, callback.getCallbackBinder()); } catch (ServiceSpecificException e) { throw new ImsException(e.getMessage(), e.errorCode); } catch (RemoteException | IllegalStateException e) { throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); } } /** * Unregisters a previously registered callback. * * @param callback The callback instance to be unregistered. */ public void unregisterImsStateCallback(@NonNull ImsStateCallback callback) { Objects.requireNonNull(callback, "Must include a non-null ImsStateCallback."); ITelephony telephony = mBinderCache.removeRunnable(callback); try { if (telephony != null) { telephony.unregisterImsStateCallback(callback.getCallbackBinder()); } } catch (RemoteException ignore) { // ignore it } } private ITelephony getITelephony() { return mBinderCache.getBinder(); } Loading telephony/java/android/telephony/ims/ImsRcsManager.java +66 −1 Original line number Diff line number Diff line Loading @@ -39,9 +39,11 @@ import android.telephony.ims.stub.ImsRegistrationImplBase; import android.util.Log; import com.android.internal.telephony.IIntegerConsumer; import com.android.internal.telephony.ITelephony; import java.util.HashMap; import java.util.Map; import java.util.Objects; import java.util.concurrent.Executor; import java.util.function.Consumer; Loading Loading @@ -159,6 +161,7 @@ public class ImsRcsManager { private final int mSubId; private final Context mContext; private final BinderCacheManager<IImsRcsController> mBinderCache; private final BinderCacheManager<ITelephony> mTelephonyBinderCache; private final Map<OnAvailabilityChangedListener, AvailabilityCallbackAdapter> mAvailabilityChangedCallbacks; Loading @@ -167,11 +170,13 @@ public class ImsRcsManager { * @hide */ public ImsRcsManager(Context context, int subId, BinderCacheManager<IImsRcsController> binderCache) { BinderCacheManager<IImsRcsController> binderCache, BinderCacheManager<ITelephony> telephonyBinderCache) { mSubId = subId; mContext = context; mBinderCache = binderCache; mAvailabilityChangedCallbacks = new HashMap<>(); mTelephonyBinderCache = telephonyBinderCache; } /** Loading Loading @@ -533,6 +538,66 @@ public class ImsRcsManager { } } /** * Register a new callback, which is used to notify the registrant of changes to * the state of the underlying IMS service that is attached to telephony to * implement IMS functionality. If the manager is created for * the {@link android.telephony.SubscriptionManager#DEFAULT_SUBSCRIPTION_ID}, * this throws an {@link ImsException}. * * <p>Requires Permission: * {@link android.Manifest.permission#READ_PRECISE_PHONE_STATE READ_PRECISE_PHONE_STATE} * or that the calling app has carrier privileges * (see {@link android.telephony.TelephonyManager#hasCarrierPrivileges}). * * @param executor the Executor that will be used to call the {@link ImsStateCallback}. * @param callback The callback instance being registered. * @throws ImsException in the case that the callback can not be registered. * See {@link ImsException#getCode} for more information on when this is called. */ @RequiresPermission(anyOf = {Manifest.permission.READ_PRECISE_PHONE_STATE, Manifest.permission.READ_PRIVILEGED_PHONE_STATE, Manifest.permission.ACCESS_RCS_USER_CAPABILITY_EXCHANGE}) public void registerImsStateCallback(@NonNull Executor executor, @NonNull ImsStateCallback callback) throws ImsException { Objects.requireNonNull(callback, "Must include a non-null ImsStateCallback."); Objects.requireNonNull(executor, "Must include a non-null Executor."); callback.init(executor); ITelephony telephony = mTelephonyBinderCache.listenOnBinder(callback, callback::binderDied); if (telephony == null) { throw new ImsException("Telephony server is down", ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); } try { telephony.registerImsStateCallback( mSubId, ImsFeature.FEATURE_RCS, callback.getCallbackBinder()); } catch (ServiceSpecificException e) { throw new ImsException(e.getMessage(), e.errorCode); } catch (RemoteException | IllegalStateException e) { throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); } } /** * Unregisters a previously registered callback. * * @param callback The callback instance to be unregistered. */ public void unregisterImsStateCallback(@NonNull ImsStateCallback callback) { Objects.requireNonNull(callback, "Must include a non-null ImsStateCallback."); ITelephony telephony = mTelephonyBinderCache.removeRunnable(callback); try { if (telephony != null) { telephony.unregisterImsStateCallback(callback.getCallbackBinder()); } } catch (RemoteException ignore) { // ignore it } } /** * Add the {@link OnAvailabilityChangedListener} to collection for tracking. * @param executor The executor that will be used when the publish state is changed and the Loading Loading
core/api/current.txt +17 −0 Original line number Diff line number Diff line Loading @@ -43648,8 +43648,10 @@ package android.telephony.ims { method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public boolean isVoWiFiSettingEnabled(); method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public boolean isVtSettingEnabled(); method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public void registerImsRegistrationCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.RegistrationManager.RegistrationCallback) throws android.telephony.ims.ImsException; method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRECISE_PHONE_STATE, "android.permission.READ_PRIVILEGED_PHONE_STATE"}) public void registerImsStateCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.ImsStateCallback) throws android.telephony.ims.ImsException; method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public void registerMmTelCapabilityCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.ImsMmTelManager.CapabilityCallback) throws android.telephony.ims.ImsException; method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public void unregisterImsRegistrationCallback(@NonNull android.telephony.ims.RegistrationManager.RegistrationCallback); method public void unregisterImsStateCallback(@NonNull android.telephony.ims.ImsStateCallback); method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public void unregisterMmTelCapabilityCallback(@NonNull android.telephony.ims.ImsMmTelManager.CapabilityCallback); field public static final int WIFI_MODE_CELLULAR_PREFERRED = 1; // 0x1 field public static final int WIFI_MODE_WIFI_ONLY = 0; // 0x0 Loading @@ -43666,7 +43668,9 @@ package android.telephony.ims { method @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void getRegistrationTransportType(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>); method @NonNull public android.telephony.ims.RcsUceAdapter getUceAdapter(); method @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void registerImsRegistrationCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.RegistrationManager.RegistrationCallback) throws android.telephony.ims.ImsException; method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRECISE_PHONE_STATE, "android.permission.READ_PRIVILEGED_PHONE_STATE", "android.permission.ACCESS_RCS_USER_CAPABILITY_EXCHANGE"}) public void registerImsStateCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.ImsStateCallback) throws android.telephony.ims.ImsException; method @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void unregisterImsRegistrationCallback(@NonNull android.telephony.ims.RegistrationManager.RegistrationCallback); method public void unregisterImsStateCallback(@NonNull android.telephony.ims.ImsStateCallback); field public static final String ACTION_SHOW_CAPABILITY_DISCOVERY_OPT_IN = "android.telephony.ims.action.SHOW_CAPABILITY_DISCOVERY_OPT_IN"; } Loading Loading @@ -43865,6 +43869,19 @@ package android.telephony.ims { field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsRegistrationAttributes> CREATOR; } public abstract class ImsStateCallback { ctor public ImsStateCallback(); method public abstract void onAvailable(); method public abstract void onError(); method public abstract void onUnavailable(int); field public static final int REASON_IMS_SERVICE_DISCONNECTED = 3; // 0x3 field public static final int REASON_IMS_SERVICE_NOT_READY = 6; // 0x6 field public static final int REASON_NO_IMS_SERVICE_CONFIGURED = 4; // 0x4 field public static final int REASON_SUBSCRIPTION_INACTIVE = 5; // 0x5 field public static final int REASON_UNKNOWN_PERMANENT_ERROR = 2; // 0x2 field public static final int REASON_UNKNOWN_TEMPORARY_ERROR = 1; // 0x1 } public class RcsUceAdapter { method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isUceSettingEnabled() throws android.telephony.ims.ImsException; }
core/api/system-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -13953,7 +13953,9 @@ package android.telephony.ims { method @RequiresPermission(android.Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION) public void createSipDelegate(@NonNull android.telephony.ims.DelegateRequest, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.stub.DelegateConnectionStateCallback, @NonNull android.telephony.ims.stub.DelegateConnectionMessageCallback) throws android.telephony.ims.ImsException; method @RequiresPermission(android.Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION) public void destroySipDelegate(@NonNull android.telephony.ims.SipDelegateConnection, int); method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION}) public boolean isSupported() throws android.telephony.ims.ImsException; method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION}) public void registerImsStateCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.ImsStateCallback) throws android.telephony.ims.ImsException; method @RequiresPermission(android.Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION) public void triggerFullNetworkRegistration(@NonNull android.telephony.ims.SipDelegateConnection, @IntRange(from=100, to=699) int, @Nullable String); method public void unregisterImsStateCallback(@NonNull android.telephony.ims.ImsStateCallback); field public static final int DENIED_REASON_INVALID = 4; // 0x4 field public static final int DENIED_REASON_IN_USE_BY_ANOTHER_DELEGATE = 1; // 0x1 field public static final int DENIED_REASON_NOT_ALLOWED = 2; // 0x2
telephony/java/android/telephony/ImsManager.java +2 −2 Original line number Diff line number Diff line Loading @@ -119,7 +119,7 @@ public class ImsManager { throw new IllegalArgumentException("Invalid subscription ID: " + subscriptionId); } return new ImsRcsManager(mContext, subscriptionId, sRcsCache); return new ImsRcsManager(mContext, subscriptionId, sRcsCache, sTelephonyCache); } /** Loading Loading @@ -157,7 +157,7 @@ public class ImsManager { throw new IllegalArgumentException("Invalid subscription ID: " + subscriptionId); } return new SipDelegateManager(mContext, subscriptionId, sRcsCache); return new SipDelegateManager(mContext, subscriptionId, sRcsCache, sTelephonyCache); } private static IImsRcsController getIImsRcsControllerInterface() { Loading
telephony/java/android/telephony/ims/ImsMmTelManager.java +60 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import com.android.internal.telephony.ITelephony; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Objects; import java.util.concurrent.Executor; import java.util.function.Consumer; Loading Loading @@ -1482,6 +1483,65 @@ public class ImsMmTelManager implements RegistrationManager { } } /** * Register a new callback, which is used to notify the registrant of changes to * the state of the underlying IMS service that is attached to telephony to * implement IMS functionality. If the manager is created for * the {@link SubscriptionManager#DEFAULT_SUBSCRIPTION_ID}, * this throws an {@link ImsException}. * * <p>Requires Permission: * {@link android.Manifest.permission#READ_PRECISE_PHONE_STATE READ_PRECISE_PHONE_STATE} * or that the calling app has carrier privileges * (see {@link android.telephony.TelephonyManager#hasCarrierPrivileges}). * * @param executor the Executor that will be used to call the {@link ImsStateCallback}. * @param callback The callback instance being registered. * @throws ImsException in the case that the callback can not be registered. * See {@link ImsException#getCode} for more information on when this is called. */ @RequiresPermission(anyOf = {Manifest.permission.READ_PRECISE_PHONE_STATE, Manifest.permission.READ_PRIVILEGED_PHONE_STATE}) public void registerImsStateCallback(@NonNull Executor executor, @NonNull ImsStateCallback callback) throws ImsException { Objects.requireNonNull(callback, "Must include a non-null ImsStateCallback."); Objects.requireNonNull(executor, "Must include a non-null Executor."); callback.init(executor); ITelephony telephony = mBinderCache.listenOnBinder(callback, callback::binderDied); if (telephony == null) { throw new ImsException("Telephony server is down", ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); } try { telephony.registerImsStateCallback( mSubId, ImsFeature.FEATURE_MMTEL, callback.getCallbackBinder()); } catch (ServiceSpecificException e) { throw new ImsException(e.getMessage(), e.errorCode); } catch (RemoteException | IllegalStateException e) { throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); } } /** * Unregisters a previously registered callback. * * @param callback The callback instance to be unregistered. */ public void unregisterImsStateCallback(@NonNull ImsStateCallback callback) { Objects.requireNonNull(callback, "Must include a non-null ImsStateCallback."); ITelephony telephony = mBinderCache.removeRunnable(callback); try { if (telephony != null) { telephony.unregisterImsStateCallback(callback.getCallbackBinder()); } } catch (RemoteException ignore) { // ignore it } } private ITelephony getITelephony() { return mBinderCache.getBinder(); } Loading
telephony/java/android/telephony/ims/ImsRcsManager.java +66 −1 Original line number Diff line number Diff line Loading @@ -39,9 +39,11 @@ import android.telephony.ims.stub.ImsRegistrationImplBase; import android.util.Log; import com.android.internal.telephony.IIntegerConsumer; import com.android.internal.telephony.ITelephony; import java.util.HashMap; import java.util.Map; import java.util.Objects; import java.util.concurrent.Executor; import java.util.function.Consumer; Loading Loading @@ -159,6 +161,7 @@ public class ImsRcsManager { private final int mSubId; private final Context mContext; private final BinderCacheManager<IImsRcsController> mBinderCache; private final BinderCacheManager<ITelephony> mTelephonyBinderCache; private final Map<OnAvailabilityChangedListener, AvailabilityCallbackAdapter> mAvailabilityChangedCallbacks; Loading @@ -167,11 +170,13 @@ public class ImsRcsManager { * @hide */ public ImsRcsManager(Context context, int subId, BinderCacheManager<IImsRcsController> binderCache) { BinderCacheManager<IImsRcsController> binderCache, BinderCacheManager<ITelephony> telephonyBinderCache) { mSubId = subId; mContext = context; mBinderCache = binderCache; mAvailabilityChangedCallbacks = new HashMap<>(); mTelephonyBinderCache = telephonyBinderCache; } /** Loading Loading @@ -533,6 +538,66 @@ public class ImsRcsManager { } } /** * Register a new callback, which is used to notify the registrant of changes to * the state of the underlying IMS service that is attached to telephony to * implement IMS functionality. If the manager is created for * the {@link android.telephony.SubscriptionManager#DEFAULT_SUBSCRIPTION_ID}, * this throws an {@link ImsException}. * * <p>Requires Permission: * {@link android.Manifest.permission#READ_PRECISE_PHONE_STATE READ_PRECISE_PHONE_STATE} * or that the calling app has carrier privileges * (see {@link android.telephony.TelephonyManager#hasCarrierPrivileges}). * * @param executor the Executor that will be used to call the {@link ImsStateCallback}. * @param callback The callback instance being registered. * @throws ImsException in the case that the callback can not be registered. * See {@link ImsException#getCode} for more information on when this is called. */ @RequiresPermission(anyOf = {Manifest.permission.READ_PRECISE_PHONE_STATE, Manifest.permission.READ_PRIVILEGED_PHONE_STATE, Manifest.permission.ACCESS_RCS_USER_CAPABILITY_EXCHANGE}) public void registerImsStateCallback(@NonNull Executor executor, @NonNull ImsStateCallback callback) throws ImsException { Objects.requireNonNull(callback, "Must include a non-null ImsStateCallback."); Objects.requireNonNull(executor, "Must include a non-null Executor."); callback.init(executor); ITelephony telephony = mTelephonyBinderCache.listenOnBinder(callback, callback::binderDied); if (telephony == null) { throw new ImsException("Telephony server is down", ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); } try { telephony.registerImsStateCallback( mSubId, ImsFeature.FEATURE_RCS, callback.getCallbackBinder()); } catch (ServiceSpecificException e) { throw new ImsException(e.getMessage(), e.errorCode); } catch (RemoteException | IllegalStateException e) { throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); } } /** * Unregisters a previously registered callback. * * @param callback The callback instance to be unregistered. */ public void unregisterImsStateCallback(@NonNull ImsStateCallback callback) { Objects.requireNonNull(callback, "Must include a non-null ImsStateCallback."); ITelephony telephony = mTelephonyBinderCache.removeRunnable(callback); try { if (telephony != null) { telephony.unregisterImsStateCallback(callback.getCallbackBinder()); } } catch (RemoteException ignore) { // ignore it } } /** * Add the {@link OnAvailabilityChangedListener} to collection for tracking. * @param executor The executor that will be used when the publish state is changed and the Loading