summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/current.txt4
-rw-r--r--core/java/android/app/ContextImpl.java13
-rw-r--r--telecomm/java/android/telecomm/ConnectionService.java26
-rw-r--r--telecomm/java/android/telecomm/ConnectionServiceAdapter.java9
-rw-r--r--telecomm/java/android/telecomm/ParcelableConnection.aidl19
-rw-r--r--telecomm/java/android/telecomm/ParcelableConnection.java156
-rw-r--r--telecomm/java/android/telecomm/PhoneAccount.java3
-rw-r--r--telecomm/java/android/telecomm/RemoteCallVideoProvider.java14
-rw-r--r--telecomm/java/android/telecomm/RemoteConnectionService.java39
-rw-r--r--telecomm/java/com/android/internal/telecomm/IConnectionServiceAdapter.aidl4
10 files changed, 250 insertions, 37 deletions
diff --git a/api/current.txt b/api/current.txt
index 8fc9f02596a6..001d9b99fa8e 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -28618,12 +28618,12 @@ package android.telecomm {
method public void sendSessionModifyRequest(android.telecomm.VideoCallProfile);
method public void sendSessionModifyResponse(android.telecomm.VideoCallProfile);
method public void setCallVideoClient(android.telecomm.CallVideoClient);
- method public void setCamera(java.lang.String) throws android.os.RemoteException;
+ method public void setCamera(java.lang.String);
method public void setDeviceOrientation(int);
method public void setDisplaySurface(android.view.Surface);
method public void setPauseImage(java.lang.String);
method public void setPreviewSurface(android.view.Surface);
- method public void setZoom(float) throws android.os.RemoteException;
+ method public void setZoom(float);
}
public final class RemoteConnection {
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 8e3323b8769e..4d6bd4b20845 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -762,9 +762,16 @@ class ContextImpl extends Context {
registerService(PERSISTENT_DATA_BLOCK_SERVICE, new ServiceFetcher() {
public Object createService(ContextImpl ctx) {
IBinder b = ServiceManager.getService(PERSISTENT_DATA_BLOCK_SERVICE);
- return new PersistentDataBlockManager(
- IPersistentDataBlockService.Stub.asInterface(b));
- }});
+ IPersistentDataBlockService persistentDataBlockService =
+ IPersistentDataBlockService.Stub.asInterface(b);
+ if (persistentDataBlockService != null) {
+ return new PersistentDataBlockManager(persistentDataBlockService);
+ } else {
+ // not supported
+ return null;
+ }
+ }
+ });
registerService(MEDIA_PROJECTION_SERVICE, new ServiceFetcher() {
public Object createService(ContextImpl ctx) {
diff --git a/telecomm/java/android/telecomm/ConnectionService.java b/telecomm/java/android/telecomm/ConnectionService.java
index f751826ab47c..d5b39cf12cae 100644
--- a/telecomm/java/android/telecomm/ConnectionService.java
+++ b/telecomm/java/android/telecomm/ConnectionService.java
@@ -432,14 +432,20 @@ public abstract class ConnectionService extends Service {
public void onSuccess(ConnectionRequest request, Connection connection) {
Log.d(this, "adapter handleCreateConnectionSuccessful %s",
request.getCallId());
- mAdapter.handleCreateConnectionSuccessful(request);
addConnection(request.getCallId(), connection);
-
- // TODO: onSuccess should pass through the entire state of the connection instead of
- // having to set it like this afterwards. Also, it would eliminate the hack of
- // having to change the request object that we pass back.
- mConnectionListener.onCallCapabilitiesChanged(
- connection, connection.getCallCapabilities());
+ mAdapter.handleCreateConnectionSuccessful(
+ request,
+ new ParcelableConnection(
+ request.getAccountHandle(),
+ connection.getState(),
+ connection.getCallCapabilities(),
+ connection.getHandle(),
+ connection.getHandlePresentation(),
+ connection.getCallerDisplayName(),
+ connection.getCallerDisplayNamePresentation(),
+ connection.getCallVideoProvider() == null ?
+ null : connection.getCallVideoProvider().getInterface(),
+ connection.getVideoState()));
}
@Override
@@ -720,12 +726,6 @@ public abstract class ConnectionService extends Service {
mIdByConnection.put(connection, callId);
connection.addConnectionListener(mConnectionListener);
onConnectionAdded(connection);
-
- // Trigger listeners for properties set before connection listener was added.
- CallVideoProvider callVideoProvider = connection.getCallVideoProvider();
- if (callVideoProvider != null) {
- connection.setCallVideoProvider(callVideoProvider);
- }
}
private void removeConnection(Connection connection) {
diff --git a/telecomm/java/android/telecomm/ConnectionServiceAdapter.java b/telecomm/java/android/telecomm/ConnectionServiceAdapter.java
index 0b8d93d29c6a..66e99252fbf9 100644
--- a/telecomm/java/android/telecomm/ConnectionServiceAdapter.java
+++ b/telecomm/java/android/telecomm/ConnectionServiceAdapter.java
@@ -74,10 +74,11 @@ final class ConnectionServiceAdapter implements DeathRecipient {
}
}
- void handleCreateConnectionSuccessful(ConnectionRequest request) {
+ void handleCreateConnectionSuccessful(
+ ConnectionRequest request, ParcelableConnection connection) {
for (IConnectionServiceAdapter adapter : mAdapters) {
try {
- adapter.handleCreateConnectionSuccessful(request);
+ adapter.handleCreateConnectionSuccessful(request, connection);
} catch (RemoteException e) {
}
}
@@ -277,7 +278,9 @@ final class ConnectionServiceAdapter implements DeathRecipient {
void setCallVideoProvider(String callId, CallVideoProvider callVideoProvider) {
for (IConnectionServiceAdapter adapter : mAdapters) {
try {
- adapter.setCallVideoProvider(callId, callVideoProvider.getInterface());
+ adapter.setCallVideoProvider(
+ callId,
+ callVideoProvider == null ? null : callVideoProvider.getInterface());
} catch (RemoteException e) {
}
}
diff --git a/telecomm/java/android/telecomm/ParcelableConnection.aidl b/telecomm/java/android/telecomm/ParcelableConnection.aidl
new file mode 100644
index 000000000000..e3c3bd247d17
--- /dev/null
+++ b/telecomm/java/android/telecomm/ParcelableConnection.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2014, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telecomm;
+
+parcelable ParcelableConnection;
diff --git a/telecomm/java/android/telecomm/ParcelableConnection.java b/telecomm/java/android/telecomm/ParcelableConnection.java
new file mode 100644
index 000000000000..f730fef12bf5
--- /dev/null
+++ b/telecomm/java/android/telecomm/ParcelableConnection.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright 2014, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telecomm;
+
+import android.net.Uri;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import com.android.internal.telecomm.ICallVideoProvider;
+
+/**
+ * Information about a connection that is used between Telecomm and the ConnectionService.
+ * This is used to send initial Connection information to Telecomm when the connection is
+ * first created.
+ * @hide
+ */
+public final class ParcelableConnection implements Parcelable {
+ private PhoneAccountHandle mPhoneAccount;
+ private int mState;
+ private int mCapabilities;
+ private Uri mHandle;
+ private int mHandlePresentation;
+ private String mCallerDisplayName;
+ private int mCallerDisplayNamePresentation;
+ private ICallVideoProvider mCallVideoProvider;
+ private int mVideoState;
+
+ /** @hide */
+ public ParcelableConnection(
+ PhoneAccountHandle phoneAccount,
+ int state,
+ int capabilities,
+ Uri handle,
+ int handlePresentation,
+ String callerDisplayName,
+ int callerDisplayNamePresentation,
+ ICallVideoProvider callVideoProvider,
+ int videoState) {
+ mPhoneAccount = phoneAccount;
+ mState = state;
+ mCapabilities = capabilities;
+ mHandle = handle;
+ mHandlePresentation = handlePresentation;
+ mCallerDisplayName = callerDisplayName;
+ mCallerDisplayNamePresentation = callerDisplayNamePresentation;
+ mCallVideoProvider = callVideoProvider;
+ mVideoState = videoState;
+ }
+
+ public PhoneAccountHandle getPhoneAccount() {
+ return mPhoneAccount;
+ }
+
+ public int getState() {
+ return mState;
+ }
+
+ // Bit mask of actions a call supports, values are defined in {@link CallCapabilities}.
+ public int getCapabilities() {
+ return mCapabilities;
+ }
+
+ public Uri getHandle() {
+ return mHandle;
+ }
+
+ public int getHandlePresentation() {
+ return mHandlePresentation;
+ }
+
+ public String getCallerDisplayName() {
+ return mCallerDisplayName;
+ }
+
+ public int getCallerDisplayNamePresentation() {
+ return mCallerDisplayNamePresentation;
+ }
+
+ public ICallVideoProvider getCallVideoProvider() {
+ return mCallVideoProvider;
+ }
+
+ public int getVideoState() {
+ return mVideoState;
+ }
+
+ public static final Parcelable.Creator<ParcelableConnection> CREATOR =
+ new Parcelable.Creator<ParcelableConnection> () {
+ @Override
+ public ParcelableConnection createFromParcel(Parcel source) {
+ ClassLoader classLoader = ParcelableConnection.class.getClassLoader();
+
+ PhoneAccountHandle phoneAccount = source.readParcelable(classLoader);
+ int state = source.readInt();
+ int capabilities = source.readInt();
+ Uri handle = source.readParcelable(classLoader);
+ int handlePresentation = source.readInt();
+ String callerDisplayName = source.readString();
+ int callerDisplayNamePresentation = source.readInt();
+ ICallVideoProvider callVideoProvider =
+ ICallVideoProvider.Stub.asInterface(source.readStrongBinder());
+ int videoState = source.readInt();
+
+ return new ParcelableConnection(
+ phoneAccount,
+ state,
+ capabilities,
+ handle,
+ handlePresentation,
+ callerDisplayName,
+ callerDisplayNamePresentation,
+ callVideoProvider,
+ videoState);
+ }
+
+ @Override
+ public ParcelableConnection[] newArray(int size) {
+ return new ParcelableConnection[size];
+ }
+ };
+
+ /** {@inheritDoc} */
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /** Writes ParcelableConnection object into a Parcel. */
+ @Override
+ public void writeToParcel(Parcel destination, int flags) {
+ destination.writeParcelable(mPhoneAccount, 0);
+ destination.writeInt(mState);
+ destination.writeInt(mCapabilities);
+ destination.writeParcelable(mHandle, 0);
+ destination.writeInt(mHandlePresentation);
+ destination.writeString(mCallerDisplayName);
+ destination.writeInt(mCallerDisplayNamePresentation);
+ destination.writeStrongBinder(
+ mCallVideoProvider != null ? mCallVideoProvider.asBinder() : null);
+ destination.writeInt(mVideoState);
+ }
+}
diff --git a/telecomm/java/android/telecomm/PhoneAccount.java b/telecomm/java/android/telecomm/PhoneAccount.java
index 0570d183c1fb..5a7753ccd87b 100644
--- a/telecomm/java/android/telecomm/PhoneAccount.java
+++ b/telecomm/java/android/telecomm/PhoneAccount.java
@@ -18,6 +18,7 @@ package android.telecomm;
import android.content.Context;
import android.content.pm.PackageManager;
+import android.content.res.Resources.NotFoundException;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Parcel;
@@ -181,7 +182,7 @@ public class PhoneAccount implements Parcelable {
}
try {
return packageContext.getResources().getDrawable(resId);
- } catch (MissingResourceException e) {
+ } catch (NotFoundException|MissingResourceException e) {
Log.e(this, e, "Cannot find icon %d in package %s",
resId, mAccountHandle.getComponentName().getPackageName());
return null;
diff --git a/telecomm/java/android/telecomm/RemoteCallVideoProvider.java b/telecomm/java/android/telecomm/RemoteCallVideoProvider.java
index 170cf043343e..b8b8b9dee426 100644
--- a/telecomm/java/android/telecomm/RemoteCallVideoProvider.java
+++ b/telecomm/java/android/telecomm/RemoteCallVideoProvider.java
@@ -59,8 +59,11 @@ public class RemoteCallVideoProvider {
*
* @param cameraId The id of the camera.
*/
- public void setCamera(String cameraId) throws RemoteException {
- mCallVideoProvider.setCamera(cameraId);
+ public void setCamera(String cameraId) {
+ try {
+ mCallVideoProvider.setCamera(cameraId);
+ } catch (RemoteException e) {
+ }
}
/**
@@ -107,8 +110,11 @@ public class RemoteCallVideoProvider {
*
* @param value The camera zoom ratio.
*/
- public void setZoom(float value) throws RemoteException {
- mCallVideoProvider.setZoom(value);
+ public void setZoom(float value) {
+ try {
+ mCallVideoProvider.setZoom(value);
+ } catch (RemoteException e) {
+ }
}
/**
diff --git a/telecomm/java/android/telecomm/RemoteConnectionService.java b/telecomm/java/android/telecomm/RemoteConnectionService.java
index 29461afd7534..10569abc0cca 100644
--- a/telecomm/java/android/telecomm/RemoteConnectionService.java
+++ b/telecomm/java/android/telecomm/RemoteConnectionService.java
@@ -19,18 +19,17 @@ package android.telecomm;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.net.Uri;
-import android.os.IBinder.DeathRecipient;
import android.os.Handler;
+import android.os.IBinder.DeathRecipient;
import android.os.Message;
import android.os.RemoteException;
import android.telephony.DisconnectCause;
-
import android.text.TextUtils;
import com.android.internal.os.SomeArgs;
+import com.android.internal.telecomm.ICallVideoProvider;
import com.android.internal.telecomm.IConnectionService;
import com.android.internal.telecomm.IConnectionServiceAdapter;
-import com.android.internal.telecomm.ICallVideoProvider;
import com.android.internal.telecomm.RemoteServiceCallback;
import java.util.LinkedList;
@@ -80,11 +79,27 @@ final class RemoteConnectionService implements DeathRecipient {
public void handleMessage(Message msg) {
switch (msg.what) {
case MSG_HANDLE_CREATE_CONNECTION_SUCCESSFUL: {
- ConnectionRequest request = (ConnectionRequest) msg.obj;
- if (isPendingConnection(request.getCallId())) {
- mConnection = new RemoteConnection(mConnectionService, request.getCallId());
- mPendingResponse.onSuccess(request, mConnection);
- clearPendingInformation();
+ SomeArgs args = (SomeArgs) msg.obj;
+ try {
+ ConnectionRequest request = (ConnectionRequest) args.arg1;
+ if (isPendingConnection(request.getCallId())) {
+ ParcelableConnection parcel = (ParcelableConnection) args.arg2;
+ mConnection = new RemoteConnection(
+ mConnectionService, request.getCallId());
+ mConnection.setState(parcel.getState());
+ mConnection.setCallCapabilities(parcel.getCapabilities());
+ mConnection.setHandle(
+ parcel.getHandle(), parcel.getHandlePresentation());
+ mConnection.setCallerDisplayName(
+ parcel.getCallerDisplayName(),
+ parcel.getCallerDisplayNamePresentation());
+ // TODO: Do we need to support video providers for remote connections?
+
+ mPendingResponse.onSuccess(request, mConnection);
+ clearPendingInformation();
+ }
+ } finally {
+ args.recycle();
}
break;
}
@@ -242,8 +257,12 @@ final class RemoteConnectionService implements DeathRecipient {
private final IConnectionServiceAdapter mAdapter = new IConnectionServiceAdapter.Stub() {
@Override
- public void handleCreateConnectionSuccessful(ConnectionRequest request) {
- mHandler.obtainMessage(MSG_HANDLE_CREATE_CONNECTION_SUCCESSFUL, request).sendToTarget();
+ public void handleCreateConnectionSuccessful(
+ ConnectionRequest request, ParcelableConnection connection) {
+ SomeArgs args = SomeArgs.obtain();
+ args.arg1 = request;
+ args.arg2 = connection;
+ mHandler.obtainMessage(MSG_HANDLE_CREATE_CONNECTION_SUCCESSFUL, args).sendToTarget();
}
@Override
diff --git a/telecomm/java/com/android/internal/telecomm/IConnectionServiceAdapter.aidl b/telecomm/java/com/android/internal/telecomm/IConnectionServiceAdapter.aidl
index 1abdf7c51f01..552993f3cd3b 100644
--- a/telecomm/java/com/android/internal/telecomm/IConnectionServiceAdapter.aidl
+++ b/telecomm/java/com/android/internal/telecomm/IConnectionServiceAdapter.aidl
@@ -19,6 +19,7 @@ package com.android.internal.telecomm;
import android.app.PendingIntent;
import android.net.Uri;
import android.telecomm.ConnectionRequest;
+import android.telecomm.ParcelableConnection;
import android.telecomm.StatusHints;
import com.android.internal.telecomm.ICallVideoProvider;
@@ -32,7 +33,8 @@ import com.android.internal.telecomm.RemoteServiceCallback;
* {@hide}
*/
oneway interface IConnectionServiceAdapter {
- void handleCreateConnectionSuccessful(in ConnectionRequest request);
+ void handleCreateConnectionSuccessful(
+ in ConnectionRequest request, in ParcelableConnection connection);
void handleCreateConnectionFailed(
in ConnectionRequest request, int errorCode, String errorMessage);