Hugo Benichi 5224f00b51 Fix unsafe concurrent access in LegacyTypeTracker
This patch adds synchronization inside LegacyTypeTracker so that
getNetworkForType() can safely run concurrently with remove().

Without synchronization if remove() removes the last network for a
given type while getNetworkForType() runs for the same type, it is
possible that getNetworkForType tries to access the head of an empty
list, resulting in a runtime exception.

This issue was found by zoran.jovanovic@sonymobile.com who proposed a
fix in AOSP (Change-Id: Ia963662edb9d643790e8d9439e4dbdcac4c2187b).

This patch differs from the fix proposed by the bug reporter and tries
instead to do the minimum amount of locking to make getNetworkForType
safe.

Bug: 29030387

(cherry picked from commit 78caa25870391f676e1edbd448b5ff3e12a99a1e)

Change-Id: I915aac527fc8828b32bf35fee870add2dfb11d8d
2016-07-12 21:56:40 +09:00
2016-06-29 17:41:32 +01:00
2016-03-30 10:02:29 -07:00
2015-06-08 17:40:00 -07:00
2016-01-15 16:31:40 +00:00
2016-06-15 21:14:28 -07:00
2016-03-30 13:58:10 -07:00
Description
No description provided
5.1 GiB
Languages
Java 77.3%
Kotlin 9.2%
PowerBuilder 6.6%
C++ 5.5%
AIDL 1%