Camera: Switch camera2 to auto-gen C++ binder interfaces
- Move camera service AIDL files to frameworks/av
- Build C++ interface stubs with AIDL tools
- Add necessary native-side parcelables and update existing ones
- Remove manually-written stubs, rearrange remaining manual stubs
- Adjust implementations to work with auto-generated stubs
- Adjust method signatures for auto-gen differences
- Add rich error messages using binder::Status
Bug: 25091611
Change-Id: I6f69f34b9d1a3f8d1fb7db87357363f8fa8483ff
diff --git a/include/camera/camera2/OutputConfiguration.h b/include/camera/camera2/OutputConfiguration.h
index 137d98c..72a3753 100644
--- a/include/camera/camera2/OutputConfiguration.h
+++ b/include/camera/camera2/OutputConfiguration.h
@@ -18,12 +18,17 @@
#define ANDROID_HARDWARE_CAMERA2_OUTPUTCONFIGURATION_H
#include <gui/IGraphicBufferProducer.h>
+#include <binder/Parcelable.h>
namespace android {
class Surface;
-class OutputConfiguration {
+namespace hardware {
+namespace camera2 {
+namespace params {
+
+class OutputConfiguration : public android::Parcelable {
public:
static const int INVALID_ROTATION;
@@ -35,9 +40,18 @@
/**
* Keep impl up-to-date with OutputConfiguration.java in frameworks/base
*/
- status_t writeToParcel(Parcel& parcel) const;
+ virtual status_t writeToParcel(Parcel* parcel) const override;
+
+ virtual status_t readFromParcel(const Parcel* parcel) override;
+
+ // getGraphicBufferProducer will be NULL
+ // getRotation will be INVALID_ROTATION
+ // getSurfaceSetID will be INVALID_SET_ID
+ OutputConfiguration();
+
// getGraphicBufferProducer will be NULL if error occurred
// getRotation will be INVALID_ROTATION if error occurred
+ // getSurfaceSetID will be INVALID_SET_ID if error occurred
OutputConfiguration(const Parcel& parcel);
OutputConfiguration(sp<IGraphicBufferProducer>& gbp, int rotation,
@@ -45,7 +59,8 @@
bool operator == (const OutputConfiguration& other) const {
return (mGbp == other.mGbp &&
- mRotation == other.mRotation);
+ mRotation == other.mRotation &&
+ mSurfaceSetID == other.mSurfaceSetID);
}
bool operator != (const OutputConfiguration& other) const {
return !(*this == other);
@@ -53,6 +68,9 @@
bool operator < (const OutputConfiguration& other) const {
if (*this == other) return false;
if (mGbp != other.mGbp) return mGbp < other.mGbp;
+ if (mSurfaceSetID != other.mSurfaceSetID) {
+ return mSurfaceSetID < other.mSurfaceSetID;
+ }
return mRotation < other.mRotation;
}
bool operator > (const OutputConfiguration& other) const {
@@ -64,8 +82,15 @@
int mRotation;
int mSurfaceSetID;
// helper function
- static String16 readMaybeEmptyString16(const Parcel& parcel);
+ static String16 readMaybeEmptyString16(const Parcel* parcel);
};
+} // namespace params
+} // namespace camera2
+} // namespace hardware
+
+
+using hardware::camera2::params::OutputConfiguration;
+
}; // namespace android
#endif