summaryrefslogtreecommitdiff
path: root/framework-t/src/android/net/NetworkStatsCollection.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 13:50:06 +0000
commitf9fc36ea3ac6faed5ec49fbf80cd662c4d36a1a3 (patch)
treed0cd4b9dfc15d8519eb71766c5fffb50db12fda6 /framework-t/src/android/net/NetworkStatsCollection.java
parent16f9d137901baa972dca421dfbfefe2921393dc7 (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 'framework-t/src/android/net/NetworkStatsCollection.java')
0 files changed, 0 insertions, 0 deletions