From 564f7f8df3e58cd2c34ff77207b186ce2100cb9d Mon Sep 17 00:00:00 2001 From: Remi NGUYEN VAN Date: Thu, 8 Apr 2021 16:26:20 +0900 Subject: [PATCH] Improve documentation on simulateDataStall Explain that: - The method does not cause an actual data stall. - The detectionMethod parameter refers to ConnectivityDiagnosticsManager.DataStallReport constants (which already use an IntDef). - timestampMillis is relative to SystemClock.elapsedRealtime. Fixes: 183972768 Test: m Change-Id: I2eeb79e0e8ec6e8fd3b8fe1dcb1abbf2e6338983 --- framework/src/android/net/ConnectivityManager.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/framework/src/android/net/ConnectivityManager.java b/framework/src/android/net/ConnectivityManager.java index 84914a1aee..80bbf0ccf2 100644 --- a/framework/src/android/net/ConnectivityManager.java +++ b/framework/src/android/net/ConnectivityManager.java @@ -44,6 +44,7 @@ import android.content.ComponentName; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; +import android.net.ConnectivityDiagnosticsManager.DataStallReport.DetectionMethod; import android.net.IpSecManager.UdpEncapsulationSocket; import android.net.SocketKeepalive.Callback; import android.net.TetheringManager.StartTetheringCallback; @@ -5095,10 +5096,13 @@ public class ConnectivityManager { * *

This method should only be used for tests. * - *

The caller must be the owner of the specified Network. + *

The caller must be the owner of the specified Network. This simulates a data stall to + * have the system behave as if it had happened, but does not actually stall connectivity. * * @param detectionMethod The detection method used to identify the Data Stall. - * @param timestampMillis The timestamp at which the stall 'occurred', in milliseconds. + * See ConnectivityDiagnosticsManager.DataStallReport.DETECTION_METHOD_*. + * @param timestampMillis The timestamp at which the stall 'occurred', in milliseconds, as per + * SystemClock.elapsedRealtime. * @param network The Network for which a Data Stall is being simluated. * @param extras The PersistableBundle of extras included in the Data Stall notification. * @throws SecurityException if the caller is not the owner of the given network. @@ -5107,7 +5111,7 @@ public class ConnectivityManager { @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) @RequiresPermission(anyOf = {android.Manifest.permission.MANAGE_TEST_NETWORKS, android.Manifest.permission.NETWORK_STACK}) - public void simulateDataStall(int detectionMethod, long timestampMillis, + public void simulateDataStall(@DetectionMethod int detectionMethod, long timestampMillis, @NonNull Network network, @NonNull PersistableBundle extras) { try { mService.simulateDataStall(detectionMethod, timestampMillis, network, extras);