OSDN Git Service

Allow carrier-privileged apps to register telephony listeners.
authorJeff Davidson <jpd@google.com>
Thu, 1 Mar 2018 01:50:16 +0000 (17:50 -0800)
committerJeff Davidson <jpd@google.com>
Thu, 15 Mar 2018 20:47:34 +0000 (13:47 -0700)
commite173cbd343999f03681902ec63c269b32bdf27c3
treef8829858768924e7dd50591f593d8562fbf8f08e
parent2a84507b70db66627d2d1c3a444a58290f60b86d
Allow carrier-privileged apps to register telephony listeners.

For TelephonyManager#listen, we check carrier privileges if
READ_PHONE_STATE is missing for any calls which enforce the
permission. For calls which check it and behave differently (by
redacting sensitive info), we defer the permission check until the
actual event occurs, at which point it is checked based on the current
state of the device.

For SubscriptionManager#addOnSubscriptionsChangedListener, we remove
the existing permission check for READ_PHONE_STATE altogether. The
event itself contains no information, and reading subscriptions still
requires either READ_PHONE_STATE or carrier privileges on the
subscription in question.

Also updates incorrect Javadoc on
PhoneStateListener#LISTEN_SIGNAL_STRENGTH, which does not actually
check any permissions by design.

Bug: 70041899
Fixes: 74034127
Test: TreeHugger + E2E test w/ a carrier-privileged app
Change-Id: I84a56ad3972b9edcfdefcbb43ef174c54cdcac00
Merged-In: I84a56ad3972b9edcfdefcbb43ef174c54cdcac00
(cherry pick from commit 62b994b3cf0f05801bd8b58a5874118c404d656b)
services/core/java/com/android/server/TelephonyRegistry.java
telephony/java/android/telephony/PhoneStateListener.java
telephony/java/android/telephony/SubscriptionManager.java