camera: vndk: migrate from NativeHandle to ANativeWindow
The client side implementation of Camera vNDK used
NativeHandle to parcel NDK ANativeWindow, because ANativeWindow
wasn't parcelable over stable interfaces until recently. However,
this introduced an implicit dependency on HIDL as encoding
ANativeWindow to NativeHandle required HIDL Token Manager.
HIDL Token Manager is deprecated and scheduled to be removed soon.
This CL updates the client side vNDK implementation to use
ANativeWindow instead of NativeHandle. This includes updating
the shared code, which had special handling for when built for
the vNDK.
Bug: 283283111
Test: atest ACameraNdkVendorTest passes
atest CameraCtsTestCases:Native* tests pass
FaceHAL works OK!
Change-Id: I64a6918f041032c216dfa074d74ad2ea5b6abfeb
diff --git a/camera/ndk/impl/ACameraCaptureSession.h b/camera/ndk/impl/ACameraCaptureSession.h
index 88135ba..0d7a2c1 100644
--- a/camera/ndk/impl/ACameraCaptureSession.h
+++ b/camera/ndk/impl/ACameraCaptureSession.h
@@ -23,14 +23,14 @@
#ifdef __ANDROID_VNDK__
#include "ndk_vendor/impl/ACameraDevice.h"
-#include "ndk_vendor/impl/ACameraCaptureSessionVendor.h"
#else
#include "ACameraDevice.h"
+#endif
using namespace android;
struct ACaptureSessionOutput {
- explicit ACaptureSessionOutput(ACameraWindowType* window, bool isShared = false,
+ explicit ACaptureSessionOutput(ANativeWindow* window, bool isShared = false,
const char* physicalCameraId = "") :
mWindow(window), mIsShared(isShared), mPhysicalCameraId(physicalCameraId) {};
@@ -47,28 +47,27 @@
return mWindow > other.mWindow;
}
- inline bool isWindowEqual(ACameraWindowType* window) const {
+ inline bool isWindowEqual(ANativeWindow* window) const {
return mWindow == window;
}
// returns true if the window was successfully added, false otherwise.
- inline bool addSharedWindow(ACameraWindowType* window) {
+ inline bool addSharedWindow(ANativeWindow* window) {
auto ret = mSharedWindows.insert(window);
return ret.second;
}
// returns the number of elements removed.
- inline size_t removeSharedWindow(ACameraWindowType* window) {
+ inline size_t removeSharedWindow(ANativeWindow* window) {
return mSharedWindows.erase(window);
}
- ACameraWindowType* mWindow;
- std::set<ACameraWindowType *> mSharedWindows;
+ ANativeWindow* mWindow;
+ std::set<ANativeWindow*> mSharedWindows;
bool mIsShared;
int mRotation = CAMERA3_STREAM_ROTATION_0;
std::string mPhysicalCameraId;
};
-#endif
struct ACaptureSessionOutputContainer {
std::set<ACaptureSessionOutput> mOutputs;
@@ -147,7 +146,7 @@
mPreparedCb.context = context;
mPreparedCb.onWindowPrepared = cb;
}
- camera_status_t prepare(ACameraWindowType *window);
+ camera_status_t prepare(ANativeWindow *window);
ACameraDevice* getDevice();