diff options
| author | 2022-01-26 17:51:08 +0000 | |
|---|---|---|
| committer | 2022-01-26 17:51:08 +0000 | |
| commit | 6453c3096b93fdacf13167897b2c700a58a40315 (patch) | |
| tree | 8542ea63095bb6f8351b83e874c87a6665140f07 | |
| parent | 72f991560c0d21288d4a5c508e954bdae87c620f (diff) | |
| parent | 89ed0021b22e3e6aedea610821cdf17ba4cb4adf (diff) | |
Merge "[MS77] Remove hidden api dependencies from MultipathPolicyTracker" am: 679c6dbedb am: 89ed0021b2
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1958894
Change-Id: Ia4f2a249446e6eff7e51d27aaeb89cf22d805520
| -rw-r--r-- | services/core/java/com/android/server/connectivity/MultipathPolicyTracker.java | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/services/core/java/com/android/server/connectivity/MultipathPolicyTracker.java b/services/core/java/com/android/server/connectivity/MultipathPolicyTracker.java index a5024ffd761f..603f20633cfb 100644 --- a/services/core/java/com/android/server/connectivity/MultipathPolicyTracker.java +++ b/services/core/java/com/android/server/connectivity/MultipathPolicyTracker.java @@ -24,7 +24,6 @@ import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_ROAMING; import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR; import static android.net.NetworkPolicy.LIMIT_DISABLED; import static android.net.NetworkPolicy.WARNING_DISABLED; -import static android.net.NetworkTemplate.OEM_MANAGED_ALL; import static android.provider.Settings.Global.NETWORK_DEFAULT_DAILY_MULTIPATH_QUOTA_BYTES; import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID; @@ -94,6 +93,7 @@ public class MultipathPolicyTracker { private static String TAG = MultipathPolicyTracker.class.getSimpleName(); private static final boolean DBG = false; + private static final long MIN_THRESHOLD_BYTES = 2 * 1_048_576L; // 2MiB // This context is for the current user. private final Context mContext; @@ -278,15 +278,11 @@ public class MultipathPolicyTracker { } private NetworkIdentity getTemplateMatchingNetworkIdentity(NetworkCapabilities nc) { - return new NetworkIdentity( - ConnectivityManager.TYPE_MOBILE, - 0 /* subType, unused for template matching */, - subscriberId, - null /* networkId, unused for matching mobile networks */, - !nc.hasCapability(NET_CAPABILITY_NOT_ROAMING), - !nc.hasCapability(NET_CAPABILITY_NOT_METERED), - false /* defaultNetwork, templates should have DEFAULT_NETWORK_ALL */, - OEM_MANAGED_ALL); + return new NetworkIdentity.Builder().setType(ConnectivityManager.TYPE_MOBILE) + .setSubscriberId(subscriberId) + .setRoaming(!nc.hasCapability(NET_CAPABILITY_NOT_ROAMING)) + .setMetered(!nc.hasCapability(NET_CAPABILITY_NOT_METERED)) + .build(); } private long getRemainingDailyBudget(long limitBytes, @@ -375,7 +371,7 @@ public class MultipathPolicyTracker { // This will only be called if the total quota for the day changed, not if usage changed // since last time, so even if this is called very often the budget will not snap to 0 // as soon as there are less than 2MB left for today. - if (budget > NetworkStatsManager.MIN_THRESHOLD_BYTES) { + if (budget > MIN_THRESHOLD_BYTES) { if (DBG) { Log.d(TAG, "Setting callback for " + budget + " bytes on network " + network); } |