Merge "Make NetworkCapabilities authoritative for roaming state"
am: b32eec22b2
Change-Id: I85043174796af8d37a390786e37993bd224a644a
This commit is contained in:
@@ -5852,9 +5852,10 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
}
|
}
|
||||||
newNc.setPrivateDnsBroken(nai.networkCapabilities.isPrivateDnsBroken());
|
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)) {
|
if (!newNc.hasTransport(TRANSPORT_CELLULAR)) {
|
||||||
newNc.addCapability(NET_CAPABILITY_NOT_SUSPENDED);
|
newNc.addCapability(NET_CAPABILITY_NOT_SUSPENDED);
|
||||||
|
newNc.addCapability(NET_CAPABILITY_NOT_ROAMING);
|
||||||
}
|
}
|
||||||
|
|
||||||
return newNc;
|
return newNc;
|
||||||
@@ -5893,7 +5894,9 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
processListenRequests(nai);
|
processListenRequests(nai);
|
||||||
final boolean prevSuspended = !prevNc.hasCapability(NET_CAPABILITY_NOT_SUSPENDED);
|
final boolean prevSuspended = !prevNc.hasCapability(NET_CAPABILITY_NOT_SUSPENDED);
|
||||||
final boolean suspended = !newNc.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
|
// TODO (b/73132094) : remove this call once the few users of onSuspended and
|
||||||
// onResumed have been removed.
|
// onResumed have been removed.
|
||||||
notifyNetworkCallbacks(nai, suspended ? ConnectivityManager.CALLBACK_SUSPENDED
|
notifyNetworkCallbacks(nai, suspended ? ConnectivityManager.CALLBACK_SUSPENDED
|
||||||
@@ -6643,7 +6646,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
@NonNull
|
@NonNull
|
||||||
private NetworkInfo mixInInfo(@NonNull final NetworkAgentInfo nai, @NonNull NetworkInfo info) {
|
private NetworkInfo mixInInfo(@NonNull final NetworkAgentInfo nai, @NonNull NetworkInfo info) {
|
||||||
final NetworkInfo newInfo = new 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 =
|
final boolean suspended =
|
||||||
!nai.networkCapabilities.hasCapability(NET_CAPABILITY_NOT_SUSPENDED);
|
!nai.networkCapabilities.hasCapability(NET_CAPABILITY_NOT_SUSPENDED);
|
||||||
if (suspended && info.getDetailedState() == NetworkInfo.DetailedState.CONNECTED) {
|
if (suspended && info.getDetailedState() == NetworkInfo.DetailedState.CONNECTED) {
|
||||||
@@ -6656,6 +6659,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
newInfo.setDetailedState(NetworkInfo.DetailedState.SUSPENDED, info.getReason(),
|
newInfo.setDetailedState(NetworkInfo.DetailedState.SUSPENDED, info.getReason(),
|
||||||
info.getExtraInfo());
|
info.getExtraInfo());
|
||||||
}
|
}
|
||||||
|
newInfo.setRoaming(!nai.networkCapabilities.hasCapability(NET_CAPABILITY_NOT_ROAMING));
|
||||||
return newInfo;
|
return newInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user