From bd7a485826978782f2d4557bb9fd7731ec74b180 Mon Sep 17 00:00:00 2001 From: Remi NGUYEN VAN Date: Wed, 13 Jul 2022 20:42:13 +0900 Subject: [PATCH] Revert QosCallbackException constant values The constants are used for the NetworkAgent.sendQosCallbackError system API, so changing their values changes the behavior of that API. This is observed when running S CTS against the latest version of the connectivity module: testQosCallbackOnError fails because a SocketNotConnectedException ends up being reported, instead of an UnsupportedOperationException. Revert the constants to their values before change ID: I7102ae9ba7cb9e1cc8d06b252aad4dad75860f3e Bug: 238061856 Test: cts-tradefed run cts -m CtsNetTestCases \ -t android.net.cts.NetworkAgentTest using a CTS v12.1 package. Change-Id: Iaa12729d9e7dc627a6654a6fa47b8248e0cd3049 --- framework/src/android/net/QosCallbackException.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/framework/src/android/net/QosCallbackException.java b/framework/src/android/net/QosCallbackException.java index b80cff415e..72430d22d1 100644 --- a/framework/src/android/net/QosCallbackException.java +++ b/framework/src/android/net/QosCallbackException.java @@ -57,6 +57,9 @@ public final class QosCallbackException extends Exception { private static final String TAG = "QosCallbackException"; // Types of exceptions supported // + // The constants are used for the sendQosCallbackError system API, so they must not be changed + // as there may be callers relying on their historical values to call that API. + // TODO: mark the constants as @SystemApi, since they are necessary to call a system API. /** {@hide} */ public static final int EX_TYPE_FILTER_NONE = 0; @@ -67,13 +70,13 @@ public final class QosCallbackException extends Exception { public static final int EX_TYPE_FILTER_SOCKET_NOT_BOUND = 2; /** {@hide} */ - public static final int EX_TYPE_FILTER_SOCKET_NOT_CONNECTED = 3; + public static final int EX_TYPE_FILTER_NOT_SUPPORTED = 3; /** {@hide} */ - public static final int EX_TYPE_FILTER_NOT_SUPPORTED = 4; + public static final int EX_TYPE_FILTER_SOCKET_LOCAL_ADDRESS_CHANGED = 4; /** {@hide} */ - public static final int EX_TYPE_FILTER_SOCKET_LOCAL_ADDRESS_CHANGED = 5; + public static final int EX_TYPE_FILTER_SOCKET_NOT_CONNECTED = 5; /** {@hide} */ public static final int EX_TYPE_FILTER_SOCKET_REMOTE_ADDRESS_CHANGED = 6;