Merge "Expose and update the call forward/waiting APIs"
This commit is contained in:
@@ -10710,6 +10710,26 @@ 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 ERROR_FDN_CHECK_FAILURE = 2; // 0x2
|
||||
field public static final int ERROR_NOT_SUPPORTED = 3; // 0x3
|
||||
field public static final int ERROR_UNKNOWN = 1; // 0x1
|
||||
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
|
||||
field public static final int SUCCESS = 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);
|
||||
@@ -11371,6 +11391,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);
|
||||
@@ -11447,6 +11469,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 setCallWaitingStatus(boolean, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>);
|
||||
method @Deprecated @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);
|
||||
@@ -11484,6 +11508,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
|
||||
@@ -11538,6 +11566,11 @@ 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);
|
||||
}
|
||||
|
||||
public final class UiccAccessRule implements android.os.Parcelable {
|
||||
ctor public UiccAccessRule(byte[], @Nullable String, long);
|
||||
method public int describeContents();
|
||||
|
||||
@@ -9572,6 +9572,26 @@ 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 ERROR_FDN_CHECK_FAILURE = 2; // 0x2
|
||||
field public static final int ERROR_NOT_SUPPORTED = 3; // 0x3
|
||||
field public static final int ERROR_UNKNOWN = 1; // 0x1
|
||||
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
|
||||
field public static final int SUCCESS = 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);
|
||||
@@ -10233,6 +10253,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);
|
||||
@@ -10309,6 +10331,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 setCallWaitingStatus(boolean, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>);
|
||||
method @Deprecated @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);
|
||||
@@ -10346,6 +10370,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
|
||||
@@ -10400,6 +10428,11 @@ 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);
|
||||
}
|
||||
|
||||
public final class UiccAccessRule implements android.os.Parcelable {
|
||||
ctor public UiccAccessRule(byte[], @Nullable String, long);
|
||||
method public int describeContents();
|
||||
|
||||
@@ -27,6 +27,26 @@ 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 ERROR_FDN_CHECK_FAILURE = 2; // 0x2
|
||||
field public static final int ERROR_NOT_SUPPORTED = 3; // 0x3
|
||||
field public static final int ERROR_UNKNOWN = 1; // 0x1
|
||||
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
|
||||
field public static final int SUCCESS = 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);
|
||||
@@ -656,6 +676,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);
|
||||
@@ -732,6 +754,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 setCallWaitingStatus(boolean, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>);
|
||||
method @Deprecated @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);
|
||||
@@ -769,6 +793,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
|
||||
@@ -823,6 +851,11 @@ 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);
|
||||
}
|
||||
|
||||
public final class UiccAccessRule implements android.os.Parcelable {
|
||||
ctor public UiccAccessRule(byte[], @Nullable String, long);
|
||||
method public int describeContents();
|
||||
|
||||
@@ -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,35 @@ 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
|
||||
* Indicates that the operation was successful.
|
||||
*/
|
||||
public static final int STATUS_INACTIVE = 0;
|
||||
public static final int SUCCESS = 0;
|
||||
|
||||
/**
|
||||
* Indicates the call forwarding status is active.
|
||||
*
|
||||
* @hide
|
||||
* Indicates that setting or retrieving the call forwarding info failed with an unknown error.
|
||||
*/
|
||||
public static final int STATUS_ACTIVE = 1;
|
||||
public static final int ERROR_UNKNOWN = 1;
|
||||
|
||||
/**
|
||||
* Indicates the call forwarding could not be enabled because the recipient is not on
|
||||
* Indicates that call forwarding is not enabled because the recipient is not on a
|
||||
* Fixed Dialing Number (FDN) list.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final int STATUS_FDN_CHECK_FAILURE = 2;
|
||||
public static final int ERROR_FDN_CHECK_FAILURE = 2;
|
||||
|
||||
/**
|
||||
* Indicates the call forwarding status is with an unknown error.
|
||||
*
|
||||
* @hide
|
||||
* Indicates that call forwarding is not supported on the network at this time.
|
||||
*/
|
||||
public static final int STATUS_UNKNOWN_ERROR = 3;
|
||||
public static final int ERROR_NOT_SUPPORTED = 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 +70,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 +77,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 +84,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 +92,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 +100,25 @@ 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
|
||||
* Call forwarding errors
|
||||
* @hide
|
||||
*/
|
||||
@IntDef(prefix = { "STATUS_" }, value = {
|
||||
STATUS_ACTIVE,
|
||||
STATUS_INACTIVE,
|
||||
STATUS_UNKNOWN_ERROR,
|
||||
STATUS_NOT_SUPPORTED,
|
||||
STATUS_FDN_CHECK_FAILURE
|
||||
@IntDef(prefix = { "ERROR_" }, value = {
|
||||
ERROR_UNKNOWN,
|
||||
ERROR_NOT_SUPPORTED,
|
||||
ERROR_FDN_CHECK_FAILURE
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface CallForwardingStatus {
|
||||
public @interface CallForwardingError{
|
||||
}
|
||||
|
||||
/**
|
||||
* Call forwarding reason types
|
||||
* @hide
|
||||
*/
|
||||
@IntDef(flag = true, prefix = { "REASON_" }, value = {
|
||||
REASON_UNCONDITIONAL,
|
||||
@@ -152,9 +133,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 +159,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 +197,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 +205,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 +230,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 +254,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 +265,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 +286,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) + "]";
|
||||
|
||||
@@ -99,6 +99,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;
|
||||
@@ -13020,195 +13022,304 @@ 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 {
|
||||
/**
|
||||
* 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(@CallForwardingInfo.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}.
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* @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}
|
||||
*
|
||||
* @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.
|
||||
* {@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 CallForwardingInfo#SUCCESS} if the operation
|
||||
* succeeded and an error code from {@link CallForwardingInfo}
|
||||
* if 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 @CallForwardingInfo.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.
|
||||
*
|
||||
* @return the status of call waiting function.
|
||||
* 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.
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* @param isEnable {@code true} to enable; {@code false} to disable.
|
||||
* @return {@code true} to indicate it was set successfully; {@code false} otherwise.
|
||||
* 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.
|
||||
*
|
||||
* @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 setCallWaitingStatus(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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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;
|
||||
@@ -1648,78 +1649,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);
|
||||
|
||||
/**
|
||||
* Get Client request stats which will contain statistical information
|
||||
|
||||
Reference in New Issue
Block a user