diff options
| author | 2020-01-15 00:49:43 +0900 | |
|---|---|---|
| committer | 2020-01-20 10:45:48 +0000 | |
| commit | e1a90d6645176ea4487fed9b4eb361f476cfbbb4 (patch) | |
| tree | fac621467d2a2adf43f706cf7117b9a325bbf9ae | |
| parent | 107f16371134c8b9fb26a60519f209be6154c566 (diff) | |
Make NetworkCapabilities authoritative for roaming state
...instead of NetworkInfo
Bug: 138306002
Test: FrameworksNetTests FrameworksTelephonyTests
Change-Id: Ifdea19fa32089b5c7925f5010169b1dea3d2b304
Merged-In: Ifdea19fa32089b5c7925f5010169b1dea3d2b304
| -rw-r--r-- | services/core/java/com/android/server/ConnectivityService.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index c2e9c9a04ff3..7a998a5aef78 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -5855,9 +5855,10 @@ public class ConnectivityService extends IConnectivityManager.Stub } newNc.setPrivateDnsBroken(nai.networkCapabilities.isPrivateDnsBroken()); - // TODO : remove this once all factories are updated to send NOT_SUSPENDED + // TODO : remove this once all factories are updated to send NOT_SUSPENDED and NOT_ROAMING if (!newNc.hasTransport(TRANSPORT_CELLULAR)) { newNc.addCapability(NET_CAPABILITY_NOT_SUSPENDED); + newNc.addCapability(NET_CAPABILITY_NOT_ROAMING); } return newNc; @@ -5906,7 +5907,9 @@ public class ConnectivityService extends IConnectivityManager.Stub processListenRequests(nai); final boolean prevSuspended = !prevNc.hasCapability(NET_CAPABILITY_NOT_SUSPENDED); final boolean suspended = !newNc.hasCapability(NET_CAPABILITY_NOT_SUSPENDED); - if (prevSuspended != suspended) { + final boolean prevRoaming = !prevNc.hasCapability(NET_CAPABILITY_NOT_ROAMING); + final boolean roaming = !newNc.hasCapability(NET_CAPABILITY_NOT_ROAMING); + if (prevSuspended != suspended || prevRoaming != roaming) { // TODO (b/73132094) : remove this call once the few users of onSuspended and // onResumed have been removed. notifyNetworkCallbacks(nai, suspended ? ConnectivityManager.CALLBACK_SUSPENDED @@ -6622,7 +6625,7 @@ public class ConnectivityService extends IConnectivityManager.Stub @NonNull private NetworkInfo mixInInfo(@NonNull final NetworkAgentInfo nai, @NonNull NetworkInfo info) { final NetworkInfo newInfo = new NetworkInfo(info); - // The suspended bit is managed in NetworkCapabilities. + // The suspended and roaming bits are managed in NetworkCapabilities. final boolean suspended = !nai.networkCapabilities.hasCapability(NET_CAPABILITY_NOT_SUSPENDED); if (suspended && info.getDetailedState() == NetworkInfo.DetailedState.CONNECTED) { @@ -6635,6 +6638,7 @@ public class ConnectivityService extends IConnectivityManager.Stub newInfo.setDetailedState(NetworkInfo.DetailedState.SUSPENDED, info.getReason(), info.getExtraInfo()); } + newInfo.setRoaming(!nai.networkCapabilities.hasCapability(NET_CAPABILITY_NOT_ROAMING)); return newInfo; } |