Merge "Add more error codes."

am: 53484a4946

Change-Id: Idc0f2f8dd76279e4bb1e9260be2418aef0e32e41
This commit is contained in:
Daniel Huang
2019-12-18 10:28:19 -08:00
committed by android-build-merger
2 changed files with 79 additions and 5 deletions

View File

@@ -45335,6 +45335,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
@@ -45351,8 +45353,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

View File

@@ -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)
private 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.
@@ -11161,7 +11172,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 {}
/** /**
@@ -11179,6 +11192,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 = {
@@ -11186,7 +11209,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 {}
/** /**
@@ -11214,6 +11243,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.
* *
@@ -11246,7 +11305,11 @@ public class TelephonyManager {
final long identity = Binder.clearCallingIdentity(); final long identity = Binder.clearCallingIdentity();
try { try {
executor.execute(() -> { executor.execute(() -> {
callback.accept(SET_OPPORTUNISTIC_SUB_INACTIVE_SUBSCRIPTION); 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);
}
}); });
} finally { } finally {
Binder.restoreCallingIdentity(identity); Binder.restoreCallingIdentity(identity);
@@ -11340,9 +11403,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(() -> {
callback.accept(UPDATE_AVAILABLE_NETWORKS_UNKNOWN_FAILURE); 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);
}
}); });
} finally { } finally {
Binder.restoreCallingIdentity(identity); Binder.restoreCallingIdentity(identity);