diff options
author | Hall Liu <hallliu@google.com> | 2020-10-22 19:48:18 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2020-10-22 19:48:18 +0000 |
commit | f0b822c8bb0442f7d206736ffda2cd9aff14cc08 (patch) | |
tree | abd1dceab77cdd438f61f05b472bcadb86a6b2fe | |
parent | 3a14c6bdcc973838660dd7eb89302e349b39daec (diff) | |
parent | 594dc4b92054649e0302b04226afb2e0c6b9fc74 (diff) |
Merge changes from topic "expose-call-forward"
* changes:
Move some of the call-forwarding related constants
Expose and update the call forward/waiting APIs
-rwxr-xr-x | api/system-current.txt | 33 | ||||
-rw-r--r-- | non-updatable-api/system-current.txt | 33 | ||||
-rw-r--r-- | telephony/api/system-current.txt | 33 | ||||
-rw-r--r-- | telephony/java/android/telephony/CallForwardingInfo.java | 109 | ||||
-rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 302 | ||||
-rw-r--r-- | telephony/java/com/android/internal/telephony/ICallForwardingInfoCallback.aidl | 25 | ||||
-rw-r--r-- | telephony/java/com/android/internal/telephony/ITelephony.aidl | 76 |
7 files changed, 379 insertions, 232 deletions
diff --git a/api/system-current.txt b/api/system-current.txt index e81f6d4c031d..484e1dd225f1 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -10543,6 +10543,22 @@ package android.telephony { field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CallAttributes> CREATOR; } + public final class CallForwardingInfo implements android.os.Parcelable { + ctor public CallForwardingInfo(boolean, int, @Nullable String, int); + method public int describeContents(); + method @Nullable public String getNumber(); + method public int getReason(); + method public int getTimeoutSeconds(); + method public boolean isEnabled(); + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CallForwardingInfo> CREATOR; + field public static final int REASON_ALL = 4; // 0x4 + field public static final int REASON_ALL_CONDITIONAL = 5; // 0x5 + field public static final int REASON_BUSY = 1; // 0x1 + field public static final int REASON_NOT_REACHABLE = 3; // 0x3 + field public static final int REASON_NO_REPLY = 2; // 0x2 + field public static final int REASON_UNCONDITIONAL = 0; // 0x0 + } + public final class CallQuality implements android.os.Parcelable { ctor public CallQuality(int, int, int, int, int, int, int, int, int, int, int); ctor public CallQuality(int, int, int, int, int, int, int, int, int, int, int, boolean, boolean, boolean); @@ -11184,6 +11200,8 @@ package android.telephony { method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.List<android.service.carrier.CarrierIdentifier> getAllowedCarriers(int); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getAllowedNetworkTypes(); method @Nullable @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public android.content.ComponentName getAndUpdateDefaultRespondViaMessageApplication(); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void getCallForwarding(int, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyManager.CallForwardingInfoCallback); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void getCallWaitingStatus(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>); method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public android.telephony.ImsiEncryptionInfo getCarrierInfoForImsiEncryption(int); method public java.util.List<java.lang.String> getCarrierPackageNamesForIntent(android.content.Intent); method public java.util.List<java.lang.String> getCarrierPackageNamesForIntentAndPhone(android.content.Intent, int); @@ -11262,6 +11280,8 @@ package android.telephony { method @RequiresPermission(android.Manifest.permission.CONNECTIVITY_INTERNAL) public void resetSettings(); method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setAllowedCarriers(int, java.util.List<android.service.carrier.CarrierIdentifier>); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setAllowedNetworkTypes(long); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCallForwarding(@NonNull android.telephony.CallForwardingInfo, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCallWaitingEnabled(boolean, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCarrierDataEnabled(boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setCarrierRestrictionRules(@NonNull android.telephony.CarrierRestrictionRules); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataActivationState(int); @@ -11300,6 +11320,10 @@ package android.telephony { field public static final String ACTION_SIM_APPLICATION_STATE_CHANGED = "android.telephony.action.SIM_APPLICATION_STATE_CHANGED"; field public static final String ACTION_SIM_CARD_STATE_CHANGED = "android.telephony.action.SIM_CARD_STATE_CHANGED"; field public static final String ACTION_SIM_SLOT_STATUS_CHANGED = "android.telephony.action.SIM_SLOT_STATUS_CHANGED"; + field public static final int CALL_WAITING_STATUS_DISABLED = 2; // 0x2 + field public static final int CALL_WAITING_STATUS_ENABLED = 1; // 0x1 + field public static final int CALL_WAITING_STATUS_NOT_SUPPORTED = 4; // 0x4 + field public static final int CALL_WAITING_STATUS_UNKNOWN_ERROR = 3; // 0x3 field public static final int CARRIER_PRIVILEGE_STATUS_ERROR_LOADING_RULES = -2; // 0xfffffffe field public static final int CARRIER_PRIVILEGE_STATUS_HAS_ACCESS = 1; // 0x1 field public static final int CARRIER_PRIVILEGE_STATUS_NO_ACCESS = 0; // 0x0 @@ -11356,6 +11380,15 @@ package android.telephony { field public static final int SRVCC_STATE_HANDOVER_STARTED = 0; // 0x0 } + public static interface TelephonyManager.CallForwardingInfoCallback { + method public void onCallForwardingInfoAvailable(@NonNull android.telephony.CallForwardingInfo); + method public void onError(int); + field public static final int RESULT_ERROR_FDN_CHECK_FAILURE = 2; // 0x2 + field public static final int RESULT_ERROR_NOT_SUPPORTED = 3; // 0x3 + field public static final int RESULT_ERROR_UNKNOWN = 1; // 0x1 + field public static final int RESULT_SUCCESS = 0; // 0x0 + } + public final class UiccAccessRule implements android.os.Parcelable { ctor public UiccAccessRule(byte[], @Nullable String, long); method public int describeContents(); diff --git a/non-updatable-api/system-current.txt b/non-updatable-api/system-current.txt index e48195e47a29..e1475c6bfcdd 100644 --- a/non-updatable-api/system-current.txt +++ b/non-updatable-api/system-current.txt @@ -9425,6 +9425,22 @@ package android.telephony { field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CallAttributes> CREATOR; } + public final class CallForwardingInfo implements android.os.Parcelable { + ctor public CallForwardingInfo(boolean, int, @Nullable String, int); + method public int describeContents(); + method @Nullable public String getNumber(); + method public int getReason(); + method public int getTimeoutSeconds(); + method public boolean isEnabled(); + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CallForwardingInfo> CREATOR; + field public static final int REASON_ALL = 4; // 0x4 + field public static final int REASON_ALL_CONDITIONAL = 5; // 0x5 + field public static final int REASON_BUSY = 1; // 0x1 + field public static final int REASON_NOT_REACHABLE = 3; // 0x3 + field public static final int REASON_NO_REPLY = 2; // 0x2 + field public static final int REASON_UNCONDITIONAL = 0; // 0x0 + } + public final class CallQuality implements android.os.Parcelable { ctor public CallQuality(int, int, int, int, int, int, int, int, int, int, int); ctor public CallQuality(int, int, int, int, int, int, int, int, int, int, int, boolean, boolean, boolean); @@ -10066,6 +10082,8 @@ package android.telephony { method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.List<android.service.carrier.CarrierIdentifier> getAllowedCarriers(int); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getAllowedNetworkTypes(); method @Nullable @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public android.content.ComponentName getAndUpdateDefaultRespondViaMessageApplication(); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void getCallForwarding(int, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyManager.CallForwardingInfoCallback); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void getCallWaitingStatus(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>); method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public android.telephony.ImsiEncryptionInfo getCarrierInfoForImsiEncryption(int); method public java.util.List<java.lang.String> getCarrierPackageNamesForIntent(android.content.Intent); method public java.util.List<java.lang.String> getCarrierPackageNamesForIntentAndPhone(android.content.Intent, int); @@ -10144,6 +10162,8 @@ package android.telephony { method @RequiresPermission(android.Manifest.permission.CONNECTIVITY_INTERNAL) public void resetSettings(); method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setAllowedCarriers(int, java.util.List<android.service.carrier.CarrierIdentifier>); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setAllowedNetworkTypes(long); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCallForwarding(@NonNull android.telephony.CallForwardingInfo, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCallWaitingEnabled(boolean, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCarrierDataEnabled(boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setCarrierRestrictionRules(@NonNull android.telephony.CarrierRestrictionRules); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataActivationState(int); @@ -10182,6 +10202,10 @@ package android.telephony { field public static final String ACTION_SIM_APPLICATION_STATE_CHANGED = "android.telephony.action.SIM_APPLICATION_STATE_CHANGED"; field public static final String ACTION_SIM_CARD_STATE_CHANGED = "android.telephony.action.SIM_CARD_STATE_CHANGED"; field public static final String ACTION_SIM_SLOT_STATUS_CHANGED = "android.telephony.action.SIM_SLOT_STATUS_CHANGED"; + field public static final int CALL_WAITING_STATUS_DISABLED = 2; // 0x2 + field public static final int CALL_WAITING_STATUS_ENABLED = 1; // 0x1 + field public static final int CALL_WAITING_STATUS_NOT_SUPPORTED = 4; // 0x4 + field public static final int CALL_WAITING_STATUS_UNKNOWN_ERROR = 3; // 0x3 field public static final int CARRIER_PRIVILEGE_STATUS_ERROR_LOADING_RULES = -2; // 0xfffffffe field public static final int CARRIER_PRIVILEGE_STATUS_HAS_ACCESS = 1; // 0x1 field public static final int CARRIER_PRIVILEGE_STATUS_NO_ACCESS = 0; // 0x0 @@ -10238,6 +10262,15 @@ package android.telephony { field public static final int SRVCC_STATE_HANDOVER_STARTED = 0; // 0x0 } + public static interface TelephonyManager.CallForwardingInfoCallback { + method public void onCallForwardingInfoAvailable(@NonNull android.telephony.CallForwardingInfo); + method public void onError(int); + field public static final int RESULT_ERROR_FDN_CHECK_FAILURE = 2; // 0x2 + field public static final int RESULT_ERROR_NOT_SUPPORTED = 3; // 0x3 + field public static final int RESULT_ERROR_UNKNOWN = 1; // 0x1 + field public static final int RESULT_SUCCESS = 0; // 0x0 + } + public final class UiccAccessRule implements android.os.Parcelable { ctor public UiccAccessRule(byte[], @Nullable String, long); method public int describeContents(); diff --git a/telephony/api/system-current.txt b/telephony/api/system-current.txt index b092ec635d9e..9505b8f78b81 100644 --- a/telephony/api/system-current.txt +++ b/telephony/api/system-current.txt @@ -27,6 +27,22 @@ package android.telephony { field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CallAttributes> CREATOR; } + public final class CallForwardingInfo implements android.os.Parcelable { + ctor public CallForwardingInfo(boolean, int, @Nullable String, int); + method public int describeContents(); + method @Nullable public String getNumber(); + method public int getReason(); + method public int getTimeoutSeconds(); + method public boolean isEnabled(); + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CallForwardingInfo> CREATOR; + field public static final int REASON_ALL = 4; // 0x4 + field public static final int REASON_ALL_CONDITIONAL = 5; // 0x5 + field public static final int REASON_BUSY = 1; // 0x1 + field public static final int REASON_NOT_REACHABLE = 3; // 0x3 + field public static final int REASON_NO_REPLY = 2; // 0x2 + field public static final int REASON_UNCONDITIONAL = 0; // 0x0 + } + public final class CallQuality implements android.os.Parcelable { ctor public CallQuality(int, int, int, int, int, int, int, int, int, int, int); ctor public CallQuality(int, int, int, int, int, int, int, int, int, int, int, boolean, boolean, boolean); @@ -640,6 +656,8 @@ package android.telephony { method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.List<android.service.carrier.CarrierIdentifier> getAllowedCarriers(int); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getAllowedNetworkTypes(); method @Nullable @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public android.content.ComponentName getAndUpdateDefaultRespondViaMessageApplication(); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void getCallForwarding(int, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyManager.CallForwardingInfoCallback); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void getCallWaitingStatus(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>); method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public android.telephony.ImsiEncryptionInfo getCarrierInfoForImsiEncryption(int); method public java.util.List<java.lang.String> getCarrierPackageNamesForIntent(android.content.Intent); method public java.util.List<java.lang.String> getCarrierPackageNamesForIntentAndPhone(android.content.Intent, int); @@ -719,6 +737,8 @@ package android.telephony { method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setAllowedCarriers(int, java.util.List<android.service.carrier.CarrierIdentifier>); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setAllowedNetworkTypes(long); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCarrierDataEnabled(boolean); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCallForwarding(@NonNull android.telephony.CallForwardingInfo, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCallWaitingEnabled(boolean, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setCarrierRestrictionRules(@NonNull android.telephony.CarrierRestrictionRules); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataActivationState(int); method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabled(int, boolean); @@ -756,6 +776,10 @@ package android.telephony { field public static final String ACTION_SIM_APPLICATION_STATE_CHANGED = "android.telephony.action.SIM_APPLICATION_STATE_CHANGED"; field public static final String ACTION_SIM_CARD_STATE_CHANGED = "android.telephony.action.SIM_CARD_STATE_CHANGED"; field public static final String ACTION_SIM_SLOT_STATUS_CHANGED = "android.telephony.action.SIM_SLOT_STATUS_CHANGED"; + field public static final int CALL_WAITING_STATUS_DISABLED = 2; // 0x2 + field public static final int CALL_WAITING_STATUS_ENABLED = 1; // 0x1 + field public static final int CALL_WAITING_STATUS_NOT_SUPPORTED = 4; // 0x4 + field public static final int CALL_WAITING_STATUS_UNKNOWN_ERROR = 3; // 0x3 field public static final int CARRIER_PRIVILEGE_STATUS_ERROR_LOADING_RULES = -2; // 0xfffffffe field public static final int CARRIER_PRIVILEGE_STATUS_HAS_ACCESS = 1; // 0x1 field public static final int CARRIER_PRIVILEGE_STATUS_NO_ACCESS = 0; // 0x0 @@ -812,6 +836,15 @@ package android.telephony { field public static final int SRVCC_STATE_HANDOVER_STARTED = 0; // 0x0 } + public static interface TelephonyManager.CallForwardingInfoCallback { + method public void onCallForwardingInfoAvailable(@NonNull android.telephony.CallForwardingInfo); + method public void onError(int); + field public static final int RESULT_ERROR_FDN_CHECK_FAILURE = 2; // 0x2 + field public static final int RESULT_ERROR_NOT_SUPPORTED = 3; // 0x3 + field public static final int RESULT_ERROR_UNKNOWN = 1; // 0x1 + field public static final int RESULT_SUCCESS = 0; // 0x0 + } + public final class UiccAccessRule implements android.os.Parcelable { ctor public UiccAccessRule(byte[], @Nullable String, long); method public int describeContents(); diff --git a/telephony/java/android/telephony/CallForwardingInfo.java b/telephony/java/android/telephony/CallForwardingInfo.java index 7e777fae46eb..6ae6d002d990 100644 --- a/telephony/java/android/telephony/CallForwardingInfo.java +++ b/telephony/java/android/telephony/CallForwardingInfo.java @@ -20,6 +20,7 @@ import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SuppressLint; +import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; @@ -33,50 +34,14 @@ import java.util.Objects; * Defines the call forwarding information. * @hide */ +@SystemApi public final class CallForwardingInfo implements Parcelable { private static final String TAG = "CallForwardingInfo"; /** - * Indicates the call forwarding status is inactive. - * - * @hide - */ - public static final int STATUS_INACTIVE = 0; - - /** - * Indicates the call forwarding status is active. - * - * @hide - */ - public static final int STATUS_ACTIVE = 1; - - /** - * Indicates the call forwarding could not be enabled because the recipient is not on - * Fixed Dialing Number (FDN) list. - * - * @hide - */ - public static final int STATUS_FDN_CHECK_FAILURE = 2; - - /** - * Indicates the call forwarding status is with an unknown error. - * - * @hide - */ - public static final int STATUS_UNKNOWN_ERROR = 3; - - /** - * Indicates the call forwarding is not supported (e.g. called via CDMA). - * - * @hide - */ - public static final int STATUS_NOT_SUPPORTED = 4; - - /** - * Indicates the call forwarding reason is "unconditional". + * Indicates that call forwarding reason is "unconditional". * Reference: 3GPP TS 27.007 version 10.3.0 Release 10 - 7.11 Call forwarding number * and conditions +CCFC - * @hide */ public static final int REASON_UNCONDITIONAL = 0; @@ -84,7 +49,6 @@ public final class CallForwardingInfo implements Parcelable { * Indicates the call forwarding status is "busy". * Reference: 3GPP TS 27.007 version 10.3.0 Release 10 - 7.11 Call forwarding number * and conditions +CCFC - * @hide */ public static final int REASON_BUSY = 1; @@ -92,7 +56,6 @@ public final class CallForwardingInfo implements Parcelable { * Indicates the call forwarding reason is "no reply". * Reference: 3GPP TS 27.007 version 10.3.0 Release 10 - 7.11 Call forwarding number * and conditions +CCFC - * @hide */ public static final int REASON_NO_REPLY = 2; @@ -100,7 +63,6 @@ public final class CallForwardingInfo implements Parcelable { * Indicates the call forwarding reason is "not reachable". * Reference: 3GPP TS 27.007 version 10.3.0 Release 10 - 7.11 Call forwarding number * and conditions +CCFC - * @hide */ public static final int REASON_NOT_REACHABLE = 3; @@ -109,7 +71,6 @@ public final class CallForwardingInfo implements Parcelable { * simultaneously (unconditional, busy, no reply, and not reachable). * Reference: 3GPP TS 27.007 version 10.3.0 Release 10 - 7.11 Call forwarding number * and conditions +CCFC - * @hide */ public static final int REASON_ALL = 4; @@ -118,26 +79,12 @@ public final class CallForwardingInfo implements Parcelable { * forwarding reasons simultaneously (busy, no reply, and not reachable). * Reference: 3GPP TS 27.007 version 10.3.0 Release 10 - 7.11 Call forwarding number * and conditions +CCFC - * @hide */ public static final int REASON_ALL_CONDITIONAL = 5; /** - * Call forwarding function status - */ - @IntDef(prefix = { "STATUS_" }, value = { - STATUS_ACTIVE, - STATUS_INACTIVE, - STATUS_UNKNOWN_ERROR, - STATUS_NOT_SUPPORTED, - STATUS_FDN_CHECK_FAILURE - }) - @Retention(RetentionPolicy.SOURCE) - public @interface CallForwardingStatus { - } - - /** * Call forwarding reason types + * @hide */ @IntDef(flag = true, prefix = { "REASON_" }, value = { REASON_UNCONDITIONAL, @@ -152,9 +99,9 @@ public final class CallForwardingInfo implements Parcelable { } /** - * The call forwarding status. + * Whether call forwarding is enabled for this reason. */ - private int mStatus; + private boolean mEnabled; /** * The call forwarding reason indicates the condition under which calls will be forwarded. @@ -178,39 +125,35 @@ public final class CallForwardingInfo implements Parcelable { /** * Construct a CallForwardingInfo. * - * @param status the call forwarding status + * @param enabled Whether to enable call forwarding for the reason specified + * in {@link #getReason()}. * @param reason the call forwarding reason * @param number the phone number to which calls will be forwarded * @param timeSeconds the timeout (in seconds) before the forwarding is attempted - * @hide */ - public CallForwardingInfo(@CallForwardingStatus int status, @CallForwardingReason int reason, + public CallForwardingInfo(boolean enabled, @CallForwardingReason int reason, @Nullable String number, int timeSeconds) { - mStatus = status; + mEnabled = enabled; mReason = reason; mNumber = number; mTimeSeconds = timeSeconds; } /** - * Returns the call forwarding status. + * Whether call forwarding is enabled for the reason from {@link #getReason()}. * - * @return the call forwarding status. - * - * @hide + * @return {@code true} if enabled, {@code false} otherwise. */ - public @CallForwardingStatus int getStatus() { - return mStatus; + public boolean isEnabled() { + return mEnabled; } /** * Returns the call forwarding reason. The call forwarding reason indicates the condition - * under which calls will be forwarded. For example, {@link #REASON_NO_REPLY} indicates - * that calls will be forward to {@link #getNumber()} when the user fails to answer the call. + * under which calls will be forwarded. For example, {@link #REASON_NO_REPLY} indicates + * that calls will be forwarded when the user fails to answer the call. * * @return the call forwarding reason. - * - * @hide */ public @CallForwardingReason int getReason() { return mReason; @@ -220,9 +163,7 @@ public final class CallForwardingInfo implements Parcelable { * Returns the phone number to which calls will be forwarded. * * @return the number calls will be forwarded to, or {@code null} if call forwarding - * is being disabled. - * - * @hide + * is disabled. */ @Nullable public String getNumber() { @@ -230,16 +171,14 @@ public final class CallForwardingInfo implements Parcelable { } /** - * Gets the timeout (in seconds) before the forwarding is attempted. For example, + * Gets the timeout (in seconds) before forwarding is attempted. For example, * if {@link #REASON_NO_REPLY} is the call forwarding reason, the device will wait this - * duration of time before forwarding the call to {@link #getNumber()}. + * duration of time before forwarding the call to the number returned by {@link #getNumber()}. * * Reference: 3GPP TS 27.007 version 10.3.0 Release 10 * 7.11 Call forwarding number and conditions +CCFC * * @return the timeout (in seconds) before the forwarding is attempted. - * - * @hide */ @SuppressLint("MethodNameUnits") public int getTimeoutSeconds() { @@ -257,14 +196,14 @@ public final class CallForwardingInfo implements Parcelable { @Override public void writeToParcel(Parcel out, int flags) { out.writeString(mNumber); - out.writeInt(mStatus); + out.writeBoolean(mEnabled); out.writeInt(mReason); out.writeInt(mTimeSeconds); } private CallForwardingInfo(Parcel in) { mNumber = in.readString(); - mStatus = in.readInt(); + mEnabled = in.readBoolean(); mReason = in.readInt(); mTimeSeconds = in.readInt(); } @@ -281,7 +220,7 @@ public final class CallForwardingInfo implements Parcelable { } CallForwardingInfo other = (CallForwardingInfo) o; - return mStatus == other.mStatus + return mEnabled == other.mEnabled && mNumber == other.mNumber && mReason == other.mReason && mTimeSeconds == other.mTimeSeconds; @@ -292,7 +231,7 @@ public final class CallForwardingInfo implements Parcelable { */ @Override public int hashCode() { - return Objects.hash(mStatus, mNumber, mReason, mTimeSeconds); + return Objects.hash(mEnabled, mNumber, mReason, mTimeSeconds); } public static final @NonNull Parcelable.Creator<CallForwardingInfo> CREATOR = @@ -313,7 +252,7 @@ public final class CallForwardingInfo implements Parcelable { */ @Override public String toString() { - return "[CallForwardingInfo: status=" + mStatus + return "[CallForwardingInfo: enabled=" + mEnabled + ", reason= " + mReason + ", timeSec= " + mTimeSeconds + " seconds" + ", number=" + Rlog.pii(TAG, mNumber) + "]"; diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index ca47b83b20e7..072527beeff9 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -96,6 +96,8 @@ import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.telephony.CellNetworkScanResult; import com.android.internal.telephony.IBooleanConsumer; +import com.android.internal.telephony.ICallForwardingInfoCallback; +import com.android.internal.telephony.IIntegerConsumer; import com.android.internal.telephony.INumberVerificationCallback; import com.android.internal.telephony.IOns; import com.android.internal.telephony.IPhoneSubInfo; @@ -12746,195 +12748,339 @@ public class TelephonyManager { } /** - * Gets the voice call forwarding info {@link CallForwardingInfo}, given the call forward - * reason. + * Callback to be used with {@link #getCallForwarding} + * @hide + */ + @SystemApi + public interface CallForwardingInfoCallback { + /** + * Indicates that the operation was successful. + */ + int RESULT_SUCCESS = 0; + + /** + * Indicates that setting or retrieving the call forwarding info failed with an unknown + * error. + */ + int RESULT_ERROR_UNKNOWN = 1; + + /** + * Indicates that call forwarding is not enabled because the recipient is not on a + * Fixed Dialing Number (FDN) list. + */ + int RESULT_ERROR_FDN_CHECK_FAILURE = 2; + + /** + * Indicates that call forwarding is not supported on the network at this time. + */ + int RESULT_ERROR_NOT_SUPPORTED = 3; + + /** + * Call forwarding errors + * @hide + */ + @IntDef(prefix = { "RESULT_ERROR_" }, value = { + RESULT_ERROR_UNKNOWN, + RESULT_ERROR_NOT_SUPPORTED, + RESULT_ERROR_FDN_CHECK_FAILURE + }) + @Retention(RetentionPolicy.SOURCE) + @interface CallForwardingError{ + } + /** + * Called when the call forwarding info is successfully retrieved from the network. + * @param info information about how calls are forwarded + */ + void onCallForwardingInfoAvailable(@NonNull CallForwardingInfo info); + + /** + * Called when there was an error retrieving the call forwarding information. + * @param error + */ + void onError(@CallForwardingError int error); + } + + /** + * Gets the voice call forwarding info for a given call forwarding reason. * - * @param callForwardingReason the call forwarding reasons + * This method queries the network for the currently set call forwarding configuration for the + * provided call forwarding reason. When the network has provided its response, the result will + * be supplied via the provided {@link Executor} on the provided + * {@link CallForwardingInfoCallback}. * - * @throws IllegalArgumentException if callForwardingReason is not any of - * {@link CallForwardingInfo.REASON_UNCONDITIONAL}, {@link CallForwardingInfo.REASON_BUSY}, - * {@link CallForwardingInfo.REASON_NO_REPLY}, {@link CallForwardingInfo.REASON_NOT_REACHABLE}, - * {@link CallForwardingInfo.REASON_ALL}, {@link CallForwardingInfo.REASON_ALL_CONDITIONAL} + * @param callForwardingReason the call forwarding reason to query. + * @param executor The executor on which to execute the callback once the result is ready. + * @param callback The callback the results should be delivered on. * - * @return {@link CallForwardingInfo} with the status {@link CallForwardingInfo#STATUS_ACTIVE} - * or {@link CallForwardingInfo#STATUS_INACTIVE} and the target phone number to forward calls - * to, if it's available. Otherwise, it will return a {@link CallForwardingInfo} with status - * {@link CallForwardingInfo#STATUS_UNKNOWN_ERROR}, - * {@link CallForwardingInfo#STATUS_NOT_SUPPORTED}, - * or {@link CallForwardingInfo#STATUS_FDN_CHECK_FAILURE} depending on the situation. + * @throws IllegalArgumentException if callForwardingReason is not any of + * {@link CallForwardingInfo#REASON_UNCONDITIONAL}, {@link CallForwardingInfo#REASON_BUSY}, + * {@link CallForwardingInfo#REASON_NO_REPLY}, {@link CallForwardingInfo#REASON_NOT_REACHABLE}, + * {@link CallForwardingInfo#REASON_ALL}, or {@link CallForwardingInfo#REASON_ALL_CONDITIONAL} * * @hide */ @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) - @NonNull - public CallForwardingInfo getCallForwarding(@CallForwardingReason int callForwardingReason) { + @SystemApi + public void getCallForwarding(@CallForwardingReason int callForwardingReason, + @NonNull Executor executor, @NonNull CallForwardingInfoCallback callback) { if (callForwardingReason < CallForwardingInfo.REASON_UNCONDITIONAL || callForwardingReason > CallForwardingInfo.REASON_ALL_CONDITIONAL) { throw new IllegalArgumentException("callForwardingReason is out of range"); } + + ICallForwardingInfoCallback internalCallback = new ICallForwardingInfoCallback.Stub() { + @Override + public void onCallForwardingInfoAvailable(CallForwardingInfo info) { + executor.execute(() -> + Binder.withCleanCallingIdentity(() -> + callback.onCallForwardingInfoAvailable(info))); + } + + @Override + public void onError(int error) { + executor.execute(() -> + Binder.withCleanCallingIdentity(() -> + callback.onError(error))); + } + }; + try { ITelephony telephony = getITelephony(); if (telephony != null) { - return telephony.getCallForwarding(getSubId(), callForwardingReason); + telephony.getCallForwarding(getSubId(), callForwardingReason, internalCallback); } } catch (RemoteException ex) { Rlog.e(TAG, "getCallForwarding RemoteException", ex); - } catch (NullPointerException ex) { - Rlog.e(TAG, "getCallForwarding NPE", ex); + ex.rethrowAsRuntimeException(); } - return new CallForwardingInfo( - CallForwardingInfo.STATUS_UNKNOWN_ERROR, 0 /* reason */, null /* number */, - 0 /* timeout */); } /** - * Sets the voice call forwarding info including status (enable/disable), call forwarding - * reason, the number to forward, and the timeout before the forwarding is attempted. + * Sets voice call forwarding behavior as described by the provided {@link CallForwardingInfo}. * - * @param callForwardingInfo {@link CallForwardingInfo} to setup the call forwarding. - * Enabling if {@link CallForwardingInfo#getStatus()} returns - * {@link CallForwardingInfo#STATUS_ACTIVE}; Disabling if - * {@link CallForwardingInfo#getStatus()} returns {@link CallForwardingInfo#STATUS_INACTIVE}. + * This method will enable call forwarding if the provided {@link CallForwardingInfo} returns + * {@code true} from its {@link CallForwardingInfo#isEnabled()} method, and disables call + * forwarding otherwise. * - * @throws IllegalArgumentException if any of the following for parameter callForwardingInfo: - * 0) it is {@code null}. - * 1) {@link CallForwardingInfo#getStatus()} returns neither - * {@link CallForwardingInfo#STATUS_ACTIVE} nor {@link CallForwardingInfo#STATUS_INACTIVE}. - * 2) {@link CallForwardingInfo#getReason()} is not any of - * {@link CallForwardingInfo.REASON_UNCONDITIONAL}, {@link CallForwardingInfo.REASON_BUSY}, - * {@link CallForwardingInfo.REASON_NO_REPLY}, {@link CallForwardingInfo.REASON_NOT_REACHABLE}, - * {@link CallForwardingInfo.REASON_ALL}, {@link CallForwardingInfo.REASON_ALL_CONDITIONAL} - * 3) {@link CallForwardingInfo#getNumber()} returns {@code null}. - * 4) {@link CallForwardingInfo#getTimeoutSeconds()} doesn't return a positive value. + * If you wish to be notified about the results of this operation, provide an {@link Executor} + * and {@link Consumer<Integer>} to be notified asynchronously when the operation completes. * - * @return {@code true} to indicate it was set successfully; {@code false} otherwise. + * @param callForwardingInfo Info about whether calls should be forwarded and where they + * should be forwarded to. + * @param executor The executor on which the listener will be called. Must be non-null if + * {@code listener} is non-null. + * @param resultListener Asynchronous listener that'll be called when the operation completes. + * Called with {@link CallForwardingInfoCallback#RESULT_SUCCESS} if the + * operation succeeded and an error code from + * {@link CallForwardingInfoCallback} it failed. * + * @throws IllegalArgumentException if any of the following are true for the parameter + * callForwardingInfo: + * <ul> + * <li>it is {@code null}.</li> + * <li>{@link CallForwardingInfo#getReason()} is not any of: + * <ul> + * <li>{@link CallForwardingInfo#REASON_UNCONDITIONAL}</li> + * <li>{@link CallForwardingInfo#REASON_BUSY}</li> + * <li>{@link CallForwardingInfo#REASON_NO_REPLY}</li> + * <li>{@link CallForwardingInfo#REASON_NOT_REACHABLE}</li> + * <li>{@link CallForwardingInfo#REASON_ALL}</li> + * <li>{@link CallForwardingInfo#REASON_ALL_CONDITIONAL}</li> + * </ul> + * <li>{@link CallForwardingInfo#getNumber()} returns {@code null} when enabling call + * forwarding</li> + * <li>{@link CallForwardingInfo#getTimeoutSeconds()} returns a non-positive value when + * enabling call forwarding</li> + * </ul> * @hide */ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) - public boolean setCallForwarding(@NonNull CallForwardingInfo callForwardingInfo) { + @SystemApi + public void setCallForwarding(@NonNull CallForwardingInfo callForwardingInfo, + @Nullable @CallbackExecutor Executor executor, + @Nullable @CallForwardingInfoCallback.CallForwardingError + Consumer<Integer> resultListener) { if (callForwardingInfo == null) { throw new IllegalArgumentException("callForwardingInfo is null"); } - int callForwardingStatus = callForwardingInfo.getStatus(); - if (callForwardingStatus != CallForwardingInfo.STATUS_ACTIVE - && callForwardingStatus != CallForwardingInfo.STATUS_INACTIVE) { - throw new IllegalArgumentException( - "callForwardingStatus is neither active nor inactive"); - } int callForwardingReason = callForwardingInfo.getReason(); if (callForwardingReason < CallForwardingInfo.REASON_UNCONDITIONAL || callForwardingReason > CallForwardingInfo.REASON_ALL_CONDITIONAL) { throw new IllegalArgumentException("callForwardingReason is out of range"); } - if (callForwardingInfo.getNumber() == null) { - throw new IllegalArgumentException("callForwarding number is null"); + if (callForwardingInfo.isEnabled()) { + if (callForwardingInfo.getNumber() == null) { + throw new IllegalArgumentException("callForwarding number is null"); + } + if (callForwardingInfo.getTimeoutSeconds() <= 0) { + throw new IllegalArgumentException("callForwarding timeout isn't positive"); + } } - if (callForwardingInfo.getTimeoutSeconds() <= 0) { - throw new IllegalArgumentException("callForwarding timeout isn't positive"); + if (resultListener != null) { + Objects.requireNonNull(executor); } + + IIntegerConsumer internalCallback = new IIntegerConsumer.Stub() { + @Override + public void accept(int result) { + executor.execute(() -> + Binder.withCleanCallingIdentity(() -> resultListener.accept(result))); + } + }; + try { ITelephony telephony = getITelephony(); if (telephony != null) { - return telephony.setCallForwarding(getSubId(), callForwardingInfo); + telephony.setCallForwarding(getSubId(), callForwardingInfo, internalCallback); } } catch (RemoteException ex) { Rlog.e(TAG, "setCallForwarding RemoteException", ex); + ex.rethrowAsRuntimeException(); } catch (NullPointerException ex) { Rlog.e(TAG, "setCallForwarding NPE", ex); + throw ex; } - return false; } /** - * Indicates the call waiting status is active. + * Indicates that call waiting is enabled. * * @hide */ - public static final int CALL_WAITING_STATUS_ACTIVE = 1; + @SystemApi + public static final int CALL_WAITING_STATUS_ENABLED = 1; /** - * Indicates the call waiting status is inactive. + * Indicates that call waiting is disabled. * * @hide */ - public static final int CALL_WAITING_STATUS_INACTIVE = 2; + @SystemApi + public static final int CALL_WAITING_STATUS_DISABLED = 2; /** - * Indicates the call waiting status is with an unknown error. + * Indicates there was an unknown error retrieving the call waiting status. * * @hide */ + @SystemApi public static final int CALL_WAITING_STATUS_UNKNOWN_ERROR = 3; /** - * Indicates the call waiting is not supported (e.g. called via CDMA). + * Indicates the call waiting is not supported on the current network. * * @hide */ + @SystemApi public static final int CALL_WAITING_STATUS_NOT_SUPPORTED = 4; /** - * Call waiting function status - * * @hide */ @IntDef(prefix = { "CALL_WAITING_STATUS_" }, value = { - CALL_WAITING_STATUS_ACTIVE, - CALL_WAITING_STATUS_INACTIVE, - CALL_WAITING_STATUS_NOT_SUPPORTED, - CALL_WAITING_STATUS_UNKNOWN_ERROR + CALL_WAITING_STATUS_ENABLED, + CALL_WAITING_STATUS_DISABLED, + CALL_WAITING_STATUS_UNKNOWN_ERROR, + CALL_WAITING_STATUS_NOT_SUPPORTED, }) @Retention(RetentionPolicy.SOURCE) public @interface CallWaitingStatus { } /** - * Gets the status of voice call waiting function. Call waiting function enables the waiting - * for the incoming call when it reaches the user who is busy to make another call and allows - * users to decide whether to switch to the incoming call. + * Retrieves the call waiting status of this device from the network. + * + * When call waiting is enabled, an incoming call that arrives when the user is already on + * an active call will be held in a waiting state while the user is notified instead of being + * rejected with a busy signal. * - * @return the status of call waiting function. + * @param executor The executor on which the result listener will be called. + * @param resultListener A {@link Consumer} that will be called with the result fetched + * from the network. The result will be one of: + * <ul> + * <li>{@link #CALL_WAITING_STATUS_ENABLED}}</li> + * <li>{@link #CALL_WAITING_STATUS_DISABLED}}</li> + * <li>{@link #CALL_WAITING_STATUS_UNKNOWN_ERROR}}</li> + * <li>{@link #CALL_WAITING_STATUS_NOT_SUPPORTED}}</li> + * </ul> * @hide */ + @SystemApi @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) - public @CallWaitingStatus int getCallWaitingStatus() { + public void getCallWaitingStatus(@NonNull Executor executor, + @NonNull @CallWaitingStatus Consumer<Integer> resultListener) { + Objects.requireNonNull(executor); + Objects.requireNonNull(resultListener); + + IIntegerConsumer internalCallback = new IIntegerConsumer.Stub() { + @Override + public void accept(int result) { + executor.execute(() -> Binder.withCleanCallingIdentity( + () -> resultListener.accept(result))); + } + }; + try { ITelephony telephony = getITelephony(); if (telephony != null) { - return telephony.getCallWaitingStatus(getSubId()); + telephony.getCallWaitingStatus(getSubId(), internalCallback); } } catch (RemoteException ex) { Rlog.e(TAG, "getCallWaitingStatus RemoteException", ex); + ex.rethrowAsRuntimeException(); } catch (NullPointerException ex) { Rlog.e(TAG, "getCallWaitingStatus NPE", ex); + throw ex; } - return CALL_WAITING_STATUS_UNKNOWN_ERROR; } /** - * Sets the status for voice call waiting function. Call waiting function enables the waiting - * for the incoming call when it reaches the user who is busy to make another call and allows - * users to decide whether to switch to the incoming call. + * Sets the call waiting status of this device with the network. + * + * If you wish to be notified about the results of this operation, provide an {@link Executor} + * and {@link Consumer<Integer>} to be notified asynchronously when the operation completes. * - * @param isEnable {@code true} to enable; {@code false} to disable. - * @return {@code true} to indicate it was set successfully; {@code false} otherwise. + * @see #getCallWaitingStatus for a description of the call waiting functionality. * + * @param enabled {@code true} to enable; {@code false} to disable. + * @param executor The executor on which the listener will be called. Must be non-null if + * {@code listener} is non-null. + * @param resultListener Asynchronous listener that'll be called when the operation completes. + * Called with the new call waiting status (either + * {@link #CALL_WAITING_STATUS_ENABLED} or + * {@link #CALL_WAITING_STATUS_DISABLED} if the operation succeeded and + * {@link #CALL_WAITING_STATUS_NOT_SUPPORTED} or + * {@link #CALL_WAITING_STATUS_UNKNOWN_ERROR} if it failed. * @hide */ + @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) - public boolean setCallWaitingStatus(boolean isEnable) { + public void setCallWaitingEnabled(boolean enabled, @Nullable Executor executor, + @Nullable Consumer<Integer> resultListener) { + if (resultListener != null) { + Objects.requireNonNull(executor); + } + + IIntegerConsumer internalCallback = new IIntegerConsumer.Stub() { + @Override + public void accept(int result) { + executor.execute(() -> + Binder.withCleanCallingIdentity(() -> resultListener.accept(result))); + } + }; + try { ITelephony telephony = getITelephony(); if (telephony != null) { - return telephony.setCallWaitingStatus(getSubId(), isEnable); + telephony.setCallWaitingStatus(getSubId(), enabled, internalCallback); } } catch (RemoteException ex) { Rlog.e(TAG, "setCallWaitingStatus RemoteException", ex); + ex.rethrowAsRuntimeException(); } catch (NullPointerException ex) { Rlog.e(TAG, "setCallWaitingStatus NPE", ex); + throw ex; } - return false; } /** diff --git a/telephony/java/com/android/internal/telephony/ICallForwardingInfoCallback.aidl b/telephony/java/com/android/internal/telephony/ICallForwardingInfoCallback.aidl new file mode 100644 index 000000000000..4d3b9f4636df --- /dev/null +++ b/telephony/java/com/android/internal/telephony/ICallForwardingInfoCallback.aidl @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2020 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 com.android.internal.telephony; + +import android.telephony.CallForwardingInfo; + +// Callback interface for the getCallForwarding API in TelephonyManager. +oneway interface ICallForwardingInfoCallback { + void onCallForwardingInfoAvailable(in CallForwardingInfo info); + void onError(int error); +}
\ No newline at end of file diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 5c31c46f293c..61c22bb09753 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -58,6 +58,7 @@ import android.telephony.ims.aidl.IImsRegistrationCallback; import com.android.ims.internal.IImsServiceFeatureCallback; import com.android.internal.telephony.CellNetworkScanResult; import com.android.internal.telephony.IBooleanConsumer; +import com.android.internal.telephony.ICallForwardingInfoCallback; import com.android.internal.telephony.IIntegerConsumer; import com.android.internal.telephony.INumberVerificationCallback; import com.android.internal.telephony.OperatorInfo; @@ -1639,78 +1640,15 @@ interface ITelephony { */ void carrierActionResetAll(int subId); - /** - * Gets the voice call forwarding info {@link CallForwardingInfo}, given the call forward - * reason. - * - * @param callForwardingReason the call forwarding reasons which are the bitwise-OR combination - * of the following constants: - * <ol> - * <li>{@link CallForwardingInfo#REASON_BUSY} </li> - * <li>{@link CallForwardingInfo#REASON_NO_REPLY} </li> - * <li>{@link CallForwardingInfo#REASON_NOT_REACHABLE} </li> - * </ol> - * - * @throws IllegalArgumentException if callForwardingReason is not a bitwise-OR combination - * of {@link CallForwardingInfo.REASON_BUSY}, {@link CallForwardingInfo.REASON_BUSY}, - * {@link CallForwardingInfo.REASON_NOT_REACHABLE} - * - * @return {@link CallForwardingInfo} with the status {@link CallForwardingInfo#STATUS_ACTIVE} - * or {@link CallForwardingInfo#STATUS_INACTIVE} and the target phone number to forward calls - * to, if it's available. Otherwise, it will return a {@link CallForwardingInfo} with status - * {@link CallForwardingInfo#STATUS_NOT_SUPPORTED} or - * {@link CallForwardingInfo#STATUS_FDN_CHECK_FAILURE} depending on the situation. - * - * @hide - */ - CallForwardingInfo getCallForwarding(int subId, int callForwardingReason); + void getCallForwarding(int subId, int callForwardingReason, + ICallForwardingInfoCallback callback); - /** - * Sets the voice call forwarding info including status (enable/disable), call forwarding - * reason, the number to forward, and the timeout before the forwarding is attempted. - * - * @param callForwardingInfo {@link CallForwardingInfo} to setup the call forwarding. - * Enabling if {@link CallForwardingInfo#getStatus()} returns - * {@link CallForwardingInfo#STATUS_ACTIVE}; Disabling if - * {@link CallForwardingInfo#getStatus()} returns {@link CallForwardingInfo#STATUS_INACTIVE}. - * - * @throws IllegalArgumentException if any of the following: - * 0) callForwardingInfo is null. - * 1) {@link CallForwardingInfo#getStatus()} for callForwardingInfo returns neither - * {@link CallForwardingInfo#STATUS_ACTIVE} nor {@link CallForwardingInfo#STATUS_INACTIVE}. - * 2) {@link CallForwardingInfo#getReason()} for callForwardingInfo doesn't return the - * bitwise-OR combination of {@link CallForwardingInfo.REASON_BUSY}, - * {@link CallForwardingInfo.REASON_BUSY}, {@link CallForwardingInfo.REASON_NOT_REACHABLE} - * 3) {@link CallForwardingInfo#getNumber()} for callForwardingInfo returns null. - * 4) {@link CallForwardingInfo#getTimeout()} for callForwardingInfo returns nagetive value. - * - * @return {@code true} to indicate it was set successfully; {@code false} otherwise. - * - * @hide - */ - boolean setCallForwarding(int subId, in CallForwardingInfo callForwardingInfo); + void setCallForwarding(int subId, in CallForwardingInfo callForwardingInfo, + IIntegerConsumer callback); - /** - * Gets the status of voice call waiting function. Call waiting function enables the waiting - * for the incoming call when it reaches the user who is busy to make another call and allows - * users to decide whether to switch to the incoming call. - * - * @return the status of call waiting function. - * @hide - */ - int getCallWaitingStatus(int subId); + void getCallWaitingStatus(int subId, IIntegerConsumer callback); - /** - * Sets the status for voice call waiting function. Call waiting function enables the waiting - * for the incoming call when it reaches the user who is busy to make another call and allows - * users to decide whether to switch to the incoming call. - * - * @param isEnable {@code true} to enable; {@code false} to disable. - * @return {@code true} to indicate it was set successfully; {@code false} otherwise. - * - * @hide - */ - boolean setCallWaitingStatus(int subId, boolean isEnable); + void setCallWaitingStatus(int subId, boolean enabled, IIntegerConsumer callback); /** * Policy control of data connection. Usually used when data limit is passed. |