Add more error codes.
1.Add error codes for setPreferredOpportunisticDataSubscription and updateAvailableNetworks 2.It's for changing behavior depending on target SDK, so use the compat framework. 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 Merged-In: I6f386bfcf75236e30141fab89e2b62ee3a8cb59e Change-Id: I6f386bfcf75236e30141fab89e2b62ee3a8cb59e
This commit is contained in:
@@ -45250,6 +45250,7 @@ package android.telephony {
|
|||||||
field public static final int APPTYPE_USIM = 2; // 0x2
|
field public static final int APPTYPE_USIM = 2; // 0x2
|
||||||
field public static final int AUTHTYPE_EAP_AKA = 129; // 0x81
|
field public static final int AUTHTYPE_EAP_AKA = 129; // 0x81
|
||||||
field public static final int AUTHTYPE_EAP_SIM = 128; // 0x80
|
field public static final int AUTHTYPE_EAP_SIM = 128; // 0x80
|
||||||
|
field public static final long CALLBACK_ON_MORE_ERROR_CODE_CHANGE = 130595455L; // 0x7c8ba7fL
|
||||||
field public static final int CALL_STATE_IDLE = 0; // 0x0
|
field public static final int CALL_STATE_IDLE = 0; // 0x0
|
||||||
field public static final int CALL_STATE_OFFHOOK = 2; // 0x2
|
field public static final int CALL_STATE_OFFHOOK = 2; // 0x2
|
||||||
field public static final int CALL_STATE_RINGING = 1; // 0x1
|
field public static final int CALL_STATE_RINGING = 1; // 0x1
|
||||||
@@ -45319,6 +45320,8 @@ package android.telephony {
|
|||||||
field public static final int PHONE_TYPE_NONE = 0; // 0x0
|
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 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_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_SUCCESS = 0; // 0x0
|
||||||
field public static final int SET_OPPORTUNISTIC_SUB_VALIDATION_FAILED = 1; // 0x1
|
field public static final int SET_OPPORTUNISTIC_SUB_VALIDATION_FAILED = 1; // 0x1
|
||||||
field public static final int SIM_STATE_ABSENT = 1; // 0x1
|
field public static final int SIM_STATE_ABSENT = 1; // 0x1
|
||||||
@@ -45335,8 +45338,14 @@ package android.telephony {
|
|||||||
field public static final int UNKNOWN_CARRIER_ID = -1; // 0xffffffff
|
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 UNSUPPORTED_CARD_ID = -1; // 0xffffffff
|
||||||
field public static final int UPDATE_AVAILABLE_NETWORKS_ABORTED = 2; // 0x2
|
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_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_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_SUCCESS = 0; // 0x0
|
||||||
field public static final int UPDATE_AVAILABLE_NETWORKS_UNKNOWN_FAILURE = 1; // 0x1
|
field public static final int UPDATE_AVAILABLE_NETWORKS_UNKNOWN_FAILURE = 1; // 0x1
|
||||||
field public static final int USSD_ERROR_SERVICE_UNAVAIL = -2; // 0xfffffffe
|
field public static final int USSD_ERROR_SERVICE_UNAVAIL = -2; // 0xfffffffe
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ import android.annotation.UnsupportedAppUsage;
|
|||||||
import android.annotation.WorkerThread;
|
import android.annotation.WorkerThread;
|
||||||
import android.app.ActivityThread;
|
import android.app.ActivityThread;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
|
import android.compat.Compatibility;
|
||||||
|
import android.compat.annotation.ChangeId;
|
||||||
|
import android.compat.annotation.EnabledAfter;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -141,6 +144,14 @@ import java.util.regex.Pattern;
|
|||||||
public class TelephonyManager {
|
public class TelephonyManager {
|
||||||
private static final String TAG = "TelephonyManager";
|
private static final String TAG = "TelephonyManager";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To expand the error codes for {@link TelephonyManager#updateAvailableNetworks} and
|
||||||
|
* {@link TelephonyManager#setPreferredOpportunisticDataSubscription}.
|
||||||
|
*/
|
||||||
|
@ChangeId
|
||||||
|
@EnabledAfter(targetSdkVersion = Build.VERSION_CODES.Q)
|
||||||
|
public static final long CALLBACK_ON_MORE_ERROR_CODE_CHANGE = 130595455L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The key to use when placing the result of {@link #requestModemActivityInfo(ResultReceiver)}
|
* The key to use when placing the result of {@link #requestModemActivityInfo(ResultReceiver)}
|
||||||
* into the ResultReceiver Bundle.
|
* into the ResultReceiver Bundle.
|
||||||
@@ -11208,7 +11219,9 @@ public class TelephonyManager {
|
|||||||
@IntDef(prefix = {"SET_OPPORTUNISTIC_SUB"}, value = {
|
@IntDef(prefix = {"SET_OPPORTUNISTIC_SUB"}, value = {
|
||||||
SET_OPPORTUNISTIC_SUB_SUCCESS,
|
SET_OPPORTUNISTIC_SUB_SUCCESS,
|
||||||
SET_OPPORTUNISTIC_SUB_VALIDATION_FAILED,
|
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 {}
|
public @interface SetOpportunisticSubscriptionResult {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11226,6 +11239,16 @@ public class TelephonyManager {
|
|||||||
*/
|
*/
|
||||||
public static final int SET_OPPORTUNISTIC_SUB_INACTIVE_SUBSCRIPTION = 2;
|
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 */
|
/** @hide */
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@IntDef(prefix = {"UPDATE_AVAILABLE_NETWORKS"}, value = {
|
@IntDef(prefix = {"UPDATE_AVAILABLE_NETWORKS"}, value = {
|
||||||
@@ -11233,7 +11256,13 @@ public class TelephonyManager {
|
|||||||
UPDATE_AVAILABLE_NETWORKS_UNKNOWN_FAILURE,
|
UPDATE_AVAILABLE_NETWORKS_UNKNOWN_FAILURE,
|
||||||
UPDATE_AVAILABLE_NETWORKS_ABORTED,
|
UPDATE_AVAILABLE_NETWORKS_ABORTED,
|
||||||
UPDATE_AVAILABLE_NETWORKS_INVALID_ARGUMENTS,
|
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 {}
|
public @interface UpdateAvailableNetworksResult {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11261,6 +11290,36 @@ public class TelephonyManager {
|
|||||||
*/
|
*/
|
||||||
public static final int UPDATE_AVAILABLE_NETWORKS_NO_CARRIER_PRIVILEGE = 4;
|
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.
|
* Set preferred opportunistic data subscription id.
|
||||||
*
|
*
|
||||||
@@ -11293,7 +11352,11 @@ public class TelephonyManager {
|
|||||||
final long identity = Binder.clearCallingIdentity();
|
final long identity = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
executor.execute(() -> {
|
executor.execute(() -> {
|
||||||
|
if (Compatibility.isChangeEnabled(CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
|
||||||
|
callback.accept(SET_OPPORTUNISTIC_SUB_REMOTE_SERVICE_EXCEPTION);
|
||||||
|
} else {
|
||||||
callback.accept(SET_OPPORTUNISTIC_SUB_INACTIVE_SUBSCRIPTION);
|
callback.accept(SET_OPPORTUNISTIC_SUB_INACTIVE_SUBSCRIPTION);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
Binder.restoreCallingIdentity(identity);
|
Binder.restoreCallingIdentity(identity);
|
||||||
@@ -11387,9 +11450,12 @@ public class TelephonyManager {
|
|||||||
if (iOpportunisticNetworkService == null) {
|
if (iOpportunisticNetworkService == null) {
|
||||||
final long identity = Binder.clearCallingIdentity();
|
final long identity = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
/* Todo<b/130595455> passing unknown due to lack of good error codes */
|
|
||||||
executor.execute(() -> {
|
executor.execute(() -> {
|
||||||
|
if (Compatibility.isChangeEnabled(CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
|
||||||
|
callback.accept(UPDATE_AVAILABLE_NETWORKS_REMOTE_SERVICE_EXCEPTION);
|
||||||
|
} else {
|
||||||
callback.accept(UPDATE_AVAILABLE_NETWORKS_UNKNOWN_FAILURE);
|
callback.accept(UPDATE_AVAILABLE_NETWORKS_UNKNOWN_FAILURE);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
Binder.restoreCallingIdentity(identity);
|
Binder.restoreCallingIdentity(identity);
|
||||||
|
|||||||
Reference in New Issue
Block a user