From f7e102081d578454ed9eea8616927fbf5100a6ce Mon Sep 17 00:00:00 2001 From: Chalard Jean Date: Fri, 28 Mar 2025 18:09:13 +0900 Subject: [PATCH] Make NetworkAgent#sendNetworkInfo public again Changing this method to private broke OEM code that would link directly against the non-public methods of the module. This should not be allowed, and we have changes in the works to disallow this, but in the mean time we can't afford to break devices in the field. Test: will have to see how it behaves in the lab on relevant devices Flag: EXEMPT bugfix Bug: 406489362 Change-Id: Ie6c1ebb04e49317fdda34ff3dd522cd9d4677556 --- framework/src/android/net/NetworkAgent.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/framework/src/android/net/NetworkAgent.java b/framework/src/android/net/NetworkAgent.java index 95b45ce481..d5a1ef3e13 100644 --- a/framework/src/android/net/NetworkAgent.java +++ b/framework/src/android/net/NetworkAgent.java @@ -1236,7 +1236,11 @@ public abstract class NetworkAgent { * @hide TODO: expose something better. */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) - private void sendNetworkInfo(final NetworkInfo networkInfo) { + // NoteĀ : this should be private, but is still called by some OEM network agents + // linking against the full module. They should not do this, and it should be + // forbidden, but as long as there are such devices this can't be made private + // on pain of breaking them. + public void sendNetworkInfo(final NetworkInfo networkInfo) { final NetworkInfo ni = new NetworkInfo(networkInfo); send(reg -> reg.sendNetworkInfo(ni)); }