diff options
| author | 2019-10-29 20:23:13 +0800 | |
|---|---|---|
| committer | 2019-11-20 15:06:01 +0800 | |
| commit | 8cbbed00df85109b4e3e50df0df26255f6e6f0bc (patch) | |
| tree | 0a633490d6bba1c1b25aa1eb5438268b82d3b589 | |
| parent | aab95e48a06f9dbbc857ad4cdecb1b1d837ee2b3 (diff) | |
Add more error codes.
Add error codes for setPreferredOpportunisticDataSubscription and updateAvailableNetworks
Test: run atest.
1.atest TelephonyManagerTest#testPreferredOpportunisticDataSubscription
[1/1] android.telephony.cts.TelephonyManagerTest#testPreferredOpportunisticDataSubscription: PASSED (1.662s)
2.atest TelephonyManagerTest#testUpdateAvailableNetworks
[1/1] android.telephony.cts.TelephonyManagerTest#testUpdateAvailableNetworks: PASSED (534ms)
Bug: 130595455
Change-Id: I6f386bfcf75236e30141fab89e2b62ee3a8cb59e
| -rw-r--r-- | api/current.txt | 8 | ||||
| -rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 58 |
2 files changed, 61 insertions, 5 deletions
diff --git a/api/current.txt b/api/current.txt index 6d2221e4e43c..81a24add13cb 100644 --- a/api/current.txt +++ b/api/current.txt @@ -45378,6 +45378,8 @@ package android.telephony { field public static final int PHONE_TYPE_NONE = 0; // 0x0 field public static final int PHONE_TYPE_SIP = 3; // 0x3 field public static final int SET_OPPORTUNISTIC_SUB_INACTIVE_SUBSCRIPTION = 2; // 0x2 + field public static final int SET_OPPORTUNISTIC_SUB_NO_OPPORTUNISTIC_SUB_AVAILABLE = 3; // 0x3 + field public static final int SET_OPPORTUNISTIC_SUB_REMOTE_SERVICE_EXCEPTION = 4; // 0x4 field public static final int SET_OPPORTUNISTIC_SUB_SUCCESS = 0; // 0x0 field public static final int SET_OPPORTUNISTIC_SUB_VALIDATION_FAILED = 1; // 0x1 field public static final int SIM_STATE_ABSENT = 1; // 0x1 @@ -45394,8 +45396,14 @@ package android.telephony { field public static final int UNKNOWN_CARRIER_ID = -1; // 0xffffffff field public static final int UNSUPPORTED_CARD_ID = -1; // 0xffffffff field public static final int UPDATE_AVAILABLE_NETWORKS_ABORTED = 2; // 0x2 + field public static final int UPDATE_AVAILABLE_NETWORKS_DISABLE_MODEM_FAIL = 5; // 0x5 + field public static final int UPDATE_AVAILABLE_NETWORKS_ENABLE_MODEM_FAIL = 6; // 0x6 field public static final int UPDATE_AVAILABLE_NETWORKS_INVALID_ARGUMENTS = 3; // 0x3 + field public static final int UPDATE_AVAILABLE_NETWORKS_MULTIPLE_NETWORKS_NOT_SUPPORTED = 7; // 0x7 field public static final int UPDATE_AVAILABLE_NETWORKS_NO_CARRIER_PRIVILEGE = 4; // 0x4 + field public static final int UPDATE_AVAILABLE_NETWORKS_NO_OPPORTUNISTIC_SUB_AVAILABLE = 8; // 0x8 + field public static final int UPDATE_AVAILABLE_NETWORKS_REMOTE_SERVICE_EXCEPTION = 9; // 0x9 + field public static final int UPDATE_AVAILABLE_NETWORKS_SERVICE_IS_DISABLED = 10; // 0xa field public static final int UPDATE_AVAILABLE_NETWORKS_SUCCESS = 0; // 0x0 field public static final int UPDATE_AVAILABLE_NETWORKS_UNKNOWN_FAILURE = 1; // 0x1 field public static final int USSD_ERROR_SERVICE_UNAVAIL = -2; // 0xfffffffe diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 2eb4809bcb27..42f1e12467a3 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -11068,7 +11068,9 @@ public class TelephonyManager { @IntDef(prefix = {"SET_OPPORTUNISTIC_SUB"}, value = { SET_OPPORTUNISTIC_SUB_SUCCESS, SET_OPPORTUNISTIC_SUB_VALIDATION_FAILED, - SET_OPPORTUNISTIC_SUB_INACTIVE_SUBSCRIPTION}) + SET_OPPORTUNISTIC_SUB_INACTIVE_SUBSCRIPTION, + SET_OPPORTUNISTIC_SUB_NO_OPPORTUNISTIC_SUB_AVAILABLE, + SET_OPPORTUNISTIC_SUB_REMOTE_SERVICE_EXCEPTION}) public @interface SetOpportunisticSubscriptionResult {} /** @@ -11086,6 +11088,17 @@ public class TelephonyManager { */ public static final int SET_OPPORTUNISTIC_SUB_INACTIVE_SUBSCRIPTION = 2; + /** + * The subscription is not valid. It must be an opportunistic subscription. + */ + public static final int SET_OPPORTUNISTIC_SUB_NO_OPPORTUNISTIC_SUB_AVAILABLE = 3; + + /** + * Subscription service happened remote exception. + */ + public static final int SET_OPPORTUNISTIC_SUB_REMOTE_SERVICE_EXCEPTION = 4; + + /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(prefix = {"UPDATE_AVAILABLE_NETWORKS"}, value = { @@ -11093,7 +11106,13 @@ public class TelephonyManager { UPDATE_AVAILABLE_NETWORKS_UNKNOWN_FAILURE, UPDATE_AVAILABLE_NETWORKS_ABORTED, UPDATE_AVAILABLE_NETWORKS_INVALID_ARGUMENTS, - UPDATE_AVAILABLE_NETWORKS_NO_CARRIER_PRIVILEGE}) + UPDATE_AVAILABLE_NETWORKS_NO_CARRIER_PRIVILEGE, + UPDATE_AVAILABLE_NETWORKS_DISABLE_MODEM_FAIL, + UPDATE_AVAILABLE_NETWORKS_ENABLE_MODEM_FAIL, + UPDATE_AVAILABLE_NETWORKS_MULTIPLE_NETWORKS_NOT_SUPPORTED, + UPDATE_AVAILABLE_NETWORKS_NO_OPPORTUNISTIC_SUB_AVAILABLE, + UPDATE_AVAILABLE_NETWORKS_REMOTE_SERVICE_EXCEPTION, + UPDATE_AVAILABLE_NETWORKS_SERVICE_IS_DISABLED}) public @interface UpdateAvailableNetworksResult {} /** @@ -11122,6 +11141,36 @@ public class TelephonyManager { public static final int UPDATE_AVAILABLE_NETWORKS_NO_CARRIER_PRIVILEGE = 4; /** + * Disable modem fail. + */ + public static final int UPDATE_AVAILABLE_NETWORKS_DISABLE_MODEM_FAIL = 5; + + /** + * Enable modem fail. + */ + public static final int UPDATE_AVAILABLE_NETWORKS_ENABLE_MODEM_FAIL = 6; + + /** + * Carrier app does not support multiple available networks. + */ + public static final int UPDATE_AVAILABLE_NETWORKS_MULTIPLE_NETWORKS_NOT_SUPPORTED = 7; + + /** + * The subscription is not valid. It must be an opportunistic subscription. + */ + public static final int UPDATE_AVAILABLE_NETWORKS_NO_OPPORTUNISTIC_SUB_AVAILABLE = 8; + + /** + * There is no OpportunisticNetworkService. + */ + public static final int UPDATE_AVAILABLE_NETWORKS_REMOTE_SERVICE_EXCEPTION = 9; + + /** + * OpportunisticNetworkService is disabled. + */ + public static final int UPDATE_AVAILABLE_NETWORKS_SERVICE_IS_DISABLED = 10; + + /** * Set preferred opportunistic data subscription id. * * Switch internet data to preferred opportunistic data subscription id. This api @@ -11151,7 +11200,7 @@ public class TelephonyManager { return; } Binder.withCleanCallingIdentity(() -> executor.execute(() -> { - callback.accept(SET_OPPORTUNISTIC_SUB_INACTIVE_SUBSCRIPTION); + callback.accept(SET_OPPORTUNISTIC_SUB_REMOTE_SERVICE_EXCEPTION); })); return; } @@ -11235,9 +11284,8 @@ public class TelephonyManager { return; } if (iOpportunisticNetworkService == null) { - /* Todo<b/130595455> passing unknown due to lack of good error codes */ Binder.withCleanCallingIdentity(() -> executor.execute(() -> { - callback.accept(UPDATE_AVAILABLE_NETWORKS_UNKNOWN_FAILURE); + callback.accept(UPDATE_AVAILABLE_NETWORKS_REMOTE_SERVICE_EXCEPTION); })); } else { Binder.withCleanCallingIdentity(() -> executor.execute(() -> { |