From 179b37dbf4705a5b7e13d196c552bca3239770b6 Mon Sep 17 00:00:00 2001 From: Chalard Jean Date: Thu, 25 Jan 2018 09:41:51 +0900 Subject: [PATCH] Fix a bug where a NetworkAgent gets repeatedly torn down mUids is not marshalled correctly when null so if the NetworkAgent runs in another process and is not a VPN then the system will see its allowed Uids as being the empty list (= nobody can use this network) instead of a null list (= everybody can use this network). This breaks emulator networking. Bug: 72436966 Test: runtests frameworks-net Test: also manual testing, this does fix emulator networking and seems not to break phone networking Cherry-pick of : Id2bbf3808e80b19cd055c832c11cf72372710942 Change-Id: I4b88d5eccbdea745a947d12635cd751e38632589 --- core/java/android/net/NetworkCapabilities.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/java/android/net/NetworkCapabilities.java b/core/java/android/net/NetworkCapabilities.java index 1a4765bcf6..8e05cfa966 100644 --- a/core/java/android/net/NetworkCapabilities.java +++ b/core/java/android/net/NetworkCapabilities.java @@ -892,7 +892,7 @@ public final class NetworkCapabilities implements Parcelable { * * @hide */ - private Set mUids = null; + private ArraySet mUids = null; /** * Convenience method to set the UIDs this network applies to to a single UID. @@ -1178,7 +1178,7 @@ public final class NetworkCapabilities implements Parcelable { dest.writeInt(mLinkDownBandwidthKbps); dest.writeParcelable((Parcelable) mNetworkSpecifier, flags); dest.writeInt(mSignalStrength); - dest.writeArraySet(new ArraySet<>(mUids)); + dest.writeArraySet(mUids); } public static final Creator CREATOR =