From 9f400b08d926b262cac99ca596dc196e8b79097e Mon Sep 17 00:00:00 2001 From: Remi NGUYEN VAN Date: Mon, 15 Mar 2021 10:20:40 +0900 Subject: [PATCH] Add ParseException constructors to API ParseException constructors are used by both platform and mainline module code, so they can't be package-private. Removing dependencies on either side is not possible as the class itself is part of the public API, and supports APIs on both sides. Having the constructors part of the API makes the class usable by both sides. Fixes: 182705505 Test: CtsNetTestCases for APIs using the exception Change-Id: Ia396ab2fa3afaed3cf474c8e60f72fc7f3f4fded --- .../Connectivity/framework/api/module-lib-current.txt | 5 +++++ .../framework/src/android/net/ParseException.java | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/Connectivity/framework/api/module-lib-current.txt b/packages/Connectivity/framework/api/module-lib-current.txt index 4b3336644ef90..b04e248ca6fee 100644 --- a/packages/Connectivity/framework/api/module-lib-current.txt +++ b/packages/Connectivity/framework/api/module-lib-current.txt @@ -25,6 +25,11 @@ package android.net { field public static final int TRANSPORT_TEST = 7; // 0x7 } + public class ParseException extends java.lang.RuntimeException { + ctor public ParseException(@NonNull String); + ctor public ParseException(@NonNull String, @NonNull Throwable); + } + public final class TcpRepairWindow { ctor public TcpRepairWindow(int, int, int, int, int, int); field public final int maxWindow; diff --git a/packages/Connectivity/framework/src/android/net/ParseException.java b/packages/Connectivity/framework/src/android/net/ParseException.java index bcfdd7ef09cc0..ca6d012dfe7c0 100644 --- a/packages/Connectivity/framework/src/android/net/ParseException.java +++ b/packages/Connectivity/framework/src/android/net/ParseException.java @@ -17,6 +17,7 @@ package android.net; import android.annotation.NonNull; +import android.annotation.SystemApi; /** * Thrown when parsing failed. @@ -25,12 +26,16 @@ import android.annotation.NonNull; public class ParseException extends RuntimeException { public String response; - ParseException(@NonNull String response) { + /** @hide */ + @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) + public ParseException(@NonNull String response) { super(response); this.response = response; } - ParseException(@NonNull String response, @NonNull Throwable cause) { + /** @hide */ + @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) + public ParseException(@NonNull String response, @NonNull Throwable cause) { super(response, cause); this.response = response; }