summaryrefslogtreecommitdiff
path: root/test-mock/src/android/test/mock/MockContext.java
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2018-04-26 14:43:31 -0700
committerTyler Gunn <tgunn@google.com>2018-04-27 08:44:07 -0700
commitf955e56d51dac0fade192b544af5679d3d8193ac (patch)
tree9af30f17af98970b4b4123e0f53bc04fbcd587ae /test-mock/src/android/test/mock/MockContext.java
parentfd935d3a126c4cfe643765d500a4fbed11d77b9b (diff)
Require READ_CALL_LOG permission to see phone numbers in phone state.
Incoming and outgoing call phone numbers are visible in the phone state broadcast and via the PhoneStateListener. To enhance user privacy, change to require the READ_CALL_LOG permission in order to receive the call phone numbers. This means to see phone numbers: 1. android.intent.action.PHONE_STATE - requires READ_PHONE_STATE and READ_CALL_LOG permission. 2. PhoneStateListener#onCallStateChanged - now required READ_CALL_LOG permission. To support this new behavior, added sendBroadcastAsUserMultiplePermissions method to context to allow sending the broadcast to all users while requiring the two permissions. Bug: 78650469 Test: Created PHONE_STATE broadcast receiver in test app and verified that when no permissions are granted, the phone number is empty for incoming and outgoing calls. Test: Granted Phone state permission to test app and verified that phone number is not populated. Test: Granted test app read call log permission and verified that phone number is populated. Test: Created PhoneStateListener in test app and verified that when no permissions are granted, phone number is empty for incoming and outgoing. calls. Test: Granted read call log permission to test app and verified that both the incoming and outgoing numbers are populated. Change-Id: I857ea00cc58a0abbb77960643f361dd6dd9c8b56
Diffstat (limited to 'test-mock/src/android/test/mock/MockContext.java')
-rw-r--r--test-mock/src/android/test/mock/MockContext.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/test-mock/src/android/test/mock/MockContext.java b/test-mock/src/android/test/mock/MockContext.java
index 4dfd0507f351..9d260ebf7231 100644
--- a/test-mock/src/android/test/mock/MockContext.java
+++ b/test-mock/src/android/test/mock/MockContext.java
@@ -364,6 +364,13 @@ public class MockContext extends Context {
}
/** @hide */
+ @Override
+ public void sendBroadcastAsUserMultiplePermissions(Intent intent, UserHandle user,
+ String[] receiverPermissions) {
+ throw new UnsupportedOperationException();
+ }
+
+ /** @hide */
@SystemApi
@Override
public void sendBroadcast(Intent intent, String receiverPermission, Bundle options) {