diff options
| author | Lorenzo Colitti <lorenzo@google.com> | 2020-12-10 09:18:35 +0000 |
|---|---|---|
| committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-12-10 09:18:35 +0000 |
| commit | 55ba4ffb1db84d16752deb10c858cc68578fc73e (patch) | |
| tree | 82c22c96ae6317cb73a2fcc9aaf19d62b9367ec8 /tests/net/java/com/android/server | |
| parent | 52dceb804b59425f110ea2936fcde7c526810d16 (diff) | |
| parent | bea9280e6e51983f91445f13d373da76ba3b01e6 (diff) | |
Merge changes I6eb6d92b,I638e29fd,I2348b7a3 am: 435d580374 am: 55477377da am: bea9280e6e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1521657
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: I430d7069e1dfbe89780cb459fff9e1eb63daa349
Diffstat (limited to 'tests/net/java/com/android/server')
| -rw-r--r-- | tests/net/java/com/android/server/ConnectivityServiceTest.java | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/tests/net/java/com/android/server/ConnectivityServiceTest.java b/tests/net/java/com/android/server/ConnectivityServiceTest.java index b6f91c457d9e..aec2f48cccea 100644 --- a/tests/net/java/com/android/server/ConnectivityServiceTest.java +++ b/tests/net/java/com/android/server/ConnectivityServiceTest.java @@ -1957,7 +1957,7 @@ public class ConnectivityServiceTest { } @Test - public void testOwnerUidChangeBug() throws Exception { + public void testOwnerUidCannotChange() throws Exception { // Owner UIDs are not visible without location permission. setupLocationPermissions(Build.VERSION_CODES.Q, true, AppOpsManager.OPSTR_FINE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION); @@ -1972,39 +1972,19 @@ public class ConnectivityServiceTest { waitForIdle(); // Send ConnectivityService an update to the mWiFiNetworkAgent's capabilities that changes - // its owner UID. + // the owner UID and an unrelated capability. NetworkCapabilities agentCapabilities = mWiFiNetworkAgent.getNetworkCapabilities(); assertEquals(originalOwnerUid, agentCapabilities.getOwnerUid()); agentCapabilities.setOwnerUid(42); - mWiFiNetworkAgent.setNetworkCapabilities(agentCapabilities, true); - waitForIdle(); - - // Check that the owner UID is not updated. - NetworkCapabilities nc = mCm.getNetworkCapabilities(mWiFiNetworkAgent.getNetwork()); - assertEquals(originalOwnerUid, nc.getOwnerUid()); - - // Make an unrelated change to the capabilities. assertFalse(agentCapabilities.hasCapability(NET_CAPABILITY_NOT_CONGESTED)); agentCapabilities.addCapability(NET_CAPABILITY_NOT_CONGESTED); mWiFiNetworkAgent.setNetworkCapabilities(agentCapabilities, true); waitForIdle(); - // Check that both the capability change and the owner UID have been modified. - // The owner UID is -1 because it is visible only to the UID that owns the network. - nc = mCm.getNetworkCapabilities(mWiFiNetworkAgent.getNetwork()); - assertEquals(-1, nc.getOwnerUid()); - assertTrue(nc.hasCapability(NET_CAPABILITY_NOT_CONGESTED)); - - // Set the owner back to originalOwnerUid, update the capabilities, and check that it is - // visible again. - // TODO: should this even be possible? - agentCapabilities.setOwnerUid(originalOwnerUid); - agentCapabilities.removeCapability(NET_CAPABILITY_NOT_CONGESTED); - mWiFiNetworkAgent.setNetworkCapabilities(agentCapabilities, true); - waitForIdle(); - - nc = mCm.getNetworkCapabilities(mWiFiNetworkAgent.getNetwork()); + // Check that the capability change has been applied but the owner UID is not modified. + NetworkCapabilities nc = mCm.getNetworkCapabilities(mWiFiNetworkAgent.getNetwork()); assertEquals(originalOwnerUid, nc.getOwnerUid()); + assertTrue(nc.hasCapability(NET_CAPABILITY_NOT_CONGESTED)); } @Test |
