Do not register callback for < MIN_THRESHOLD_BYTES

This also avoids returning a nonzero multipath preference
if remaining data is low but nonzero.

Bug: b/72877610
Change-Id: I2459ded06de77d284ae1fe81a60d9e1df56b0c26
Fixes: b/72877610
Test: Tests in go/ag/3842960 pass
This commit is contained in:
Remi NGUYEN VAN
2018-04-04 14:51:26 +09:00
parent 65ef843176
commit 27d62a0a32
2 changed files with 11 additions and 3 deletions

View File

@@ -35,6 +35,7 @@ import android.os.Messenger;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager.ServiceNotFoundException;
import android.util.DataUnit;
import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;
@@ -95,6 +96,15 @@ public class NetworkStatsManager {
/** @hide */
public static final int CALLBACK_RELEASED = 1;
/**
* Minimum data usage threshold for registering usage callbacks.
*
* Requests registered with a threshold lower than this will only be triggered once this minimum
* is reached.
* @hide
*/
public static final long MIN_THRESHOLD_BYTES = DataUnit.MEBIBYTES.toBytes(2);
private final Context mContext;
private final INetworkStatsService mService;