Merge "Expose ImsMmTelManager APIs as SystemApi"

This commit is contained in:
Brad Ebinger
2018-11-21 18:59:33 +00:00
committed by Gerrit Code Review
7 changed files with 184 additions and 112 deletions

View File

@@ -42097,6 +42097,7 @@ package android.telephony {
field public static final java.lang.String KEY_EDITABLE_VOICEMAIL_NUMBER_BOOL = "editable_voicemail_number_bool"; field public static final java.lang.String KEY_EDITABLE_VOICEMAIL_NUMBER_BOOL = "editable_voicemail_number_bool";
field public static final java.lang.String KEY_EDITABLE_VOICEMAIL_NUMBER_SETTING_BOOL = "editable_voicemail_number_setting_bool"; field public static final java.lang.String KEY_EDITABLE_VOICEMAIL_NUMBER_SETTING_BOOL = "editable_voicemail_number_setting_bool";
field public static final java.lang.String KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL = "enable_dialer_key_vibration_bool"; field public static final java.lang.String KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL = "enable_dialer_key_vibration_bool";
field public static final java.lang.String KEY_ENHANCED_4G_LTE_ON_BY_DEFAULT_BOOL = "enhanced_4g_lte_on_by_default_bool";
field public static final java.lang.String KEY_FORCE_HOME_NETWORK_BOOL = "force_home_network_bool"; field public static final java.lang.String KEY_FORCE_HOME_NETWORK_BOOL = "force_home_network_bool";
field public static final java.lang.String KEY_GSM_DTMF_TONE_DELAY_INT = "gsm_dtmf_tone_delay_int"; field public static final java.lang.String KEY_GSM_DTMF_TONE_DELAY_INT = "gsm_dtmf_tone_delay_int";
field public static final java.lang.String KEY_GSM_NONROAMING_NETWORKS_STRING_ARRAY = "gsm_nonroaming_networks_string_array"; field public static final java.lang.String KEY_GSM_NONROAMING_NETWORKS_STRING_ARRAY = "gsm_nonroaming_networks_string_array";

View File

@@ -5849,6 +5849,45 @@ package android.telephony.ims {
field public static final android.os.Parcelable.Creator<android.telephony.ims.ImsExternalCallState> CREATOR; field public static final android.os.Parcelable.Creator<android.telephony.ims.ImsExternalCallState> CREATOR;
} }
public class ImsMmTelManager {
method public static android.telephony.ims.ImsMmTelManager createForSubscriptionId(android.content.Context, int);
method public int getVoWiFiModeSetting();
method public boolean isAdvancedCallingSettingEnabled();
method public boolean isAvailable(int, int);
method public boolean isCapable(int, int);
method public boolean isVoWiFiRoamingSettingEnabled();
method public boolean isVoWiFiSettingEnabled();
method public boolean isVtSettingEnabled();
method public void registerImsRegistrationCallback(java.util.concurrent.Executor, android.telephony.ims.ImsMmTelManager.RegistrationCallback);
method public void registerMmTelCapabilityCallback(java.util.concurrent.Executor, android.telephony.ims.ImsMmTelManager.CapabilityCallback);
method public void setAdvancedCallingSetting(boolean);
method public void setRttCapabilitySetting(boolean);
method public void setVoWiFiModeSetting(int);
method public void setVoWiFiNonPersistent(boolean, int);
method public void setVoWiFiRoamingModeSetting(int);
method public void setVoWiFiRoamingSetting(boolean);
method public void setVoWiFiSetting(boolean);
method public void setVtSetting(boolean);
method public void unregisterImsRegistrationCallback(android.telephony.ims.ImsMmTelManager.RegistrationCallback);
method public void unregisterMmTelCapabilityCallback(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
field public static final int WIFI_MODE_WIFI_PREFERRED = 2; // 0x2
}
public static class ImsMmTelManager.CapabilityCallback {
ctor public ImsMmTelManager.CapabilityCallback();
method public void onCapabilitiesStatusChanged(android.telephony.ims.feature.MmTelFeature.MmTelCapabilities);
}
public static class ImsMmTelManager.RegistrationCallback {
ctor public ImsMmTelManager.RegistrationCallback();
method public void onDeregistered(android.telephony.ims.ImsReasonInfo);
method public void onRegistered(int);
method public void onRegistering(int);
method public void onTechnologyChangeFailed(int, android.telephony.ims.ImsReasonInfo);
}
public final class ImsReasonInfo implements android.os.Parcelable { public final class ImsReasonInfo implements android.os.Parcelable {
ctor public ImsReasonInfo(int, int, java.lang.String); ctor public ImsReasonInfo(int, int, java.lang.String);
method public int describeContents(); method public int describeContents();

View File

@@ -1023,9 +1023,9 @@ public class CarrierConfigManager {
public static final String KEY_HIDE_ENHANCED_4G_LTE_BOOL = "hide_enhanced_4g_lte_bool"; public static final String KEY_HIDE_ENHANCED_4G_LTE_BOOL = "hide_enhanced_4g_lte_bool";
/** /**
* Default Enhanced 4G LTE mode enabled. When this is {@code true}, Enhanced 4G LTE mode by * Sets the default state for the "Enhanced 4G LTE" or "Advanced Calling" mode toggle set by the
* default is on, otherwise if {@code false}, Enhanced 4G LTE mode by default is off. * user. When this is {@code true}, this mode by default is on, otherwise if {@code false},
* @hide * this mode by default is off.
*/ */
public static final String KEY_ENHANCED_4G_LTE_ON_BY_DEFAULT_BOOL = public static final String KEY_ENHANCED_4G_LTE_ON_BY_DEFAULT_BOOL =
"enhanced_4g_lte_on_by_default_bool"; "enhanced_4g_lte_on_by_default_bool";

View File

@@ -7675,7 +7675,7 @@ public class TelephonyManager {
try { try {
return getITelephony().isAvailable(getSubId(), return getITelephony().isAvailable(getSubId(),
MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_VOICE, MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_VOICE,
ImsRegistrationImplBase.REGISTRATION_TECH_LTE, getOpPackageName()); ImsRegistrationImplBase.REGISTRATION_TECH_LTE);
} catch (RemoteException | NullPointerException ex) { } catch (RemoteException | NullPointerException ex) {
return false; return false;
} }

View File

@@ -28,17 +28,22 @@ import android.net.Uri;
import android.os.Binder; import android.os.Binder;
import android.os.RemoteException; import android.os.RemoteException;
import android.os.ServiceManager; import android.os.ServiceManager;
import android.telephony.AccessNetworkConstants;
import android.telephony.SubscriptionManager; import android.telephony.SubscriptionManager;
import android.telephony.ims.aidl.IImsCapabilityCallback; import android.telephony.ims.aidl.IImsCapabilityCallback;
import android.telephony.ims.aidl.IImsRegistrationCallback; import android.telephony.ims.aidl.IImsRegistrationCallback;
import android.telephony.ims.feature.ImsFeature; import android.telephony.ims.feature.ImsFeature;
import android.telephony.ims.feature.MmTelFeature; import android.telephony.ims.feature.MmTelFeature;
import android.telephony.ims.stub.ImsRegistrationImplBase; import android.telephony.ims.stub.ImsRegistrationImplBase;
import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.ITelephony; import com.android.internal.telephony.ITelephony;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
/** /**
@@ -52,6 +57,7 @@ import java.util.concurrent.Executor;
* @see #createForSubscriptionId(Context, int) * @see #createForSubscriptionId(Context, int)
* @hide * @hide
*/ */
@SystemApi
public class ImsMmTelManager { public class ImsMmTelManager {
private static final String TAG = "ImsMmTelManager"; private static final String TAG = "ImsMmTelManager";
@@ -70,16 +76,12 @@ public class ImsMmTelManager {
/** /**
* Register for IMS over IWLAN if WiFi signal quality is high enough. Do not hand over to LTE * Register for IMS over IWLAN if WiFi signal quality is high enough. Do not hand over to LTE
* registration if signal quality degrades. * registration if signal quality degrades.
* @hide
*/ */
@SystemApi
public static final int WIFI_MODE_WIFI_ONLY = 0; public static final int WIFI_MODE_WIFI_ONLY = 0;
/** /**
* Prefer registering for IMS over LTE if LTE signal quality is high enough. * Prefer registering for IMS over LTE if LTE signal quality is high enough.
* @hide
*/ */
@SystemApi
public static final int WIFI_MODE_CELLULAR_PREFERRED = 1; public static final int WIFI_MODE_CELLULAR_PREFERRED = 1;
/** /**
@@ -91,13 +93,26 @@ public class ImsMmTelManager {
/** /**
* Callback class for receiving Registration callback events. * Callback class for receiving Registration callback events.
* @see #addImsRegistrationCallback(Executor, RegistrationCallback) (RegistrationCallback) * @see #registerImsRegistrationCallback(Executor, RegistrationCallback) (RegistrationCallback)
* @see #removeImsRegistrationCallback(RegistrationCallback) * @see #unregisterImsRegistrationCallback(RegistrationCallback)
*/ */
public static class RegistrationCallback { public static class RegistrationCallback {
private static class RegistrationBinder extends IImsRegistrationCallback.Stub { private static class RegistrationBinder extends IImsRegistrationCallback.Stub {
// Translate ImsRegistrationImplBase API to new AccessNetworkConstant because WLAN
// and WWAN are more accurate constants.
private static final Map<Integer, Integer> IMS_REG_TO_ACCESS_TYPE_MAP =
new HashMap<Integer, Integer>() {{
// Map NONE to -1 to make sure that we handle the REGISTRATION_TECH_NONE
// case, since it is defined.
put(ImsRegistrationImplBase.REGISTRATION_TECH_NONE, -1);
put(ImsRegistrationImplBase.REGISTRATION_TECH_LTE,
AccessNetworkConstants.TransportType.WWAN);
put(ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN,
AccessNetworkConstants.TransportType.WLAN);
}};
private final RegistrationCallback mLocalCallback; private final RegistrationCallback mLocalCallback;
private Executor mExecutor; private Executor mExecutor;
@@ -109,16 +124,16 @@ public class ImsMmTelManager {
public void onRegistered(int imsRadioTech) { public void onRegistered(int imsRadioTech) {
if (mLocalCallback == null) return; if (mLocalCallback == null) return;
Binder.withCleanCallingIdentity(() -> Binder.withCleanCallingIdentity(() -> mExecutor.execute(() ->
mExecutor.execute(() -> mLocalCallback.onRegistered(imsRadioTech))); mLocalCallback.onRegistered(getAccessType(imsRadioTech))));
} }
@Override @Override
public void onRegistering(int imsRadioTech) { public void onRegistering(int imsRadioTech) {
if (mLocalCallback == null) return; if (mLocalCallback == null) return;
Binder.withCleanCallingIdentity(() -> Binder.withCleanCallingIdentity(() -> mExecutor.execute(() ->
mExecutor.execute(() -> mLocalCallback.onRegistering(imsRadioTech))); mLocalCallback.onRegistering(getAccessType(imsRadioTech))));
} }
@Override @Override
@@ -134,8 +149,8 @@ public class ImsMmTelManager {
if (mLocalCallback == null) return; if (mLocalCallback == null) return;
Binder.withCleanCallingIdentity(() -> Binder.withCleanCallingIdentity(() ->
mExecutor.execute(() -> mExecutor.execute(() -> mLocalCallback.onTechnologyChangeFailed(
mLocalCallback.onTechnologyChangeFailed(imsRadioTech, info))); getAccessType(imsRadioTech), info)));
} }
@Override @Override
@@ -150,6 +165,15 @@ public class ImsMmTelManager {
private void setExecutor(Executor executor) { private void setExecutor(Executor executor) {
mExecutor = executor; mExecutor = executor;
} }
private static int getAccessType(int regType) {
if (!IMS_REG_TO_ACCESS_TYPE_MAP.containsKey(regType)) {
Log.w("ImsMmTelManager", "RegistrationBinder - invalid regType returned: "
+ regType);
return -1;
}
return IMS_REG_TO_ACCESS_TYPE_MAP.get(regType);
}
} }
private final RegistrationBinder mBinder = new RegistrationBinder(this); private final RegistrationBinder mBinder = new RegistrationBinder(this);
@@ -157,19 +181,19 @@ public class ImsMmTelManager {
/** /**
* 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 imsRadioTech the radio access technology. Valid values are defined in * @param imsTransportType the radio access technology. Valid values are defined in
* {@link ImsRegistrationImplBase.ImsRegistrationTech}. * {@link android.telephony.AccessNetworkConstants.TransportType}.
*/ */
public void onRegistered(@ImsRegistrationImplBase.ImsRegistrationTech int imsRadioTech) { public void onRegistered(int imsTransportType) {
} }
/** /**
* 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 imsRadioTech the radio access technology. Valid values are defined in * @param imsTransportType the radio access technology. Valid values are defined in
* {@link ImsRegistrationImplBase.ImsRegistrationTech}. * {@link android.telephony.AccessNetworkConstants.TransportType}.
*/ */
public void onRegistering(@ImsRegistrationImplBase.ImsRegistrationTech int imsRadioTech) { public void onRegistering(int imsTransportType) {
} }
/** /**
@@ -182,14 +206,14 @@ public class ImsMmTelManager {
/** /**
* A failure has occurred when trying to handover registration to another technology type, * A failure has occurred when trying to handover registration to another technology type,
* defined in {@link ImsRegistrationImplBase.ImsRegistrationTech} * defined in {@link android.telephony.AccessNetworkConstants.TransportType}
* *
* @param imsRadioTech The {@link ImsRegistrationImplBase.ImsRegistrationTech} type that has * @param imsTransportType The
* failed * {@link android.telephony.AccessNetworkConstants.TransportType}
* transport type that has failed to handover registration to.
* @param info A {@link ImsReasonInfo} that identifies the reason for failure. * @param info A {@link ImsReasonInfo} that identifies the reason for failure.
*/ */
public void onTechnologyChangeFailed( public void onTechnologyChangeFailed(int imsTransportType, ImsReasonInfo info) {
@ImsRegistrationImplBase.ImsRegistrationTech int imsRadioTech, ImsReasonInfo info) {
} }
/** /**
@@ -219,8 +243,8 @@ public class ImsMmTelManager {
/** /**
* Receives IMS capability status updates from the ImsService. * Receives IMS capability status updates from the ImsService.
* *
* @see #addMmTelCapabilityCallback(Executor, CapabilityCallback) (CapabilityCallback) * @see #registerMmTelCapabilityCallback(Executor, CapabilityCallback) (CapabilityCallback)
* @see #removeMmTelCapabilityCallback(CapabilityCallback) * @see #unregisterMmTelCapabilityCallback(CapabilityCallback)
*/ */
public static class CapabilityCallback { public static class CapabilityCallback {
@@ -285,13 +309,12 @@ public class ImsMmTelManager {
} }
} }
private Context mContext;
private int mSubId; private int mSubId;
/** /**
* Create an instance of ImsManager for the subscription id specified. * Create an instance of ImsManager for the subscription id specified.
* *
* @param context * @param context The context to create this ImsMmTelManager instance within.
* @param subId The ID of the subscription that this ImsMmTelManager will use. * @param subId The ID of the subscription that this ImsMmTelManager will use.
* @see android.telephony.SubscriptionManager#getActiveSubscriptionInfoList() * @see android.telephony.SubscriptionManager#getActiveSubscriptionInfoList()
* @throws IllegalArgumentException if the subscription is invalid or * @throws IllegalArgumentException if the subscription is invalid or
@@ -303,11 +326,15 @@ public class ImsMmTelManager {
throw new IllegalArgumentException("Invalid subscription ID"); throw new IllegalArgumentException("Invalid subscription ID");
} }
return new ImsMmTelManager(context, subId); return new ImsMmTelManager(subId);
} }
private ImsMmTelManager(Context context, int subId) { /**
mContext = context; * Only visible for testing, use {@link #createForSubscriptionId(Context, int)} instead.
* @hide
*/
@VisibleForTesting
public ImsMmTelManager(int subId) {
mSubId = subId; mSubId = subId;
} }
@@ -315,14 +342,18 @@ public class ImsMmTelManager {
* Registers a {@link RegistrationCallback} with the system, which will provide registration * Registers a {@link RegistrationCallback} with the system, which will provide registration
* updates for the subscription specified in {@link #createForSubscriptionId(Context, int)}. Use * updates for the subscription specified in {@link #createForSubscriptionId(Context, int)}. Use
* {@link SubscriptionManager.OnSubscriptionsChangedListener} to listen to Subscription changed * {@link SubscriptionManager.OnSubscriptionsChangedListener} to listen to Subscription changed
* events and call {@link #removeImsRegistrationCallback(RegistrationCallback)} to clean up * events and call {@link #unregisterImsRegistrationCallback(RegistrationCallback)} to clean up
* after a subscription is removed. * after a subscription is removed.
*
* When the callback is registered, it will initiate the callback c to be called with the
* current registration state.
*
* @param executor The executor the callback events should be run on. * @param executor The executor the callback events should be run on.
* @param c The {@link RegistrationCallback} to be added. * @param c The {@link RegistrationCallback} to be added.
* @see #removeImsRegistrationCallback(RegistrationCallback) * @see #unregisterImsRegistrationCallback(RegistrationCallback)
*/ */
@RequiresPermission(Manifest.permission.READ_PHONE_STATE) @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public void addImsRegistrationCallback(@CallbackExecutor Executor executor, public void registerImsRegistrationCallback(@CallbackExecutor Executor executor,
@NonNull RegistrationCallback c) { @NonNull RegistrationCallback c) {
if (c == null) { if (c == null) {
throw new IllegalArgumentException("Must include a non-null RegistrationCallback."); throw new IllegalArgumentException("Must include a non-null RegistrationCallback.");
@@ -332,8 +363,7 @@ public class ImsMmTelManager {
} }
c.setExecutor(executor); c.setExecutor(executor);
try { try {
getITelephony().addImsRegistrationCallback(mSubId, c.getBinder(), getITelephony().registerImsRegistrationCallback(mSubId, c.getBinder());
mContext.getOpPackageName());
} catch (RemoteException e) { } catch (RemoteException e) {
throw e.rethrowAsRuntimeException(); throw e.rethrowAsRuntimeException();
} }
@@ -344,16 +374,15 @@ public class ImsMmTelManager {
* up to avoid memory leaks or when the subscription is removed. * up to avoid memory leaks or when the subscription is removed.
* @param c The {@link RegistrationCallback} to be removed. * @param c The {@link RegistrationCallback} to be removed.
* @see SubscriptionManager.OnSubscriptionsChangedListener * @see SubscriptionManager.OnSubscriptionsChangedListener
* @see #addImsRegistrationCallback(Executor, RegistrationCallback) * @see #registerImsRegistrationCallback(Executor, RegistrationCallback)
*/ */
@RequiresPermission(Manifest.permission.READ_PHONE_STATE) @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public void removeImsRegistrationCallback(@NonNull RegistrationCallback c) { public void unregisterImsRegistrationCallback(@NonNull RegistrationCallback c) {
if (c == null) { if (c == null) {
throw new IllegalArgumentException("Must include a non-null RegistrationCallback."); throw new IllegalArgumentException("Must include a non-null RegistrationCallback.");
} }
try { try {
getITelephony().removeImsRegistrationCallback(mSubId, c.getBinder(), getITelephony().unregisterImsRegistrationCallback(mSubId, c.getBinder());
mContext.getOpPackageName());
} catch (RemoteException e) { } catch (RemoteException e) {
throw e.rethrowAsRuntimeException(); throw e.rethrowAsRuntimeException();
} }
@@ -364,14 +393,18 @@ public class ImsMmTelManager {
* updates for the subscription specified in {@link #createForSubscriptionId(Context, int)}. * updates for the subscription specified in {@link #createForSubscriptionId(Context, int)}.
* Use {@link SubscriptionManager.OnSubscriptionsChangedListener} to listen to * Use {@link SubscriptionManager.OnSubscriptionsChangedListener} to listen to
* subscription changed events and call * subscription changed events and call
* {@link #removeImsRegistrationCallback(RegistrationCallback)} to clean up after a subscription * {@link #unregisterImsRegistrationCallback(RegistrationCallback)} to clean up after a
* is removed. * subscription is removed.
*
* When the callback is registered, it will initiate the callback c to be called with the
* current capabilities.
*
* @param executor The executor the callback events should be run on. * @param executor The executor the callback events should be run on.
* @param c The MmTel {@link CapabilityCallback} to be registered. * @param c The MmTel {@link CapabilityCallback} to be registered.
* @see #removeMmTelCapabilityCallback(CapabilityCallback) * @see #unregisterMmTelCapabilityCallback(CapabilityCallback)
*/ */
@RequiresPermission(Manifest.permission.READ_PHONE_STATE) @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public void addMmTelCapabilityCallback(@CallbackExecutor Executor executor, public void registerMmTelCapabilityCallback(@CallbackExecutor Executor executor,
@NonNull CapabilityCallback c) { @NonNull CapabilityCallback c) {
if (c == null) { if (c == null) {
throw new IllegalArgumentException("Must include a non-null RegistrationCallback."); throw new IllegalArgumentException("Must include a non-null RegistrationCallback.");
@@ -381,8 +414,7 @@ public class ImsMmTelManager {
} }
c.setExecutor(executor); c.setExecutor(executor);
try { try {
getITelephony().addMmTelCapabilityCallback(mSubId, c.getBinder(), getITelephony().registerMmTelCapabilityCallback(mSubId, c.getBinder());
mContext.getOpPackageName());
} catch (RemoteException e) { } catch (RemoteException e) {
throw e.rethrowAsRuntimeException(); throw e.rethrowAsRuntimeException();
} }
@@ -392,29 +424,42 @@ public class ImsMmTelManager {
* Removes an existing MmTel {@link CapabilityCallback}. Be sure to call this when cleaning * Removes an existing MmTel {@link CapabilityCallback}. Be sure to call this when cleaning
* up to avoid memory leaks. * up to avoid memory leaks.
* @param c The MmTel {@link CapabilityCallback} to be removed. * @param c The MmTel {@link CapabilityCallback} to be removed.
* @see #addMmTelCapabilityCallback(Executor, CapabilityCallback) * @see #registerMmTelCapabilityCallback(Executor, CapabilityCallback)
*/ */
@RequiresPermission(Manifest.permission.READ_PHONE_STATE) @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public void removeMmTelCapabilityCallback(@NonNull CapabilityCallback c) { public void unregisterMmTelCapabilityCallback(@NonNull CapabilityCallback c) {
if (c == null) { if (c == null) {
throw new IllegalArgumentException("Must include a non-null RegistrationCallback."); throw new IllegalArgumentException("Must include a non-null RegistrationCallback.");
} }
try { try {
getITelephony().removeMmTelCapabilityCallback(mSubId, c.getBinder(), getITelephony().unregisterMmTelCapabilityCallback(mSubId, c.getBinder());
mContext.getOpPackageName());
} catch (RemoteException e) { } catch (RemoteException e) {
throw e.rethrowAsRuntimeException(); throw e.rethrowAsRuntimeException();
} }
} }
/** /**
* Query the user's setting for whether or not to use MmTel capabilities over IMS, * Query the user’s setting for “Advanced Calling” or "Enhanced 4G LTE", which is used to
* such as voice and video, depending on carrier configuration for the current subscription. * enable MmTel IMS features, depending on the carrier configuration for the current
* subscription. If this setting is enabled, IMS voice and video telephony over IWLAN/LTE will
* be enabled as long as the carrier has provisioned these services for the specified
* subscription. Other IMS services (SMS/UT) are not affected by this user setting and depend on
* carrier requirements.
*
* Modifying this value may also trigger an IMS registration or deregistration, depending on
* whether or not the new value is enabled or disabled.
*
* Note: If the carrier configuration for advanced calling is not editable or hidden, this
* method will do nothing and will instead always use the default value.
*
* @see android.telephony.CarrierConfigManager#KEY_CARRIER_VOLTE_PROVISIONING_REQUIRED_BOOL
* @see android.telephony.CarrierConfigManager#KEY_EDITABLE_ENHANCED_4G_LTE_BOOL
* @see android.telephony.CarrierConfigManager#KEY_HIDE_ENHANCED_4G_LTE_BOOL
* @see android.telephony.CarrierConfigManager#KEY_ENHANCED_4G_LTE_ON_BY_DEFAULT_BOOL
* @see android.telephony.CarrierConfigManager#KEY_CARRIER_VOLTE_AVAILABLE_BOOL
* @see #setAdvancedCallingSetting(boolean) * @see #setAdvancedCallingSetting(boolean)
* @return true if the user’s setting for advanced calling is enabled and false otherwise. * @return true if the user's setting for advanced calling is enabled, false otherwise.
* @hide
*/ */
@SystemApi
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public boolean isAdvancedCallingSettingEnabled() { public boolean isAdvancedCallingSettingEnabled() {
try { try {
@@ -426,13 +471,25 @@ public class ImsMmTelManager {
/** /**
* Modify the user’s setting for “Advanced Calling” or "Enhanced 4G LTE", which is used to * Modify the user’s setting for “Advanced Calling” or "Enhanced 4G LTE", which is used to
* enable MmTel IMS features, such as voice and video calling, depending on the carrier * enable MmTel IMS features, depending on the carrier configuration for the current
* configuration for the current subscription. Modifying this value may also trigger an IMS * subscription. If this setting is enabled, IMS voice and video telephony over IWLAN/LTE will
* registration or deregistration, depending on the new value. * be enabled as long as the carrier has provisioned these services for the specified
* @see #isAdvancedCallingEnabled() * subscription. Other IMS services (SMS/UT) are not affected by this user setting and depend on
* @hide * carrier requirements.
*
* Modifying this value may also trigger an IMS registration or deregistration, depending on
* whether or not the new value is enabled or disabled.
*
* Note: If the carrier configuration for advanced calling is not editable or hidden, this
* method will do nothing and will instead always use the default value.
*
* @see android.telephony.CarrierConfigManager#KEY_CARRIER_VOLTE_PROVISIONING_REQUIRED_BOOL
* @see android.telephony.CarrierConfigManager#KEY_EDITABLE_ENHANCED_4G_LTE_BOOL
* @see android.telephony.CarrierConfigManager#KEY_HIDE_ENHANCED_4G_LTE_BOOL
* @see android.telephony.CarrierConfigManager#KEY_ENHANCED_4G_LTE_ON_BY_DEFAULT_BOOL
* @see android.telephony.CarrierConfigManager#KEY_CARRIER_VOLTE_AVAILABLE_BOOL
* @see #isAdvancedCallingSettingEnabled()
*/ */
@SystemApi
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
public void setAdvancedCallingSetting(boolean isEnabled) { public void setAdvancedCallingSetting(boolean isEnabled) {
try { try {
@@ -464,12 +521,11 @@ public class ImsMmTelManager {
* @return {@code true} if the MmTel IMS capability is capable for this subscription, false * @return {@code true} if the MmTel IMS capability is capable for this subscription, false
* otherwise. * otherwise.
*/ */
@RequiresPermission(Manifest.permission.READ_PHONE_STATE) @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public boolean isCapable(@MmTelFeature.MmTelCapabilities.MmTelCapability int capability, public boolean isCapable(@MmTelFeature.MmTelCapabilities.MmTelCapability int capability,
@ImsRegistrationImplBase.ImsRegistrationTech int imsRegTech) { @ImsRegistrationImplBase.ImsRegistrationTech int imsRegTech) {
try { try {
return getITelephony().isCapable(mSubId, capability, imsRegTech, return getITelephony().isCapable(mSubId, capability, imsRegTech);
mContext.getOpPackageName());
} catch (RemoteException e) { } catch (RemoteException e) {
throw e.rethrowAsRuntimeException(); throw e.rethrowAsRuntimeException();
} }
@@ -492,12 +548,11 @@ public class ImsMmTelManager {
* @return {@code true} if the MmTel IMS capability is available for this subscription, false * @return {@code true} if the MmTel IMS capability is available for this subscription, false
* otherwise. * otherwise.
*/ */
@RequiresPermission(Manifest.permission.READ_PHONE_STATE) @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public boolean isAvailable(@MmTelFeature.MmTelCapabilities.MmTelCapability int capability, public boolean isAvailable(@MmTelFeature.MmTelCapabilities.MmTelCapability int capability,
@ImsRegistrationImplBase.ImsRegistrationTech int imsRegTech) { @ImsRegistrationImplBase.ImsRegistrationTech int imsRegTech) {
try { try {
return getITelephony().isAvailable(mSubId, capability, imsRegTech, return getITelephony().isAvailable(mSubId, capability, imsRegTech);
mContext.getOpPackageName());
} catch (RemoteException e) { } catch (RemoteException e) {
throw e.rethrowAsRuntimeException(); throw e.rethrowAsRuntimeException();
} }
@@ -508,11 +563,10 @@ public class ImsMmTelManager {
* @return true if the user’s “Video Calling” setting is currently enabled. * @return true if the user’s “Video Calling” setting is currently enabled.
* @see #setVtSetting(boolean) * @see #setVtSetting(boolean)
*/ */
@SystemApi @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
@RequiresPermission(Manifest.permission.READ_PHONE_STATE)
public boolean isVtSettingEnabled() { public boolean isVtSettingEnabled() {
try { try {
return getITelephony().isVtSettingEnabled(mSubId, mContext.getOpPackageName()); return getITelephony().isVtSettingEnabled(mSubId);
} catch (RemoteException e) { } catch (RemoteException e) {
throw e.rethrowAsRuntimeException(); throw e.rethrowAsRuntimeException();
} }
@@ -521,9 +575,7 @@ public class ImsMmTelManager {
/** /**
* Change the user's setting for Video Telephony and enable the Video Telephony capability. * Change the user's setting for Video Telephony and enable the Video Telephony capability.
* @see #isVtSettingEnabled() * @see #isVtSettingEnabled()
* @hide
*/ */
@SystemApi
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
public void setVtSetting(boolean isEnabled) { public void setVtSetting(boolean isEnabled) {
try { try {
@@ -537,9 +589,7 @@ public class ImsMmTelManager {
/** /**
* @return true if the user's setting for Voice over WiFi is enabled and false if it is not. * @return true if the user's setting for Voice over WiFi is enabled and false if it is not.
* @see #setVoWiFiSetting(boolean) * @see #setVoWiFiSetting(boolean)
* @hide
*/ */
@SystemApi
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public boolean isVoWiFiSettingEnabled() { public boolean isVoWiFiSettingEnabled() {
try { try {
@@ -553,9 +603,7 @@ public class ImsMmTelManager {
* Sets the user's setting for whether or not Voice over WiFi is enabled. * Sets the user's setting for whether or not Voice over WiFi is enabled.
* @param isEnabled true if the user's setting for Voice over WiFi is enabled, false otherwise= * @param isEnabled true if the user's setting for Voice over WiFi is enabled, false otherwise=
* @see #isVoWiFiSettingEnabled() * @see #isVoWiFiSettingEnabled()
* @hide
*/ */
@SystemApi
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
public void setVoWiFiSetting(boolean isEnabled) { public void setVoWiFiSetting(boolean isEnabled) {
try { try {
@@ -570,9 +618,7 @@ public class ImsMmTelManager {
* @return true if the user's setting for Voice over WiFi while roaming is enabled, false * @return true if the user's setting for Voice over WiFi while roaming is enabled, false
* if disabled. * if disabled.
* @see #setVoWiFiRoamingSetting(boolean) * @see #setVoWiFiRoamingSetting(boolean)
* @hide
*/ */
@SystemApi
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public boolean isVoWiFiRoamingSettingEnabled() { public boolean isVoWiFiRoamingSettingEnabled() {
try { try {
@@ -587,9 +633,7 @@ public class ImsMmTelManager {
* @param isEnabled true if the user's setting for Voice over WiFi while roaming is enabled, * @param isEnabled true if the user's setting for Voice over WiFi while roaming is enabled,
* false otherwise. * false otherwise.
* @see #isVoWiFiRoamingSettingEnabled() * @see #isVoWiFiRoamingSettingEnabled()
* @hide
*/ */
@SystemApi
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
public void setVoWiFiRoamingSetting(boolean isEnabled) { public void setVoWiFiRoamingSetting(boolean isEnabled) {
try { try {
@@ -611,9 +655,7 @@ public class ImsMmTelManager {
* - {@link #WIFI_MODE_CELLULAR_PREFERRED} * - {@link #WIFI_MODE_CELLULAR_PREFERRED}
* - {@link #WIFI_MODE_WIFI_PREFERRED} * - {@link #WIFI_MODE_WIFI_PREFERRED}
* @see #setVoWiFiSetting(boolean) * @see #setVoWiFiSetting(boolean)
* @hide
*/ */
@SystemApi
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
public void setVoWiFiNonPersistent(boolean isCapable, int mode) { public void setVoWiFiNonPersistent(boolean isCapable, int mode) {
try { try {
@@ -631,9 +673,7 @@ public class ImsMmTelManager {
* - {@link #WIFI_MODE_CELLULAR_PREFERRED} * - {@link #WIFI_MODE_CELLULAR_PREFERRED}
* - {@link #WIFI_MODE_WIFI_PREFERRED} * - {@link #WIFI_MODE_WIFI_PREFERRED}
* @see #setVoWiFiSetting(boolean) * @see #setVoWiFiSetting(boolean)
* @hide
*/ */
@SystemApi
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public @WiFiCallingMode int getVoWiFiModeSetting() { public @WiFiCallingMode int getVoWiFiModeSetting() {
try { try {
@@ -651,9 +691,7 @@ public class ImsMmTelManager {
* - {@link #WIFI_MODE_CELLULAR_PREFERRED} * - {@link #WIFI_MODE_CELLULAR_PREFERRED}
* - {@link #WIFI_MODE_WIFI_PREFERRED} * - {@link #WIFI_MODE_WIFI_PREFERRED}
* @see #getVoWiFiModeSetting() * @see #getVoWiFiModeSetting()
* @hide
*/ */
@SystemApi
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
public void setVoWiFiModeSetting(@WiFiCallingMode int mode) { public void setVoWiFiModeSetting(@WiFiCallingMode int mode) {
try { try {
@@ -674,9 +712,7 @@ public class ImsMmTelManager {
* - {@link #WIFI_MODE_CELLULAR_PREFERRED} * - {@link #WIFI_MODE_CELLULAR_PREFERRED}
* - {@link #WIFI_MODE_WIFI_PREFERRED} * - {@link #WIFI_MODE_WIFI_PREFERRED}
* @see #setVoWiFiRoamingSetting(boolean) * @see #setVoWiFiRoamingSetting(boolean)
* @hide
*/ */
@SystemApi
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
@WiFiCallingMode int getVoWiFiRoamingModeSetting() { @WiFiCallingMode int getVoWiFiRoamingModeSetting() {
try { try {
@@ -696,9 +732,7 @@ public class ImsMmTelManager {
* - {@link #WIFI_MODE_CELLULAR_PREFERRED} * - {@link #WIFI_MODE_CELLULAR_PREFERRED}
* - {@link #WIFI_MODE_WIFI_PREFERRED} * - {@link #WIFI_MODE_WIFI_PREFERRED}
* @see #getVoWiFiRoamingModeSetting() * @see #getVoWiFiRoamingModeSetting()
* @hide
*/ */
@SystemApi
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
public void setVoWiFiRoamingModeSetting(@WiFiCallingMode int mode) { public void setVoWiFiRoamingModeSetting(@WiFiCallingMode int mode) {
try { try {
@@ -712,9 +746,7 @@ public class ImsMmTelManager {
/** /**
* Change the user's setting for RTT capability of this device. * Change the user's setting for RTT capability of this device.
* @param isEnabled if true RTT will be enabled during calls. * @param isEnabled if true RTT will be enabled during calls.
* @hide
*/ */
@SystemApi
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
public void setRttCapabilitySetting(boolean isEnabled) { public void setRttCapabilitySetting(boolean isEnabled) {
try { try {
@@ -729,9 +761,7 @@ public class ImsMmTelManager {
* @return true if TTY over VoLTE is supported * @return true if TTY over VoLTE is supported
* @see android.telecom.TelecomManager#getCurrentTtyMode * @see android.telecom.TelecomManager#getCurrentTtyMode
* @see android.telephony.CarrierConfigManager#KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL * @see android.telephony.CarrierConfigManager#KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL
* @hide
*/ */
@SystemApi
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
boolean isTtyOverVolteEnabled() { boolean isTtyOverVolteEnabled() {
try { try {

View File

@@ -413,6 +413,12 @@ public abstract class ImsFeature {
*/ */
public final void addCapabilityCallback(IImsCapabilityCallback c) { public final void addCapabilityCallback(IImsCapabilityCallback c) {
mCapabilityCallbacks.register(c); mCapabilityCallbacks.register(c);
try {
// Notify the Capability callback that was just registered of the current capabilities.
c.onCapabilitiesStatusChanged(queryCapabilityStatus().mCapabilities);
} catch (RemoteException e) {
Log.w(LOG_TAG, "addCapabilityCallback: error accessing callback: " + e.getMessage());
}
} }
/** /**

View File

@@ -1587,35 +1587,31 @@ interface ITelephony {
/** /**
* Adds an IMS registration status callback for the subscription id specified. * Adds an IMS registration status callback for the subscription id specified.
*/ */
void addImsRegistrationCallback(int subId, IImsRegistrationCallback c, void registerImsRegistrationCallback(int subId, IImsRegistrationCallback c);
String callingPackage);
/** /**
* Removes an existing IMS registration status callback for the subscription specified. * Removes an existing IMS registration status callback for the subscription specified.
*/ */
void removeImsRegistrationCallback(int subId, IImsRegistrationCallback c, void unregisterImsRegistrationCallback(int subId, IImsRegistrationCallback c);
String callingPackage);
/** /**
* Adds an IMS MmTel capabilities callback for the subscription specified. * Adds an IMS MmTel capabilities callback for the subscription specified.
*/ */
void addMmTelCapabilityCallback(int subId, IImsCapabilityCallback c, void registerMmTelCapabilityCallback(int subId, IImsCapabilityCallback c);
String callingPackage);
/** /**
* Removes an existing IMS MmTel capabilities callback for the subscription specified. * Removes an existing IMS MmTel capabilities callback for the subscription specified.
*/ */
void removeMmTelCapabilityCallback(int subId, IImsCapabilityCallback c, void unregisterMmTelCapabilityCallback(int subId, IImsCapabilityCallback c);
String callingPackage);
/** /**
* return true if the IMS MmTel capability for the given registration tech is capable. * return true if the IMS MmTel capability for the given registration tech is capable.
*/ */
boolean isCapable(int subId, int capability, int regTech, String callingPackage); boolean isCapable(int subId, int capability, int regTech);
/** /**
* return true if the IMS MmTel capability for the given registration tech is available. * return true if the IMS MmTel capability for the given registration tech is available.
*/ */
boolean isAvailable(int subId, int capability, int regTech, String callingPackage); boolean isAvailable(int subId, int capability, int regTech);
/** /**
* Returns true if the user's setting for 4G LTE is enabled, for the subscription specified. * Returns true if the user's setting for 4G LTE is enabled, for the subscription specified.
@@ -1630,7 +1626,7 @@ interface ITelephony {
/** /**
* return true if the user's setting for VT is enabled for the subscription. * return true if the user's setting for VT is enabled for the subscription.
*/ */
boolean isVtSettingEnabled(int subId, String callingPackage); boolean isVtSettingEnabled(int subId);
/** /**
* Modify the user's setting for whether or not VT is available for the subscrption specified. * Modify the user's setting for whether or not VT is available for the subscrption specified.