Update Telecomm to use new wrappers and aidl paths
Change-Id: If9e5cf619defd5347b145591a416004cf0072c95
diff --git a/src/com/android/telecomm/Call.java b/src/com/android/telecomm/Call.java
index f40d4ea..1463c51 100644
--- a/src/com/android/telecomm/Call.java
+++ b/src/com/android/telecomm/Call.java
@@ -18,8 +18,8 @@
import android.telecomm.CallInfo;
import android.telecomm.CallState;
-import android.telecomm.ICallServiceSelector;
+import com.android.internal.telecomm.ICallServiceSelector;
import com.google.common.base.Preconditions;
import java.util.Date;
diff --git a/src/com/android/telecomm/CallServiceAdapter.java b/src/com/android/telecomm/CallServiceAdapter.java
index 8daa16e..3e63f39 100644
--- a/src/com/android/telecomm/CallServiceAdapter.java
+++ b/src/com/android/telecomm/CallServiceAdapter.java
@@ -19,8 +19,8 @@
import android.os.Handler;
import android.os.Looper;
import android.telecomm.CallInfo;
-import android.telecomm.ICallServiceAdapter;
+import com.android.internal.telecomm.ICallServiceAdapter;
import com.google.android.collect.Sets;
import com.google.common.base.Strings;
@@ -74,12 +74,12 @@
}
/** {@inheritDoc} */
- @Override public void setCompatibleWith(String callId, boolean isCompatible) {
+ @Override public void setIsCompatibleWith(String callId, boolean isCompatible) {
// TODO(santoscordon): fill in.
}
/** {@inheritDoc} */
- @Override public void handleIncomingCall(final CallInfo callInfo) {
+ @Override public void notifyIncomingCall(final CallInfo callInfo) {
checkValidCallId(callInfo.getId());
mHandler.post(new Runnable() {
@Override public void run() {
diff --git a/src/com/android/telecomm/CallServiceProviderWrapper.java b/src/com/android/telecomm/CallServiceProviderWrapper.java
index 7638312..97303cd 100644
--- a/src/com/android/telecomm/CallServiceProviderWrapper.java
+++ b/src/com/android/telecomm/CallServiceProviderWrapper.java
@@ -19,8 +19,10 @@
import android.content.ComponentName;
import android.os.IBinder;
import android.os.RemoteException;
-import android.telecomm.ICallServiceLookupResponse;
-import android.telecomm.ICallServiceProvider;
+import android.telecomm.TelecommConstants;
+
+import com.android.internal.telecomm.ICallServiceLookupResponse;
+import com.android.internal.telecomm.ICallServiceProvider;
/**
* Wrapper for {@link ICallServiceProvider}s, handles binding to {@link ICallServiceProvider} and
@@ -30,12 +32,6 @@
* TODO(santoscordon): Keep track of when the service can be safely unbound.
*/
public class CallServiceProviderWrapper extends ServiceBinder<ICallServiceProvider> {
- /**
- * The service action used to bind to ICallServiceProvider implementations.
- * TODO(santoscordon): Move this to TelecommConstants.
- */
- static final String CALL_SERVICE_PROVIDER_ACTION = ICallServiceProvider.class.getName();
-
/** The actual service implementation. */
private ICallServiceProvider mServiceInterface;
@@ -48,7 +44,7 @@
public CallServiceProviderWrapper(
ComponentName componentName, CallServiceRepository repository) {
- super(CALL_SERVICE_PROVIDER_ACTION, componentName);
+ super(TelecommConstants.ACTION_CALL_SERVICE_PROVIDER, componentName);
}
/**
diff --git a/src/com/android/telecomm/CallServiceRepository.java b/src/com/android/telecomm/CallServiceRepository.java
index 14a944e..6a341cd 100644
--- a/src/com/android/telecomm/CallServiceRepository.java
+++ b/src/com/android/telecomm/CallServiceRepository.java
@@ -24,11 +24,11 @@
import android.os.Handler;
import android.os.Looper;
import android.telecomm.CallServiceDescriptor;
-import android.telecomm.ICallServiceLookupResponse;
-import android.telecomm.ICallServiceProvider;
+import android.telecomm.TelecommConstants;
+import com.android.internal.telecomm.ICallServiceLookupResponse;
+import com.android.internal.telecomm.ICallServiceProvider;
import com.android.telecomm.ServiceBinder.BindCallback;
-
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
@@ -199,7 +199,7 @@
List<ComponentName> providerNames = Lists.newArrayList();
PackageManager packageManager = TelecommApp.getInstance().getPackageManager();
- Intent intent = new Intent(CallServiceProviderWrapper.CALL_SERVICE_PROVIDER_ACTION);
+ Intent intent = new Intent(TelecommConstants.ACTION_CALL_SERVICE_PROVIDER);
for (ResolveInfo entry : packageManager.queryIntentServices(intent, 0)) {
ServiceInfo serviceInfo = entry.serviceInfo;
if (serviceInfo != null) {
diff --git a/src/com/android/telecomm/CallServiceSelectorRepository.java b/src/com/android/telecomm/CallServiceSelectorRepository.java
index 98236b2..6203ffd 100644
--- a/src/com/android/telecomm/CallServiceSelectorRepository.java
+++ b/src/com/android/telecomm/CallServiceSelectorRepository.java
@@ -26,8 +26,9 @@
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
-import android.telecomm.ICallServiceSelector;
+import android.telecomm.TelecommConstants;
+import com.android.internal.telecomm.ICallServiceSelector;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
@@ -43,12 +44,6 @@
final class CallServiceSelectorRepository {
/**
- * Used to retrieve all known ICallServiceSelector implementations from the framework.
- */
- private static final String CALL_SERVICE_SELECTOR_CLASS_NAME =
- ICallServiceSelector.class.getName();
-
- /**
* Used to interrupt lookup cycles that didn't terminate naturally within the allowed
* period, see {@link Timeouts#getSelectorLookupMs()}.
*/
@@ -165,7 +160,7 @@
List<ComponentName> selectorNames = Lists.newArrayList();
PackageManager packageManager = mContext.getPackageManager();
- Intent intent = new Intent(CALL_SERVICE_SELECTOR_CLASS_NAME);
+ Intent intent = new Intent(TelecommConstants.ACTION_CALL_SERVICE_SELECTOR);
for (ResolveInfo entry : packageManager.queryIntentServices(intent, 0)) {
ServiceInfo serviceInfo = entry.serviceInfo;
if (serviceInfo != null) {
@@ -190,8 +185,8 @@
Preconditions.checkNotNull(selectorName);
- Intent serviceIntent =
- new Intent(CALL_SERVICE_SELECTOR_CLASS_NAME).setComponent(selectorName);
+ Intent serviceIntent = new Intent(
+ TelecommConstants.ACTION_CALL_SERVICE_SELECTOR).setComponent(selectorName);
Log.i(this, "Binding to ICallServiceSelector through %s", serviceIntent);
// Connection object for the service binding.
diff --git a/src/com/android/telecomm/CallServiceWrapper.java b/src/com/android/telecomm/CallServiceWrapper.java
index 15ec20d..d334f62 100644
--- a/src/com/android/telecomm/CallServiceWrapper.java
+++ b/src/com/android/telecomm/CallServiceWrapper.java
@@ -22,9 +22,10 @@
import android.telecomm.CallInfo;
import android.telecomm.CallService;
import android.telecomm.CallServiceDescriptor;
-import android.telecomm.ICallService;
-import android.telecomm.ICallServiceAdapter;
-import android.telecomm.ICallServiceProvider;
+
+import com.android.internal.telecomm.ICallService;
+import com.android.internal.telecomm.ICallServiceAdapter;
+import com.android.internal.telecomm.ICallServiceProvider;
/**
* Wrapper for {@link ICallService}s, handles binding to {@link ICallService} and keeps track of
@@ -35,12 +36,6 @@
*/
public class CallServiceWrapper extends ServiceBinder<ICallService> {
- /**
- * The service action used to bind to ICallService implementations.
- * TODO(santoscordon): Move this to TelecommConstants.
- */
- static final String CALL_SERVICE_ACTION = ICallService.class.getName();
-
/** The descriptor of this call service as supplied by the call-service provider. */
private final CallServiceDescriptor mDescriptor;
@@ -60,7 +55,7 @@
* @param adapter The call-service adapter.
*/
public CallServiceWrapper(CallServiceDescriptor descriptor, CallServiceAdapter adapter) {
- super(CALL_SERVICE_ACTION, descriptor.getServiceComponent());
+ super(TelecommConstants.ACTION_CALL_SERVICE, descriptor.getServiceComponent());
mDescriptor = descriptor;
mAdapter = adapter;
}
diff --git a/src/com/android/telecomm/CallsManager.java b/src/com/android/telecomm/CallsManager.java
index 23de67b..b8150fd 100644
--- a/src/com/android/telecomm/CallsManager.java
+++ b/src/com/android/telecomm/CallsManager.java
@@ -24,9 +24,9 @@
import android.telecomm.CallService;
import android.telecomm.CallServiceDescriptor;
import android.telecomm.CallState;
-import android.telecomm.ICallService;
import android.telephony.TelephonyManager;
+import com.android.internal.telecomm.ICallService;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
diff --git a/src/com/android/telecomm/InCallAdapter.java b/src/com/android/telecomm/InCallAdapter.java
index 9e14a2e..7232abf 100644
--- a/src/com/android/telecomm/InCallAdapter.java
+++ b/src/com/android/telecomm/InCallAdapter.java
@@ -18,7 +18,8 @@
import android.os.Handler;
import android.os.Looper;
-import android.telecomm.IInCallAdapter;
+
+import com.android.internal.telecomm.IInCallAdapter;
/**
* Receives call commands and updates from in-call app and passes them through to CallsManager.
diff --git a/src/com/android/telecomm/InCallController.java b/src/com/android/telecomm/InCallController.java
index 18651e2..4da9190 100644
--- a/src/com/android/telecomm/InCallController.java
+++ b/src/com/android/telecomm/InCallController.java
@@ -23,7 +23,8 @@
import android.os.IBinder;
import android.os.RemoteException;
import android.telecomm.CallInfo;
-import android.telecomm.IInCallService;
+
+import com.android.internal.telecomm.IInCallService;
/**
* Binds to {@link IInCallService} and provides the service to {@link CallsManager} through which it
@@ -62,7 +63,8 @@
/**
* Class name of the component within in-call app which implements {@link IInCallService}.
*/
- private static final String IN_CALL_SERVICE_CLASS_NAME = "com.android.incallui.InCallService";
+ private static final String IN_CALL_SERVICE_CLASS_NAME =
+ "com.android.incallui.InCallServiceImpl";
/** Maintains a binding connection to the in-call app. */
private final InCallServiceConnection mConnection = new InCallServiceConnection();
diff --git a/src/com/android/telecomm/OutgoingCallProcessor.java b/src/com/android/telecomm/OutgoingCallProcessor.java
index 4d21280..bcfda61 100644
--- a/src/com/android/telecomm/OutgoingCallProcessor.java
+++ b/src/com/android/telecomm/OutgoingCallProcessor.java
@@ -25,9 +25,9 @@
import android.os.RemoteException;
import android.telecomm.CallState;
import android.telecomm.CallServiceDescriptor;
-import android.telecomm.ICallServiceSelectionResponse;
-import android.telecomm.ICallServiceSelector;
+import com.android.internal.telecomm.ICallServiceSelectionResponse;
+import com.android.internal.telecomm.ICallServiceSelector;
import com.android.telecomm.ServiceBinder.BindCallback;
import java.util.Iterator;
diff --git a/src/com/android/telecomm/OutgoingCallsManager.java b/src/com/android/telecomm/OutgoingCallsManager.java
index f50f765..0ed30e6 100644
--- a/src/com/android/telecomm/OutgoingCallsManager.java
+++ b/src/com/android/telecomm/OutgoingCallsManager.java
@@ -16,8 +16,7 @@
package com.android.telecomm;
-import android.telecomm.ICallServiceSelector;
-
+import com.android.internal.telecomm.ICallServiceSelector;
import com.google.common.collect.Maps;
import java.util.List;
diff --git a/src/com/android/telecomm/Switchboard.java b/src/com/android/telecomm/Switchboard.java
index a612a88..040eb5f 100644
--- a/src/com/android/telecomm/Switchboard.java
+++ b/src/com/android/telecomm/Switchboard.java
@@ -23,9 +23,10 @@
import android.os.Handler;
import android.os.Looper;
import android.telecomm.CallServiceDescriptor;
-import android.telecomm.ICallServiceSelector;
import android.telecomm.TelecommConstants;
+import com.android.internal.telecomm.ICallServiceSelector;
+
import java.util.Iterator;
import java.util.List;
import java.util.Set;
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index c6b39b6..570b2ae 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -24,19 +24,19 @@
<!-- TODO(santoscordon): STOPSHIP Services in this manifest need permission protection. -->
<service android:name="com.android.telecomm.testcallservice.TestCallServiceProvider">
<intent-filter>
- <action android:name="android.telecomm.ICallServiceProvider" />
+ <action android:name="android.telecomm.CallServiceProvider" />
</intent-filter>
</service>
<service android:name="com.android.telecomm.testcallservice.TestCallService">
<intent-filter>
- <action android:name="android.telecomm.ICallService" />
+ <action android:name="android.telecomm.CallService" />
</intent-filter>
</service>
<service android:name="com.android.telecomm.testcallservice.DummyCallServiceSelector">
<intent-filter>
- <action android:name="android.telecomm.ICallServiceSelector" />
+ <action android:name="android.telecomm.CallServiceSelector" />
</intent-filter>
</service>
diff --git a/tests/src/com/android/telecomm/testcallservice/TestCallService.java b/tests/src/com/android/telecomm/testcallservice/TestCallService.java
index 8fa1303..db41055 100644
--- a/tests/src/com/android/telecomm/testcallservice/TestCallService.java
+++ b/tests/src/com/android/telecomm/testcallservice/TestCallService.java
@@ -16,6 +16,15 @@
package com.android.telecomm.testcallservice;
+import android.content.Intent;
+import android.media.MediaPlayer;
+import android.os.Bundle;
+import android.telecomm.CallInfo;
+import android.telecomm.CallService;
+import android.telecomm.CallServiceAdapter;
+import android.telecomm.CallState;
+import android.util.Log;
+
import com.android.telecomm.tests.R;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
@@ -23,16 +32,6 @@
import java.util.Set;
-import android.content.Intent;
-import android.media.MediaPlayer;
-import android.os.Bundle;
-import android.os.RemoteException;
-import android.telecomm.CallInfo;
-import android.telecomm.CallService;
-import android.telecomm.CallState;
-import android.telecomm.ICallServiceAdapter;
-import android.util.Log;
-
/**
* Service which provides fake calls to test the ICallService interface.
* TODO(santoscordon): Rename all classes in the directory to Dummy* (e.g., DummyCallService).
@@ -49,7 +48,7 @@
/**
* Adapter to call back into CallsManager.
*/
- private ICallServiceAdapter mCallsManagerAdapter;
+ private CallServiceAdapter mCallsManagerAdapter;
/**
* Used to play an audio tone during a call.
@@ -58,7 +57,7 @@
/** {@inheritDoc} */
@Override
- public void setCallServiceAdapter(ICallServiceAdapter callServiceAdapter) {
+ public void setCallServiceAdapter(CallServiceAdapter callServiceAdapter) {
Log.i(TAG, "setCallServiceAdapter()");
mCallsManagerAdapter = callServiceAdapter;
@@ -86,15 +85,11 @@
// Is compatible if the handle doesn't start with 7.
boolean isCompatible = !callInfo.getHandle().startsWith("7");
- try {
- // Tell CallsManager whether this call service can place the call (is compatible).
- // Returning positively on setCompatibleWith() doesn't guarantee that we will be chosen
- // to place the call. If we *are* chosen then CallsManager will execute the call()
- // method below.
- mCallsManagerAdapter.setCompatibleWith(callInfo.getId(), isCompatible);
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to setCompatibleWith().", e);
- }
+ // Tell CallsManager whether this call service can place the call (is compatible).
+ // Returning positively on setCompatibleWith() doesn't guarantee that we will be chosen
+ // to place the call. If we *are* chosen then CallsManager will execute the call()
+ // method below.
+ mCallsManagerAdapter.setIsCompatibleWith(callInfo.getId(), isCompatible);
}
/**
@@ -109,11 +104,7 @@
createCall(callInfo.getId());
- try {
- mCallsManagerAdapter.handleSuccessfulOutgoingCall(callInfo.getId());
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to create a newOutgoingCall().", e);
- }
+ mCallsManagerAdapter.handleSuccessfulOutgoingCall(callInfo.getId());
}
/** {@inheritDoc} */
@@ -132,31 +123,19 @@
String handle = "5551234";
CallInfo callInfo = new CallInfo(callId, CallState.RINGING, handle);
- try {
- mCallsManagerAdapter.handleIncomingCall(callInfo);
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to handleIncomingCall().", e);
- }
+ mCallsManagerAdapter.notifyIncomingCall(callInfo);
}
/** {@inheritDoc} */
@Override
public void answer(String callId) {
- try {
- mCallsManagerAdapter.setActive(callId);
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to setActive the call " + callId);
- }
+ mCallsManagerAdapter.setActive(callId);
}
/** {@inheritDoc} */
@Override
public void reject(String callId) {
- try {
- mCallsManagerAdapter.setDisconnected(callId);
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to setDisconnected the call " + callId);
- }
+ mCallsManagerAdapter.setDisconnected(callId);
}
/** {@inheritDoc} */
@@ -165,11 +144,7 @@
Log.i(TAG, "disconnect(" + callId + ")");
destroyCall(callId);
- try {
- mCallsManagerAdapter.setDisconnected(callId);
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to setDisconnected().", e);
- }
+ mCallsManagerAdapter.setDisconnected(callId);
}
/** {@inheritDoc} */
diff --git a/tests/src/com/android/telecomm/testcallservice/TestCallServiceProvider.java b/tests/src/com/android/telecomm/testcallservice/TestCallServiceProvider.java
index ddad90c..80c82db 100644
--- a/tests/src/com/android/telecomm/testcallservice/TestCallServiceProvider.java
+++ b/tests/src/com/android/telecomm/testcallservice/TestCallServiceProvider.java
@@ -18,10 +18,9 @@
import android.content.ComponentName;
import android.os.IBinder;
-import android.os.RemoteException;
import android.telecomm.CallServiceDescriptor;
+import android.telecomm.CallServiceLookupResponse;
import android.telecomm.CallServiceProvider;
-import android.telecomm.ICallServiceLookupResponse;
import android.util.Log;
import com.google.common.collect.Lists;
@@ -37,17 +36,13 @@
/** {@inheritDoc} */
@Override
- public void lookupCallServices(ICallServiceLookupResponse response) {
+ public void lookupCallServices(CallServiceLookupResponse response) {
Log.i(TAG, "lookupCallServices()");
- try {
- CallServiceDescriptor.Builder builder = CallServiceDescriptor.newBuilder(this);
- builder.setCallService(TestCallService.class);
- builder.setNetworkType(CallServiceDescriptor.FLAG_WIFI);
+ CallServiceDescriptor.Builder builder = CallServiceDescriptor.newBuilder(this);
+ builder.setCallService(TestCallService.class);
+ builder.setNetworkType(CallServiceDescriptor.FLAG_WIFI);
- response.setCallServiceDescriptors(Lists.newArrayList(builder.build()));
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to setCallServices().", e);
- }
+ response.setCallServiceDescriptors(Lists.newArrayList(builder.build()));
}
}