Add required flag to registerReceiver call in NetworkMonitor
Android T adds support to allow a runtime receiver to be registered as not exported, but to ensure apps can take advantage of this, calls to registerReceiver must specify a flag indicating whether the receiver should be exported for apps targeting T+ that are registering for non-system broadcasts. This commit adds the RECEIVER_NOT_EXPORTED flag to the call to registerReceiver in NetworkMonitor since this action is only broadcast via a PendingIntent created by the system. Note, this change will only affect devices running T; prior to T, there was no way to mark a dynamic receiver as unexported, so this change uses the platform's default of 0 as the value for the flags passed to Context#registerReceiver on devices running Q through S. There's also basic testing in ACTS under tools/test/connectivity/ acts_tests/tests/google/net/CaptivePortalTest.py; while this is not a blocking test, it will report if there are any issues with this flag in T. Bug: 161145287 Fixes: 216213421 Test: atest NetworkMonitorTest Change-Id: Id8d623fde0715529afa68b3837e81fbdb1a66d12
Loading
Please register or sign in to comment