Add CallModel object to the API and onCallUpdate.
Change-Id: Ie892fbc1f5eebc33328a5cb506c8fe9b24d310be
diff --git a/common/src/com/android/services/telephony/common/Call.aidl b/common/src/com/android/services/telephony/common/Call.aidl
new file mode 100644
index 0000000..52a7ed2
--- /dev/null
+++ b/common/src/com/android/services/telephony/common/Call.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2013 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 com.android.services.telephony.common;
+
+parcelable Call;
diff --git a/common/src/com/android/services/telephony/common/Call.java b/common/src/com/android/services/telephony/common/Call.java
new file mode 100644
index 0000000..66851a7
--- /dev/null
+++ b/common/src/com/android/services/telephony/common/Call.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2013 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 com.android.services.telephony.common;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * Class object used across CallHandlerService APIs.
+ * Describes a single call and its state.
+ */
+final public class Call implements Parcelable {
+
+ public static final int INVALID_CALL_ID = -1;
+
+ private int mCallId = INVALID_CALL_ID;
+ // TODO(klp): Add call state type
+
+ public Call(int callId) {
+ mCallId = callId;
+ }
+
+ public int getCallId() {
+ return mCallId;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(mCallId);
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ public static final Parcelable.Creator<Call> CREATOR
+ = new Parcelable.Creator<Call>() {
+
+ public Call createFromParcel(Parcel in) {
+ return new Call(in);
+ }
+
+ public Call[] newArray(int size) {
+ return new Call[size];
+ }
+ };
+
+ private Call(Parcel in) {
+ mCallId = in.readInt();
+ }
+
+}
diff --git a/common/src/com/android/services/telephony/common/ICallHandlerService.aidl b/common/src/com/android/services/telephony/common/ICallHandlerService.aidl
index 24378ef..cd8e252 100644
--- a/common/src/com/android/services/telephony/common/ICallHandlerService.aidl
+++ b/common/src/com/android/services/telephony/common/ICallHandlerService.aidl
@@ -16,6 +16,7 @@
package com.android.services.telephony.common;
+import com.android.services.telephony.common.Call;
import com.android.services.telephony.common.ICallCommandService;
/**
@@ -38,11 +39,17 @@
/**
* Called when a new incoming call comes in.
*/
- void onIncomingCall(int callId);
+ void onIncomingCall(in Call call);
+
+ /**
+ * Called when the state of a call changes.
+ * TODO(klp): Should this replace onIncomingCall and onDisconnect?
+ * TODO(klp): Should this take in a Collection of calls to update in bulk.
+ */
+ void onCallUpdate(in Call call);
/**
* Called when a call disconnects.
*/
- void onDisconnect(int callId);
-
+ void onDisconnect(in Call call);
}
diff --git a/src/com/android/phone/CallHandlerServiceProxy.java b/src/com/android/phone/CallHandlerServiceProxy.java
index f5247f5..7415f92 100644
--- a/src/com/android/phone/CallHandlerServiceProxy.java
+++ b/src/com/android/phone/CallHandlerServiceProxy.java
@@ -28,6 +28,7 @@
import android.os.SystemProperties;
import android.util.Log;
+import com.android.services.telephony.common.Call;
import com.android.services.telephony.common.ICallHandlerService;
import com.android.services.telephony.common.ICallCommandService;
@@ -61,7 +62,7 @@
public void onNewCall(int callId) {
if (mCallHandlerService != null) {
try {
- mCallHandlerService.onIncomingCall(callId);
+ mCallHandlerService.onIncomingCall(new Call(callId));
} catch (RemoteException e) {
Log.e(TAG, "Remote exception handling onIncomingCall", e);
}
@@ -74,7 +75,7 @@
public void onDisconnect(int callId) {
if (mCallHandlerService != null) {
try {
- mCallHandlerService.onDisconnect(callId);
+ mCallHandlerService.onDisconnect(new Call(callId));
} catch (RemoteException e) {
Log.e(TAG, "Remote exception handling onDisconnect ", e);
}