Because callbacks are called from a looper thread, if the subscriber
unsubscribes and frees the callback, invalid memory access may occur from the
looper thread.
Address this by draining all pending callbacks at the time of listener
unregistration.
NOTE: There is rare chance that the wait on the condition times out,
still resulting in the original NPE issue. We intensionally allow that
to avoid deadlock, in case the application uses the same mutex lock for
callbacks and unregister functions.
Test: for i in {1..10}; do atest -it NativeImageReaderTest; done
Test: ACameraNdkVendorTest
Bug: 148976953
Change-Id: I92f5a02a4e3e63f2e72e8043ff4f4ac16c1eec5d
Migrate BOKEH_MODE_STILL_CAPTURE and BOKEH_MODE_CONTINUOUS to be 2 enums
of CONTROL_EXTENDED_SCENE_MODE.
Test: Camera CTS, VTS
Bug: 151759402
Change-Id: Ie56c6403cd7b530356d3a007088e30730906ec65
Implementation is not complete yet, so hide the feature for now.
Test: Adjusted camera CTS continues to pass
Bug: 150036107
Change-Id: Ie112d21121693336c77700b982fc547f5cba429b
Duration keys may be missing if the device doesn't support
corresponding capture feature.
Test: build (log only change)
Bug: 150900659
Merged-In: I83e122ff08bc581ddd4bb7e304f152f612817875
Change-Id: I83e122ff08bc581ddd4bb7e304f152f612817875
The onCameraOpened/onCameraClosed callbacks are used to notify camera
service client with CAMERA_OPEN_CLOSE_LISTENER permission that a certain
camera device has been opened/closed.
Test: Manually check callbacks are received in SystemUI app
Bug: 150540299
Change-Id: If6f3624c43927c30afef7df0a780eafe3ae4c527
Instead of requiring the user to call NewGlobalRef/DeleteGlobalRef
for keeping the java object alive when creating an NDK view into it,
reference count the real native data instead, so that there's no need
to keep track of the Java object lifecycle.
- Switch CameraMetadataNative to use std::shared_ptr internally
- Switch ACameraMetadata to use std::shared_ptr internally
- Always copy data in the ACameraMetadata copy constructor
Test: New CTS tests pass, fail without this CL
Bug: 148972471
Change-Id: I40a0ccb8b40c7a89ee7d3a6f7bac7c9c88d709f1
Also fixed missing implementation of Camera availability callbacks for
ExtendedAvailabilityCallback.
Test: Camera CTS, and vndk test
Bug: 148146086
Change-Id: I557d6db3900b2346b7bc7e12cd946bc4c2dc4076
The new provider callback version enables availability callback for
physical camera.
Test: Camera CTS
Bug: 119325027
Change-Id: I22e0b669c3d9891a431e1befc7f1c9f40b826a08
Camera clients must be aware of any configured streams
that can support offline processing mode.
A few corner cases that need to be considered:
- Composite streams can support offline mode only
when all internal streams support it as well.
- Streams that use the internal camera buffer manager
will not have support for offline mode.
- Shared streams are also unsupported in offline mode.
Bug: 135142453
Test: Camera CTS
Change-Id: Idde826a6fb18a8907850e87cfe593de7cb1c5f4a
- Add NDK API spec for the new zoom API
The new zoom API combines optical and digital zoom, and supports both
zoom-out and zoom-in with more precision.
- Add new NDK API to specify separate zoom ratio ranges for different
bokeh modes.
- Add ZoomRatioMapper in camera service to convert between
control.zoomRation to and from scaler.cropRegion.
Test: Camera CTS/ITS/CtsVerifier/ZoomRatioTest
Bug: 130025314
Change-Id: I4c7d867f840b5720bc73bb0485e8a9a93d2276b5
Bug: 136595429
Test: atest CtsAppOpsTestCases (now including two new test cases that
open a camera with a null and a non-null feature)
Change-Id: Idfb8f8049dff536525d4f081151c79d980d76c69
Introduce new bokeh mode metadata tags for camera device to enable bokeh
effect.
Test: Build and read docs
Bug: 118258123
Change-Id: Iadd7c2a0edcafc516411a5a5f49ad0563e3736be
We call disconnectLocked before stopping CameraDevice's looper, in order to avoid this situation:
1) Its possible that an OnResultReceived callback is received, and posts an
AMessage with sp<ACameraCaptureSession> on CameraDevice's looper.
2) Before the looper message is processsed, ACameraDevice_close() is
called by the client, which results in the looper being stopped and
cleared with device lock held.
3) When the looper is getting cleared, the AMessage containg the
ACameraCaptureSession pointer is destructed leading to
~ACameraCaptureSession running without knowing that the device is
being closed, as a result it tries to hold device lock, resulting in
a deadlock.
Bug: 141603005
Test: CTS native tests
Test: use camera2 vndk client for extended periods of time
Change-Id: Ia0d47fc2975981055cd1f2103c1cbe8d76642fe4
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
It's possible that the following sequence happens:
1) hwbinder / binder thread T1: onResultReceived() starts -> promotes wp<CameraDevice> to sp<>;
2) Some other app thread T2 : ACameraDevice_close() -> delete ACameraDevice -> doesn't result in
CameraDevice's destructor running since mCameraDevice has another live
reference, app destroys some object O1.
3) T3 (callback looper thread): callback is received since looper is still running which accesses
dead app object O1 -> results in undefined behavior.
4) T1: onResultReceived completes and CameraDevice is destructed
We need to stop CameraDevice's looper thread (that waits for all callbacks queued to complete) in
~ACameraDevice() so we receive no callbacks after ACameraDevice is closed.
Bug: 135641415
Test: CTS native tests: no new failures
Test: AImageReaderVendorTest; enroll; while(1) auth;
Change-Id: Ia24de753f6ee409d941fff39616f09df2164880a
Merged-In: Ia24de753f6ee409d941fff39616f09df2164880a
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
(cherry picked from commit 174084011c)
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
It's possible that the following sequence happens:
1) hwbinder / binder thread T1: onResultReceived() starts -> promotes wp<CameraDevice> to sp<>;
2) Some other app thread T2 : ACameraDevice_close() -> delete ACameraDevice -> doesn't result in
CameraDevice's destructor running since mCameraDevice has another live
reference, app destroys some object O1.
3) T3 (callback looper thread): callback is received since looper is still running which accesses
dead app object O1 -> results in undefined behavior.
4) T1: onResultReceived completes and CameraDevice is destructed
We need to stop CameraDevice's looper thread (that waits for all callbacks queued to complete) in
~ACameraDevice() so we receive no callbacks after ACameraDevice is closed.
Bug: 135641415
Test: CTS native tests: no new failures
Test: AImageReaderVendorTest; enroll; while(1) auth;
Change-Id: Ia24de753f6ee409d941fff39616f09df2164880a
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
Bug: 129979644
Test: Fake SECURE_IMAGE_DATA by updating camera characteristics in
cameraserver; Retrieve capabilities in AImageReader test and
confirm that SECURE_IMAGE_DATA is supported
Test: AImageReaderVendorTest
Change-Id: Ia105969ce1df52408e6b7663a658d89f47cd90c2
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
The physical camera device ID must be present as part
of the capture result extras in case of corresponding
result failure notification.
Bug: 128835627
Test: Camera CTS,
AImageReaderVendorTest
--gtest_filter=AImageReaderVendorTest.LogicalCameraPhysicalStream
Change-Id: I042af8bd85eaadd389b059c2833f352ceb2f40fc
Camera NDK clients must receive notifications about
access permission changes.
Bug: 121379978
Test: Camera CTS
Change-Id: I66866ee3bbf7d45619995f036f19af50e812c236
Port physical camera settings support to ndk/vndk.
Test: Related camera VTS and NDK/VNDK tests pass
Bug: 115532726
Change-Id: Ie2d46b4ec041d2cec3c02145fbf06cf70eec5ac3
Camera service listeners must be able to receive
information about camera access permission changes.
Bug: 121379978
Test: Camera CTS
Change-Id: I2e13fdd35a267901a3caa0e0ce78ab1cea83e7ab
Depth jpeg image format must be available for
native clients using the Camera NDK.
Bug: 124064032
Test: Camera CTS
Change-Id: I21f14ea63fe4a568c1cfccd0dcd32fce5cad8098
- Derive HEIC capabilities from camera HAL and media framework.
- Add HeicCompositeStream to encode camera buffers to HEIC buffers.
- Add ExifUtils to overwrite JPEG APP segments and send to media codec.
- Add NDK enums and corresponding format support.
Test: Camera CTS
Bug: 79465976
Change-Id: I0a885e76335f3eba4be0fd42241edb0b7349f284
A pointer to data within CameraMetadata can become
invalid after each metadata modification. Cache any
values that could potentially point to the raw
internal metadata buffer.
Bug: 123954417
Test: Camera CTS
Change-Id: Ie5ac9600ff454af551c4cf8e0f25ba5a6a6e897d
The support inclues:
- Physical camera specific stream support,
- Physical camera result metadata, and
Test: Newly added NDK CTS test pass
Test: Newly added VNDK test pass
Bug: 120566141
Bug: 115532726
Change-Id: I939b81522ca6c518c0e54ded5d3615f9973a6a65
The error code passed to the camera2 ndk while calling the
ACameraDevice_ErrorStateCallback was the AIDL errorCode passed through
the ICameraDeviceCallbacks::onDeviceError() callback. These error codes
do not map directly, to the ones promised through the ndk in
NdkCameraDevice.h. These need to be fixed to appropriate ndk error code mappings.
Bug: 117833501
Test: GCA (sanity)
Test: CTS Native camera2 tests (sanity)
Change-Id: I65a80e4f2be5a3317a008bf0a71578e31fb45d62
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
To fix the warning in RefBase destructor.
Test: NDK CTS tests, and ARCore measure app.
Bug: 112775599
Change-Id: Ia448ac6d7e6c17699c16d287f65fc2826c9d7578
This allows camera devices to correct geometric distortion in their
optics, when requested by the application.
The correction only applies to processed (YUV, JPEG, etc) outputs,
not RAW buffers, or the result metadata.
Test: New CTS test passes
Bug: 74434422
Change-Id: I77a84c1321058ab6637be2fffaca19a27f46dca1
- Add physical camera metadata in capture result.
- Adjust capture_result book-keeping for physical capture result.
- Adapt to new version of ICameraDeviceCallback.
- Batch physical metadata with logical metadata within one
process_capture_result call.
Test: testLogicalCameraTest CTS test
Bug: 64691172
Change-Id: I63fd343770cbb6183b7c6e4566c698f69801a8e8