Finalize implementation of Remote Connection Service (2/4)
Change-Id: I6525ff7d7e5fbb06a45d4811ebbc319a4b32fd6b
diff --git a/src/com/android/telecomm/ConnectionServiceWrapper.java b/src/com/android/telecomm/ConnectionServiceWrapper.java
index c791932..82381bd 100644
--- a/src/com/android/telecomm/ConnectionServiceWrapper.java
+++ b/src/com/android/telecomm/ConnectionServiceWrapper.java
@@ -860,6 +860,7 @@
// Only give remote connection services to this connection service if it is listed as
// the connection manager.
PhoneAccountHandle simCallManager = registrar.getSimCallManager();
+ Log.d(this, "queryRemoteConnectionServices finds simCallManager = %s", simCallManager);
if (simCallManager == null ||
!simCallManager.getComponentName().equals(getComponentName())) {
noRemoteServices(callback);
diff --git a/src/com/android/telecomm/CreateConnectionProcessor.java b/src/com/android/telecomm/CreateConnectionProcessor.java
index f3449ff..5a186f4 100644
--- a/src/com/android/telecomm/CreateConnectionProcessor.java
+++ b/src/com/android/telecomm/CreateConnectionProcessor.java
@@ -147,6 +147,8 @@
}
PhoneAccountHandle simCallManager =
TelecommApp.getInstance().getPhoneAccountRegistrar().getSimCallManager();
+
+ Log.d(this, "adjustAttemptsForWifi finds simCallManager = %s", simCallManager);
if (simCallManager != null &&
!Objects.equals(simCallManager, mAttemptRecords.get(0).targetPhoneAccount)) {
mAttemptRecords.set(
diff --git a/src/com/android/telecomm/TelecommServiceImpl.java b/src/com/android/telecomm/TelecommServiceImpl.java
index 3598422..9366f84 100644
--- a/src/com/android/telecomm/TelecommServiceImpl.java
+++ b/src/com/android/telecomm/TelecommServiceImpl.java
@@ -44,7 +44,8 @@
* Implementation of the ITelecomm interface.
*/
public class TelecommServiceImpl extends ITelecommService.Stub {
- private static final String TELEPHONY_PACKAGE_NAME = "com.android.phone";
+ private static final String REGISTER_PROVIDER_OR_SUBSCRIPTION =
+ "com.android.telecomm.permission.REGISTER_PROVIDER_OR_SUBSCRIPTION";
/** ${inheritDoc} */
@Override
@@ -195,7 +196,7 @@
account.getAccountHandle().getComponentName().getPackageName());
if (PhoneAccountRegistrar.has(account, PhoneAccount.CAPABILITY_CALL_PROVIDER) ||
PhoneAccountRegistrar.has(account, PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION)) {
- enforceModifyPermissionOrCallingPackage(TELEPHONY_PACKAGE_NAME);
+ enforceRegisterProviderOrSubscriptionPermission();
}
mPhoneAccountRegistrar.registerPhoneAccount(account);
} catch (Exception e) {
@@ -410,6 +411,11 @@
}
}
+ private void enforceRegisterProviderOrSubscriptionPermission() {
+ TelecommApp.getInstance().enforceCallingOrSelfPermission(
+ REGISTER_PROVIDER_OR_SUBSCRIPTION, null);
+ }
+
private void enforceModifyPermissionOrCallingPackage(String packageName) {
// TODO(santoscordon): Use a new telecomm permission for this instead of reusing modify.
try {