From 309b2f63f3265c341f6a43cbca2fb25f9c38109a Mon Sep 17 00:00:00 2001 From: Fyodor Kupolov Date: Wed, 3 Jun 2015 16:29:01 -0700 Subject: Do not enforce PHONE_STATE_PERMISSION to register listener PHONE_STATE_PERMISSION should not be required to register to the following event types: - PhoneStateListener.LISTEN_CALL_STATE - PhoneStateListener.LISTEN_DATA_ACTIVITY - PhoneStateListener.LISTEN_DATA_CONNECTION_STATE In case of LISTEN_CALL_STATE, an empty string should be passed instead of incomingNumber, when caller has no PHONE_STATE_PERMISSION. Bug: 21588537 Change-Id: I5b6d0308924f7e4cd13a983b8e0c9b3a5bbb119b --- telephony/java/android/telephony/PhoneStateListener.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'telephony/java/android/telephony/PhoneStateListener.java') diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java index d192288..16472c8 100644 --- a/telephony/java/android/telephony/PhoneStateListener.java +++ b/telephony/java/android/telephony/PhoneStateListener.java @@ -120,8 +120,7 @@ public class PhoneStateListener { /** * Listen for changes to the device call state. * {@more} - * Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE - * READ_PHONE_STATE} + * * @see #onCallStateChanged */ public static final int LISTEN_CALL_STATE = 0x00000020; @@ -137,8 +136,6 @@ public class PhoneStateListener { * Listen for changes to the direction of data traffic on the data * connection (cellular). * {@more} - * Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE - * READ_PHONE_STATE} * Example: The status bar uses this to display the appropriate * data-traffic icon. * @@ -388,6 +385,10 @@ public class PhoneStateListener { /** * Callback invoked when device call state changes. + * @param state call state + * @param incomingNumber incoming call phone number. If application does not have + * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} permission, an empty + * string will be passed as an argument. * * @see TelephonyManager#CALL_STATE_IDLE * @see TelephonyManager#CALL_STATE_RINGING -- cgit v1.1