diff options
author | Tyler Gunn <tgunn@google.com> | 2018-02-14 14:19:42 -0800 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2018-03-21 19:25:05 +0000 |
commit | a6710f4d979c89fec120b73ab0ee0b2cb096ac0b (patch) | |
tree | 078914c850d51282a3bf762227be50c856d07ddc | |
parent | a96251ea07347e4c819f62bc546f79abc7720c01 (diff) | |
download | android_packages_services_Telephony-a6710f4d979c89fec120b73ab0ee0b2cb096ac0b.tar.gz android_packages_services_Telephony-a6710f4d979c89fec120b73ab0ee0b2cb096ac0b.tar.bz2 android_packages_services_Telephony-a6710f4d979c89fec120b73ab0ee0b2cb096ac0b.zip |
Enhanced permission checks for TelephonyManager#endCall() API.
The existing permission checks require CALL permission in order to end
an ongoing call or reject an incoming call. The Telecom equivalent of
this API requires MODIFY_PHONE_STATE. Since this API IS in fact a system
API, modifying the permission requirements to require the same
MODIFY_PHONE_STATE permission.
Test: Manual testing per bug reproduction steps.
Bug: 67862398
Change-Id: I8f15f6afd00466f6b861079a83e9fa03b962f63f
(cherry picked from commit 6707357c6e198287046e76c1d6fc5edf1fcb3fee)
(cherry picked from commit ee1901e859ed4624723d18497b70c59b0b658747)
-rw-r--r-- | src/com/android/phone/PhoneInterfaceManager.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java index 59b768484..616acda12 100644 --- a/src/com/android/phone/PhoneInterfaceManager.java +++ b/src/com/android/phone/PhoneInterfaceManager.java @@ -71,6 +71,7 @@ import android.telephony.UssdResponse; import android.telephony.VisualVoicemailSmsFilterSettings; import android.text.TextUtils; import android.util.ArraySet; +import android.util.EventLog; import android.util.Log; import android.util.Pair; import android.util.Slog; @@ -1171,7 +1172,12 @@ public class PhoneInterfaceManager extends ITelephony.Stub { * @return true is a call was ended */ public boolean endCallForSubscriber(int subId) { - enforceCallPermission(); + if (mApp.checkCallingOrSelfPermission(permission.MODIFY_PHONE_STATE) + != PackageManager.PERMISSION_GRANTED) { + Log.i(LOG_TAG, "endCall: called without modify phone state."); + EventLog.writeEvent(0x534e4554, "67862398", -1, ""); + throw new SecurityException("MODIFY_PHONE_STATE permission required."); + } return (Boolean) sendRequest(CMD_END_CALL, null, new Integer(subId)); } |