From a14b3f2184ffd772192a6fd562b157324644d787 Mon Sep 17 00:00:00 2001 From: Chalard Jean Date: Sat, 19 Feb 2022 20:43:14 +0900 Subject: [PATCH] Fix : recent Connectivity module with old NetworkStack module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adjusts the behavior of the NetworkMonitor mock to behave the same way as the real one – accept either notifyNetworkConnected or notifyNetworkConnectedParcel as a signal a network is connected. This is necessary because the Connectivity module will call either of these depending on versions of other software it finds on the device. Test: ConnectivityServiceTest NetworkMonitorTest Change-Id: I5900a019b3b033f4365d8a82b1e522336012064e --- tests/unit/java/com/android/server/ConnectivityServiceTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/java/com/android/server/ConnectivityServiceTest.java b/tests/unit/java/com/android/server/ConnectivityServiceTest.java index 16b3d5ad81..a6f6cb6e9a 100644 --- a/tests/unit/java/com/android/server/ConnectivityServiceTest.java +++ b/tests/unit/java/com/android/server/ConnectivityServiceTest.java @@ -907,6 +907,7 @@ public class ConnectivityServiceTest { return null; }; + doAnswer(validateAnswer).when(mNetworkMonitor).notifyNetworkConnected(any(), any()); doAnswer(validateAnswer).when(mNetworkMonitor).notifyNetworkConnectedParcel(any()); doAnswer(validateAnswer).when(mNetworkMonitor).forceReevaluation(anyInt());