Fix dropping of all policies on parsing IllegalArgumentException

Catch IllegalArgumentException per-policy in readPoliciesInner rather
than per-file in readInner/readFromFileLocked.

Also, using Set.of on the array split from device_policy_state.xml can throw
IllegalArgumentException if an admin set a policy containing the
separator character (;) multiple times. By default, this propagates up
and drops all subsequent policies, or crashes system_server and
causes a bootloop. Use HashSet to silently deduplicate elements.

Test: manual
Bug: 515039631
Flag: EXEMPT BUGFIX

Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:7f342a57b386d249847c9ec4928ec81f1a759981

TAG=agy
CONV=2db8a32c-7845-4172-972f-dd05658eba6a
Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:685e1a9c38d0e4e3a357a0ced66e8b200be4ce42
Merged-In: Idd9d8469e4256945342e178d9498ef90a43230e3
Change-Id: Idd9d8469e4256945342e178d9498ef90a43230e3
4 files changed