split libsurfaceflinger_client and libcamera_client out of libui
diff --git a/camera/libcameraservice/Android.mk b/camera/libcameraservice/Android.mk
index ecaebff..df5c166 100644
--- a/camera/libcameraservice/Android.mk
+++ b/camera/libcameraservice/Android.mk
@@ -48,7 +48,9 @@
libutils \
libbinder \
libcutils \
- libmedia
+ libmedia \
+ libcamera_client \
+ libsurfaceflinger_client
LOCAL_MODULE:= libcameraservice
diff --git a/camera/libcameraservice/CameraHardwareStub.h b/camera/libcameraservice/CameraHardwareStub.h
index 8a67024..957813a 100644
--- a/camera/libcameraservice/CameraHardwareStub.h
+++ b/camera/libcameraservice/CameraHardwareStub.h
@@ -20,7 +20,7 @@
#include "FakeCamera.h"
#include <utils/threads.h>
-#include <ui/CameraHardwareInterface.h>
+#include <camera/CameraHardwareInterface.h>
#include <binder/MemoryBase.h>
#include <binder/MemoryHeapBase.h>
#include <utils/threads.h>
diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp
index 405d471..86a6fac 100644
--- a/camera/libcameraservice/CameraService.cpp
+++ b/camera/libcameraservice/CameraService.cpp
@@ -25,7 +25,9 @@
#include <utils/Errors.h>
#include <binder/MemoryBase.h>
#include <binder/MemoryHeapBase.h>
-#include <ui/ICameraService.h>
+#include <camera/ICameraService.h>
+#include <surfaceflinger/ISurface.h>
+#include <ui/Overlay.h>
#include <media/mediaplayer.h>
#include <media/AudioSystem.h>
diff --git a/camera/libcameraservice/CameraService.h b/camera/libcameraservice/CameraService.h
index b3d20f6..bc49b1d 100644
--- a/camera/libcameraservice/CameraService.h
+++ b/camera/libcameraservice/CameraService.h
@@ -19,9 +19,9 @@
#ifndef ANDROID_SERVERS_CAMERA_CAMERASERVICE_H
#define ANDROID_SERVERS_CAMERA_CAMERASERVICE_H
-#include <ui/ICameraService.h>
-#include <ui/CameraHardwareInterface.h>
-#include <ui/Camera.h>
+#include <camera/ICameraService.h>
+#include <camera/CameraHardwareInterface.h>
+#include <camera/Camera.h>
namespace android {
diff --git a/camera/tests/CameraServiceTest/Android.mk b/camera/tests/CameraServiceTest/Android.mk
index 8da7c1f..9bb190a 100644
--- a/camera/tests/CameraServiceTest/Android.mk
+++ b/camera/tests/CameraServiceTest/Android.mk
@@ -17,6 +17,8 @@
libbinder \
libcutils \
libutils \
- libui
+ libui \
+ libcamera_client \
+ libsurfaceflinger_client
include $(BUILD_EXECUTABLE)
diff --git a/camera/tests/CameraServiceTest/CameraServiceTest.cpp b/camera/tests/CameraServiceTest/CameraServiceTest.cpp
index f89d9d3..9fc795b 100644
--- a/camera/tests/CameraServiceTest/CameraServiceTest.cpp
+++ b/camera/tests/CameraServiceTest/CameraServiceTest.cpp
@@ -6,13 +6,13 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
-#include <ui/ISurface.h>
-#include <ui/Camera.h>
-#include <ui/CameraParameters.h>
+#include <surfaceflinger/ISurface.h>
+#include <camera/Camera.h>
+#include <camera/CameraParameters.h>
#include <ui/GraphicBuffer.h>
-#include <ui/ICamera.h>
-#include <ui/ICameraClient.h>
-#include <ui/ICameraService.h>
+#include <camera/ICamera.h>
+#include <camera/ICameraClient.h>
+#include <camera/ICameraService.h>
#include <ui/Overlay.h>
#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
diff --git a/include/private/ui/LayerState.h b/include/private/surfaceflinger/LayerState.h
similarity index 91%
rename from include/private/ui/LayerState.h
rename to include/private/surfaceflinger/LayerState.h
index f1a2618..d7fe572 100644
--- a/include/private/ui/LayerState.h
+++ b/include/private/surfaceflinger/LayerState.h
@@ -14,17 +14,18 @@
* limitations under the License.
*/
-#ifndef ANDROID_COMPOSER_LAYER_STATE_H
-#define ANDROID_COMPOSER_LAYER_STATE_H
+#ifndef ANDROID_SF_LAYER_STATE_H
+#define ANDROID_SF_LAYER_STATE_H
#include <stdint.h>
#include <sys/types.h>
#include <utils/Errors.h>
-#include <ui/ISurfaceFlingerClient.h>
#include <ui/Region.h>
+#include <surfaceflinger/ISurface.h>
+
namespace android {
class Parcel;
@@ -69,5 +70,5 @@
}; // namespace android
-#endif // ANDROID_COMPOSER_LAYER_STATE_H
+#endif // ANDROID_SF_LAYER_STATE_H
diff --git a/include/private/ui/SharedBufferStack.h b/include/private/surfaceflinger/SharedBufferStack.h
similarity index 98%
rename from include/private/ui/SharedBufferStack.h
rename to include/private/surfaceflinger/SharedBufferStack.h
index bbc1822..9b5a1e0 100644
--- a/include/private/ui/SharedBufferStack.h
+++ b/include/private/surfaceflinger/SharedBufferStack.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ANDROID_UI_SHARED_BUFFER_STACK_H
-#define ANDROID_UI_SHARED_BUFFER_STACK_H
+#ifndef ANDROID_SF_SHARED_BUFFER_STACK_H
+#define ANDROID_SF_SHARED_BUFFER_STACK_H
#include <stdint.h>
#include <sys/types.h>
@@ -356,4 +356,4 @@
// ---------------------------------------------------------------------------
}; // namespace android
-#endif /* ANDROID_UI_SHARED_BUFFER_STACK_H */
+#endif /* ANDROID_SF_SHARED_BUFFER_STACK_H */
diff --git a/include/ui/ISurface.h b/include/surfaceflinger/ISurface.h
similarity index 96%
rename from include/ui/ISurface.h
rename to include/surfaceflinger/ISurface.h
index c7f181c..472f759 100644
--- a/include/ui/ISurface.h
+++ b/include/surfaceflinger/ISurface.h
@@ -14,15 +14,17 @@
* limitations under the License.
*/
-#ifndef ANDROID_ISURFACE_H
-#define ANDROID_ISURFACE_H
+#ifndef ANDROID_SF_ISURFACE_H
+#define ANDROID_SF_ISURFACE_H
#include <stdint.h>
#include <sys/types.h>
#include <utils/Errors.h>
-#include <binder/IInterface.h>
#include <utils/RefBase.h>
+
+#include <binder/IInterface.h>
+
#include <ui/PixelFormat.h>
#include <hardware/hardware.h>
@@ -107,4 +109,4 @@
}; // namespace android
-#endif // ANDROID_ISURFACE_H
+#endif // ANDROID_SF_ISURFACE_H
diff --git a/include/ui/ISurfaceComposer.h b/include/surfaceflinger/ISurfaceComposer.h
similarity index 89%
rename from include/ui/ISurfaceComposer.h
rename to include/surfaceflinger/ISurfaceComposer.h
index 25d954c..d1e7785 100644
--- a/include/ui/ISurfaceComposer.h
+++ b/include/surfaceflinger/ISurfaceComposer.h
@@ -14,25 +14,24 @@
* limitations under the License.
*/
-#ifndef ANDROID_ISURFACE_COMPOSER_H
-#define ANDROID_ISURFACE_COMPOSER_H
+#ifndef ANDROID_SF_ISURFACE_COMPOSER_H
+#define ANDROID_SF_ISURFACE_COMPOSER_H
#include <stdint.h>
#include <sys/types.h>
#include <utils/RefBase.h>
#include <utils/Errors.h>
+
#include <binder/IInterface.h>
#include <ui/PixelFormat.h>
-#include <ui/ISurfaceFlingerClient.h>
+
+#include <surfaceflinger/ISurfaceFlingerClient.h>
namespace android {
-
// ----------------------------------------------------------------------------
-class DisplayInfo;
-
class ISurfaceComposer : public IInterface
{
public:
@@ -92,19 +91,19 @@
/* retrieve the control block */
virtual sp<IMemoryHeap> getCblk() const = 0;
- /* open/close transactions. recquires ACCESS_SURFACE_FLINGER permission */
+ /* open/close transactions. requires ACCESS_SURFACE_FLINGER permission */
virtual void openGlobalTransaction() = 0;
virtual void closeGlobalTransaction() = 0;
- /* [un]freeze display. recquires ACCESS_SURFACE_FLINGER permission */
+ /* [un]freeze display. requires ACCESS_SURFACE_FLINGER permission */
virtual status_t freezeDisplay(DisplayID dpy, uint32_t flags) = 0;
virtual status_t unfreezeDisplay(DisplayID dpy, uint32_t flags) = 0;
- /* Set display orientation. recquires ACCESS_SURFACE_FLINGER permission */
+ /* Set display orientation. requires ACCESS_SURFACE_FLINGER permission */
virtual int setOrientation(DisplayID dpy, int orientation, uint32_t flags) = 0;
/* signal that we're done booting.
- * recquires ACCESS_SURFACE_FLINGER permission
+ * Requires ACCESS_SURFACE_FLINGER permission
*/
virtual void bootFinished() = 0;
@@ -143,4 +142,4 @@
}; // namespace android
-#endif // ANDROID_ISURFACE_COMPOSER_H
+#endif // ANDROID_SF_ISURFACE_COMPOSER_H
diff --git a/include/ui/ISurfaceFlingerClient.h b/include/surfaceflinger/ISurfaceFlingerClient.h
similarity index 92%
rename from include/ui/ISurfaceFlingerClient.h
rename to include/surfaceflinger/ISurfaceFlingerClient.h
index 5d231e6..1fba162 100644
--- a/include/ui/ISurfaceFlingerClient.h
+++ b/include/surfaceflinger/ISurfaceFlingerClient.h
@@ -14,28 +14,26 @@
* limitations under the License.
*/
-#ifndef ANDROID_ISURFACE_FLINGER_CLIENT_H
-#define ANDROID_ISURFACE_FLINGER_CLIENT_H
+#ifndef ANDROID_SF_ISURFACE_FLINGER_CLIENT_H
+#define ANDROID_SF_ISURFACE_FLINGER_CLIENT_H
#include <stdint.h>
#include <sys/types.h>
#include <utils/Errors.h>
-#include <binder/IInterface.h>
#include <utils/RefBase.h>
-#include <ui/ISurface.h>
+#include <binder/IInterface.h>
#include <ui/PixelFormat.h>
+#include <surfaceflinger/ISurface.h>
+
namespace android {
// ----------------------------------------------------------------------------
-class Rect;
-class Point;
-class IMemory;
-class ISurface;
+class IMemoryHeap;
typedef int32_t ClientID;
typedef int32_t DisplayID;
@@ -89,4 +87,4 @@
}; // namespace android
-#endif // ANDROID_ISURFACE_FLINGER_CLIENT_H
+#endif // ANDROID_SF_ISURFACE_FLINGER_CLIENT_H
diff --git a/include/ui/Surface.h b/include/surfaceflinger/Surface.h
similarity index 97%
rename from include/ui/Surface.h
rename to include/surfaceflinger/Surface.h
index 008c297..9808832 100644
--- a/include/ui/Surface.h
+++ b/include/surfaceflinger/Surface.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ANDROID_UI_SURFACE_H
-#define ANDROID_UI_SURFACE_H
+#ifndef ANDROID_SF_SURFACE_H
+#define ANDROID_SF_SURFACE_H
#include <stdint.h>
#include <sys/types.h>
@@ -23,13 +23,13 @@
#include <utils/RefBase.h>
#include <utils/threads.h>
-#include <ui/ISurface.h>
#include <ui/PixelFormat.h>
#include <ui/Region.h>
-#include <ui/ISurfaceFlingerClient.h>
-
#include <ui/egl/android_natives.h>
+#include <surfaceflinger/ISurface.h>
+#include <surfaceflinger/ISurfaceFlingerClient.h>
+
namespace android {
// ---------------------------------------------------------------------------
@@ -250,5 +250,5 @@
}; // namespace android
-#endif // ANDROID_UI_SURFACE_H
+#endif // ANDROID_SF_SURFACE_H
diff --git a/include/ui/SurfaceComposerClient.h b/include/surfaceflinger/SurfaceComposerClient.h
similarity index 95%
rename from include/ui/SurfaceComposerClient.h
rename to include/surfaceflinger/SurfaceComposerClient.h
index 777b878..49e83c0 100644
--- a/include/ui/SurfaceComposerClient.h
+++ b/include/surfaceflinger/SurfaceComposerClient.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ANDROID_SURFACE_COMPOSER_CLIENT_H
-#define ANDROID_SURFACE_COMPOSER_CLIENT_H
+#ifndef ANDROID_SF_SURFACE_COMPOSER_CLIENT_H
+#define ANDROID_SF_SURFACE_COMPOSER_CLIENT_H
#include <stdint.h>
#include <sys/types.h>
@@ -27,17 +27,18 @@
#include <utils/threads.h>
#include <ui/PixelFormat.h>
-#include <ui/ISurfaceComposer.h>
#include <ui/Region.h>
-#include <ui/Surface.h>
+
+#include <surfaceflinger/Surface.h>
namespace android {
// ---------------------------------------------------------------------------
class Region;
-class SurfaceFlingerSynchro;
class SharedClient;
+class ISurfaceComposer;
+class DisplayInfo;
class SurfaceComposerClient : virtual public RefBase
{
@@ -158,5 +159,5 @@
}; // namespace android
-#endif // ANDROID_SURFACE_COMPOSER_CLIENT_H
+#endif // ANDROID_SF_SURFACE_COMPOSER_CLIENT_H
diff --git a/include/ui/Camera.h b/include/ui/Camera.h
deleted file mode 100644
index c506fb8..0000000
--- a/include/ui/Camera.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * Copyright (C) 2008 HTC Inc.
- *
- * 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.
- */
-
-#ifndef ANDROID_HARDWARE_CAMERA_H
-#define ANDROID_HARDWARE_CAMERA_H
-
-#include <utils/Timers.h>
-#include <ui/ICameraClient.h>
-
-namespace android {
-
-/*
- * A set of bit masks for specifying how the received preview frames are
- * handled before the previewCallback() call.
- *
- * The least significant 3 bits of an "int" value are used for this purpose:
- *
- * ..... 0 0 0
- * ^ ^ ^
- * | | |---------> determine whether the callback is enabled or not
- * | |-----------> determine whether the callback is one-shot or not
- * |-------------> determine whether the frame is copied out or not
- *
- * WARNING:
- * When a frame is sent directly without copying, it is the frame receiver's
- * responsiblity to make sure that the frame data won't get corrupted by
- * subsequent preview frames filled by the camera. This flag is recommended
- * only when copying out data brings significant performance price and the
- * handling/processing of the received frame data is always faster than
- * the preview frame rate so that data corruption won't occur.
- *
- * For instance,
- * 1. 0x00 disables the callback. In this case, copy out and one shot bits
- * are ignored.
- * 2. 0x01 enables a callback without copying out the received frames. A
- * typical use case is the Camcorder application to avoid making costly
- * frame copies.
- * 3. 0x05 is enabling a callback with frame copied out repeatedly. A typical
- * use case is the Camera application.
- * 4. 0x07 is enabling a callback with frame copied out only once. A typical use
- * case is the Barcode scanner application.
- */
-#define FRAME_CALLBACK_FLAG_ENABLE_MASK 0x01
-#define FRAME_CALLBACK_FLAG_ONE_SHOT_MASK 0x02
-#define FRAME_CALLBACK_FLAG_COPY_OUT_MASK 0x04
-
-// Typical use cases
-#define FRAME_CALLBACK_FLAG_NOOP 0x00
-#define FRAME_CALLBACK_FLAG_CAMCORDER 0x01
-#define FRAME_CALLBACK_FLAG_CAMERA 0x05
-#define FRAME_CALLBACK_FLAG_BARCODE_SCANNER 0x07
-
-// msgType in notifyCallback and dataCallback functions
-enum {
- CAMERA_MSG_ERROR = 0x001,
- CAMERA_MSG_SHUTTER = 0x002,
- CAMERA_MSG_FOCUS = 0x004,
- CAMERA_MSG_ZOOM = 0x008,
- CAMERA_MSG_PREVIEW_FRAME = 0x010,
- CAMERA_MSG_VIDEO_FRAME = 0x020,
- CAMERA_MSG_POSTVIEW_FRAME = 0x040,
- CAMERA_MSG_RAW_IMAGE = 0x080,
- CAMERA_MSG_COMPRESSED_IMAGE = 0x100,
- CAMERA_MSG_ALL_MSGS = 0x1FF
-};
-
-// cmdType in sendCommand functions
-enum {
- CAMERA_CMD_START_SMOOTH_ZOOM = 1,
- CAMERA_CMD_STOP_SMOOTH_ZOOM = 2,
- CAMERA_CMD_SET_DISPLAY_ORIENTATION = 3,
-};
-
-// camera fatal errors
-enum {
- CAMERA_ERROR_UKNOWN = 1,
- CAMERA_ERROR_SERVER_DIED = 100
-};
-
-class ICameraService;
-class ICamera;
-class Surface;
-class Mutex;
-class String8;
-
-// ref-counted object for callbacks
-class CameraListener: virtual public RefBase
-{
-public:
- virtual void notify(int32_t msgType, int32_t ext1, int32_t ext2) = 0;
- virtual void postData(int32_t msgType, const sp<IMemory>& dataPtr) = 0;
- virtual void postDataTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& dataPtr) = 0;
-};
-
-class Camera : public BnCameraClient, public IBinder::DeathRecipient
-{
-public:
- // construct a camera client from an existing remote
- static sp<Camera> create(const sp<ICamera>& camera);
- static sp<Camera> connect();
- ~Camera();
- void init();
-
- status_t reconnect();
- void disconnect();
- status_t lock();
- status_t unlock();
-
- status_t getStatus() { return mStatus; }
-
- // pass the buffered ISurface to the camera service
- status_t setPreviewDisplay(const sp<Surface>& surface);
- status_t setPreviewDisplay(const sp<ISurface>& surface);
-
- // start preview mode, must call setPreviewDisplay first
- status_t startPreview();
-
- // stop preview mode
- void stopPreview();
-
- // get preview state
- bool previewEnabled();
-
- // start recording mode, must call setPreviewDisplay first
- status_t startRecording();
-
- // stop recording mode
- void stopRecording();
-
- // get recording state
- bool recordingEnabled();
-
- // release a recording frame
- void releaseRecordingFrame(const sp<IMemory>& mem);
-
- // autoFocus - status returned from callback
- status_t autoFocus();
-
- // cancel auto focus
- status_t cancelAutoFocus();
-
- // take a picture - picture returned from callback
- status_t takePicture();
-
- // set preview/capture parameters - key/value pairs
- status_t setParameters(const String8& params);
-
- // get preview/capture parameters - key/value pairs
- String8 getParameters() const;
-
- // send command to camera driver
- status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2);
-
- void setListener(const sp<CameraListener>& listener);
- void setPreviewCallbackFlags(int preview_callback_flag);
-
- // ICameraClient interface
- virtual void notifyCallback(int32_t msgType, int32_t ext, int32_t ext2);
- virtual void dataCallback(int32_t msgType, const sp<IMemory>& dataPtr);
- virtual void dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& dataPtr);
-
- sp<ICamera> remote();
-
-private:
- Camera();
- Camera(const Camera&);
- Camera& operator=(const Camera);
- virtual void binderDied(const wp<IBinder>& who);
-
- class DeathNotifier: public IBinder::DeathRecipient
- {
- public:
- DeathNotifier() {
- }
-
- virtual void binderDied(const wp<IBinder>& who);
- };
-
- static sp<DeathNotifier> mDeathNotifier;
-
- // helper function to obtain camera service handle
- static const sp<ICameraService>& getCameraService();
-
- sp<ICamera> mCamera;
- status_t mStatus;
-
- sp<CameraListener> mListener;
-
- friend class DeathNotifier;
-
- static Mutex mLock;
- static sp<ICameraService> mCameraService;
-
-};
-
-}; // namespace android
-
-#endif
diff --git a/include/ui/CameraHardwareInterface.h b/include/ui/CameraHardwareInterface.h
deleted file mode 100644
index 240c134..0000000
--- a/include/ui/CameraHardwareInterface.h
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-
-#ifndef ANDROID_HARDWARE_CAMERA_HARDWARE_INTERFACE_H
-#define ANDROID_HARDWARE_CAMERA_HARDWARE_INTERFACE_H
-
-#include <binder/IMemory.h>
-#include <utils/RefBase.h>
-#include <ui/ISurface.h>
-#include <ui/Camera.h>
-#include <ui/CameraParameters.h>
-#include <ui/Overlay.h>
-
-namespace android {
-/**
- * The size of image for display.
- */
-typedef struct image_rect_struct
-{
- uint32_t width; /* Image width */
- uint32_t height; /* Image height */
-} image_rect_type;
-
-
-typedef void (*notify_callback)(int32_t msgType,
- int32_t ext1,
- int32_t ext2,
- void* user);
-
-typedef void (*data_callback)(int32_t msgType,
- const sp<IMemory>& dataPtr,
- void* user);
-
-typedef void (*data_callback_timestamp)(nsecs_t timestamp,
- int32_t msgType,
- const sp<IMemory>& dataPtr,
- void* user);
-
-/**
- * CameraHardwareInterface.h defines the interface to the
- * camera hardware abstraction layer, used for setting and getting
- * parameters, live previewing, and taking pictures.
- *
- * It is a referenced counted interface with RefBase as its base class.
- * CameraService calls openCameraHardware() to retrieve a strong pointer to the
- * instance of this interface and may be called multiple times. The
- * following steps describe a typical sequence:
- *
- * -# After CameraService calls openCameraHardware(), getParameters() and
- * setParameters() are used to initialize the camera instance.
- * CameraService calls getPreviewHeap() to establish access to the
- * preview heap so it can be registered with SurfaceFlinger for
- * efficient display updating while in preview mode.
- * -# startPreview() is called. The camera instance then periodically
- * sends the message CAMERA_MSG_PREVIEW_FRAME (if enabled) each time
- * a new preview frame is available. If data callback code needs to use
- * this memory after returning, it must copy the data.
- *
- * Prior to taking a picture, CameraService calls autofocus(). When auto
- * focusing has completed, the camera instance sends a CAMERA_MSG_FOCUS notification,
- * which informs the application whether focusing was successful. The camera instance
- * only sends this message once and it is up to the application to call autoFocus()
- * again if refocusing is desired.
- *
- * CameraService calls takePicture() to request the camera instance take a
- * picture. At this point, if a shutter, postview, raw, and/or compressed callback
- * is desired, the corresponding message must be enabled. As with CAMERA_MSG_PREVIEW_FRAME,
- * any memory provided in a data callback must be copied if it's needed after returning.
- */
-class CameraHardwareInterface : public virtual RefBase {
-public:
- virtual ~CameraHardwareInterface() { }
-
- /** Return the IMemoryHeap for the preview image heap */
- virtual sp<IMemoryHeap> getPreviewHeap() const = 0;
-
- /** Return the IMemoryHeap for the raw image heap */
- virtual sp<IMemoryHeap> getRawHeap() const = 0;
-
- /** Set the notification and data callbacks */
- virtual void setCallbacks(notify_callback notify_cb,
- data_callback data_cb,
- data_callback_timestamp data_cb_timestamp,
- void* user) = 0;
-
- /**
- * The following three functions all take a msgtype,
- * which is a bitmask of the messages defined in
- * include/ui/Camera.h
- */
-
- /**
- * Enable a message, or set of messages.
- */
- virtual void enableMsgType(int32_t msgType) = 0;
-
- /**
- * Disable a message, or a set of messages.
- */
- virtual void disableMsgType(int32_t msgType) = 0;
-
- /**
- * Query whether a message, or a set of messages, is enabled.
- * Note that this is operates as an AND, if any of the messages
- * queried are off, this will return false.
- */
- virtual bool msgTypeEnabled(int32_t msgType) = 0;
-
- /**
- * Start preview mode.
- */
- virtual status_t startPreview() = 0;
-
- /**
- * Only used if overlays are used for camera preview.
- */
- virtual bool useOverlay() {return false;}
- virtual status_t setOverlay(const sp<Overlay> &overlay) {return BAD_VALUE;}
-
- /**
- * Stop a previously started preview.
- */
- virtual void stopPreview() = 0;
-
- /**
- * Returns true if preview is enabled.
- */
- virtual bool previewEnabled() = 0;
-
- /**
- * Start record mode. When a record image is available a CAMERA_MSG_VIDEO_FRAME
- * message is sent with the corresponding frame. Every record frame must be released
- * by calling releaseRecordingFrame().
- */
- virtual status_t startRecording() = 0;
-
- /**
- * Stop a previously started recording.
- */
- virtual void stopRecording() = 0;
-
- /**
- * Returns true if recording is enabled.
- */
- virtual bool recordingEnabled() = 0;
-
- /**
- * Release a record frame previously returned by CAMERA_MSG_VIDEO_FRAME.
- */
- virtual void releaseRecordingFrame(const sp<IMemory>& mem) = 0;
-
- /**
- * Start auto focus, the notification callback routine is called
- * with CAMERA_MSG_FOCUS once when focusing is complete. autoFocus()
- * will be called again if another auto focus is needed.
- */
- virtual status_t autoFocus() = 0;
-
- /**
- * Cancels auto-focus function. If the auto-focus is still in progress,
- * this function will cancel it. Whether the auto-focus is in progress
- * or not, this function will return the focus position to the default.
- * If the camera does not support auto-focus, this is a no-op.
- */
- virtual status_t cancelAutoFocus() = 0;
-
- /**
- * Take a picture.
- */
- virtual status_t takePicture() = 0;
-
- /**
- * Cancel a picture that was started with takePicture. Calling this
- * method when no picture is being taken is a no-op.
- */
- virtual status_t cancelPicture() = 0;
-
- /** Set the camera parameters. */
- virtual status_t setParameters(const CameraParameters& params) = 0;
-
- /** Return the camera parameters. */
- virtual CameraParameters getParameters() const = 0;
-
- /**
- * Send command to camera driver.
- */
- virtual status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) = 0;
-
- /**
- * Release the hardware resources owned by this object. Note that this is
- * *not* done in the destructor.
- */
- virtual void release() = 0;
-
- /**
- * Dump state of the camera hardware
- */
- virtual status_t dump(int fd, const Vector<String16>& args) const = 0;
-};
-
-/** factory function to instantiate a camera hardware object */
-extern "C" sp<CameraHardwareInterface> openCameraHardware();
-
-}; // namespace android
-
-#endif
diff --git a/include/ui/CameraParameters.h b/include/ui/CameraParameters.h
deleted file mode 100644
index e328f33..0000000
--- a/include/ui/CameraParameters.h
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-
-#ifndef ANDROID_HARDWARE_CAMERA_PARAMETERS_H
-#define ANDROID_HARDWARE_CAMERA_PARAMETERS_H
-
-#include <utils/KeyedVector.h>
-#include <utils/String8.h>
-
-namespace android {
-
-class CameraParameters
-{
-public:
- CameraParameters();
- CameraParameters(const String8 ¶ms) { unflatten(params); }
- ~CameraParameters();
-
- String8 flatten() const;
- void unflatten(const String8 ¶ms);
-
- void set(const char *key, const char *value);
- void set(const char *key, int value);
- void setFloat(const char *key, float value);
- const char *get(const char *key) const;
- int getInt(const char *key) const;
- float getFloat(const char *key) const;
-
- /* preview-size=176x144 */
- void setPreviewSize(int width, int height);
- void getPreviewSize(int *width, int *height) const;
-
- /* preview-fps=15 */
- void setPreviewFrameRate(int fps);
- int getPreviewFrameRate() const;
-
- /* preview-format=rgb565|yuv422 */
- void setPreviewFormat(const char *format);
- const char *getPreviewFormat() const;
-
- /* picture-size=1024x768 */
- void setPictureSize(int width, int height);
- void getPictureSize(int *width, int *height) const;
-
- /* picture-format=yuv422|jpeg */
- void setPictureFormat(const char *format);
- const char *getPictureFormat() const;
-
- void dump() const;
- status_t dump(int fd, const Vector<String16>& args) const;
-
- // Parameter keys to communicate between camera application and driver.
- // The access (read/write, read only, or write only) is viewed from the
- // perspective of applications, not driver.
-
- // Preview frame size in pixels (width x height).
- // Example value: "480x320". Read/Write.
- static const char KEY_PREVIEW_SIZE[];
- // Supported preview frame sizes in pixels.
- // Example value: "800x600,480x320". Read only.
- static const char KEY_SUPPORTED_PREVIEW_SIZES[];
- // The image format for preview frames.
- // Example value: "yuv420sp" or PIXEL_FORMAT_XXX constants. Read/write.
- static const char KEY_PREVIEW_FORMAT[];
- // Supported image formats for preview frames.
- // Example value: "yuv420sp,yuv422i-yuyv". Read only.
- static const char KEY_SUPPORTED_PREVIEW_FORMATS[];
- // Number of preview frames per second.
- // Example value: "15". Read/write.
- static const char KEY_PREVIEW_FRAME_RATE[];
- // Supported number of preview frames per second.
- // Example value: "24,15,10". Read.
- static const char KEY_SUPPORTED_PREVIEW_FRAME_RATES[];
- // The dimensions for captured pictures in pixels (width x height).
- // Example value: "1024x768". Read/write.
- static const char KEY_PICTURE_SIZE[];
- // Supported dimensions for captured pictures in pixels.
- // Example value: "2048x1536,1024x768". Read only.
- static const char KEY_SUPPORTED_PICTURE_SIZES[];
- // The image format for captured pictures.
- // Example value: "jpeg" or PIXEL_FORMAT_XXX constants. Read/write.
- static const char KEY_PICTURE_FORMAT[];
- // Supported image formats for captured pictures.
- // Example value: "jpeg,rgb565". Read only.
- static const char KEY_SUPPORTED_PICTURE_FORMATS[];
- // The width (in pixels) of EXIF thumbnail in Jpeg picture.
- // Example value: "512". Read/write.
- static const char KEY_JPEG_THUMBNAIL_WIDTH[];
- // The height (in pixels) of EXIF thumbnail in Jpeg picture.
- // Example value: "384". Read/write.
- static const char KEY_JPEG_THUMBNAIL_HEIGHT[];
- // Supported EXIF thumbnail sizes (width x height). 0x0 means not thumbnail
- // in EXIF.
- // Example value: "512x384,320x240,0x0". Read only.
- static const char KEY_SUPPORTED_JPEG_THUMBNAIL_SIZES[];
- // The quality of the EXIF thumbnail in Jpeg picture. The range is 1 to 100,
- // with 100 being the best.
- // Example value: "90". Read/write.
- static const char KEY_JPEG_THUMBNAIL_QUALITY[];
- // Jpeg quality of captured picture. The range is 1 to 100, with 100 being
- // the best.
- // Example value: "90". Read/write.
- static const char KEY_JPEG_QUALITY[];
- // The orientation of the device in degrees. For example, suppose the
- // natural position of the device is landscape. If the user takes a picture
- // in landscape mode in 2048x1536 resolution, the rotation will be set to
- // "0". If the user rotates the phone 90 degrees clockwise, the rotation
- // should be set to "90".
- // The camera driver can set orientation in the EXIF header without rotating
- // the picture. Or the driver can rotate the picture and the EXIF thumbnail.
- // If the Jpeg picture is rotated, the orientation in the EXIF header should
- // be missing or 1 (row #0 is top and column #0 is left side). The driver
- // should not set default value for this parameter.
- // Example value: "0" or "90" or "180" or "270". Write only.
- static const char KEY_ROTATION[];
- // GPS latitude coordinate. This will be stored in JPEG EXIF header.
- // Example value: "25.032146". Write only.
- static const char KEY_GPS_LATITUDE[];
- // GPS longitude coordinate. This will be stored in JPEG EXIF header.
- // Example value: "121.564448". Write only.
- static const char KEY_GPS_LONGITUDE[];
- // GPS altitude. This will be stored in JPEG EXIF header.
- // Example value: "21.0". Write only.
- static const char KEY_GPS_ALTITUDE[];
- // GPS timestamp (UTC in seconds since January 1, 1970). This should be
- // stored in JPEG EXIF header.
- // Example value: "1251192757". Write only.
- static const char KEY_GPS_TIMESTAMP[];
- // Current white balance setting.
- // Example value: "auto" or WHITE_BALANCE_XXX constants. Read/write.
- static const char KEY_WHITE_BALANCE[];
- // Supported white balance settings.
- // Example value: "auto,incandescent,daylight". Read only.
- static const char KEY_SUPPORTED_WHITE_BALANCE[];
- // Current color effect setting.
- // Example value: "none" or EFFECT_XXX constants. Read/write.
- static const char KEY_EFFECT[];
- // Supported color effect settings.
- // Example value: "none,mono,sepia". Read only.
- static const char KEY_SUPPORTED_EFFECTS[];
- // Current antibanding setting.
- // Example value: "auto" or ANTIBANDING_XXX constants. Read/write.
- static const char KEY_ANTIBANDING[];
- // Supported antibanding settings.
- // Example value: "auto,50hz,60hz,off". Read only.
- static const char KEY_SUPPORTED_ANTIBANDING[];
- // Current scene mode.
- // Example value: "auto" or SCENE_MODE_XXX constants. Read/write.
- static const char KEY_SCENE_MODE[];
- // Supported scene mode settings.
- // Example value: "auto,night,fireworks". Read only.
- static const char KEY_SUPPORTED_SCENE_MODES[];
- // Current flash mode.
- // Example value: "auto" or FLASH_MODE_XXX constants. Read/write.
- static const char KEY_FLASH_MODE[];
- // Supported flash modes.
- // Example value: "auto,on,off". Read only.
- static const char KEY_SUPPORTED_FLASH_MODES[];
- // Current focus mode. If the camera does not support auto-focus, the value
- // should be FOCUS_MODE_FIXED. If the focus mode is not FOCUS_MODE_FIXED or
- // or FOCUS_MODE_INFINITY, applications should call
- // CameraHardwareInterface.autoFocus to start the focus.
- // Example value: "auto" or FOCUS_MODE_XXX constants. Read/write.
- static const char KEY_FOCUS_MODE[];
- // Supported focus modes.
- // Example value: "auto,macro,fixed". Read only.
- static const char KEY_SUPPORTED_FOCUS_MODES[];
- // Focal length in millimeter.
- // Example value: "4.31". Read only.
- static const char KEY_FOCAL_LENGTH[];
- // Horizontal angle of view in degrees.
- // Example value: "54.8". Read only.
- static const char KEY_HORIZONTAL_VIEW_ANGLE[];
- // Vertical angle of view in degrees.
- // Example value: "42.5". Read only.
- static const char KEY_VERTICAL_VIEW_ANGLE[];
- // Exposure compensation. The value is multiplied by 100. -100 means -1 EV.
- // 130 means +1.3 EV.
- // Example value: "0" or "133". Read/write.
- static const char KEY_EXPOSURE_COMPENSATION[];
- // Supported exposure compensation.
- // Example value: "-100,-66,-33,0,33,66,100". Read only.
- static const char KEY_SUPPORTED_EXPOSURE_COMPENSATION[];
-
-
- // Values for white balance settings.
- static const char WHITE_BALANCE_AUTO[];
- static const char WHITE_BALANCE_INCANDESCENT[];
- static const char WHITE_BALANCE_FLUORESCENT[];
- static const char WHITE_BALANCE_WARM_FLUORESCENT[];
- static const char WHITE_BALANCE_DAYLIGHT[];
- static const char WHITE_BALANCE_CLOUDY_DAYLIGHT[];
- static const char WHITE_BALANCE_TWILIGHT[];
- static const char WHITE_BALANCE_SHADE[];
-
- // Values for effect settings.
- static const char EFFECT_NONE[];
- static const char EFFECT_MONO[];
- static const char EFFECT_NEGATIVE[];
- static const char EFFECT_SOLARIZE[];
- static const char EFFECT_SEPIA[];
- static const char EFFECT_POSTERIZE[];
- static const char EFFECT_WHITEBOARD[];
- static const char EFFECT_BLACKBOARD[];
- static const char EFFECT_AQUA[];
-
- // Values for antibanding settings.
- static const char ANTIBANDING_AUTO[];
- static const char ANTIBANDING_50HZ[];
- static const char ANTIBANDING_60HZ[];
- static const char ANTIBANDING_OFF[];
-
- // Values for flash mode settings.
- // Flash will not be fired.
- static const char FLASH_MODE_OFF[];
- // Flash will be fired automatically when required. The flash may be fired
- // during preview, auto-focus, or snapshot depending on the driver.
- static const char FLASH_MODE_AUTO[];
- // Flash will always be fired during snapshot. The flash may also be
- // fired during preview or auto-focus depending on the driver.
- static const char FLASH_MODE_ON[];
- // Flash will be fired in red-eye reduction mode.
- static const char FLASH_MODE_RED_EYE[];
- // Constant emission of light during preview, auto-focus and snapshot.
- // This can also be used for video recording.
- static const char FLASH_MODE_TORCH[];
-
- // Values for scene mode settings.
- static const char SCENE_MODE_AUTO[];
- static const char SCENE_MODE_ACTION[];
- static const char SCENE_MODE_PORTRAIT[];
- static const char SCENE_MODE_LANDSCAPE[];
- static const char SCENE_MODE_NIGHT[];
- static const char SCENE_MODE_NIGHT_PORTRAIT[];
- static const char SCENE_MODE_THEATRE[];
- static const char SCENE_MODE_BEACH[];
- static const char SCENE_MODE_SNOW[];
- static const char SCENE_MODE_SUNSET[];
- static const char SCENE_MODE_STEADYPHOTO[];
- static const char SCENE_MODE_FIREWORKS[];
- static const char SCENE_MODE_SPORTS[];
- static const char SCENE_MODE_PARTY[];
- static const char SCENE_MODE_CANDLELIGHT[];
-
- // Formats for setPreviewFormat and setPictureFormat.
- static const char PIXEL_FORMAT_YUV422SP[];
- static const char PIXEL_FORMAT_YUV420SP[]; // NV21
- static const char PIXEL_FORMAT_YUV422I[]; // YUY2
- static const char PIXEL_FORMAT_RGB565[];
- static const char PIXEL_FORMAT_JPEG[];
-
- // Values for focus mode settings.
- // Auto-focus mode.
- static const char FOCUS_MODE_AUTO[];
- // Focus is set at infinity. Applications should not call
- // CameraHardwareInterface.autoFocus in this mode.
- static const char FOCUS_MODE_INFINITY[];
- static const char FOCUS_MODE_MACRO[];
- // Focus is fixed. The camera is always in this mode if the focus is not
- // adjustable. If the camera has auto-focus, this mode can fix the
- // focus, which is usually at hyperfocal distance. Applications should
- // not call CameraHardwareInterface.autoFocus in this mode.
- static const char FOCUS_MODE_FIXED[];
-
-private:
- DefaultKeyedVector<String8,String8> mMap;
-};
-
-}; // namespace android
-
-#endif
diff --git a/include/ui/ICamera.h b/include/ui/ICamera.h
deleted file mode 100644
index 5642691..0000000
--- a/include/ui/ICamera.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-
-#ifndef ANDROID_HARDWARE_ICAMERA_H
-#define ANDROID_HARDWARE_ICAMERA_H
-
-#include <utils/RefBase.h>
-#include <binder/IInterface.h>
-#include <binder/Parcel.h>
-#include <ui/ISurface.h>
-#include <binder/IMemory.h>
-#include <utils/String8.h>
-#include <ui/Camera.h>
-
-namespace android {
-
-class ICameraClient;
-
-class ICamera: public IInterface
-{
-public:
- DECLARE_META_INTERFACE(Camera);
-
- virtual void disconnect() = 0;
-
- // connect new client with existing camera remote
- virtual status_t connect(const sp<ICameraClient>& client) = 0;
-
- // prevent other processes from using this ICamera interface
- virtual status_t lock() = 0;
-
- // allow other processes to use this ICamera interface
- virtual status_t unlock() = 0;
-
- // pass the buffered ISurface to the camera service
- virtual status_t setPreviewDisplay(const sp<ISurface>& surface) = 0;
-
- // set the preview callback flag to affect how the received frames from
- // preview are handled.
- virtual void setPreviewCallbackFlag(int flag) = 0;
-
- // start preview mode, must call setPreviewDisplay first
- virtual status_t startPreview() = 0;
-
- // stop preview mode
- virtual void stopPreview() = 0;
-
- // get preview state
- virtual bool previewEnabled() = 0;
-
- // start recording mode
- virtual status_t startRecording() = 0;
-
- // stop recording mode
- virtual void stopRecording() = 0;
-
- // get recording state
- virtual bool recordingEnabled() = 0;
-
- // release a recording frame
- virtual void releaseRecordingFrame(const sp<IMemory>& mem) = 0;
-
- // auto focus
- virtual status_t autoFocus() = 0;
-
- // cancel auto focus
- virtual status_t cancelAutoFocus() = 0;
-
- // take a picture
- virtual status_t takePicture() = 0;
-
- // set preview/capture parameters - key/value pairs
- virtual status_t setParameters(const String8& params) = 0;
-
- // get preview/capture parameters - key/value pairs
- virtual String8 getParameters() const = 0;
-
- // send command to camera driver
- virtual status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) = 0;
-};
-
-// ----------------------------------------------------------------------------
-
-class BnCamera: public BnInterface<ICamera>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-}; // namespace android
-
-#endif
diff --git a/include/ui/ICameraClient.h b/include/ui/ICameraClient.h
deleted file mode 100644
index 236d0f6..0000000
--- a/include/ui/ICameraClient.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-
-#ifndef ANDROID_HARDWARE_ICAMERA_APP_H
-#define ANDROID_HARDWARE_ICAMERA_APP_H
-
-#include <utils/RefBase.h>
-#include <binder/IInterface.h>
-#include <binder/Parcel.h>
-#include <binder/IMemory.h>
-#include <utils/Timers.h>
-
-namespace android {
-
-class ICameraClient: public IInterface
-{
-public:
- DECLARE_META_INTERFACE(CameraClient);
-
- virtual void notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2) = 0;
- virtual void dataCallback(int32_t msgType, const sp<IMemory>& data) = 0;
- virtual void dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& data) = 0;
-};
-
-// ----------------------------------------------------------------------------
-
-class BnCameraClient: public BnInterface<ICameraClient>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-}; // namespace android
-
-#endif
diff --git a/include/ui/ICameraService.h b/include/ui/ICameraService.h
deleted file mode 100644
index 061681a..0000000
--- a/include/ui/ICameraService.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-
-#ifndef ANDROID_HARDWARE_ICAMERASERVICE_H
-#define ANDROID_HARDWARE_ICAMERASERVICE_H
-
-#include <utils/RefBase.h>
-#include <binder/IInterface.h>
-#include <binder/Parcel.h>
-
-#include <ui/ICameraClient.h>
-#include <ui/ICamera.h>
-
-namespace android {
-
-class ICameraService : public IInterface
-{
-public:
- enum {
- CONNECT = IBinder::FIRST_CALL_TRANSACTION,
- };
-
-public:
- DECLARE_META_INTERFACE(CameraService);
-
- virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient) = 0;
-};
-
-// ----------------------------------------------------------------------------
-
-class BnCameraService: public BnInterface<ICameraService>
-{
-public:
- virtual status_t onTransact( uint32_t code,
- const Parcel& data,
- Parcel* reply,
- uint32_t flags = 0);
-};
-
-}; // namespace android
-
-#endif
diff --git a/libs/surfaceflinger/Android.mk b/libs/surfaceflinger/Android.mk
index b3fed58..395a937 100644
--- a/libs/surfaceflinger/Android.mk
+++ b/libs/surfaceflinger/Android.mk
@@ -39,7 +39,8 @@
libEGL \
libGLESv1_CM \
libbinder \
- libui
+ libui \
+ libsurfaceflinger_client
LOCAL_C_INCLUDES := \
$(call include-path-for, corecg graphics)
diff --git a/libs/surfaceflinger/Layer.cpp b/libs/surfaceflinger/Layer.cpp
index 1870d3a..f38efab 100644
--- a/libs/surfaceflinger/Layer.cpp
+++ b/libs/surfaceflinger/Layer.cpp
@@ -27,7 +27,8 @@
#include <ui/GraphicBuffer.h>
#include <ui/PixelFormat.h>
-#include <ui/Surface.h>
+
+#include <surfaceflinger/Surface.h>
#include "clz.h"
#include "Layer.h"
diff --git a/libs/surfaceflinger/LayerBase.h b/libs/surfaceflinger/LayerBase.h
index f73ea0c..a49faf7 100644
--- a/libs/surfaceflinger/LayerBase.h
+++ b/libs/surfaceflinger/LayerBase.h
@@ -23,14 +23,15 @@
#include <EGL/egl.h>
#include <EGL/eglext.h>
-#include <private/ui/SharedBufferStack.h>
-#include <private/ui/LayerState.h>
-
#include <utils/RefBase.h>
#include <ui/Region.h>
#include <ui/Overlay.h>
+#include <surfaceflinger/ISurfaceFlingerClient.h>
+#include <private/surfaceflinger/SharedBufferStack.h>
+#include <private/surfaceflinger/LayerState.h>
+
#include <pixelflinger/pixelflinger.h>
#include "Transform.h"
diff --git a/libs/surfaceflinger/LayerBlur.h b/libs/surfaceflinger/LayerBlur.h
index 2e9d7c6..5b63dec 100644
--- a/libs/surfaceflinger/LayerBlur.h
+++ b/libs/surfaceflinger/LayerBlur.h
@@ -20,8 +20,6 @@
#include <stdint.h>
#include <sys/types.h>
-#include <private/ui/LayerState.h>
-
#include <ui/Region.h>
#include "LayerBase.h"
diff --git a/libs/surfaceflinger/SurfaceFlinger.h b/libs/surfaceflinger/SurfaceFlinger.h
index 2b7820c..4520c0e 100644
--- a/libs/surfaceflinger/SurfaceFlinger.h
+++ b/libs/surfaceflinger/SurfaceFlinger.h
@@ -31,11 +31,8 @@
#include <binder/Permission.h>
#include <ui/PixelFormat.h>
-#include <ui/ISurfaceComposer.h>
-#include <ui/ISurfaceFlingerClient.h>
-
-#include <private/ui/SharedBufferStack.h>
-#include <private/ui/LayerState.h>
+#include <surfaceflinger/ISurfaceComposer.h>
+#include <surfaceflinger/ISurfaceFlingerClient.h>
#include "Barrier.h"
#include "Layer.h"
diff --git a/libs/surfaceflinger/tests/overlays/Android.mk b/libs/surfaceflinger/tests/overlays/Android.mk
index dc47e45..592b601 100644
--- a/libs/surfaceflinger/tests/overlays/Android.mk
+++ b/libs/surfaceflinger/tests/overlays/Android.mk
@@ -7,7 +7,8 @@
LOCAL_SHARED_LIBRARIES := \
libcutils \
libutils \
- libui
+ libui \
+ libsurfaceflinger_client
LOCAL_MODULE:= test-overlays
diff --git a/libs/surfaceflinger/tests/overlays/overlays.cpp b/libs/surfaceflinger/tests/overlays/overlays.cpp
index 0b9322e..c248a615 100644
--- a/libs/surfaceflinger/tests/overlays/overlays.cpp
+++ b/libs/surfaceflinger/tests/overlays/overlays.cpp
@@ -3,10 +3,11 @@
#include <binder/IServiceManager.h>
#include <utils/Log.h>
-#include <ui/Surface.h>
-#include <ui/ISurface.h>
#include <ui/Overlay.h>
-#include <ui/SurfaceComposerClient.h>
+
+#include <surfaceflinger/Surface.h>
+#include <surfaceflinger/ISurface.h>
+#include <surfaceflinger/SurfaceComposerClient.h>
using namespace android;
diff --git a/libs/surfaceflinger/tests/resize/Android.mk b/libs/surfaceflinger/tests/resize/Android.mk
index ef1532f..24c2d01 100644
--- a/libs/surfaceflinger/tests/resize/Android.mk
+++ b/libs/surfaceflinger/tests/resize/Android.mk
@@ -7,7 +7,8 @@
LOCAL_SHARED_LIBRARIES := \
libcutils \
libutils \
- libui
+ libui \
+ libsurfaceflinger_client
LOCAL_MODULE:= test-resize
diff --git a/libs/surfaceflinger/tests/resize/resize.cpp b/libs/surfaceflinger/tests/resize/resize.cpp
index 21c6ab6..127cca3 100644
--- a/libs/surfaceflinger/tests/resize/resize.cpp
+++ b/libs/surfaceflinger/tests/resize/resize.cpp
@@ -1,14 +1,16 @@
#include <cutils/memory.h>
-#include <utils/IPCThreadState.h>
-#include <utils/ProcessState.h>
-#include <utils/IServiceManager.h>
#include <utils/Log.h>
-#include <ui/Surface.h>
-#include <ui/ISurface.h>
+#include <binder/IPCThreadState.h>
+#include <binder/ProcessState.h>
+#include <binder/IServiceManager.h>
+
+#include <surfaceflinger/Surface.h>
+#include <surfaceflinger/ISurface.h>
+#include <surfaceflinger/SurfaceComposerClient.h>
+
#include <ui/Overlay.h>
-#include <ui/SurfaceComposerClient.h>
using namespace android;
diff --git a/libs/surfaceflinger_client/Android.mk b/libs/surfaceflinger_client/Android.mk
new file mode 100644
index 0000000..fe85b34
--- /dev/null
+++ b/libs/surfaceflinger_client/Android.mk
@@ -0,0 +1,26 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES:= \
+ ISurfaceComposer.cpp \
+ ISurface.cpp \
+ ISurfaceFlingerClient.cpp \
+ LayerState.cpp \
+ SharedBufferStack.cpp \
+ Surface.cpp \
+ SurfaceComposerClient.cpp
+
+LOCAL_SHARED_LIBRARIES := \
+ libcutils \
+ libutils \
+ libbinder \
+ libhardware \
+ libui
+
+LOCAL_MODULE:= libsurfaceflinger_client
+
+ifeq ($(TARGET_SIMULATOR),true)
+ LOCAL_LDLIBS += -lpthread
+endif
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/libs/ui/ISurface.cpp b/libs/surfaceflinger_client/ISurface.cpp
similarity index 98%
rename from libs/ui/ISurface.cpp
rename to libs/surfaceflinger_client/ISurface.cpp
index 6f3d762..9125146 100644
--- a/libs/ui/ISurface.cpp
+++ b/libs/surfaceflinger_client/ISurface.cpp
@@ -23,12 +23,12 @@
#include <binder/Parcel.h>
#include <binder/IMemory.h>
-#include <ui/ISurface.h>
#include <ui/Overlay.h>
-#include <ui/Surface.h>
-
#include <ui/GraphicBuffer.h>
+#include <surfaceflinger/Surface.h>
+#include <surfaceflinger/ISurface.h>
+
namespace android {
// ----------------------------------------------------------------------
diff --git a/libs/ui/ISurfaceComposer.cpp b/libs/surfaceflinger_client/ISurfaceComposer.cpp
similarity index 98%
rename from libs/ui/ISurfaceComposer.cpp
rename to libs/surfaceflinger_client/ISurfaceComposer.cpp
index fd2a590..b6f4e24 100644
--- a/libs/ui/ISurfaceComposer.cpp
+++ b/libs/surfaceflinger_client/ISurfaceComposer.cpp
@@ -25,9 +25,10 @@
#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
-#include <ui/ISurfaceComposer.h>
#include <ui/DisplayInfo.h>
+#include <surfaceflinger/ISurfaceComposer.h>
+
// ---------------------------------------------------------------------------
#define LIKELY( exp ) (__builtin_expect( (exp) != 0, true ))
diff --git a/libs/ui/ISurfaceFlingerClient.cpp b/libs/surfaceflinger_client/ISurfaceFlingerClient.cpp
similarity index 97%
rename from libs/ui/ISurfaceFlingerClient.cpp
rename to libs/surfaceflinger_client/ISurfaceFlingerClient.cpp
index 4a6a1d7..e636c52 100644
--- a/libs/ui/ISurfaceFlingerClient.cpp
+++ b/libs/surfaceflinger_client/ISurfaceFlingerClient.cpp
@@ -26,12 +26,12 @@
#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
-#include <ui/ISurface.h>
-#include <ui/ISurfaceFlingerClient.h>
#include <ui/Point.h>
#include <ui/Rect.h>
-#include <private/ui/LayerState.h>
+#include <surfaceflinger/ISurface.h>
+#include <surfaceflinger/ISurfaceFlingerClient.h>
+#include <private/surfaceflinger/LayerState.h>
// ---------------------------------------------------------------------------
diff --git a/libs/ui/LayerState.cpp b/libs/surfaceflinger_client/LayerState.cpp
similarity index 82%
rename from libs/ui/LayerState.cpp
rename to libs/surfaceflinger_client/LayerState.cpp
index a53ffb7..114a9e9 100644
--- a/libs/ui/LayerState.cpp
+++ b/libs/surfaceflinger_client/LayerState.cpp
@@ -16,37 +16,25 @@
#include <utils/Errors.h>
#include <binder/Parcel.h>
-#include <private/ui/LayerState.h>
+#include <private/surfaceflinger/LayerState.h>
namespace android {
status_t layer_state_t::write(Parcel& output) const
{
size_t size = sizeof(layer_state_t);
-
- //output.writeStrongBinder(surface->asBinder());
- //size -= sizeof(surface);
-
transparentRegion.write(output);
size -= sizeof(transparentRegion);
-
output.write(this, size);
-
return NO_ERROR;
}
status_t layer_state_t::read(const Parcel& input)
{
size_t size = sizeof(layer_state_t);
-
- //surface = interface_cast<ISurface>(input.readStrongBinder());
- //size -= sizeof(surface);
-
transparentRegion.read(input);
size -= sizeof(transparentRegion);
-
input.read(this, size);
-
return NO_ERROR;
}
diff --git a/libs/ui/SharedBufferStack.cpp b/libs/surfaceflinger_client/SharedBufferStack.cpp
similarity index 99%
rename from libs/ui/SharedBufferStack.cpp
rename to libs/surfaceflinger_client/SharedBufferStack.cpp
index 46b6766..ceb5e59 100644
--- a/libs/ui/SharedBufferStack.cpp
+++ b/libs/surfaceflinger_client/SharedBufferStack.cpp
@@ -23,7 +23,7 @@
#include <utils/Log.h>
#include <utils/threads.h>
-#include <private/ui/SharedBufferStack.h>
+#include <private/surfaceflinger/SharedBufferStack.h>
#include <ui/Rect.h>
#include <ui/Region.h>
diff --git a/libs/ui/Surface.cpp b/libs/surfaceflinger_client/Surface.cpp
similarity index 98%
rename from libs/ui/Surface.cpp
rename to libs/surfaceflinger_client/Surface.cpp
index c7be05b..eb3457b 100644
--- a/libs/ui/Surface.cpp
+++ b/libs/surfaceflinger_client/Surface.cpp
@@ -26,22 +26,25 @@
#include <utils/Errors.h>
#include <utils/threads.h>
#include <utils/CallStack.h>
+#include <utils/Log.h>
+
+#include <pixelflinger/pixelflinger.h>
+
#include <binder/IPCThreadState.h>
#include <binder/IMemory.h>
-#include <utils/Log.h>
#include <ui/DisplayInfo.h>
#include <ui/GraphicBuffer.h>
#include <ui/GraphicBufferMapper.h>
-#include <ui/ISurface.h>
-#include <ui/Surface.h>
-#include <ui/SurfaceComposerClient.h>
#include <ui/Rect.h>
-#include <pixelflinger/pixelflinger.h>
+#include <surfaceflinger/Surface.h>
+#include <surfaceflinger/ISurface.h>
+#include <surfaceflinger/ISurfaceComposer.h>
+#include <surfaceflinger/SurfaceComposerClient.h>
-#include <private/ui/SharedBufferStack.h>
-#include <private/ui/LayerState.h>
+#include <private/surfaceflinger/SharedBufferStack.h>
+#include <private/surfaceflinger/LayerState.h>
namespace android {
diff --git a/libs/ui/SurfaceComposerClient.cpp b/libs/surfaceflinger_client/SurfaceComposerClient.cpp
similarity index 97%
rename from libs/ui/SurfaceComposerClient.cpp
rename to libs/surfaceflinger_client/SurfaceComposerClient.cpp
index eda84ef..0b5e504 100644
--- a/libs/ui/SurfaceComposerClient.cpp
+++ b/libs/surfaceflinger_client/SurfaceComposerClient.cpp
@@ -29,19 +29,21 @@
#include <utils/Errors.h>
#include <utils/threads.h>
#include <utils/KeyedVector.h>
-#include <binder/IServiceManager.h>
-#include <binder/IMemory.h>
#include <utils/Log.h>
+#include <binder/IServiceManager.h>
+#include <binder/IMemory.h>
+
#include <ui/DisplayInfo.h>
-#include <ui/ISurfaceComposer.h>
-#include <ui/ISurfaceFlingerClient.h>
-#include <ui/ISurface.h>
-#include <ui/SurfaceComposerClient.h>
#include <ui/Rect.h>
-#include <private/ui/LayerState.h>
-#include <private/ui/SharedBufferStack.h>
+#include <surfaceflinger/ISurfaceComposer.h>
+#include <surfaceflinger/ISurfaceFlingerClient.h>
+#include <surfaceflinger/ISurface.h>
+#include <surfaceflinger/SurfaceComposerClient.h>
+
+#include <private/surfaceflinger/LayerState.h>
+#include <private/surfaceflinger/SharedBufferStack.h>
#define VERBOSE(...) ((void)0)
//#define VERBOSE LOGD
diff --git a/libs/ui/Android.mk b/libs/ui/Android.mk
index 84aec61..f7acd97 100644
--- a/libs/ui/Android.mk
+++ b/libs/ui/Android.mk
@@ -2,8 +2,6 @@
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
- Camera.cpp \
- CameraParameters.cpp \
EGLUtils.cpp \
EventHub.cpp \
EventRecurrence.cpp \
@@ -13,21 +11,11 @@
GraphicBufferMapper.cpp \
KeyLayoutMap.cpp \
KeyCharacterMap.cpp \
- ICamera.cpp \
- ICameraClient.cpp \
- ICameraService.cpp \
IOverlay.cpp \
- ISurfaceComposer.cpp \
- ISurface.cpp \
- ISurfaceFlingerClient.cpp \
- LayerState.cpp \
Overlay.cpp \
PixelFormat.cpp \
Rect.cpp \
- Region.cpp \
- SharedBufferStack.cpp \
- Surface.cpp \
- SurfaceComposerClient.cpp
+ Region.cpp
LOCAL_SHARED_LIBRARIES := \
libcutils \
diff --git a/libs/ui/Camera.cpp b/libs/ui/Camera.cpp
deleted file mode 100644
index f374fbc..0000000
--- a/libs/ui/Camera.cpp
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
-**
-** Copyright (C) 2008, The Android Open Source Project
-** Copyright (C) 2008 HTC Inc.
-**
-** 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.
-*/
-
-//#define LOG_NDEBUG 0
-#define LOG_TAG "Camera"
-#include <utils/Log.h>
-#include <binder/IServiceManager.h>
-#include <utils/threads.h>
-#include <binder/IMemory.h>
-#include <ui/Surface.h>
-#include <ui/Camera.h>
-#include <ui/ICameraService.h>
-
-namespace android {
-
-// client singleton for camera service binder interface
-Mutex Camera::mLock;
-sp<ICameraService> Camera::mCameraService;
-sp<Camera::DeathNotifier> Camera::mDeathNotifier;
-
-// establish binder interface to camera service
-const sp<ICameraService>& Camera::getCameraService()
-{
- Mutex::Autolock _l(mLock);
- if (mCameraService.get() == 0) {
- sp<IServiceManager> sm = defaultServiceManager();
- sp<IBinder> binder;
- do {
- binder = sm->getService(String16("media.camera"));
- if (binder != 0)
- break;
- LOGW("CameraService not published, waiting...");
- usleep(500000); // 0.5 s
- } while(true);
- if (mDeathNotifier == NULL) {
- mDeathNotifier = new DeathNotifier();
- }
- binder->linkToDeath(mDeathNotifier);
- mCameraService = interface_cast<ICameraService>(binder);
- }
- LOGE_IF(mCameraService==0, "no CameraService!?");
- return mCameraService;
-}
-
-// ---------------------------------------------------------------------------
-
-Camera::Camera()
-{
- init();
-}
-
-// construct a camera client from an existing camera remote
-sp<Camera> Camera::create(const sp<ICamera>& camera)
-{
- LOGV("create");
- if (camera == 0) {
- LOGE("camera remote is a NULL pointer");
- return 0;
- }
-
- sp<Camera> c = new Camera();
- if (camera->connect(c) == NO_ERROR) {
- c->mStatus = NO_ERROR;
- c->mCamera = camera;
- camera->asBinder()->linkToDeath(c);
- }
- return c;
-}
-
-void Camera::init()
-{
- mStatus = UNKNOWN_ERROR;
-}
-
-Camera::~Camera()
-{
- disconnect();
-}
-
-sp<Camera> Camera::connect()
-{
- LOGV("connect");
- sp<Camera> c = new Camera();
- const sp<ICameraService>& cs = getCameraService();
- if (cs != 0) {
- c->mCamera = cs->connect(c);
- }
- if (c->mCamera != 0) {
- c->mCamera->asBinder()->linkToDeath(c);
- c->mStatus = NO_ERROR;
- } else {
- c.clear();
- }
- return c;
-}
-
-void Camera::disconnect()
-{
- LOGV("disconnect");
- if (mCamera != 0) {
- mCamera->disconnect();
- mCamera = 0;
- }
-}
-
-status_t Camera::reconnect()
-{
- LOGV("reconnect");
- sp <ICamera> c = mCamera;
- if (c == 0) return NO_INIT;
- return c->connect(this);
-}
-
-sp<ICamera> Camera::remote()
-{
- return mCamera;
-}
-
-status_t Camera::lock()
-{
- sp <ICamera> c = mCamera;
- if (c == 0) return NO_INIT;
- return c->lock();
-}
-
-status_t Camera::unlock()
-{
- sp <ICamera> c = mCamera;
- if (c == 0) return NO_INIT;
- return c->unlock();
-}
-
-// pass the buffered ISurface to the camera service
-status_t Camera::setPreviewDisplay(const sp<Surface>& surface)
-{
- LOGV("setPreviewDisplay");
- sp <ICamera> c = mCamera;
- if (c == 0) return NO_INIT;
- if (surface != 0) {
- return c->setPreviewDisplay(surface->getISurface());
- } else {
- LOGD("app passed NULL surface");
- return c->setPreviewDisplay(0);
- }
-}
-
-status_t Camera::setPreviewDisplay(const sp<ISurface>& surface)
-{
- LOGV("setPreviewDisplay");
- if (surface == 0) {
- LOGD("app passed NULL surface");
- }
- sp <ICamera> c = mCamera;
- if (c == 0) return NO_INIT;
- return c->setPreviewDisplay(surface);
-}
-
-
-// start preview mode
-status_t Camera::startPreview()
-{
- LOGV("startPreview");
- sp <ICamera> c = mCamera;
- if (c == 0) return NO_INIT;
- return c->startPreview();
-}
-
-// start recording mode, must call setPreviewDisplay first
-status_t Camera::startRecording()
-{
- LOGV("startRecording");
- sp <ICamera> c = mCamera;
- if (c == 0) return NO_INIT;
- return c->startRecording();
-}
-
-// stop preview mode
-void Camera::stopPreview()
-{
- LOGV("stopPreview");
- sp <ICamera> c = mCamera;
- if (c == 0) return;
- c->stopPreview();
-}
-
-// stop recording mode
-void Camera::stopRecording()
-{
- LOGV("stopRecording");
- sp <ICamera> c = mCamera;
- if (c == 0) return;
- c->stopRecording();
-}
-
-// release a recording frame
-void Camera::releaseRecordingFrame(const sp<IMemory>& mem)
-{
- LOGV("releaseRecordingFrame");
- sp <ICamera> c = mCamera;
- if (c == 0) return;
- c->releaseRecordingFrame(mem);
-}
-
-// get preview state
-bool Camera::previewEnabled()
-{
- LOGV("previewEnabled");
- sp <ICamera> c = mCamera;
- if (c == 0) return false;
- return c->previewEnabled();
-}
-
-// get recording state
-bool Camera::recordingEnabled()
-{
- LOGV("recordingEnabled");
- sp <ICamera> c = mCamera;
- if (c == 0) return false;
- return c->recordingEnabled();
-}
-
-status_t Camera::autoFocus()
-{
- LOGV("autoFocus");
- sp <ICamera> c = mCamera;
- if (c == 0) return NO_INIT;
- return c->autoFocus();
-}
-
-status_t Camera::cancelAutoFocus()
-{
- LOGV("cancelAutoFocus");
- sp <ICamera> c = mCamera;
- if (c == 0) return NO_INIT;
- return c->cancelAutoFocus();
-}
-
-// take a picture
-status_t Camera::takePicture()
-{
- LOGV("takePicture");
- sp <ICamera> c = mCamera;
- if (c == 0) return NO_INIT;
- return c->takePicture();
-}
-
-// set preview/capture parameters - key/value pairs
-status_t Camera::setParameters(const String8& params)
-{
- LOGV("setParameters");
- sp <ICamera> c = mCamera;
- if (c == 0) return NO_INIT;
- return c->setParameters(params);
-}
-
-// get preview/capture parameters - key/value pairs
-String8 Camera::getParameters() const
-{
- LOGV("getParameters");
- String8 params;
- sp <ICamera> c = mCamera;
- if (c != 0) params = mCamera->getParameters();
- return params;
-}
-
-// send command to camera driver
-status_t Camera::sendCommand(int32_t cmd, int32_t arg1, int32_t arg2)
-{
- LOGV("sendCommand");
- sp <ICamera> c = mCamera;
- if (c == 0) return NO_INIT;
- return c->sendCommand(cmd, arg1, arg2);
-}
-
-void Camera::setListener(const sp<CameraListener>& listener)
-{
- Mutex::Autolock _l(mLock);
- mListener = listener;
-}
-
-void Camera::setPreviewCallbackFlags(int flag)
-{
- LOGV("setPreviewCallbackFlags");
- sp <ICamera> c = mCamera;
- if (c == 0) return;
- mCamera->setPreviewCallbackFlag(flag);
-}
-
-// callback from camera service
-void Camera::notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2)
-{
- sp<CameraListener> listener;
- {
- Mutex::Autolock _l(mLock);
- listener = mListener;
- }
- if (listener != NULL) {
- listener->notify(msgType, ext1, ext2);
- }
-}
-
-// callback from camera service when frame or image is ready
-void Camera::dataCallback(int32_t msgType, const sp<IMemory>& dataPtr)
-{
- sp<CameraListener> listener;
- {
- Mutex::Autolock _l(mLock);
- listener = mListener;
- }
- if (listener != NULL) {
- listener->postData(msgType, dataPtr);
- }
-}
-
-// callback from camera service when timestamped frame is ready
-void Camera::dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& dataPtr)
-{
- sp<CameraListener> listener;
- {
- Mutex::Autolock _l(mLock);
- listener = mListener;
- }
- if (listener != NULL) {
- listener->postDataTimestamp(timestamp, msgType, dataPtr);
- }
-}
-
-void Camera::binderDied(const wp<IBinder>& who) {
- LOGW("ICamera died");
- notifyCallback(CAMERA_MSG_ERROR, CAMERA_ERROR_SERVER_DIED, 0);
-}
-
-void Camera::DeathNotifier::binderDied(const wp<IBinder>& who) {
- LOGV("binderDied");
- Mutex::Autolock _l(Camera::mLock);
- Camera::mCameraService.clear();
- LOGW("Camera server died!");
-}
-
-}; // namespace android
-
diff --git a/libs/ui/CameraParameters.cpp b/libs/ui/CameraParameters.cpp
deleted file mode 100644
index 493b9c1..0000000
--- a/libs/ui/CameraParameters.cpp
+++ /dev/null
@@ -1,369 +0,0 @@
-/*
-**
-** Copyright 2008, 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.
-*/
-
-#define LOG_TAG "CameraParams"
-#include <utils/Log.h>
-
-#include <string.h>
-#include <stdlib.h>
-#include <ui/CameraParameters.h>
-
-namespace android {
-// Parameter keys to communicate between camera application and driver.
-const char CameraParameters::KEY_PREVIEW_SIZE[] = "preview-size";
-const char CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES[] = "preview-size-values";
-const char CameraParameters::KEY_PREVIEW_FORMAT[] = "preview-format";
-const char CameraParameters::KEY_SUPPORTED_PREVIEW_FORMATS[] = "preview-format-values";
-const char CameraParameters::KEY_PREVIEW_FRAME_RATE[] = "preview-frame-rate";
-const char CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATES[] = "preview-frame-rate-values";
-const char CameraParameters::KEY_PICTURE_SIZE[] = "picture-size";
-const char CameraParameters::KEY_SUPPORTED_PICTURE_SIZES[] = "picture-size-values";
-const char CameraParameters::KEY_PICTURE_FORMAT[] = "picture-format";
-const char CameraParameters::KEY_SUPPORTED_PICTURE_FORMATS[] = "picture-format-values";
-const char CameraParameters::KEY_JPEG_THUMBNAIL_WIDTH[] = "jpeg-thumbnail-width";
-const char CameraParameters::KEY_JPEG_THUMBNAIL_HEIGHT[] = "jpeg-thumbnail-height";
-const char CameraParameters::KEY_SUPPORTED_JPEG_THUMBNAIL_SIZES[] = "jpeg-thumbnail-size-values";
-const char CameraParameters::KEY_JPEG_THUMBNAIL_QUALITY[] = "jpeg-thumbnail-quality";
-const char CameraParameters::KEY_JPEG_QUALITY[] = "jpeg-quality";
-const char CameraParameters::KEY_ROTATION[] = "rotation";
-const char CameraParameters::KEY_GPS_LATITUDE[] = "gps-latitude";
-const char CameraParameters::KEY_GPS_LONGITUDE[] = "gps-longitude";
-const char CameraParameters::KEY_GPS_ALTITUDE[] = "gps-altitude";
-const char CameraParameters::KEY_GPS_TIMESTAMP[] = "gps-timestamp";
-const char CameraParameters::KEY_WHITE_BALANCE[] = "whitebalance";
-const char CameraParameters::KEY_SUPPORTED_WHITE_BALANCE[] = "whitebalance-values";
-const char CameraParameters::KEY_EFFECT[] = "effect";
-const char CameraParameters::KEY_SUPPORTED_EFFECTS[] = "effect-values";
-const char CameraParameters::KEY_ANTIBANDING[] = "antibanding";
-const char CameraParameters::KEY_SUPPORTED_ANTIBANDING[] = "antibanding-values";
-const char CameraParameters::KEY_SCENE_MODE[] = "scene-mode";
-const char CameraParameters::KEY_SUPPORTED_SCENE_MODES[] = "scene-mode-values";
-const char CameraParameters::KEY_FLASH_MODE[] = "flash-mode";
-const char CameraParameters::KEY_SUPPORTED_FLASH_MODES[] = "flash-mode-values";
-const char CameraParameters::KEY_FOCUS_MODE[] = "focus-mode";
-const char CameraParameters::KEY_SUPPORTED_FOCUS_MODES[] = "focus-mode-values";
-const char CameraParameters::KEY_FOCAL_LENGTH[] = "focal-length";
-const char CameraParameters::KEY_HORIZONTAL_VIEW_ANGLE[] = "horizontal-view-angle";
-const char CameraParameters::KEY_VERTICAL_VIEW_ANGLE[] = "vertical-view-angle";
-const char CameraParameters::KEY_EXPOSURE_COMPENSATION[] = "exposure-compensation";
-const char CameraParameters::KEY_SUPPORTED_EXPOSURE_COMPENSATION[] = "exposure-compensation-values";
-
-// Values for white balance settings.
-const char CameraParameters::WHITE_BALANCE_AUTO[] = "auto";
-const char CameraParameters::WHITE_BALANCE_INCANDESCENT[] = "incandescent";
-const char CameraParameters::WHITE_BALANCE_FLUORESCENT[] = "fluorescent";
-const char CameraParameters::WHITE_BALANCE_WARM_FLUORESCENT[] = "warm-fluorescent";
-const char CameraParameters::WHITE_BALANCE_DAYLIGHT[] = "daylight";
-const char CameraParameters::WHITE_BALANCE_CLOUDY_DAYLIGHT[] = "cloudy-daylight";
-const char CameraParameters::WHITE_BALANCE_TWILIGHT[] = "twilight";
-const char CameraParameters::WHITE_BALANCE_SHADE[] = "shade";
-
-// Values for effect settings.
-const char CameraParameters::EFFECT_NONE[] = "none";
-const char CameraParameters::EFFECT_MONO[] = "mono";
-const char CameraParameters::EFFECT_NEGATIVE[] = "negative";
-const char CameraParameters::EFFECT_SOLARIZE[] = "solarize";
-const char CameraParameters::EFFECT_SEPIA[] = "sepia";
-const char CameraParameters::EFFECT_POSTERIZE[] = "posterize";
-const char CameraParameters::EFFECT_WHITEBOARD[] = "whiteboard";
-const char CameraParameters::EFFECT_BLACKBOARD[] = "blackboard";
-const char CameraParameters::EFFECT_AQUA[] = "aqua";
-
-// Values for antibanding settings.
-const char CameraParameters::ANTIBANDING_AUTO[] = "auto";
-const char CameraParameters::ANTIBANDING_50HZ[] = "50hz";
-const char CameraParameters::ANTIBANDING_60HZ[] = "60hz";
-const char CameraParameters::ANTIBANDING_OFF[] = "off";
-
-// Values for flash mode settings.
-const char CameraParameters::FLASH_MODE_OFF[] = "off";
-const char CameraParameters::FLASH_MODE_AUTO[] = "auto";
-const char CameraParameters::FLASH_MODE_ON[] = "on";
-const char CameraParameters::FLASH_MODE_RED_EYE[] = "red-eye";
-const char CameraParameters::FLASH_MODE_TORCH[] = "torch";
-
-// Values for scene mode settings.
-const char CameraParameters::SCENE_MODE_AUTO[] = "auto";
-const char CameraParameters::SCENE_MODE_ACTION[] = "action";
-const char CameraParameters::SCENE_MODE_PORTRAIT[] = "portrait";
-const char CameraParameters::SCENE_MODE_LANDSCAPE[] = "landscape";
-const char CameraParameters::SCENE_MODE_NIGHT[] = "night";
-const char CameraParameters::SCENE_MODE_NIGHT_PORTRAIT[] = "night-portrait";
-const char CameraParameters::SCENE_MODE_THEATRE[] = "theatre";
-const char CameraParameters::SCENE_MODE_BEACH[] = "beach";
-const char CameraParameters::SCENE_MODE_SNOW[] = "snow";
-const char CameraParameters::SCENE_MODE_SUNSET[] = "sunset";
-const char CameraParameters::SCENE_MODE_STEADYPHOTO[] = "steadyphoto";
-const char CameraParameters::SCENE_MODE_FIREWORKS[] = "fireworks";
-const char CameraParameters::SCENE_MODE_SPORTS[] = "sports";
-const char CameraParameters::SCENE_MODE_PARTY[] = "party";
-const char CameraParameters::SCENE_MODE_CANDLELIGHT[] = "candlelight";
-
-// Formats for setPreviewFormat and setPictureFormat.
-const char CameraParameters::PIXEL_FORMAT_YUV422SP[] = "yuv422sp";
-const char CameraParameters::PIXEL_FORMAT_YUV420SP[] = "yuv420sp";
-const char CameraParameters::PIXEL_FORMAT_YUV422I[] = "yuv422i-yuyv";
-const char CameraParameters::PIXEL_FORMAT_RGB565[] = "rgb565";
-const char CameraParameters::PIXEL_FORMAT_JPEG[] = "jpeg";
-
-// Values for focus mode settings.
-const char CameraParameters::FOCUS_MODE_AUTO[] = "auto";
-const char CameraParameters::FOCUS_MODE_INFINITY[] = "infinity";
-const char CameraParameters::FOCUS_MODE_MACRO[] = "macro";
-const char CameraParameters::FOCUS_MODE_FIXED[] = "fixed";
-
-CameraParameters::CameraParameters()
- : mMap()
-{
-}
-
-CameraParameters::~CameraParameters()
-{
-}
-
-String8 CameraParameters::flatten() const
-{
- String8 flattened("");
- size_t size = mMap.size();
-
- for (size_t i = 0; i < size; i++) {
- String8 k, v;
- k = mMap.keyAt(i);
- v = mMap.valueAt(i);
-
- flattened += k;
- flattened += "=";
- flattened += v;
- if (i != size-1)
- flattened += ";";
- }
-
- return flattened;
-}
-
-void CameraParameters::unflatten(const String8 ¶ms)
-{
- const char *a = params.string();
- const char *b;
-
- mMap.clear();
-
- for (;;) {
- // Find the bounds of the key name.
- b = strchr(a, '=');
- if (b == 0)
- break;
-
- // Create the key string.
- String8 k(a, (size_t)(b-a));
-
- // Find the value.
- a = b+1;
- b = strchr(a, ';');
- if (b == 0) {
- // If there's no semicolon, this is the last item.
- String8 v(a);
- mMap.add(k, v);
- break;
- }
-
- String8 v(a, (size_t)(b-a));
- mMap.add(k, v);
- a = b+1;
- }
-}
-
-
-void CameraParameters::set(const char *key, const char *value)
-{
- // XXX i think i can do this with strspn()
- if (strchr(key, '=') || strchr(key, ';')) {
- //XXX LOGE("Key \"%s\"contains invalid character (= or ;)", key);
- return;
- }
-
- if (strchr(value, '=') || strchr(key, ';')) {
- //XXX LOGE("Value \"%s\"contains invalid character (= or ;)", value);
- return;
- }
-
- mMap.replaceValueFor(String8(key), String8(value));
-}
-
-void CameraParameters::set(const char *key, int value)
-{
- char str[16];
- sprintf(str, "%d", value);
- set(key, str);
-}
-
-void CameraParameters::setFloat(const char *key, float value)
-{
- char str[16]; // 14 should be enough. We overestimate to be safe.
- snprintf(str, sizeof(str), "%g", value);
- set(key, str);
-}
-
-const char *CameraParameters::get(const char *key) const
-{
- String8 v = mMap.valueFor(String8(key));
- if (v.length() == 0)
- return 0;
- return v.string();
-}
-
-int CameraParameters::getInt(const char *key) const
-{
- const char *v = get(key);
- if (v == 0)
- return -1;
- return strtol(v, 0, 0);
-}
-
-float CameraParameters::getFloat(const char *key) const
-{
- const char *v = get(key);
- if (v == 0) return -1;
- return strtof(v, 0);
-}
-
-static int parse_size(const char *str, int &width, int &height)
-{
- // Find the width.
- char *end;
- int w = (int)strtol(str, &end, 10);
- // If an 'x' does not immediately follow, give up.
- if (*end != 'x')
- return -1;
-
- // Find the height, immediately after the 'x'.
- int h = (int)strtol(end+1, 0, 10);
-
- width = w;
- height = h;
-
- return 0;
-}
-
-void CameraParameters::setPreviewSize(int width, int height)
-{
- char str[32];
- sprintf(str, "%dx%d", width, height);
- set(KEY_PREVIEW_SIZE, str);
-}
-
-void CameraParameters::getPreviewSize(int *width, int *height) const
-{
- *width = -1;
- *height = -1;
-
- // Get the current string, if it doesn't exist, leave the -1x-1
- const char *p = get(KEY_PREVIEW_SIZE);
- if (p == 0)
- return;
-
- int w, h;
- if (parse_size(p, w, h) == 0) {
- *width = w;
- *height = h;
- }
-}
-
-void CameraParameters::setPreviewFrameRate(int fps)
-{
- set(KEY_PREVIEW_FRAME_RATE, fps);
-}
-
-int CameraParameters::getPreviewFrameRate() const
-{
- return getInt(KEY_PREVIEW_FRAME_RATE);
-}
-
-void CameraParameters::setPreviewFormat(const char *format)
-{
- set(KEY_PREVIEW_FORMAT, format);
-}
-
-const char *CameraParameters::getPreviewFormat() const
-{
- return get(KEY_PREVIEW_FORMAT);
-}
-
-void CameraParameters::setPictureSize(int width, int height)
-{
- char str[32];
- sprintf(str, "%dx%d", width, height);
- set(KEY_PICTURE_SIZE, str);
-}
-
-void CameraParameters::getPictureSize(int *width, int *height) const
-{
- *width = -1;
- *height = -1;
-
- // Get the current string, if it doesn't exist, leave the -1x-1
- const char *p = get(KEY_PICTURE_SIZE);
- if (p == 0)
- return;
-
- int w, h;
- if (parse_size(p, w, h) == 0) {
- *width = w;
- *height = h;
- }
-}
-
-void CameraParameters::setPictureFormat(const char *format)
-{
- set(KEY_PICTURE_FORMAT, format);
-}
-
-const char *CameraParameters::getPictureFormat() const
-{
- return get(KEY_PICTURE_FORMAT);
-}
-
-void CameraParameters::dump() const
-{
- LOGD("dump: mMap.size = %d", mMap.size());
- for (size_t i = 0; i < mMap.size(); i++) {
- String8 k, v;
- k = mMap.keyAt(i);
- v = mMap.valueAt(i);
- LOGD("%s: %s\n", k.string(), v.string());
- }
-}
-
-status_t CameraParameters::dump(int fd, const Vector<String16>& args) const
-{
- const size_t SIZE = 256;
- char buffer[SIZE];
- String8 result;
- snprintf(buffer, 255, "CameraParameters::dump: mMap.size = %d\n", mMap.size());
- result.append(buffer);
- for (size_t i = 0; i < mMap.size(); i++) {
- String8 k, v;
- k = mMap.keyAt(i);
- v = mMap.valueAt(i);
- snprintf(buffer, 255, "\t%s: %s\n", k.string(), v.string());
- result.append(buffer);
- }
- write(fd, result.string(), result.size());
- return NO_ERROR;
-}
-
-}; // namespace android
diff --git a/libs/ui/FramebufferNativeWindow.cpp b/libs/ui/FramebufferNativeWindow.cpp
index c5e22e5..1fa2c68 100644
--- a/libs/ui/FramebufferNativeWindow.cpp
+++ b/libs/ui/FramebufferNativeWindow.cpp
@@ -27,7 +27,6 @@
#include <utils/threads.h>
#include <utils/RefBase.h>
-#include <ui/SurfaceComposerClient.h>
#include <ui/Rect.h>
#include <ui/FramebufferNativeWindow.h>
diff --git a/libs/ui/ICamera.cpp b/libs/ui/ICamera.cpp
deleted file mode 100644
index 4154b05..0000000
--- a/libs/ui/ICamera.cpp
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
-**
-** Copyright 2008, 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.
-*/
-
-//#define LOG_NDEBUG 0
-#define LOG_TAG "ICamera"
-#include <utils/Log.h>
-#include <stdint.h>
-#include <sys/types.h>
-#include <binder/Parcel.h>
-#include <ui/ICamera.h>
-
-namespace android {
-
-enum {
- DISCONNECT = IBinder::FIRST_CALL_TRANSACTION,
- SET_PREVIEW_DISPLAY,
- SET_PREVIEW_CALLBACK_FLAG,
- START_PREVIEW,
- STOP_PREVIEW,
- AUTO_FOCUS,
- CANCEL_AUTO_FOCUS,
- TAKE_PICTURE,
- SET_PARAMETERS,
- GET_PARAMETERS,
- SEND_COMMAND,
- CONNECT,
- LOCK,
- UNLOCK,
- PREVIEW_ENABLED,
- START_RECORDING,
- STOP_RECORDING,
- RECORDING_ENABLED,
- RELEASE_RECORDING_FRAME,
-};
-
-class BpCamera: public BpInterface<ICamera>
-{
-public:
- BpCamera(const sp<IBinder>& impl)
- : BpInterface<ICamera>(impl)
- {
- }
-
- // disconnect from camera service
- void disconnect()
- {
- LOGV("disconnect");
- Parcel data, reply;
- data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
- remote()->transact(DISCONNECT, data, &reply);
- }
-
- // pass the buffered ISurface to the camera service
- status_t setPreviewDisplay(const sp<ISurface>& surface)
- {
- LOGV("setPreviewDisplay");
- Parcel data, reply;
- data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
- data.writeStrongBinder(surface->asBinder());
- remote()->transact(SET_PREVIEW_DISPLAY, data, &reply);
- return reply.readInt32();
- }
-
- // set the preview callback flag to affect how the received frames from
- // preview are handled. See Camera.h for details.
- void setPreviewCallbackFlag(int flag)
- {
- LOGV("setPreviewCallbackFlag(%d)", flag);
- Parcel data, reply;
- data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
- data.writeInt32(flag);
- remote()->transact(SET_PREVIEW_CALLBACK_FLAG, data, &reply);
- }
-
- // start preview mode, must call setPreviewDisplay first
- status_t startPreview()
- {
- LOGV("startPreview");
- Parcel data, reply;
- data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
- remote()->transact(START_PREVIEW, data, &reply);
- return reply.readInt32();
- }
-
- // start recording mode, must call setPreviewDisplay first
- status_t startRecording()
- {
- LOGV("startRecording");
- Parcel data, reply;
- data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
- remote()->transact(START_RECORDING, data, &reply);
- return reply.readInt32();
- }
-
- // stop preview mode
- void stopPreview()
- {
- LOGV("stopPreview");
- Parcel data, reply;
- data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
- remote()->transact(STOP_PREVIEW, data, &reply);
- }
-
- // stop recording mode
- void stopRecording()
- {
- LOGV("stopRecording");
- Parcel data, reply;
- data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
- remote()->transact(STOP_RECORDING, data, &reply);
- }
-
- void releaseRecordingFrame(const sp<IMemory>& mem)
- {
- LOGV("releaseRecordingFrame");
- Parcel data, reply;
- data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
- data.writeStrongBinder(mem->asBinder());
- remote()->transact(RELEASE_RECORDING_FRAME, data, &reply);
- }
-
- // check preview state
- bool previewEnabled()
- {
- LOGV("previewEnabled");
- Parcel data, reply;
- data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
- remote()->transact(PREVIEW_ENABLED, data, &reply);
- return reply.readInt32();
- }
-
- // check recording state
- bool recordingEnabled()
- {
- LOGV("recordingEnabled");
- Parcel data, reply;
- data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
- remote()->transact(RECORDING_ENABLED, data, &reply);
- return reply.readInt32();
- }
-
- // auto focus
- status_t autoFocus()
- {
- LOGV("autoFocus");
- Parcel data, reply;
- data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
- remote()->transact(AUTO_FOCUS, data, &reply);
- status_t ret = reply.readInt32();
- return ret;
- }
-
- // cancel focus
- status_t cancelAutoFocus()
- {
- LOGV("cancelAutoFocus");
- Parcel data, reply;
- data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
- remote()->transact(CANCEL_AUTO_FOCUS, data, &reply);
- status_t ret = reply.readInt32();
- return ret;
- }
-
- // take a picture - returns an IMemory (ref-counted mmap)
- status_t takePicture()
- {
- LOGV("takePicture");
- Parcel data, reply;
- data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
- remote()->transact(TAKE_PICTURE, data, &reply);
- status_t ret = reply.readInt32();
- return ret;
- }
-
- // set preview/capture parameters - key/value pairs
- status_t setParameters(const String8& params)
- {
- LOGV("setParameters");
- Parcel data, reply;
- data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
- data.writeString8(params);
- remote()->transact(SET_PARAMETERS, data, &reply);
- return reply.readInt32();
- }
-
- // get preview/capture parameters - key/value pairs
- String8 getParameters() const
- {
- LOGV("getParameters");
- Parcel data, reply;
- data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
- remote()->transact(GET_PARAMETERS, data, &reply);
- return reply.readString8();
- }
- virtual status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2)
- {
- LOGD("sendCommand");
- Parcel data, reply;
- data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
- data.writeInt32(cmd);
- data.writeInt32(arg1);
- data.writeInt32(arg2);
- remote()->transact(SEND_COMMAND, data, &reply);
- return reply.readInt32();
- }
- virtual status_t connect(const sp<ICameraClient>& cameraClient)
- {
- Parcel data, reply;
- data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
- data.writeStrongBinder(cameraClient->asBinder());
- remote()->transact(CONNECT, data, &reply);
- return reply.readInt32();
- }
- virtual status_t lock()
- {
- Parcel data, reply;
- data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
- remote()->transact(LOCK, data, &reply);
- return reply.readInt32();
- }
- virtual status_t unlock()
- {
- Parcel data, reply;
- data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
- remote()->transact(UNLOCK, data, &reply);
- return reply.readInt32();
- }
-};
-
-IMPLEMENT_META_INTERFACE(Camera, "android.hardware.ICamera");
-
-// ----------------------------------------------------------------------
-
-status_t BnCamera::onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
-{
- switch(code) {
- case DISCONNECT: {
- LOGV("DISCONNECT");
- CHECK_INTERFACE(ICamera, data, reply);
- disconnect();
- return NO_ERROR;
- } break;
- case SET_PREVIEW_DISPLAY: {
- LOGV("SET_PREVIEW_DISPLAY");
- CHECK_INTERFACE(ICamera, data, reply);
- sp<ISurface> surface = interface_cast<ISurface>(data.readStrongBinder());
- reply->writeInt32(setPreviewDisplay(surface));
- return NO_ERROR;
- } break;
- case SET_PREVIEW_CALLBACK_FLAG: {
- LOGV("SET_PREVIEW_CALLBACK_TYPE");
- CHECK_INTERFACE(ICamera, data, reply);
- int callback_flag = data.readInt32();
- setPreviewCallbackFlag(callback_flag);
- return NO_ERROR;
- } break;
- case START_PREVIEW: {
- LOGV("START_PREVIEW");
- CHECK_INTERFACE(ICamera, data, reply);
- reply->writeInt32(startPreview());
- return NO_ERROR;
- } break;
- case START_RECORDING: {
- LOGV("START_RECORDING");
- CHECK_INTERFACE(ICamera, data, reply);
- reply->writeInt32(startRecording());
- return NO_ERROR;
- } break;
- case STOP_PREVIEW: {
- LOGV("STOP_PREVIEW");
- CHECK_INTERFACE(ICamera, data, reply);
- stopPreview();
- return NO_ERROR;
- } break;
- case STOP_RECORDING: {
- LOGV("STOP_RECORDING");
- CHECK_INTERFACE(ICamera, data, reply);
- stopRecording();
- return NO_ERROR;
- } break;
- case RELEASE_RECORDING_FRAME: {
- LOGV("RELEASE_RECORDING_FRAME");
- CHECK_INTERFACE(ICamera, data, reply);
- sp<IMemory> mem = interface_cast<IMemory>(data.readStrongBinder());
- releaseRecordingFrame(mem);
- return NO_ERROR;
- } break;
- case PREVIEW_ENABLED: {
- LOGV("PREVIEW_ENABLED");
- CHECK_INTERFACE(ICamera, data, reply);
- reply->writeInt32(previewEnabled());
- return NO_ERROR;
- } break;
- case RECORDING_ENABLED: {
- LOGV("RECORDING_ENABLED");
- CHECK_INTERFACE(ICamera, data, reply);
- reply->writeInt32(recordingEnabled());
- return NO_ERROR;
- } break;
- case AUTO_FOCUS: {
- LOGV("AUTO_FOCUS");
- CHECK_INTERFACE(ICamera, data, reply);
- reply->writeInt32(autoFocus());
- return NO_ERROR;
- } break;
- case CANCEL_AUTO_FOCUS: {
- LOGV("CANCEL_AUTO_FOCUS");
- CHECK_INTERFACE(ICamera, data, reply);
- reply->writeInt32(cancelAutoFocus());
- return NO_ERROR;
- } break;
- case TAKE_PICTURE: {
- LOGV("TAKE_PICTURE");
- CHECK_INTERFACE(ICamera, data, reply);
- reply->writeInt32(takePicture());
- return NO_ERROR;
- } break;
- case SET_PARAMETERS: {
- LOGV("SET_PARAMETERS");
- CHECK_INTERFACE(ICamera, data, reply);
- String8 params(data.readString8());
- reply->writeInt32(setParameters(params));
- return NO_ERROR;
- } break;
- case GET_PARAMETERS: {
- LOGV("GET_PARAMETERS");
- CHECK_INTERFACE(ICamera, data, reply);
- reply->writeString8(getParameters());
- return NO_ERROR;
- } break;
- case SEND_COMMAND: {
- LOGV("SEND_COMMAND");
- CHECK_INTERFACE(ICamera, data, reply);
- int command = data.readInt32();
- int arg1 = data.readInt32();
- int arg2 = data.readInt32();
- reply->writeInt32(sendCommand(command, arg1, arg2));
- return NO_ERROR;
- } break;
- case CONNECT: {
- CHECK_INTERFACE(ICamera, data, reply);
- sp<ICameraClient> cameraClient = interface_cast<ICameraClient>(data.readStrongBinder());
- reply->writeInt32(connect(cameraClient));
- return NO_ERROR;
- } break;
- case LOCK: {
- CHECK_INTERFACE(ICamera, data, reply);
- reply->writeInt32(lock());
- return NO_ERROR;
- } break;
- case UNLOCK: {
- CHECK_INTERFACE(ICamera, data, reply);
- reply->writeInt32(unlock());
- return NO_ERROR;
- } break;
- default:
- return BBinder::onTransact(code, data, reply, flags);
- }
-}
-
-// ----------------------------------------------------------------------------
-
-}; // namespace android
-
diff --git a/libs/ui/ICameraClient.cpp b/libs/ui/ICameraClient.cpp
deleted file mode 100644
index 42b4da4..0000000
--- a/libs/ui/ICameraClient.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
-**
-** Copyright 2008, 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.
-*/
-
-//#define LOG_NDEBUG 0
-#define LOG_TAG "ICameraClient"
-#include <utils/Log.h>
-#include <stdint.h>
-#include <sys/types.h>
-#include <ui/ICameraClient.h>
-
-namespace android {
-
-enum {
- NOTIFY_CALLBACK = IBinder::FIRST_CALL_TRANSACTION,
- DATA_CALLBACK,
- DATA_CALLBACK_TIMESTAMP,
-};
-
-class BpCameraClient: public BpInterface<ICameraClient>
-{
-public:
- BpCameraClient(const sp<IBinder>& impl)
- : BpInterface<ICameraClient>(impl)
- {
- }
-
- // generic callback from camera service to app
- void notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2)
- {
- LOGV("notifyCallback");
- Parcel data, reply;
- data.writeInterfaceToken(ICameraClient::getInterfaceDescriptor());
- data.writeInt32(msgType);
- data.writeInt32(ext1);
- data.writeInt32(ext2);
- remote()->transact(NOTIFY_CALLBACK, data, &reply, IBinder::FLAG_ONEWAY);
- }
-
- // generic data callback from camera service to app with image data
- void dataCallback(int32_t msgType, const sp<IMemory>& imageData)
- {
- LOGV("dataCallback");
- Parcel data, reply;
- data.writeInterfaceToken(ICameraClient::getInterfaceDescriptor());
- data.writeInt32(msgType);
- data.writeStrongBinder(imageData->asBinder());
- remote()->transact(DATA_CALLBACK, data, &reply, IBinder::FLAG_ONEWAY);
- }
-
- // generic data callback from camera service to app with image data
- void dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& imageData)
- {
- LOGV("dataCallback");
- Parcel data, reply;
- data.writeInterfaceToken(ICameraClient::getInterfaceDescriptor());
- data.writeInt64(timestamp);
- data.writeInt32(msgType);
- data.writeStrongBinder(imageData->asBinder());
- remote()->transact(DATA_CALLBACK_TIMESTAMP, data, &reply, IBinder::FLAG_ONEWAY);
- }
-};
-
-IMPLEMENT_META_INTERFACE(CameraClient, "android.hardware.ICameraClient");
-
-// ----------------------------------------------------------------------
-
-status_t BnCameraClient::onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
-{
- switch(code) {
- case NOTIFY_CALLBACK: {
- LOGV("NOTIFY_CALLBACK");
- CHECK_INTERFACE(ICameraClient, data, reply);
- int32_t msgType = data.readInt32();
- int32_t ext1 = data.readInt32();
- int32_t ext2 = data.readInt32();
- notifyCallback(msgType, ext1, ext2);
- return NO_ERROR;
- } break;
- case DATA_CALLBACK: {
- LOGV("DATA_CALLBACK");
- CHECK_INTERFACE(ICameraClient, data, reply);
- int32_t msgType = data.readInt32();
- sp<IMemory> imageData = interface_cast<IMemory>(data.readStrongBinder());
- dataCallback(msgType, imageData);
- return NO_ERROR;
- } break;
- case DATA_CALLBACK_TIMESTAMP: {
- LOGV("DATA_CALLBACK_TIMESTAMP");
- CHECK_INTERFACE(ICameraClient, data, reply);
- nsecs_t timestamp = data.readInt64();
- int32_t msgType = data.readInt32();
- sp<IMemory> imageData = interface_cast<IMemory>(data.readStrongBinder());
- dataCallbackTimestamp(timestamp, msgType, imageData);
- return NO_ERROR;
- } break;
- default:
- return BBinder::onTransact(code, data, reply, flags);
- }
-}
-
-// ----------------------------------------------------------------------------
-
-}; // namespace android
-
diff --git a/libs/ui/ICameraService.cpp b/libs/ui/ICameraService.cpp
deleted file mode 100644
index 84986c6..0000000
--- a/libs/ui/ICameraService.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-**
-** Copyright 2008, 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.
-*/
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <binder/Parcel.h>
-#include <binder/IPCThreadState.h>
-#include <binder/IServiceManager.h>
-
-#include <ui/ICameraService.h>
-
-namespace android {
-
-class BpCameraService: public BpInterface<ICameraService>
-{
-public:
- BpCameraService(const sp<IBinder>& impl)
- : BpInterface<ICameraService>(impl)
- {
- }
-
- // connect to camera service
- virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient)
- {
- Parcel data, reply;
- data.writeInterfaceToken(ICameraService::getInterfaceDescriptor());
- data.writeStrongBinder(cameraClient->asBinder());
- remote()->transact(BnCameraService::CONNECT, data, &reply);
- return interface_cast<ICamera>(reply.readStrongBinder());
- }
-};
-
-IMPLEMENT_META_INTERFACE(CameraService, "android.hardware.ICameraService");
-
-// ----------------------------------------------------------------------
-
-status_t BnCameraService::onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
-{
- switch(code) {
- case CONNECT: {
- CHECK_INTERFACE(ICameraService, data, reply);
- sp<ICameraClient> cameraClient = interface_cast<ICameraClient>(data.readStrongBinder());
- sp<ICamera> camera = connect(cameraClient);
- reply->writeStrongBinder(camera->asBinder());
- return NO_ERROR;
- } break;
- default:
- return BBinder::onTransact(code, data, reply, flags);
- }
-}
-
-// ----------------------------------------------------------------------------
-
-}; // namespace android
-