Use destroyLiveTcpSocketsByOwnerUids for frozen apps
Bug: 284900338 Test: FrameworksNetTests Change-Id: Ia10f3c3b01c42d6ae5ba7b18786b66ca3209b108
This commit is contained in:
@@ -2986,19 +2986,17 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void handleFrozenUids(int[] uids, int[] frozenStates) {
|
private void handleFrozenUids(int[] uids, int[] frozenStates) {
|
||||||
final ArraySet<Range<Integer>> ranges = new ArraySet<>();
|
final ArraySet<Integer> ownerUids = new ArraySet<>();
|
||||||
|
|
||||||
for (int i = 0; i < uids.length; i++) {
|
for (int i = 0; i < uids.length; i++) {
|
||||||
if (frozenStates[i] == UID_FROZEN_STATE_FROZEN) {
|
if (frozenStates[i] == UID_FROZEN_STATE_FROZEN) {
|
||||||
Integer uidAsInteger = Integer.valueOf(uids[i]);
|
ownerUids.add(uids[i]);
|
||||||
ranges.add(new Range(uidAsInteger, uidAsInteger));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ranges.isEmpty()) {
|
if (!ownerUids.isEmpty()) {
|
||||||
final Set<Integer> exemptUids = new ArraySet<>();
|
|
||||||
try {
|
try {
|
||||||
mDeps.destroyLiveTcpSockets(ranges, exemptUids);
|
mDeps.destroyLiveTcpSocketsByOwnerUids(ownerUids);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
loge("Exception in socket destroy: " + e);
|
loge("Exception in socket destroy: " + e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18513,12 +18513,7 @@ public class ConnectivityServiceTest {
|
|||||||
|
|
||||||
waitForIdle();
|
waitForIdle();
|
||||||
|
|
||||||
final Set<Integer> exemptUids = new ArraySet();
|
verify(mDestroySocketsWrapper).destroyLiveTcpSocketsByOwnerUids(Set.of(TEST_FROZEN_UID));
|
||||||
final UidRange frozenUidRange = new UidRange(TEST_FROZEN_UID, TEST_FROZEN_UID);
|
|
||||||
final Set<UidRange> ranges = Collections.singleton(frozenUidRange);
|
|
||||||
|
|
||||||
verify(mDestroySocketsWrapper).destroyLiveTcpSockets(eq(UidRange.toIntRanges(ranges)),
|
|
||||||
eq(exemptUids));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user