summaryrefslogtreecommitdiff
path: root/tests/common/java/android/net/LinkPropertiesTest.java
diff options
context:
space:
mode:
authorjunyulai <junyulai@google.com>2022-03-08 17:36:42 +0800
committerCherrypicker Worker <android-build-cherrypicker-worker@google.com>2022-05-11 01:34:15 +0000
commit46b9c1bf629688aac57998dc01b850d5c0b166f6 (patch)
treea2a08bd19021aa765bb422405441c52a39a50d00 /tests/common/java/android/net/LinkPropertiesTest.java
parent196d39a925cf3a4e984fab5bcf0d1fed9f01648e (diff)
Check carrier privilege for CBS network requests synchronously
Normally if an app calls requestNetwork with capabilities that it does not have permission to request, it gets a SecurityException, except if it requests NET_CAPABILITY_CBS, in which case the request will not throw but the app will get an onUnavailable callback. Make this codepath throw as well. This simplifies the code and makes the app-visible behaviour more consistent (and consistent with what happens in S and below). The reason the code was written this way is because the carrier privilege app should receive a callback if it loses permission. But onUnavailable is also not the best callback to send, since it is used very rarely and also releases the app's request. It seems better to leave the request registered and send onLost. Test: atest FrameworksNetTests Bug: 194332512 Change-Id: I5eaeb415a6654851246e38599a996fbd9366fde0 (cherry picked from commit 96bd9fe4dec806ba615691d091b2f696ecd798fe) Merged-In: I5eaeb415a6654851246e38599a996fbd9366fde0
Diffstat (limited to 'tests/common/java/android/net/LinkPropertiesTest.java')
0 files changed, 0 insertions, 0 deletions