Skip to content

Commit f166f48

Browse files
committed
Roaming always metered, relax DHCP metered check.
Always treat roaming connections as metered, and relax DHCP test to match any substring for forward compatibility. Bug: 6382737, 6375399 Change-Id: I9781a60f55fbe35da6f8bfc7a1d609608e8f0951
1 parent 1e945c4 commit f166f48

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

core/java/android/net/DhcpInfoInternal.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,11 @@ public void updateFromDhcpRequest(DhcpInfoInternal orig) {
147147
* metered, and sensitive to heavy data transfers.
148148
*/
149149
public boolean hasMeteredHint() {
150-
return "ANDROID_METERED".equals(vendorInfo);
150+
if (vendorInfo != null) {
151+
return vendorInfo.contains("ANDROID_METERED");
152+
} else {
153+
return false;
154+
}
151155
}
152156

153157
public String toString() {

services/java/com/android/server/net/NetworkPolicyManagerService.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,6 +1497,11 @@ private NetworkQuotaInfo getNetworkQuotaInfoUnchecked(NetworkState state) {
14971497
public boolean isNetworkMetered(NetworkState state) {
14981498
final NetworkIdentity ident = NetworkIdentity.buildNetworkIdentity(mContext, state);
14991499

1500+
// roaming networks are always considered metered
1501+
if (ident.getRoaming()) {
1502+
return true;
1503+
}
1504+
15001505
final NetworkPolicy policy;
15011506
synchronized (mRulesLock) {
15021507
policy = findPolicyForNetworkLocked(ident);

0 commit comments

Comments
 (0)