From 594dc4b92054649e0302b04226afb2e0c6b9fc74 Mon Sep 17 00:00:00 2001 From: Hall Liu Date: Tue, 29 Sep 2020 17:08:58 -0700 Subject: [PATCH] Move some of the call-forwarding related constants Move the call forwarding result constants into CallForwardingInfoCallback and rename them to RESULT_* Fixes: 169153246 Test: atest TelephonyManagerTest Change-Id: I14b4d527807e92fe977b8304f8dd95e7cd93e819 Merged-In: I14b4d527807e92fe977b8304f8dd95e7cd93e819 --- api/system-current.txt | 10 ++-- non-updatable-api/system-current.txt | 10 ++-- telephony/api/system-current.txt | 10 ++-- .../android/telephony/CallForwardingInfo.java | 34 -------------- .../android/telephony/TelephonyManager.java | 47 ++++++++++++++++--- 5 files changed, 56 insertions(+), 55 deletions(-) diff --git a/api/system-current.txt b/api/system-current.txt index bd5fcb5e6f54b..d009d1b4d5afb 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -10551,16 +10551,12 @@ package android.telephony { method public int getTimeoutSeconds(); method public boolean isEnabled(); field @NonNull public static final android.os.Parcelable.Creator 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 { @@ -11283,7 +11279,7 @@ package android.telephony { method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setAllowedCarriers(int, java.util.List); 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); - method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCallWaitingStatus(boolean, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCallWaitingEnabled(boolean, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer); 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); @@ -11382,6 +11378,10 @@ package android.telephony { 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 { diff --git a/non-updatable-api/system-current.txt b/non-updatable-api/system-current.txt index 98a96f75841c7..006aba8fb7f46 100644 --- a/non-updatable-api/system-current.txt +++ b/non-updatable-api/system-current.txt @@ -9433,16 +9433,12 @@ package android.telephony { method public int getTimeoutSeconds(); method public boolean isEnabled(); field @NonNull public static final android.os.Parcelable.Creator 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 { @@ -10165,7 +10161,7 @@ package android.telephony { method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setAllowedCarriers(int, java.util.List); 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); - method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCallWaitingStatus(boolean, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCallWaitingEnabled(boolean, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer); 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); @@ -10264,6 +10260,10 @@ package android.telephony { 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 { diff --git a/telephony/api/system-current.txt b/telephony/api/system-current.txt index 48db88927c0d7..15d69d6c8f635 100644 --- a/telephony/api/system-current.txt +++ b/telephony/api/system-current.txt @@ -35,16 +35,12 @@ package android.telephony { method public int getTimeoutSeconds(); method public boolean isEnabled(); field @NonNull public static final android.os.Parcelable.Creator 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 { @@ -741,7 +737,7 @@ package android.telephony { 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); - method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCallWaitingStatus(boolean, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCallWaitingEnabled(boolean, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer); 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); @@ -839,6 +835,10 @@ package android.telephony { 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 { diff --git a/telephony/java/android/telephony/CallForwardingInfo.java b/telephony/java/android/telephony/CallForwardingInfo.java index 2106f7fc4bb8f..6ae6d002d9902 100644 --- a/telephony/java/android/telephony/CallForwardingInfo.java +++ b/telephony/java/android/telephony/CallForwardingInfo.java @@ -38,27 +38,6 @@ import java.util.Objects; public final class CallForwardingInfo implements Parcelable { private static final String TAG = "CallForwardingInfo"; - /** - * Indicates that the operation was successful. - */ - public static final int SUCCESS = 0; - - /** - * Indicates that setting or retrieving the call forwarding info failed with an unknown error. - */ - public static final int ERROR_UNKNOWN = 1; - - /** - * Indicates that call forwarding is not enabled because the recipient is not on a - * Fixed Dialing Number (FDN) list. - */ - public static final int ERROR_FDN_CHECK_FAILURE = 2; - - /** - * Indicates that call forwarding is not supported on the network at this time. - */ - public static final int ERROR_NOT_SUPPORTED = 3; - /** * Indicates that call forwarding reason is "unconditional". * Reference: 3GPP TS 27.007 version 10.3.0 Release 10 - 7.11 Call forwarding number @@ -103,19 +82,6 @@ public final class CallForwardingInfo implements Parcelable { */ public static final int REASON_ALL_CONDITIONAL = 5; - /** - * Call forwarding errors - * @hide - */ - @IntDef(prefix = { "ERROR_" }, value = { - ERROR_UNKNOWN, - ERROR_NOT_SUPPORTED, - ERROR_FDN_CHECK_FAILURE - }) - @Retention(RetentionPolicy.SOURCE) - public @interface CallForwardingError{ - } - /** * Call forwarding reason types * @hide diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 9de3090d58527..3ba32219ef731 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -12753,6 +12753,40 @@ public class TelephonyManager { */ @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 @@ -12763,7 +12797,7 @@ public class TelephonyManager { * Called when there was an error retrieving the call forwarding information. * @param error */ - void onError(@CallForwardingInfo.CallForwardingError int error); + void onError(@CallForwardingError int error); } /** @@ -12836,9 +12870,9 @@ public class TelephonyManager { * @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. + * 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: @@ -12864,7 +12898,8 @@ public class TelephonyManager { @SystemApi public void setCallForwarding(@NonNull CallForwardingInfo callForwardingInfo, @Nullable @CallbackExecutor Executor executor, - @Nullable @CallForwardingInfo.CallForwardingError Consumer resultListener) { + @Nullable @CallForwardingInfoCallback.CallForwardingError + Consumer resultListener) { if (callForwardingInfo == null) { throw new IllegalArgumentException("callForwardingInfo is null"); } @@ -13020,7 +13055,7 @@ public class TelephonyManager { */ @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) - public void setCallWaitingStatus(boolean enabled, @Nullable Executor executor, + public void setCallWaitingEnabled(boolean enabled, @Nullable Executor executor, @Nullable Consumer resultListener) { if (resultListener != null) { Objects.requireNonNull(executor);