diff options
author | Brad Ebinger <breadley@google.com> | 2016-02-12 16:24:04 -0800 |
---|---|---|
committer | The Android Automerger <android-build@google.com> | 2016-02-26 16:56:21 -0800 |
commit | 2e11a63adbf452cd3b78c2e1e9e8234c6430fa4b (patch) | |
tree | 9baeedfee35256cc026486e4ccb399f446eec353 | |
parent | d9f9006eafb1751f1b4ae1aa0954d445aa03fd3c (diff) | |
download | android_packages_services_Telecomm-2e11a63adbf452cd3b78c2e1e9e8234c6430fa4b.tar.gz android_packages_services_Telecomm-2e11a63adbf452cd3b78c2e1e9e8234c6430fa4b.tar.bz2 android_packages_services_Telecomm-2e11a63adbf452cd3b78c2e1e9e8234c6430fa4b.zip |
DO NOT MERGE Check PAH in addNewIncomingCall
Check to be sure that the PhoneAccountHandle in addNewIncomingCall
corresponds to an existing registered PhoneAccount in Telecom and that
the PhoneAccount is enabled. Otherwise, throw a SecurityException.
Bug: 26864502
Change-Id: I6bbd8a1ece821b62bee2c94decde87a41afbf8b0
-rw-r--r-- | src/com/android/server/telecom/TelecomServiceImpl.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/com/android/server/telecom/TelecomServiceImpl.java b/src/com/android/server/telecom/TelecomServiceImpl.java index fc8977b0..9c4585dc 100644 --- a/src/com/android/server/telecom/TelecomServiceImpl.java +++ b/src/com/android/server/telecom/TelecomServiceImpl.java @@ -44,6 +44,7 @@ import android.telecom.TelecomManager; import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.text.TextUtils; +import android.util.EventLog; // TODO: Needed for move to system service: import com.android.internal.R; import com.android.internal.telecom.ITelecomService; @@ -742,6 +743,7 @@ public class TelecomServiceImpl { phoneAccountHandle.getComponentName().getPackageName()); // Make sure it doesn't cross the UserHandle boundary enforceUserHandleMatchesCaller(phoneAccountHandle); + enforcePhoneAccountIsRegisteredEnabled(phoneAccountHandle); } long token = Binder.clearCallingIdentity(); @@ -777,6 +779,7 @@ public class TelecomServiceImpl { // Make sure it doesn't cross the UserHandle boundary enforceUserHandleMatchesCaller(phoneAccountHandle); + enforcePhoneAccountIsRegisteredEnabled(phoneAccountHandle); long token = Binder.clearCallingIdentity(); try { @@ -1056,6 +1059,21 @@ public class TelecomServiceImpl { return false; } + // Enforce that the PhoneAccountHandle being passed in is both registered to the current user + // and enabled. + private void enforcePhoneAccountIsRegisteredEnabled(PhoneAccountHandle phoneAccountHandle) { + PhoneAccount phoneAccount = mPhoneAccountRegistrar.getPhoneAccountCheckCallingUser( + phoneAccountHandle); + if (phoneAccount == null) { + EventLog.writeEvent(0x534e4554, "26864502", Binder.getCallingUid(), "R"); + throw new SecurityException("This PhoneAccountHandle is not registered for this user!"); + } + if (!phoneAccount.isEnabled()) { + EventLog.writeEvent(0x534e4554, "26864502", Binder.getCallingUid(), "E"); + throw new SecurityException("This PhoneAccountHandle is not enabled for this user!"); + } + } + private void enforcePhoneAccountModificationForPackage(String packageName) { // TODO: Use a new telecomm permission for this instead of reusing modify. |