Merge "[RCS] Create AIDL layer for RcsUceAdapter, create RCS UCE controller implementation in Telephony."
am: 303c5dc0fb
Change-Id: Ibcd4e3ab7c60c1446019d652e5603b02ca9f34b2
This commit is contained in:
@@ -173,6 +173,7 @@ import android.telephony.SubscriptionManager;
|
|||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.telephony.euicc.EuiccCardManager;
|
import android.telephony.euicc.EuiccCardManager;
|
||||||
import android.telephony.euicc.EuiccManager;
|
import android.telephony.euicc.EuiccManager;
|
||||||
|
import android.telephony.ims.ImsManager;
|
||||||
import android.telephony.ims.RcsMessageManager;
|
import android.telephony.ims.RcsMessageManager;
|
||||||
import android.util.ArrayMap;
|
import android.util.ArrayMap;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -630,6 +631,14 @@ final class SystemServiceRegistry {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
registerService(Context.TELEPHONY_IMS_SERVICE, ImsManager.class,
|
||||||
|
new CachedServiceFetcher<ImsManager>() {
|
||||||
|
@Override
|
||||||
|
public ImsManager createService(ContextImpl ctx) {
|
||||||
|
return new ImsManager(ctx.getOuterContext());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
registerService(Context.CARRIER_CONFIG_SERVICE, CarrierConfigManager.class,
|
registerService(Context.CARRIER_CONFIG_SERVICE, CarrierConfigManager.class,
|
||||||
new CachedServiceFetcher<CarrierConfigManager>() {
|
new CachedServiceFetcher<CarrierConfigManager>() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -4732,6 +4732,13 @@ public abstract class Context {
|
|||||||
*/
|
*/
|
||||||
public static final String APP_BINDING_SERVICE = "app_binding";
|
public static final String APP_BINDING_SERVICE = "app_binding";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use with {@link #getSystemService(String)} to retrieve an
|
||||||
|
* {@link android.telephony.ims.ImsManager}.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final String TELEPHONY_IMS_SERVICE = "telephony_ims";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use with {@link #getSystemService(String)} to retrieve an
|
* Use with {@link #getSystemService(String)} to retrieve an
|
||||||
* {@link android.telephony.ims.RcsMessageManager}.
|
* {@link android.telephony.ims.RcsMessageManager}.
|
||||||
|
|||||||
66
telephony/java/android/telephony/ImsManager.java
Normal file
66
telephony/java/android/telephony/ImsManager.java
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 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.SystemService;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.telephony.SubscriptionManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides access to information about Telephony IMS services on the device.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@SystemService(Context.TELEPHONY_IMS_SERVICE)
|
||||||
|
public class ImsManager {
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
|
public ImsManager(Context context) {
|
||||||
|
mContext = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an instance of ImsRcsManager for the subscription id specified.
|
||||||
|
*
|
||||||
|
* @param subscriptionId The ID of the subscription that this ImsRcsManager will use.
|
||||||
|
* @throws IllegalArgumentException if the subscription is invalid.
|
||||||
|
* @return a ImsRcsManager instance with the specific subscription ID.
|
||||||
|
*/
|
||||||
|
public ImsRcsManager getImsRcsManager(int subscriptionId) {
|
||||||
|
if (!SubscriptionManager.isValidSubscriptionId(subscriptionId)) {
|
||||||
|
throw new IllegalArgumentException("Invalid subscription ID: " + subscriptionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ImsRcsManager(mContext, subscriptionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an instance of ImsMmTelManager for the subscription id specified.
|
||||||
|
*
|
||||||
|
* @param subscriptionId The ID of the subscription that this ImsMmTelManager will use.
|
||||||
|
* @throws IllegalArgumentException if the subscription is invalid.
|
||||||
|
* @return a ImsMmTelManager instance with the specific subscription ID.
|
||||||
|
*/
|
||||||
|
public ImsMmTelManager getImsMmTelManager(int subscriptionId) {
|
||||||
|
if (!SubscriptionManager.isValidSubscriptionId(subscriptionId)) {
|
||||||
|
throw new IllegalArgumentException("Invalid subscription ID: " + subscriptionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ImsMmTelManager(subscriptionId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,11 +22,15 @@ import android.annotation.NonNull;
|
|||||||
import android.annotation.RequiresPermission;
|
import android.annotation.RequiresPermission;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
|
import android.os.IBinder;
|
||||||
|
import android.os.RemoteException;
|
||||||
|
import android.os.ServiceManager;
|
||||||
import android.telephony.AccessNetworkConstants;
|
import android.telephony.AccessNetworkConstants;
|
||||||
import android.telephony.SubscriptionManager;
|
|
||||||
import android.telephony.ims.aidl.IImsCapabilityCallback;
|
import android.telephony.ims.aidl.IImsCapabilityCallback;
|
||||||
|
import android.telephony.ims.aidl.IImsRcsController;
|
||||||
import android.telephony.ims.feature.ImsFeature;
|
import android.telephony.ims.feature.ImsFeature;
|
||||||
import android.telephony.ims.feature.RcsFeature;
|
import android.telephony.ims.feature.RcsFeature;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
@@ -35,10 +39,11 @@ import java.util.function.Consumer;
|
|||||||
* Manager for interfacing with the framework RCS services, including the User Capability Exchange
|
* Manager for interfacing with the framework RCS services, including the User Capability Exchange
|
||||||
* (UCE) service, as well as managing user settings.
|
* (UCE) service, as well as managing user settings.
|
||||||
*
|
*
|
||||||
* Use {@link #createForSubscriptionId(Context, int)} to create an instance of this manager.
|
* Use {@link ImsManager#getImsRcsManager(int)} to create an instance of this manager.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public class ImsRcsManager implements RegistrationManager {
|
public class ImsRcsManager implements RegistrationManager {
|
||||||
|
private static final String TAG = "ImsRcsManager";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Receives RCS availability status updates from the ImsService.
|
* Receives RCS availability status updates from the ImsService.
|
||||||
@@ -112,30 +117,23 @@ public class ImsRcsManager implements RegistrationManager {
|
|||||||
private final int mSubId;
|
private final int mSubId;
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an instance of ImsRcsManager for the subscription id specified.
|
* Use {@link ImsManager#getImsRcsManager(int)} to create an instance of this class.
|
||||||
*
|
|
||||||
* @param context The context to create this ImsRcsManager instance within.
|
|
||||||
* @param subscriptionId The ID of the subscription that this ImsRcsManager will use.
|
|
||||||
* @see android.telephony.SubscriptionManager#getActiveSubscriptionInfoList()
|
|
||||||
* @throws IllegalArgumentException if the subscription is invalid.
|
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public static ImsRcsManager createForSubscriptionId(Context context, int subscriptionId) {
|
public ImsRcsManager(Context context, int subId) {
|
||||||
if (!SubscriptionManager.isValidSubscriptionId(subscriptionId)) {
|
mSubId = subId;
|
||||||
throw new IllegalArgumentException("Invalid subscription ID");
|
mContext = context;
|
||||||
}
|
|
||||||
|
|
||||||
return new ImsRcsManager(context, subscriptionId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use {@link #createForSubscriptionId(Context, int)} to create an instance of this class.
|
* @return A {@link RcsUceAdapter} used for User Capability Exchange (UCE) operations for
|
||||||
|
* this subscription.
|
||||||
|
* @hide
|
||||||
*/
|
*/
|
||||||
private ImsRcsManager(Context context, int subId) {
|
@NonNull
|
||||||
mContext = context;
|
public RcsUceAdapter getUceAdapter() {
|
||||||
mSubId = subId;
|
return new RcsUceAdapter(mSubId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**{@inheritDoc}*/
|
/**{@inheritDoc}*/
|
||||||
@@ -225,9 +223,22 @@ public class ImsRcsManager implements RegistrationManager {
|
|||||||
if (executor == null) {
|
if (executor == null) {
|
||||||
throw new IllegalArgumentException("Must include a non-null Executor.");
|
throw new IllegalArgumentException("Must include a non-null Executor.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IImsRcsController imsRcsController = getIImsRcsController();
|
||||||
|
if (imsRcsController == null) {
|
||||||
|
Log.e(TAG, "Register availability callback: IImsRcsController is null");
|
||||||
|
throw new ImsException("Can not find remote IMS service",
|
||||||
|
ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
|
||||||
|
}
|
||||||
|
|
||||||
c.setExecutor(executor);
|
c.setExecutor(executor);
|
||||||
throw new UnsupportedOperationException("registerRcsAvailabilityCallback is not"
|
try {
|
||||||
+ "supported.");
|
imsRcsController.registerRcsAvailabilityCallback(c.getBinder());
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Log.e(TAG, "Error calling IImsRcsController#registerRcsAvailabilityCallback", e);
|
||||||
|
throw new ImsException("Remote IMS Service is not available",
|
||||||
|
ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -238,14 +249,31 @@ public class ImsRcsManager implements RegistrationManager {
|
|||||||
* inactive subscription, it will result in a no-op.
|
* inactive subscription, it will result in a no-op.
|
||||||
* @param c The RCS {@link AvailabilityCallback} to be removed.
|
* @param c The RCS {@link AvailabilityCallback} to be removed.
|
||||||
* @see #registerRcsAvailabilityCallback(Executor, AvailabilityCallback)
|
* @see #registerRcsAvailabilityCallback(Executor, AvailabilityCallback)
|
||||||
|
* @throws ImsException if the IMS service is not available when calling this method
|
||||||
|
* {@link ImsRcsController#unregisterRcsAvailabilityCallback()}.
|
||||||
|
* See {@link ImsException#getCode()} for more information on the error codes.
|
||||||
*/
|
*/
|
||||||
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||||
public void unregisterRcsAvailabilityCallback(@NonNull AvailabilityCallback c) {
|
public void unregisterRcsAvailabilityCallback(@NonNull AvailabilityCallback c)
|
||||||
|
throws ImsException {
|
||||||
if (c == null) {
|
if (c == null) {
|
||||||
throw new IllegalArgumentException("Must include a non-null AvailabilityCallback.");
|
throw new IllegalArgumentException("Must include a non-null AvailabilityCallback.");
|
||||||
}
|
}
|
||||||
throw new UnsupportedOperationException("unregisterRcsAvailabilityCallback is not"
|
|
||||||
+ "supported.");
|
IImsRcsController imsRcsController = getIImsRcsController();
|
||||||
|
if (imsRcsController == null) {
|
||||||
|
Log.e(TAG, "Unregister availability callback: IImsRcsController is null");
|
||||||
|
throw new ImsException("Can not find remote IMS service",
|
||||||
|
ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
imsRcsController.unregisterRcsAvailabilityCallback(c.getBinder());
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Log.e(TAG, "Error calling IImsRcsController#unregisterRcsAvailabilityCallback", e);
|
||||||
|
throw new ImsException("Remote IMS Service is not available",
|
||||||
|
ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -260,10 +288,27 @@ public class ImsRcsManager implements RegistrationManager {
|
|||||||
* rather the subscription is capable of this service over IMS.
|
* rather the subscription is capable of this service over IMS.
|
||||||
* @see #isAvailable(int)
|
* @see #isAvailable(int)
|
||||||
* @see android.telephony.CarrierConfigManager#KEY_USE_RCS_PRESENCE_BOOL
|
* @see android.telephony.CarrierConfigManager#KEY_USE_RCS_PRESENCE_BOOL
|
||||||
|
* @throws ImsException if the IMS service is not available when calling this method
|
||||||
|
* {@link ImsRcsController#isCapable(int, int)}.
|
||||||
|
* See {@link ImsException#getCode()} for more information on the error codes.
|
||||||
*/
|
*/
|
||||||
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||||
public boolean isCapable(@RcsFeature.RcsImsCapabilities.RcsImsCapabilityFlag int capability) {
|
public boolean isCapable(@RcsFeature.RcsImsCapabilities.RcsImsCapabilityFlag int capability)
|
||||||
throw new UnsupportedOperationException("isCapable is not supported.");
|
throws ImsException {
|
||||||
|
IImsRcsController imsRcsController = getIImsRcsController();
|
||||||
|
if (imsRcsController == null) {
|
||||||
|
Log.e(TAG, "isCapable: IImsRcsController is null");
|
||||||
|
throw new ImsException("Can not find remote IMS service",
|
||||||
|
ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return imsRcsController.isCapable(mSubId, capability);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Log.e(TAG, "Error calling IImsRcsController#isCapable", e);
|
||||||
|
throw new ImsException("Remote IMS Service is not available",
|
||||||
|
ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -277,18 +322,31 @@ public class ImsRcsManager implements RegistrationManager {
|
|||||||
* false otherwise. If the capability is available, IMS is registered and the service is
|
* false otherwise. If the capability is available, IMS is registered and the service is
|
||||||
* currently available over IMS.
|
* currently available over IMS.
|
||||||
* @see #isCapable(int)
|
* @see #isCapable(int)
|
||||||
|
* @throws ImsException if the IMS service is not available when calling this method
|
||||||
|
* {@link ImsRcsController#isAvailable(int, int)}.
|
||||||
|
* See {@link ImsException#getCode()} for more information on the error codes.
|
||||||
*/
|
*/
|
||||||
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||||
public boolean isAvailable(@RcsFeature.RcsImsCapabilities.RcsImsCapabilityFlag int capability) {
|
public boolean isAvailable(@RcsFeature.RcsImsCapabilities.RcsImsCapabilityFlag int capability)
|
||||||
throw new UnsupportedOperationException("isAvailable is not supported.");
|
throws ImsException {
|
||||||
|
IImsRcsController imsRcsController = getIImsRcsController();
|
||||||
|
if (imsRcsController == null) {
|
||||||
|
Log.e(TAG, "isAvailable: IImsRcsController is null");
|
||||||
|
throw new ImsException("Can not find remote IMS service",
|
||||||
|
ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return imsRcsController.isAvailable(mSubId, capability);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Log.e(TAG, "Error calling IImsRcsController#isAvailable", e);
|
||||||
|
throw new ImsException("Remote IMS Service is not available",
|
||||||
|
ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private IImsRcsController getIImsRcsController() {
|
||||||
* @return A new {@link RcsUceAdapter} used for User Capability Exchange (UCE) operations for
|
IBinder binder = ServiceManager.getService(Context.TELEPHONY_IMS_SERVICE);
|
||||||
* this subscription.
|
return IImsRcsController.Stub.asInterface(binder);
|
||||||
*/
|
|
||||||
@NonNull
|
|
||||||
public RcsUceAdapter getUceAdapter() {
|
|
||||||
return new RcsUceAdapter(mSubId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,13 @@ import android.annotation.NonNull;
|
|||||||
import android.annotation.RequiresPermission;
|
import android.annotation.RequiresPermission;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.os.Binder;
|
||||||
|
import android.os.IBinder;
|
||||||
|
import android.os.RemoteException;
|
||||||
|
import android.os.ServiceManager;
|
||||||
|
import android.telephony.ims.aidl.IImsRcsController;
|
||||||
|
import android.telephony.ims.aidl.IRcsUceControllerCallback;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
@@ -36,6 +43,7 @@ import java.util.concurrent.Executor;
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public class RcsUceAdapter {
|
public class RcsUceAdapter {
|
||||||
|
private static final String TAG = "RcsUceAdapter";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An unknown error has caused the request to fail.
|
* An unknown error has caused the request to fail.
|
||||||
@@ -188,7 +196,6 @@ public class RcsUceAdapter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Not to be instantiated directly, use
|
* Not to be instantiated directly, use
|
||||||
* {@link ImsRcsManager#createForSubscriptionId(Context, int)} and
|
|
||||||
* {@link ImsRcsManager#getUceAdapter()} to instantiate this manager class.
|
* {@link ImsRcsManager#getUceAdapter()} to instantiate this manager class.
|
||||||
*/
|
*/
|
||||||
RcsUceAdapter(int subId) {
|
RcsUceAdapter(int subId) {
|
||||||
@@ -218,7 +225,45 @@ public class RcsUceAdapter {
|
|||||||
public void requestCapabilities(@CallbackExecutor Executor executor,
|
public void requestCapabilities(@CallbackExecutor Executor executor,
|
||||||
@NonNull List<Uri> contactNumbers,
|
@NonNull List<Uri> contactNumbers,
|
||||||
@NonNull CapabilitiesCallback c) throws ImsException {
|
@NonNull CapabilitiesCallback c) throws ImsException {
|
||||||
throw new UnsupportedOperationException("isUceSettingEnabled is not supported.");
|
if (c == null) {
|
||||||
|
throw new IllegalArgumentException("Must include a non-null AvailabilityCallback.");
|
||||||
|
}
|
||||||
|
if (executor == null) {
|
||||||
|
throw new IllegalArgumentException("Must include a non-null Executor.");
|
||||||
|
}
|
||||||
|
if (contactNumbers == null) {
|
||||||
|
throw new IllegalArgumentException("Must include non-null contact number list.");
|
||||||
|
}
|
||||||
|
|
||||||
|
IImsRcsController imsRcsController = getIImsRcsController();
|
||||||
|
if (imsRcsController == null) {
|
||||||
|
Log.e(TAG, "requestCapabilities: IImsRcsController is null");
|
||||||
|
throw new ImsException("Can not find remote IMS service",
|
||||||
|
ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
IRcsUceControllerCallback internalCallback = new IRcsUceControllerCallback.Stub() {
|
||||||
|
@Override
|
||||||
|
public void onCapabilitiesReceived(List<RcsContactUceCapability> contactCapabilities) {
|
||||||
|
Binder.withCleanCallingIdentity(() ->
|
||||||
|
executor.execute(() ->
|
||||||
|
c.onCapabilitiesReceived(contactCapabilities)));
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onError(int errorCode) {
|
||||||
|
Binder.withCleanCallingIdentity(() ->
|
||||||
|
executor.execute(() ->
|
||||||
|
c.onError(errorCode)));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
imsRcsController.requestCapabilities(mSubId, contactNumbers, internalCallback);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Log.e(TAG, "Error calling IImsRcsController#requestCapabilities", e);
|
||||||
|
throw new ImsException("Remote IMS Service is not available",
|
||||||
|
ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -233,7 +278,20 @@ public class RcsUceAdapter {
|
|||||||
*/
|
*/
|
||||||
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||||
public @PublishState int getUcePublishState() throws ImsException {
|
public @PublishState int getUcePublishState() throws ImsException {
|
||||||
throw new UnsupportedOperationException("getPublishState is not supported.");
|
IImsRcsController imsRcsController = getIImsRcsController();
|
||||||
|
if (imsRcsController == null) {
|
||||||
|
Log.e(TAG, "getUcePublishState: IImsRcsController is null");
|
||||||
|
throw new ImsException("Can not find remote IMS service",
|
||||||
|
ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return imsRcsController.getUcePublishState(mSubId);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Log.e(TAG, "Error calling IImsRcsController#getUcePublishState", e);
|
||||||
|
throw new ImsException("Remote IMS Service is not available",
|
||||||
|
ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -252,9 +310,22 @@ public class RcsUceAdapter {
|
|||||||
*/
|
*/
|
||||||
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||||
public boolean isUceSettingEnabled() throws ImsException {
|
public boolean isUceSettingEnabled() throws ImsException {
|
||||||
// TODO: add SubscriptionController column for this property.
|
IImsRcsController imsRcsController = getIImsRcsController();
|
||||||
throw new UnsupportedOperationException("isUceSettingEnabled is not supported.");
|
if (imsRcsController == null) {
|
||||||
|
Log.e(TAG, "isUceSettingEnabled: IImsRcsController is null");
|
||||||
|
throw new ImsException("Can not find remote IMS service",
|
||||||
|
ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return imsRcsController.isUceSettingEnabled(mSubId);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Log.e(TAG, "Error calling IImsRcsController#isUceSettingEnabled", e);
|
||||||
|
throw new ImsException("Remote IMS Service is not available",
|
||||||
|
ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the user’s setting for whether or not UCE is enabled for the associated subscription.
|
* Change the user’s setting for whether or not UCE is enabled for the associated subscription.
|
||||||
* @param isEnabled the user's setting for whether or not they wish for Presence and User
|
* @param isEnabled the user's setting for whether or not they wish for Presence and User
|
||||||
@@ -270,7 +341,24 @@ public class RcsUceAdapter {
|
|||||||
*/
|
*/
|
||||||
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
|
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
|
||||||
public void setUceSettingEnabled(boolean isEnabled) throws ImsException {
|
public void setUceSettingEnabled(boolean isEnabled) throws ImsException {
|
||||||
// TODO: add SubscriptionController column for this property.
|
IImsRcsController imsRcsController = getIImsRcsController();
|
||||||
throw new UnsupportedOperationException("setUceSettingEnabled is not supported.");
|
if (imsRcsController == null) {
|
||||||
|
Log.e(TAG, "setUceSettingEnabled: IImsRcsController is null");
|
||||||
|
throw new ImsException("Can not find remote IMS service",
|
||||||
|
ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
imsRcsController.setUceSettingEnabled(mSubId, isEnabled);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Log.e(TAG, "Error calling IImsRcsController#setUceSettingEnabled", e);
|
||||||
|
throw new ImsException("Remote IMS Service is not available",
|
||||||
|
ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IImsRcsController getIImsRcsController() {
|
||||||
|
IBinder binder = ServiceManager.getService(Context.TELEPHONY_IMS_SERVICE);
|
||||||
|
return IImsRcsController.Stub.asInterface(binder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 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.aidl;
|
||||||
|
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.telephony.ims.aidl.IImsCapabilityCallback;
|
||||||
|
import android.telephony.ims.aidl.IRcsUceControllerCallback;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface used to interact with the Telephony IMS.
|
||||||
|
*
|
||||||
|
* {@hide}
|
||||||
|
*/
|
||||||
|
interface IImsRcsController {
|
||||||
|
void registerRcsAvailabilityCallback(IImsCapabilityCallback c);
|
||||||
|
void unregisterRcsAvailabilityCallback(IImsCapabilityCallback c);
|
||||||
|
boolean isCapable(int subId, int capability);
|
||||||
|
boolean isAvailable(int subId, int capability);
|
||||||
|
|
||||||
|
// ImsUceAdapter specific
|
||||||
|
void requestCapabilities(int subId, in List<Uri> contactNumbers, IRcsUceControllerCallback c);
|
||||||
|
int getUcePublishState(int subId);
|
||||||
|
boolean isUceSettingEnabled(int subId);
|
||||||
|
void setUceSettingEnabled(int subId, boolean isEnabled);
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019 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.aidl;
|
||||||
|
|
||||||
|
import android.telephony.ims.RcsContactUceCapability;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides interface for RCS UCE when receive a change.
|
||||||
|
*
|
||||||
|
* {@hide}
|
||||||
|
*/
|
||||||
|
oneway interface IRcsUceControllerCallback {
|
||||||
|
void onCapabilitiesReceived(in List<RcsContactUceCapability> contactCapabilities);
|
||||||
|
void onError(int errorCode);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user