diff options
author | Sailesh Nepal <sail@google.com> | 2015-03-04 15:43:15 -0800 |
---|---|---|
committer | The Android Automerger <android-build@google.com> | 2015-04-20 09:20:47 -0700 |
commit | bfb71774fd3ce5f5079968f391a9cff458993d21 (patch) | |
tree | 37d1f74d242f84a8e9c98b6e605f3ec86ef2439f | |
parent | 83334b85a2c85bd3090bf70509f6f154e1216073 (diff) | |
download | Telecomm-lollipop-mr1-fi-release.tar.gz |
Allow PSTN phone account for incoming calls from connection managerandroid-5.1.1_r8android-5.1.1_r29android-5.1.1_r23android-5.1.1_r18android-5.1.1_r13lollipop-mr1-fi-release
Currently the phone account specified for an incoming call must
match belong to the calling app.
This CL relaxes that restricition a little. Now connection managers
can specify PSTN phone accounts when adding a new incoming call.
This is necessary so that incoming calls from the connection manager
are displayed the same way as outgoing calls from the connection
manager.
Bug: 19591608, 19217193
Change-Id: I856ada853865c0ca01a2c3f9baede354f0855ea8
-rw-r--r-- | src/com/android/server/telecom/TelecomService.java | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/com/android/server/telecom/TelecomService.java b/src/com/android/server/telecom/TelecomService.java index 0e0f0a144..e914f32b5 100644 --- a/src/com/android/server/telecom/TelecomService.java +++ b/src/com/android/server/telecom/TelecomService.java @@ -657,11 +657,16 @@ public class TelecomService extends Service { public void addNewIncomingCall(PhoneAccountHandle phoneAccountHandle, Bundle extras) { Log.i(this, "Adding new incoming call with phoneAccountHandle %s", phoneAccountHandle); if (phoneAccountHandle != null && phoneAccountHandle.getComponentName() != null) { - mAppOpsManager.checkPackage( - Binder.getCallingUid(), phoneAccountHandle.getComponentName().getPackageName()); - - // Make sure it doesn't cross the UserHandle boundary - enforceUserHandleMatchesCaller(phoneAccountHandle); + // TODO(sail): Add unit tests for adding incoming calls from a SIM call manager. + if (isCallerSimCallManager() && TelephonyUtil.isPstnComponentName( + phoneAccountHandle.getComponentName())) { + Log.v(this, "Allowing call manager to add incoming call with PSTN handle"); + } else { + mAppOpsManager.checkPackage(Binder.getCallingUid(), + phoneAccountHandle.getComponentName().getPackageName()); + // Make sure it doesn't cross the UserHandle boundary + enforceUserHandleMatchesCaller(phoneAccountHandle); + } Intent intent = new Intent(TelecomManager.ACTION_INCOMING_CALL); intent.putExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, phoneAccountHandle); @@ -932,6 +937,19 @@ public class TelecomService extends Service { } } + private boolean isCallerSimCallManager() { + PhoneAccountHandle accountHandle = mPhoneAccountRegistrar.getSimCallManager(); + if (accountHandle != null) { + try { + mAppOpsManager.checkPackage( + Binder.getCallingUid(), accountHandle.getComponentName().getPackageName()); + return true; + } catch (SecurityException e) { + } + } + return false; + } + private boolean isDefaultDialerCalling() { ComponentName defaultDialerComponent = getDefaultPhoneAppInternal(); if (defaultDialerComponent != null) { |