From 5b76d8d7dc1ef7b1af5deb9b84fedf73b58a8be4 Mon Sep 17 00:00:00 2001 From: Chalard Jean Date: Wed, 13 Jan 2021 16:01:06 +0900 Subject: [PATCH] [NS01.5] Fix an embarrassing bug The existing implementations override the function with the int, so the default impl of the function with the int has to call the new one, not the other way around. Otherwise, when implementations are migrated to overriding the new one the old code continues to call the function with the int and that wouldn't work as expected if it didn't call the newly overridden method. Test: TH Change-Id: Ic31cec6481781e0185a0ba150be52390597737e7 --- staticlibs/device/android/net/NetworkFactory.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/staticlibs/device/android/net/NetworkFactory.java b/staticlibs/device/android/net/NetworkFactory.java index 4ddb0dac0a..4bc45cfce2 100644 --- a/staticlibs/device/android/net/NetworkFactory.java +++ b/staticlibs/device/android/net/NetworkFactory.java @@ -366,12 +366,12 @@ public class NetworkFactory extends Handler { /** @deprecated none of the implementors use the score : migrate them */ @Deprecated protected void needNetworkFor(NetworkRequest networkRequest, int score) { - if (++mRefCount == 1) startNetwork(); + needNetworkFor(networkRequest); } // override to do fancier stuff protected void needNetworkFor(NetworkRequest networkRequest) { - needNetworkFor(networkRequest, 0); + if (++mRefCount == 1) startNetwork(); } protected void releaseNetworkFor(NetworkRequest networkRequest) {