OSDN Git Service

Adding CallVideoProvider to Telecomm.
authorAndrew Lee <anwlee@google.com>
Fri, 20 Jun 2014 23:29:33 +0000 (16:29 -0700)
committerAndrew Lee <anwlee@google.com>
Tue, 24 Jun 2014 20:51:59 +0000 (13:51 -0700)
Change-Id: I16c3c64ff2bcda46e0fd95accb360c972f964b9d

Android.mk
telecomm/java/android/telecomm/CallVideoProvider.java [new file with mode: 0644]
telecomm/java/com/android/internal/telecomm/ICallVideoProvider.aidl [new file with mode: 0644]

index 8ba8815..d0cb407 100644 (file)
@@ -330,6 +330,7 @@ LOCAL_SRC_FILES += \
        telecomm/java/com/android/internal/telecomm/ICallServiceAdapter.aidl \
        telecomm/java/com/android/internal/telecomm/ICallServiceLookupResponse.aidl \
        telecomm/java/com/android/internal/telecomm/ICallServiceProvider.aidl \
+       telecomm/java/com/android/internal/telecomm/ICallVideoProvider.aidl \
        telecomm/java/com/android/internal/telecomm/IInCallAdapter.aidl \
        telecomm/java/com/android/internal/telecomm/IInCallService.aidl \
        telecomm/java/com/android/internal/telecomm/ITelecommService.aidl \
diff --git a/telecomm/java/android/telecomm/CallVideoProvider.java b/telecomm/java/android/telecomm/CallVideoProvider.java
new file mode 100644 (file)
index 0000000..6126fca
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 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.app.Service;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.Message;
+
+import com.android.internal.telecomm.ICallVideoProvider;
+
+/** @hide */
+public abstract class CallVideoProvider {
+    private static final int MSG_SET_CAMERA = 1;
+
+    /**
+     * Default handler used to consolidate binder method calls onto a single thread.
+     */
+    private final class CallVideoProviderHandler extends Handler {
+        @Override
+        public void handleMessage(Message msg) {
+            switch (msg.what) {
+                case MSG_SET_CAMERA:
+                    setCamera((String) msg.obj);
+                default:
+                    break;
+            }
+        }
+    }
+
+    /**
+     * Default ICallVideoProvider implementation.
+     */
+    private final class CallVideoProviderBinder extends ICallVideoProvider.Stub {
+        public void setCamera(String cameraId) {
+            mMessageHandler.obtainMessage(MSG_SET_CAMERA, cameraId).sendToTarget();
+        }
+    }
+
+    private final CallVideoProviderHandler mMessageHandler = new CallVideoProviderHandler();
+    private final CallVideoProviderBinder mBinder;
+
+    protected CallVideoProvider() {
+        mBinder = new CallVideoProviderBinder();
+    }
+
+    /**
+     * Sets the camera to be used for video recording in a video call.
+     *
+     * @param cameraId The id of the camera.
+     */
+    public abstract void setCamera(String cameraId);
+}
diff --git a/telecomm/java/com/android/internal/telecomm/ICallVideoProvider.aidl b/telecomm/java/com/android/internal/telecomm/ICallVideoProvider.aidl
new file mode 100644 (file)
index 0000000..c116dcb
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 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 com.android.internal.telecomm;
+
+/**
+ * Internal remote interface for a call video provider.
+ * @see android.telecomm.CallVideoProvider
+ * @hide
+ */
+oneway interface ICallVideoProvider {
+    void setCamera(String cameraId);
+}
\ No newline at end of file