summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 05:02:31 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 05:02:31 +0000
commit29b5649a831bd4a9e611cd4ba992808b1100cb99 (patch)
tree17efbfdf7029d2d63d910c0f81f6a409a4636567
parentc9cb6ec6787b9a0e9c3be79fae472623db03657d (diff)
parentfc75eb2e99169d3f61c2e7f76beb8e5d6125fb82 (diff)
downloadinterfaces-android14-mainline-extservices-release.tar.gz
Snap for 10453563 from fc75eb2e99169d3f61c2e7f76beb8e5d6125fb82 to mainline-extservices-releaseaml_ext_341620040aml_ext_341518010aml_ext_341414010aml_ext_341317010aml_ext_341131030aml_ext_341027030android14-mainline-extservices-release
Change-Id: I7c7c360df08a53934c5b458ee77417aaa8059327
-rw-r--r--PREUPLOAD.cfg1
-rw-r--r--TEST_MAPPING5
-rw-r--r--automotive/OWNERS4
-rw-r--r--automotive/display/aidl/Android.bp13
-rw-r--r--automotive/display/aidl/aidl_api/android.frameworks.automotive.display/2/.hash1
-rw-r--r--automotive/display/aidl/aidl_api/android.frameworks.automotive.display/2/android/frameworks/automotive/display/DisplayDesc.aidl41
-rw-r--r--automotive/display/aidl/aidl_api/android.frameworks.automotive.display/2/android/frameworks/automotive/display/ICarDisplayProxy.aidl46
-rw-r--r--automotive/display/aidl/aidl_api/android.frameworks.automotive.display/2/android/frameworks/automotive/display/Rotation.aidl41
-rw-r--r--automotive/display/aidl/aidl_api/android.frameworks.automotive.display/current/android/frameworks/automotive/display/ICarDisplayProxy.aidl4
-rw-r--r--automotive/display/aidl/android/frameworks/automotive/display/ICarDisplayProxy.aidl24
-rw-r--r--automotive/display/aidl/vts/functional/Android.bp53
-rw-r--r--automotive/display/aidl/vts/functional/VtsHalCarDisplayTargetTest.cpp157
-rw-r--r--automotive/powerpolicy/aidl/Android.bp13
-rw-r--r--automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/2/.hash1
-rw-r--r--automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/2/android/frameworks/automotive/powerpolicy/CarPowerPolicy.aidl42
-rw-r--r--automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/2/android/frameworks/automotive/powerpolicy/CarPowerPolicyFilter.aidl39
-rw-r--r--automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/2/android/frameworks/automotive/powerpolicy/ICarPowerPolicyChangeCallback.aidl38
-rw-r--r--automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/2/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl41
-rw-r--r--automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/2/android/frameworks/automotive/powerpolicy/PowerComponent.aidl54
-rw-r--r--automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/CarPowerPolicy.aidl5
-rw-r--r--automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/CarPowerPolicyFilter.aidl4
-rw-r--r--automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/ICarPowerPolicyChangeCallback.aidl3
-rw-r--r--automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl3
-rw-r--r--automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/PowerComponent.aidl4
-rw-r--r--automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/CarPowerPolicy.aidl10
-rw-r--r--automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/CarPowerPolicyFilter.aidl5
-rw-r--r--automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/PowerComponent.aidl5
-rw-r--r--automotive/powerpolicy/aidl/vts/Android.bp4
-rw-r--r--automotive/powerpolicy/aidl/vts/VtsAidlPowerPolicyTargetTest.cpp9
-rw-r--r--automotive/telemetry/aidl/Android.bp17
-rw-r--r--automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/2/.hash1
-rw-r--r--automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/2/android/frameworks/automotive/telemetry/CallbackConfig.aidl38
-rw-r--r--automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/2/android/frameworks/automotive/telemetry/CarData.aidl39
-rw-r--r--automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/2/android/frameworks/automotive/telemetry/ICarTelemetry.aidl40
-rw-r--r--automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/2/android/frameworks/automotive/telemetry/ICarTelemetryCallback.aidl38
-rw-r--r--automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/current/android/frameworks/automotive/telemetry/CallbackConfig.aidl38
-rw-r--r--automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/current/android/frameworks/automotive/telemetry/ICarTelemetry.aidl2
-rw-r--r--automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/current/android/frameworks/automotive/telemetry/ICarTelemetryCallback.aidl38
-rw-r--r--automotive/telemetry/aidl/android/frameworks/automotive/telemetry/CallbackConfig.aidl34
-rw-r--r--automotive/telemetry/aidl/android/frameworks/automotive/telemetry/ICarTelemetry.aidl19
-rw-r--r--automotive/telemetry/aidl/android/frameworks/automotive/telemetry/ICarTelemetryCallback.aidl35
-rw-r--r--automotive/telemetry/aidl/vts/functional/Android.bp2
-rw-r--r--automotive/telemetry/aidl/vts/functional/VtsHalCarTelemetryTest.cpp61
-rw-r--r--cameraservice/common/aidl/Android.bp32
-rw-r--r--cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/.hash1
-rw-r--r--cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/android/frameworks/cameraservice/common/CameraMetadataType.aidl43
-rw-r--r--cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/android/frameworks/cameraservice/common/ProviderIdAndVendorTagSections.aidl39
-rw-r--r--cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/android/frameworks/cameraservice/common/Status.aidl49
-rw-r--r--cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/android/frameworks/cameraservice/common/TagBoundaryId.aidl39
-rw-r--r--cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/android/frameworks/cameraservice/common/VendorTag.aidl40
-rw-r--r--cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/android/frameworks/cameraservice/common/VendorTagSection.aidl39
-rw-r--r--cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/current/android/frameworks/cameraservice/common/CameraMetadataType.aidl43
-rw-r--r--cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/current/android/frameworks/cameraservice/common/ProviderIdAndVendorTagSections.aidl39
-rw-r--r--cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/current/android/frameworks/cameraservice/common/Status.aidl49
-rw-r--r--cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/current/android/frameworks/cameraservice/common/TagBoundaryId.aidl39
-rw-r--r--cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/current/android/frameworks/cameraservice/common/VendorTag.aidl40
-rw-r--r--cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/current/android/frameworks/cameraservice/common/VendorTagSection.aidl39
-rw-r--r--cameraservice/common/aidl/android/frameworks/cameraservice/common/CameraMetadataType.aidl49
-rw-r--r--cameraservice/common/aidl/android/frameworks/cameraservice/common/ProviderIdAndVendorTagSections.aidl31
-rw-r--r--cameraservice/common/aidl/android/frameworks/cameraservice/common/Status.aidl78
-rw-r--r--cameraservice/common/aidl/android/frameworks/cameraservice/common/TagBoundaryId.aidl33
-rw-r--r--cameraservice/common/aidl/android/frameworks/cameraservice/common/VendorTag.aidl37
-rw-r--r--cameraservice/common/aidl/android/frameworks/cameraservice/common/VendorTagSection.aidl34
-rw-r--r--cameraservice/device/aidl/Android.bp41
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/.hash1
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/CameraMetadata.aidl38
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/CaptureMetadataInfo.aidl39
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/CaptureRequest.aidl39
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/CaptureResultExtras.aidl43
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/ErrorCode.aidl46
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/ICameraDeviceCallback.aidl43
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/ICameraDeviceUser.aidl52
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/OutputConfiguration.aidl55
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/PhysicalCameraSettings.aidl39
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/PhysicalCaptureResultInfo.aidl39
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/SessionConfiguration.aidl42
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/StreamAndWindowId.aidl39
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/StreamConfigurationMode.aidl47
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/SubmitInfo.aidl39
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/TemplateId.aidl43
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/CameraMetadata.aidl38
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/CaptureMetadataInfo.aidl39
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/CaptureRequest.aidl39
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/CaptureResultExtras.aidl43
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/ErrorCode.aidl46
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/ICameraDeviceCallback.aidl43
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/ICameraDeviceUser.aidl52
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/OutputConfiguration.aidl55
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/PhysicalCameraSettings.aidl39
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/PhysicalCaptureResultInfo.aidl39
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/SessionConfiguration.aidl42
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/StreamAndWindowId.aidl39
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/StreamConfigurationMode.aidl47
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/SubmitInfo.aidl39
-rw-r--r--cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/TemplateId.aidl43
-rw-r--r--cameraservice/device/aidl/android/frameworks/cameraservice/device/CameraMetadata.aidl30
-rw-r--r--cameraservice/device/aidl/android/frameworks/cameraservice/device/CaptureMetadataInfo.aidl32
-rw-r--r--cameraservice/device/aidl/android/frameworks/cameraservice/device/CaptureRequest.aidl40
-rw-r--r--cameraservice/device/aidl/android/frameworks/cameraservice/device/CaptureResultExtras.aidl53
-rw-r--r--cameraservice/device/aidl/android/frameworks/cameraservice/device/ErrorCode.aidl69
-rw-r--r--cameraservice/device/aidl/android/frameworks/cameraservice/device/ICameraDeviceCallback.aidl86
-rw-r--r--cameraservice/device/aidl/android/frameworks/cameraservice/device/ICameraDeviceUser.aidl265
-rw-r--r--cameraservice/device/aidl/android/frameworks/cameraservice/device/OutputConfiguration.aidl100
-rw-r--r--cameraservice/device/aidl/android/frameworks/cameraservice/device/PhysicalCameraSettings.aidl29
-rw-r--r--cameraservice/device/aidl/android/frameworks/cameraservice/device/PhysicalCaptureResultInfo.aidl29
-rw-r--r--cameraservice/device/aidl/android/frameworks/cameraservice/device/SessionConfiguration.aidl51
-rw-r--r--cameraservice/device/aidl/android/frameworks/cameraservice/device/StreamAndWindowId.aidl35
-rw-r--r--cameraservice/device/aidl/android/frameworks/cameraservice/device/StreamConfigurationMode.aidl52
-rw-r--r--cameraservice/device/aidl/android/frameworks/cameraservice/device/SubmitInfo.aidl30
-rw-r--r--cameraservice/device/aidl/android/frameworks/cameraservice/device/TemplateId.aidl62
-rw-r--r--cameraservice/service/aidl/Android.bp39
-rw-r--r--cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/1/.hash1
-rw-r--r--cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/1/android/frameworks/cameraservice/service/CameraDeviceStatus.aidl42
-rw-r--r--cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/1/android/frameworks/cameraservice/service/CameraStatusAndId.aidl40
-rw-r--r--cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/1/android/frameworks/cameraservice/service/ICameraService.aidl42
-rw-r--r--cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/1/android/frameworks/cameraservice/service/ICameraServiceListener.aidl39
-rw-r--r--cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/current/android/frameworks/cameraservice/service/CameraDeviceStatus.aidl42
-rw-r--r--cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/current/android/frameworks/cameraservice/service/CameraStatusAndId.aidl40
-rw-r--r--cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/current/android/frameworks/cameraservice/service/ICameraService.aidl42
-rw-r--r--cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/current/android/frameworks/cameraservice/service/ICameraServiceListener.aidl39
-rw-r--r--cameraservice/service/aidl/android/frameworks/cameraservice/service/CameraDeviceStatus.aidl47
-rw-r--r--cameraservice/service/aidl/android/frameworks/cameraservice/service/CameraStatusAndId.aidl33
-rw-r--r--cameraservice/service/aidl/android/frameworks/cameraservice/service/ICameraService.aidl111
-rw-r--r--cameraservice/service/aidl/android/frameworks/cameraservice/service/ICameraServiceListener.aidl44
-rw-r--r--cameraservice/vts/functional/Android.bp30
-rw-r--r--cameraservice/vts/functional/VtsAidlCameraServiceTargetTest.cpp598
-rw-r--r--location/OWNERS1
-rw-r--r--location/altitude/aidl/Android.bp44
-rw-r--r--location/altitude/aidl/aidl_api/android.frameworks.location.altitude/1/.hash1
-rw-r--r--location/altitude/aidl/aidl_api/android.frameworks.location.altitude/1/android/frameworks/location/altitude/AddMslAltitudeToLocationRequest.aidl41
-rw-r--r--location/altitude/aidl/aidl_api/android.frameworks.location.altitude/1/android/frameworks/location/altitude/AddMslAltitudeToLocationResponse.aidl39
-rw-r--r--location/altitude/aidl/aidl_api/android.frameworks.location.altitude/1/android/frameworks/location/altitude/IAltitudeService.aidl38
-rw-r--r--location/altitude/aidl/aidl_api/android.frameworks.location.altitude/current/android/frameworks/location/altitude/AddMslAltitudeToLocationRequest.aidl41
-rw-r--r--location/altitude/aidl/aidl_api/android.frameworks.location.altitude/current/android/frameworks/location/altitude/AddMslAltitudeToLocationResponse.aidl39
-rw-r--r--location/altitude/aidl/aidl_api/android.frameworks.location.altitude/current/android/frameworks/location/altitude/IAltitudeService.aidl38
-rw-r--r--location/altitude/aidl/android/frameworks/location/altitude/AddMslAltitudeToLocationRequest.aidl33
-rw-r--r--location/altitude/aidl/android/frameworks/location/altitude/AddMslAltitudeToLocationResponse.aidl27
-rw-r--r--location/altitude/aidl/android/frameworks/location/altitude/IAltitudeService.aidl31
-rw-r--r--location/altitude/aidl/vts/functional/Android.bp44
-rw-r--r--location/altitude/aidl/vts/functional/VtsHalAltitudeServiceTargetTest.cpp70
-rw-r--r--sensorservice/aidl/Android.bp34
-rw-r--r--sensorservice/aidl/aidl_api/android.frameworks.sensorservice/1/.hash1
-rw-r--r--sensorservice/aidl/aidl_api/android.frameworks.sensorservice/1/android/frameworks/sensorservice/IDirectReportChannel.aidl23
-rw-r--r--sensorservice/aidl/aidl_api/android.frameworks.sensorservice/1/android/frameworks/sensorservice/IEventQueue.aidl24
-rw-r--r--sensorservice/aidl/aidl_api/android.frameworks.sensorservice/1/android/frameworks/sensorservice/IEventQueueCallback.aidl23
-rw-r--r--sensorservice/aidl/aidl_api/android.frameworks.sensorservice/1/android/frameworks/sensorservice/ISensorManager.aidl34
-rw-r--r--sensorservice/aidl/aidl_api/android.frameworks.sensorservice/current/android/frameworks/sensorservice/IDirectReportChannel.aidl23
-rw-r--r--sensorservice/aidl/aidl_api/android.frameworks.sensorservice/current/android/frameworks/sensorservice/IEventQueue.aidl24
-rw-r--r--sensorservice/aidl/aidl_api/android.frameworks.sensorservice/current/android/frameworks/sensorservice/IEventQueueCallback.aidl23
-rw-r--r--sensorservice/aidl/aidl_api/android.frameworks.sensorservice/current/android/frameworks/sensorservice/ISensorManager.aidl34
-rw-r--r--sensorservice/aidl/android/frameworks/sensorservice/IDirectReportChannel.aidl41
-rw-r--r--sensorservice/aidl/android/frameworks/sensorservice/IEventQueue.aidl40
-rw-r--r--sensorservice/aidl/android/frameworks/sensorservice/IEventQueueCallback.aidl22
-rw-r--r--sensorservice/aidl/android/frameworks/sensorservice/ISensorManager.aidl111
-rw-r--r--sensorservice/aidl/vts/Android.bp49
-rw-r--r--sensorservice/aidl/vts/VtsHalSensorManagerTargetTest.cpp260
-rw-r--r--sensorservice/libsensorndkbridge/ALooper.cpp18
-rw-r--r--sensorservice/libsensorndkbridge/ALooper.h8
-rw-r--r--sensorservice/libsensorndkbridge/ASensorEventQueue.cpp32
-rw-r--r--sensorservice/libsensorndkbridge/ASensorEventQueue.h23
-rw-r--r--sensorservice/libsensorndkbridge/ASensorManager.cpp136
-rw-r--r--sensorservice/libsensorndkbridge/ASensorManager.h25
-rw-r--r--sensorservice/libsensorndkbridge/Android.bp20
-rw-r--r--sensorservice/utils/Android.bp31
-rw-r--r--sensorservice/utils/direct_channel_buffer_reader.cc140
-rw-r--r--sensorservice/utils/direct_channel_buffer_reader.h138
-rw-r--r--sensorservice/utils/direct_channel_buffer_reader_test.cc337
-rw-r--r--stats/aidl/Android.bp16
-rw-r--r--stats/aidl/TEST_MAPPING7
-rw-r--r--stats/aidl/aidl_api/android.frameworks.stats/2/.hash1
-rw-r--r--stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/Annotation.aidl39
-rw-r--r--stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/AnnotationId.aidl56
-rw-r--r--stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/AnnotationSet.aidl39
-rw-r--r--stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/AnnotationValue.aidl39
-rw-r--r--stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/IStats.aidl38
-rw-r--r--stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/RestrictionCategory.aidl42
-rw-r--r--stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/VendorAtom.aidl42
-rw-r--r--stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/VendorAtomValue.aidl48
-rw-r--r--stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/Annotation.aidl39
-rw-r--r--stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/AnnotationId.aidl56
-rw-r--r--stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/AnnotationSet.aidl39
-rw-r--r--stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/AnnotationValue.aidl39
-rw-r--r--stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/RestrictionCategory.aidl42
-rw-r--r--stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/VendorAtom.aidl2
-rw-r--r--stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/VendorAtomValue.aidl7
-rw-r--r--stats/aidl/android/frameworks/stats/Annotation.aidl28
-rw-r--r--stats/aidl/android/frameworks/stats/AnnotationId.aidl127
-rw-r--r--stats/aidl/android/frameworks/stats/AnnotationSet.aidl34
-rw-r--r--stats/aidl/android/frameworks/stats/AnnotationValue.aidl25
-rw-r--r--stats/aidl/android/frameworks/stats/RestrictionCategory.aidl46
-rw-r--r--stats/aidl/android/frameworks/stats/VendorAtom.aidl41
-rw-r--r--stats/aidl/android/frameworks/stats/VendorAtomValue.aidl7
-rw-r--r--stats/aidl/test_client/AidlStatsClient.cpp120
-rw-r--r--stats/aidl/test_client/Android.bp2
-rw-r--r--stats/aidl/vts/OWNERS7
-rw-r--r--stats/aidl/vts/functional/Android.bp2
-rw-r--r--stats/aidl/vts/functional/VtsHalStatsTargetTest.cpp28
-rw-r--r--stats/aidl/vts/java/Android.bp55
-rw-r--r--stats/aidl/vts/java/AndroidManifest.xml29
-rw-r--r--stats/aidl/vts/java/AndroidTest.xml31
-rw-r--r--stats/aidl/vts/java/apps/vtsistatsapp/Android.bp36
-rw-r--r--stats/aidl/vts/java/apps/vtsistatsapp/AndroidManifest.xml29
-rw-r--r--stats/aidl/vts/java/apps/vtsistatsapp/src/VtsVendorAtomJavaTest.java147
-rw-r--r--stats/aidl/vts/java/src/com/android/vts/istats/VendorAtomTests.java160
-rw-r--r--stats/aidl/vts/java/test_vendor_atom.proto57
205 files changed, 8973 insertions, 175 deletions
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
index 213c93a..18b0a1b 100644
--- a/PREUPLOAD.cfg
+++ b/PREUPLOAD.cfg
@@ -3,3 +3,4 @@ ignore_merged_commits = true
[Builtin Hooks]
clang_format = true
+bpfmt = true
diff --git a/TEST_MAPPING b/TEST_MAPPING
index e165df0..1993efe 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -3,6 +3,11 @@
{
"name": "hal_implementation_test"
}
+ ],
+ "auto-presubmit": [
+ {
+ "name": "hal_implementation_test"
+ }
]
}
diff --git a/automotive/OWNERS b/automotive/OWNERS
index e34575b..09e257c 100644
--- a/automotive/OWNERS
+++ b/automotive/OWNERS
@@ -1,3 +1 @@
-gurunagarajan@google.com
-keunyoung@google.com
-sgurun@google.com
+include platform/packages/services/Car:/OWNERS
diff --git a/automotive/display/aidl/Android.bp b/automotive/display/aidl/Android.bp
index 7edde63..8b2b7af 100644
--- a/automotive/display/aidl/Android.bp
+++ b/automotive/display/aidl/Android.bp
@@ -22,6 +22,9 @@ aidl_interface {
srcs: ["android/frameworks/automotive/display/*.aidl"],
stability: "vintf",
imports: ["android.hardware.common-V2"],
+ include_dirs: [
+ "frameworks/native/aidl/gui",
+ ],
backend: {
cpp: {
enabled: false,
@@ -34,6 +37,9 @@ aidl_interface {
vndk: {
enabled: false,
},
+ additional_shared_libraries: [
+ "libnativewindow",
+ ],
},
},
versions_with_info: [
@@ -41,6 +47,11 @@ aidl_interface {
version: "1",
imports: ["android.hardware.common-V2"],
},
- ],
+ {
+ version: "2",
+ imports: ["android.hardware.common-V2"],
+ },
+ ],
+ frozen: true,
}
diff --git a/automotive/display/aidl/aidl_api/android.frameworks.automotive.display/2/.hash b/automotive/display/aidl/aidl_api/android.frameworks.automotive.display/2/.hash
new file mode 100644
index 0000000..7e91586
--- /dev/null
+++ b/automotive/display/aidl/aidl_api/android.frameworks.automotive.display/2/.hash
@@ -0,0 +1 @@
+c9dbd700b8b71be6703e499f4ff798be245b088e
diff --git a/automotive/display/aidl/aidl_api/android.frameworks.automotive.display/2/android/frameworks/automotive/display/DisplayDesc.aidl b/automotive/display/aidl/aidl_api/android.frameworks.automotive.display/2/android/frameworks/automotive/display/DisplayDesc.aidl
new file mode 100644
index 0000000..476f79f
--- /dev/null
+++ b/automotive/display/aidl/aidl_api/android.frameworks.automotive.display/2/android/frameworks/automotive/display/DisplayDesc.aidl
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.display;
+@VintfStability
+parcelable DisplayDesc {
+ int width;
+ int height;
+ long layer;
+ android.frameworks.automotive.display.Rotation orientation;
+}
diff --git a/automotive/display/aidl/aidl_api/android.frameworks.automotive.display/2/android/frameworks/automotive/display/ICarDisplayProxy.aidl b/automotive/display/aidl/aidl_api/android.frameworks.automotive.display/2/android/frameworks/automotive/display/ICarDisplayProxy.aidl
new file mode 100644
index 0000000..0a40d16
--- /dev/null
+++ b/automotive/display/aidl/aidl_api/android.frameworks.automotive.display/2/android/frameworks/automotive/display/ICarDisplayProxy.aidl
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.display;
+@VintfStability
+interface ICarDisplayProxy {
+ long[] getDisplayIdList();
+ android.frameworks.automotive.display.DisplayDesc getDisplayInfo(in long id);
+ /**
+ * @deprecated As of android.frameworks.automotive.display-V2, this method is deprecated and replaced with getSurface().
+ */
+ android.hardware.common.NativeHandle getHGraphicBufferProducer(in long id);
+ void hideWindow(in long id);
+ void showWindow(in long id);
+ android.view.Surface getSurface(in long id);
+}
diff --git a/automotive/display/aidl/aidl_api/android.frameworks.automotive.display/2/android/frameworks/automotive/display/Rotation.aidl b/automotive/display/aidl/aidl_api/android.frameworks.automotive.display/2/android/frameworks/automotive/display/Rotation.aidl
new file mode 100644
index 0000000..8c4c374
--- /dev/null
+++ b/automotive/display/aidl/aidl_api/android.frameworks.automotive.display/2/android/frameworks/automotive/display/Rotation.aidl
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.display;
+@Backing(type="int") @VintfStability
+enum Rotation {
+ ROTATION_0 = 0,
+ ROTATION_90 = 1,
+ ROTATION_180 = 2,
+ ROTATION_270 = 3,
+}
diff --git a/automotive/display/aidl/aidl_api/android.frameworks.automotive.display/current/android/frameworks/automotive/display/ICarDisplayProxy.aidl b/automotive/display/aidl/aidl_api/android.frameworks.automotive.display/current/android/frameworks/automotive/display/ICarDisplayProxy.aidl
index 643623a..0a40d16 100644
--- a/automotive/display/aidl/aidl_api/android.frameworks.automotive.display/current/android/frameworks/automotive/display/ICarDisplayProxy.aidl
+++ b/automotive/display/aidl/aidl_api/android.frameworks.automotive.display/current/android/frameworks/automotive/display/ICarDisplayProxy.aidl
@@ -36,7 +36,11 @@ package android.frameworks.automotive.display;
interface ICarDisplayProxy {
long[] getDisplayIdList();
android.frameworks.automotive.display.DisplayDesc getDisplayInfo(in long id);
+ /**
+ * @deprecated As of android.frameworks.automotive.display-V2, this method is deprecated and replaced with getSurface().
+ */
android.hardware.common.NativeHandle getHGraphicBufferProducer(in long id);
void hideWindow(in long id);
void showWindow(in long id);
+ android.view.Surface getSurface(in long id);
}
diff --git a/automotive/display/aidl/android/frameworks/automotive/display/ICarDisplayProxy.aidl b/automotive/display/aidl/android/frameworks/automotive/display/ICarDisplayProxy.aidl
index e09c4bc..e79e549 100644
--- a/automotive/display/aidl/android/frameworks/automotive/display/ICarDisplayProxy.aidl
+++ b/automotive/display/aidl/android/frameworks/automotive/display/ICarDisplayProxy.aidl
@@ -18,16 +18,21 @@ package android.frameworks.automotive.display;
import android.frameworks.automotive.display.DisplayDesc;
import android.hardware.common.NativeHandle;
+import android.view.Surface;
/**
* ICarDisplayProxy is an interface implemented by the car display proxy daemon and allows
* the vendor processes to render their contents on the display via SurfaceFlinger.
*
- * To obtain a Surface associated with the target display, a client needs to call
+ * A client can obtain a Surface associated with the target display via
+ * ICarDisplayProxy.getSurface() and control the visibility of the target surface via
+ * ICarDisplayProxy.showWindow() and ICarDisplayProxy.hideWindow().
+ *
+ * If a client uses ICarDisplayProxy.getHGraphicBufferProducer(), which is deprecated with
+ * android.frameworks.automotive.display-V2, a client should call
* ICarDisplayProxy.getHGraphicBufferProducer() and convert a returned NativeHandle into
* HGraphicBufferProducer. libbufferqueueconverter provides getSurfaceFromHGPB() to get
- * the surface from a converted HGraphicBufferProducer. A client can control the visibility
- * of a target surface via ICarDisplayProxy.showWindow() and ICarDisplayProxy.hideWindow().
+ * the surface from a converted HGraphicBufferProducer.
*/
@VintfStability
interface ICarDisplayProxy {
@@ -55,6 +60,8 @@ interface ICarDisplayProxy {
* @throws STATUS_FAILED_TRANSACTION if it fails to create the surface or read the display
* information
* STATUS_BAD_VALUE if it fails to create HGraphicBufferProducer
+ * @deprecated As of android.frameworks.automotive.display-V2, this method is deprecated and
+ * replaced with getSurface().
*/
NativeHandle getHGraphicBufferProducer(in long id);
@@ -77,4 +84,15 @@ interface ICarDisplayProxy {
* Other STATUS_* if it fails to apply a SurfaceFlinger transaction.
*/
void showWindow(in long id);
+
+ /**
+ * Gets a Surface associated with the target display.
+ *
+ * @param in id A stable ID of a target display.
+ * @return android.view.Surface object.
+ * @throws STATUS_FAILED_TRANSACTION if it fails to create the surface or read the display
+ * information
+ * STATUS_BAD_VALUE if it fails to create a Surface object.
+ */
+ Surface getSurface(in long id);
}
diff --git a/automotive/display/aidl/vts/functional/Android.bp b/automotive/display/aidl/vts/functional/Android.bp
new file mode 100644
index 0000000..657e47b
--- /dev/null
+++ b/automotive/display/aidl/vts/functional/Android.bp
@@ -0,0 +1,53 @@
+//
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+cc_test {
+ name: "VtsHalCarDisplayTargetTest",
+ srcs: [
+ ":libgui_frame_event_aidl",
+ "./**/*.cpp",
+ ],
+ defaults: [
+ "VtsHalTargetTestDefaults",
+ "use_libaidlvintf_gtest_helper_static",
+ ],
+ shared_libs: [
+ "android.hardware.graphics.bufferqueue@2.0",
+ "android.hidl.token@1.0-utils",
+ "libbinder",
+ "libbinder_ndk",
+ "libnativewindow",
+ "libui",
+ "libgui",
+ ],
+ static_libs: [
+ "android.frameworks.automotive.display-V2-ndk",
+ "android.hardware.common-V2-ndk",
+ "libaidlcommonsupport",
+ "libbufferqueueconverter",
+ ],
+ header_libs: [
+ "libgui_aidl_headers",
+ ],
+ test_suites: [
+ "general-tests",
+ "vts",
+ ],
+}
diff --git a/automotive/display/aidl/vts/functional/VtsHalCarDisplayTargetTest.cpp b/automotive/display/aidl/vts/functional/VtsHalCarDisplayTargetTest.cpp
new file mode 100644
index 0000000..b3e4b5b
--- /dev/null
+++ b/automotive/display/aidl/vts/functional/VtsHalCarDisplayTargetTest.cpp
@@ -0,0 +1,157 @@
+/*
+ * Copyright (C) 2023 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 "VtsHalCarDisplayTest"
+
+#include <aidl/Gtest.h>
+#include <aidl/Vintf.h>
+#include <aidl/android/frameworks/automotive/display/DisplayDesc.h>
+#include <aidl/android/frameworks/automotive/display/ICarDisplayProxy.h>
+#include <aidlcommonsupport/NativeHandle.h>
+#include <android-base/logging.h>
+#include <android/binder_ibinder.h>
+#include <android/binder_manager.h>
+#include <android/binder_process.h>
+#include <android/binder_status.h>
+#include <bufferqueueconverter/BufferQueueConverter.h>
+
+namespace {
+
+using ::aidl::android::frameworks::automotive::display::DisplayDesc;
+using ::aidl::android::frameworks::automotive::display::ICarDisplayProxy;
+using ::aidl::android::hardware::common::NativeHandle;
+
+android::sp<HGraphicBufferProducer> convertNativeHandleToHGBP(const NativeHandle& aidlHandle) {
+ native_handle_t* handle = ::android::dupFromAidl(aidlHandle);
+ if (handle == nullptr || handle->numFds != 0 ||
+ handle->numInts < std::ceil(sizeof(size_t) / sizeof(int))) {
+ LOG(ERROR) << "Invalid native handle";
+ return nullptr;
+ }
+ android::hardware::hidl_vec<uint8_t> halToken;
+ halToken.setToExternal(reinterpret_cast<uint8_t*>(const_cast<int*>(&(handle->data[1]))),
+ handle->data[0]);
+ android::sp<HGraphicBufferProducer> hgbp =
+ HGraphicBufferProducer::castFrom(::android::retrieveHalInterface(halToken));
+ return std::move(hgbp);
+}
+
+} // namespace
+
+// The main test class for Automotive Display Service
+class CarDisplayAidlTest : public ::testing::TestWithParam<std::string> {
+ public:
+ void SetUp() override {
+ // Make sure we can connect to the service
+ std::string serviceName = GetParam();
+ AIBinder* binder = AServiceManager_waitForService(serviceName.data());
+ ASSERT_NE(binder, nullptr);
+ mDisplayProxy = ICarDisplayProxy::fromBinder(ndk::SpAIBinder(binder));
+ ASSERT_NE(mDisplayProxy, nullptr);
+ LOG(INFO) << "Test target service: " << serviceName;
+
+ loadDisplayList();
+ }
+
+ void TearDown() override {
+ mDisplayProxy.reset();
+ mDisplayIds.clear();
+ }
+
+ protected:
+ void loadDisplayList() {
+ ASSERT_TRUE(mDisplayProxy->getDisplayIdList(&mDisplayIds).isOk());
+ LOG(INFO) << "We have " << mDisplayIds.size() << " displays.";
+ }
+
+ std::shared_ptr<ICarDisplayProxy> mDisplayProxy;
+ std::vector<int64_t> mDisplayIds;
+};
+
+TEST_P(CarDisplayAidlTest, getIGBPObject) {
+ LOG(INFO) << "Test getHGraphicBufferProducer method";
+
+ for (const auto& id : mDisplayIds) {
+ // Get a display info.
+ DisplayDesc desc;
+ ASSERT_TRUE(mDisplayProxy->getDisplayInfo(id, &desc).isOk());
+
+ // Get a HGBP object as a native handle object.
+ NativeHandle handle;
+ ASSERT_TRUE(mDisplayProxy->getHGraphicBufferProducer(id, &handle).isOk());
+
+ // Convert a native handle object into a HGBP object.
+ android::sp<android::hardware::graphics::bufferqueue::V2_0::IGraphicBufferProducer>
+ gfxBufferProducer = convertNativeHandleToHGBP(handle);
+ ASSERT_NE(gfxBufferProducer, nullptr);
+
+ // Create a Surface object.
+ android::SurfaceHolderUniquePtr surfaceHolder = getSurfaceFromHGBP(gfxBufferProducer);
+ ASSERT_NE(surfaceHolder, nullptr);
+
+ // Verify the size.
+ ANativeWindow* nativeWindow = getNativeWindow(surfaceHolder.get());
+ ASSERT_EQ(desc.width, ANativeWindow_getWidth(nativeWindow));
+ ASSERT_EQ(desc.height, ANativeWindow_getHeight(nativeWindow));
+ }
+}
+
+TEST_P(CarDisplayAidlTest, showWindow) {
+ LOG(INFO) << "Test showWindow method";
+ for (const auto& id : mDisplayIds) {
+ ASSERT_TRUE(mDisplayProxy->showWindow(id).isOk());
+ }
+}
+
+TEST_P(CarDisplayAidlTest, hideWindow) {
+ LOG(INFO) << "Test hideWindow method";
+
+ for (const auto& id : mDisplayIds) {
+ ASSERT_TRUE(mDisplayProxy->hideWindow(id).isOk());
+ }
+}
+
+TEST_P(CarDisplayAidlTest, getSurface) {
+ LOG(INFO) << "Test getSurface method";
+
+ for (const auto& id : mDisplayIds) {
+ // Get a display info.
+ DisplayDesc desc;
+ ASSERT_TRUE(mDisplayProxy->getDisplayInfo(id, &desc).isOk());
+
+ // Get a Surface object.
+ aidl::android::view::Surface shimSurface;
+ ASSERT_TRUE(mDisplayProxy->getSurface(id, &shimSurface).isOk());
+
+ // Verify the size.
+ ANativeWindow* nativeWindow = shimSurface.get();
+ ASSERT_EQ(desc.width, ANativeWindow_getWidth(nativeWindow));
+ ASSERT_EQ(desc.height, ANativeWindow_getHeight(nativeWindow));
+ }
+}
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(CarDisplayAidlTest);
+INSTANTIATE_TEST_SUITE_P(
+ PerInstance, CarDisplayAidlTest,
+ testing::ValuesIn(android::getAidlHalInstanceNames(ICarDisplayProxy::descriptor)),
+ android::PrintInstanceNameToString);
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ ABinderProcess_setThreadPoolMaxThreadCount(/* numThreads= */ 1);
+ ABinderProcess_startThreadPool();
+ return RUN_ALL_TESTS();
+}
diff --git a/automotive/powerpolicy/aidl/Android.bp b/automotive/powerpolicy/aidl/Android.bp
index 97fd58d..6fbe047 100644
--- a/automotive/powerpolicy/aidl/Android.bp
+++ b/automotive/powerpolicy/aidl/Android.bp
@@ -38,7 +38,18 @@ aidl_interface {
enabled: true,
},
},
- versions: ["1"],
+ versions_with_info: [
+ {
+ version: "1",
+ imports: [],
+ },
+ {
+ version: "2",
+ imports: [],
+ },
+
+ ],
+ frozen: true,
}
aidl_interface {
diff --git a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/2/.hash b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/2/.hash
new file mode 100644
index 0000000..ec975f3
--- /dev/null
+++ b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/2/.hash
@@ -0,0 +1 @@
+94ecd099d77943d070e40a17a65389d2c1f1445d
diff --git a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/2/android/frameworks/automotive/powerpolicy/CarPowerPolicy.aidl b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/2/android/frameworks/automotive/powerpolicy/CarPowerPolicy.aidl
new file mode 100644
index 0000000..dced3c4
--- /dev/null
+++ b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/2/android/frameworks/automotive/powerpolicy/CarPowerPolicy.aidl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.powerpolicy;
+@VintfStability
+parcelable CarPowerPolicy {
+ @utf8InCpp String policyId;
+ android.frameworks.automotive.powerpolicy.PowerComponent[] enabledComponents;
+ android.frameworks.automotive.powerpolicy.PowerComponent[] disabledComponents;
+ int[] enabledCustomComponents = {};
+ int[] disabledCustomComponents = {};
+}
diff --git a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/2/android/frameworks/automotive/powerpolicy/CarPowerPolicyFilter.aidl b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/2/android/frameworks/automotive/powerpolicy/CarPowerPolicyFilter.aidl
new file mode 100644
index 0000000..e2d0f8a
--- /dev/null
+++ b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/2/android/frameworks/automotive/powerpolicy/CarPowerPolicyFilter.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.powerpolicy;
+@VintfStability
+parcelable CarPowerPolicyFilter {
+ android.frameworks.automotive.powerpolicy.PowerComponent[] components;
+ int[] customComponents = {};
+}
diff --git a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/2/android/frameworks/automotive/powerpolicy/ICarPowerPolicyChangeCallback.aidl b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/2/android/frameworks/automotive/powerpolicy/ICarPowerPolicyChangeCallback.aidl
new file mode 100644
index 0000000..c5574a1
--- /dev/null
+++ b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/2/android/frameworks/automotive/powerpolicy/ICarPowerPolicyChangeCallback.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.powerpolicy;
+@VintfStability
+interface ICarPowerPolicyChangeCallback {
+ oneway void onPolicyChanged(in android.frameworks.automotive.powerpolicy.CarPowerPolicy policy);
+}
diff --git a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/2/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/2/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl
new file mode 100644
index 0000000..6372fa3
--- /dev/null
+++ b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/2/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.powerpolicy;
+@VintfStability
+interface ICarPowerPolicyServer {
+ android.frameworks.automotive.powerpolicy.CarPowerPolicy getCurrentPowerPolicy();
+ boolean getPowerComponentState(in android.frameworks.automotive.powerpolicy.PowerComponent componentId);
+ void registerPowerPolicyChangeCallback(in android.frameworks.automotive.powerpolicy.ICarPowerPolicyChangeCallback callback, in android.frameworks.automotive.powerpolicy.CarPowerPolicyFilter filter);
+ void unregisterPowerPolicyChangeCallback(in android.frameworks.automotive.powerpolicy.ICarPowerPolicyChangeCallback callback);
+}
diff --git a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/2/android/frameworks/automotive/powerpolicy/PowerComponent.aidl b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/2/android/frameworks/automotive/powerpolicy/PowerComponent.aidl
new file mode 100644
index 0000000..6c933df
--- /dev/null
+++ b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/2/android/frameworks/automotive/powerpolicy/PowerComponent.aidl
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.powerpolicy;
+@Backing(type="int") @VintfStability
+enum PowerComponent {
+ AUDIO = 1,
+ MEDIA = 2,
+ DISPLAY = 3,
+ BLUETOOTH = 4,
+ WIFI = 5,
+ CELLULAR = 6,
+ ETHERNET = 7,
+ PROJECTION = 8,
+ NFC = 9,
+ INPUT = 10,
+ VOICE_INTERACTION = 11,
+ VISUAL_INTERACTION = 12,
+ TRUSTED_DEVICE_DETECTION = 13,
+ LOCATION = 14,
+ MICROPHONE = 15,
+ CPU = 16,
+ MINIMUM_CUSTOM_COMPONENT_VALUE = 1000,
+}
diff --git a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/CarPowerPolicy.aidl b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/CarPowerPolicy.aidl
index 3750dbb..dced3c4 100644
--- a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/CarPowerPolicy.aidl
+++ b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/CarPowerPolicy.aidl
@@ -12,7 +12,8 @@
* 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.
- *////////////////////////////////////////////////////////////////////////////////
+ */
+///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
@@ -36,4 +37,6 @@ parcelable CarPowerPolicy {
@utf8InCpp String policyId;
android.frameworks.automotive.powerpolicy.PowerComponent[] enabledComponents;
android.frameworks.automotive.powerpolicy.PowerComponent[] disabledComponents;
+ int[] enabledCustomComponents = {};
+ int[] disabledCustomComponents = {};
}
diff --git a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/CarPowerPolicyFilter.aidl b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/CarPowerPolicyFilter.aidl
index 45792a6..e2d0f8a 100644
--- a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/CarPowerPolicyFilter.aidl
+++ b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/CarPowerPolicyFilter.aidl
@@ -12,7 +12,8 @@
* 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.
- *////////////////////////////////////////////////////////////////////////////////
+ */
+///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
@@ -34,4 +35,5 @@ package android.frameworks.automotive.powerpolicy;
@VintfStability
parcelable CarPowerPolicyFilter {
android.frameworks.automotive.powerpolicy.PowerComponent[] components;
+ int[] customComponents = {};
}
diff --git a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/ICarPowerPolicyChangeCallback.aidl b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/ICarPowerPolicyChangeCallback.aidl
index aa6777e..c5574a1 100644
--- a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/ICarPowerPolicyChangeCallback.aidl
+++ b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/ICarPowerPolicyChangeCallback.aidl
@@ -12,7 +12,8 @@
* 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.
- *////////////////////////////////////////////////////////////////////////////////
+ */
+///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
diff --git a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl
index e75bfd0..6372fa3 100644
--- a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl
+++ b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.aidl
@@ -12,7 +12,8 @@
* 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.
- *////////////////////////////////////////////////////////////////////////////////
+ */
+///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
diff --git a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/PowerComponent.aidl b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/PowerComponent.aidl
index 2b289f6..6c933df 100644
--- a/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/PowerComponent.aidl
+++ b/automotive/powerpolicy/aidl/aidl_api/android.frameworks.automotive.powerpolicy/current/android/frameworks/automotive/powerpolicy/PowerComponent.aidl
@@ -12,7 +12,8 @@
* 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.
- *////////////////////////////////////////////////////////////////////////////////
+ */
+///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
@@ -49,4 +50,5 @@ enum PowerComponent {
LOCATION = 14,
MICROPHONE = 15,
CPU = 16,
+ MINIMUM_CUSTOM_COMPONENT_VALUE = 1000,
}
diff --git a/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/CarPowerPolicy.aidl b/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/CarPowerPolicy.aidl
index 80267e6..9128786 100644
--- a/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/CarPowerPolicy.aidl
+++ b/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/CarPowerPolicy.aidl
@@ -38,4 +38,14 @@ parcelable CarPowerPolicy {
* List of power components to be disabled.
*/
PowerComponent[] disabledComponents;
+
+ /**
+ * List of custom power components to be enabled.
+ */
+ int[] enabledCustomComponents = {};
+
+ /**
+ * List of custom power components to be disabled.
+ */
+ int[] disabledCustomComponents = {};
}
diff --git a/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/CarPowerPolicyFilter.aidl b/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/CarPowerPolicyFilter.aidl
index 86289cd..fbe329a 100644
--- a/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/CarPowerPolicyFilter.aidl
+++ b/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/CarPowerPolicyFilter.aidl
@@ -29,4 +29,9 @@ parcelable CarPowerPolicyFilter {
* List of power components of interest.
*/
PowerComponent[] components;
+
+ /**
+ * List of custom power components of interest
+ */
+ int[] customComponents = {};
}
diff --git a/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/PowerComponent.aidl b/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/PowerComponent.aidl
index d92cdaf..8fa3b13 100644
--- a/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/PowerComponent.aidl
+++ b/automotive/powerpolicy/aidl/android/frameworks/automotive/powerpolicy/PowerComponent.aidl
@@ -103,4 +103,9 @@ enum PowerComponent {
* state when system gets out of sleep state.
*/
CPU = 16,
+
+ /**
+ * This is minimal value for custom OEM component values.
+ */
+ MINIMUM_CUSTOM_COMPONENT_VALUE = 1000,
}
diff --git a/automotive/powerpolicy/aidl/vts/Android.bp b/automotive/powerpolicy/aidl/vts/Android.bp
index 39ebbe6..a382bc0 100644
--- a/automotive/powerpolicy/aidl/vts/Android.bp
+++ b/automotive/powerpolicy/aidl/vts/Android.bp
@@ -32,11 +32,11 @@ cc_test {
"libbinder_ndk",
],
static_libs: [
- "android.frameworks.automotive.powerpolicy-V1-ndk",
+ "android.frameworks.automotive.powerpolicy-V2-ndk",
"libgmock",
],
test_suites: [
"general-tests",
"vts",
],
-} \ No newline at end of file
+}
diff --git a/automotive/powerpolicy/aidl/vts/VtsAidlPowerPolicyTargetTest.cpp b/automotive/powerpolicy/aidl/vts/VtsAidlPowerPolicyTargetTest.cpp
index 402d291..454c3f1 100644
--- a/automotive/powerpolicy/aidl/vts/VtsAidlPowerPolicyTargetTest.cpp
+++ b/automotive/powerpolicy/aidl/vts/VtsAidlPowerPolicyTargetTest.cpp
@@ -21,6 +21,7 @@
#include <aidl/android/frameworks/automotive/powerpolicy/CarPowerPolicyFilter.h>
#include <aidl/android/frameworks/automotive/powerpolicy/ICarPowerPolicyServer.h>
#include <aidl/android/frameworks/automotive/powerpolicy/PowerComponent.h>
+#include <android-base/stringprintf.h>
#include <android/binder_auto_utils.h>
#include <android/binder_manager.h>
#include <android/binder_status.h>
@@ -40,6 +41,7 @@ using ::android::ProcessState;
using ::android::status_t;
using ::android::String16;
using ::android::UNKNOWN_ERROR;
+using ::android::base::StringPrintf;
using ::ndk::ScopedAStatus;
using ::ndk::SpAIBinder;
@@ -76,9 +78,12 @@ TEST_P(PowerPolicyAidlTest, TestGetCurrentPowerPolicy) {
TEST_P(PowerPolicyAidlTest, TestGetPowerComponentState) {
bool state;
for (const auto componentId : ndk::enum_range<PowerComponent>()) {
+ if (componentId >= PowerComponent::MINIMUM_CUSTOM_COMPONENT_VALUE) {
+ continue;
+ }
ScopedAStatus status = powerPolicyServer->getPowerComponentState(componentId, &state);
-
- ASSERT_TRUE(status.isOk());
+ std::string errMsg = StringPrintf("Getting state of component(%d) fails", componentId);
+ ASSERT_TRUE(status.isOk()) << errMsg;
}
}
diff --git a/automotive/telemetry/aidl/Android.bp b/automotive/telemetry/aidl/Android.bp
index 6379c35..944a94c 100644
--- a/automotive/telemetry/aidl/Android.bp
+++ b/automotive/telemetry/aidl/Android.bp
@@ -32,7 +32,7 @@ aidl_interface {
enabled: true,
},
java: {
- sdk_version: "module_current",
+ sdk_version: "module_current",
min_sdk_version: "31",
apex_available: [
"//apex_available:platform",
@@ -44,9 +44,22 @@ aidl_interface {
enabled: true,
},
},
+ versions_with_info: [
+ {
+ version: "1",
+ imports: [],
+ },
+ {
+ version: "2",
+ imports: [],
+ },
+
+ ],
+ frozen: true,
+
// Run "m android.frameworks.automotive.telemetry-freeze-api" to bump the version. Freeze the
// version only during the release.
// Run "m android.frameworks.automotive.telemetry-update-api" to update the
// "aidl_api/.../current/" dir.
- versions: ["1"],
+
}
diff --git a/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/2/.hash b/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/2/.hash
new file mode 100644
index 0000000..a556cca
--- /dev/null
+++ b/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/2/.hash
@@ -0,0 +1 @@
+0067842a41ff513323a7f23d835aace691d1509d
diff --git a/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/2/android/frameworks/automotive/telemetry/CallbackConfig.aidl b/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/2/android/frameworks/automotive/telemetry/CallbackConfig.aidl
new file mode 100644
index 0000000..7351883
--- /dev/null
+++ b/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/2/android/frameworks/automotive/telemetry/CallbackConfig.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2021, 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.telemetry;
+@VintfStability
+parcelable CallbackConfig {
+ int[] carDataIds;
+}
diff --git a/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/2/android/frameworks/automotive/telemetry/CarData.aidl b/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/2/android/frameworks/automotive/telemetry/CarData.aidl
new file mode 100644
index 0000000..4e400b1
--- /dev/null
+++ b/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/2/android/frameworks/automotive/telemetry/CarData.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2021, 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.telemetry;
+@VintfStability
+parcelable CarData {
+ int id;
+ byte[] content;
+}
diff --git a/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/2/android/frameworks/automotive/telemetry/ICarTelemetry.aidl b/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/2/android/frameworks/automotive/telemetry/ICarTelemetry.aidl
new file mode 100644
index 0000000..531c955
--- /dev/null
+++ b/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/2/android/frameworks/automotive/telemetry/ICarTelemetry.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2021, 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.telemetry;
+@VintfStability
+interface ICarTelemetry {
+ void write(in android.frameworks.automotive.telemetry.CarData[] dataList);
+ void addCallback(in android.frameworks.automotive.telemetry.CallbackConfig config, in android.frameworks.automotive.telemetry.ICarTelemetryCallback callback);
+ void removeCallback(in android.frameworks.automotive.telemetry.ICarTelemetryCallback callback);
+}
diff --git a/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/2/android/frameworks/automotive/telemetry/ICarTelemetryCallback.aidl b/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/2/android/frameworks/automotive/telemetry/ICarTelemetryCallback.aidl
new file mode 100644
index 0000000..2241e29
--- /dev/null
+++ b/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/2/android/frameworks/automotive/telemetry/ICarTelemetryCallback.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2022, 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.telemetry;
+@VintfStability
+interface ICarTelemetryCallback {
+ void onChange(in int[] ids);
+}
diff --git a/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/current/android/frameworks/automotive/telemetry/CallbackConfig.aidl b/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/current/android/frameworks/automotive/telemetry/CallbackConfig.aidl
new file mode 100644
index 0000000..7351883
--- /dev/null
+++ b/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/current/android/frameworks/automotive/telemetry/CallbackConfig.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2021, 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.telemetry;
+@VintfStability
+parcelable CallbackConfig {
+ int[] carDataIds;
+}
diff --git a/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/current/android/frameworks/automotive/telemetry/ICarTelemetry.aidl b/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/current/android/frameworks/automotive/telemetry/ICarTelemetry.aidl
index bdf5631..531c955 100644
--- a/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/current/android/frameworks/automotive/telemetry/ICarTelemetry.aidl
+++ b/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/current/android/frameworks/automotive/telemetry/ICarTelemetry.aidl
@@ -35,4 +35,6 @@ package android.frameworks.automotive.telemetry;
@VintfStability
interface ICarTelemetry {
void write(in android.frameworks.automotive.telemetry.CarData[] dataList);
+ void addCallback(in android.frameworks.automotive.telemetry.CallbackConfig config, in android.frameworks.automotive.telemetry.ICarTelemetryCallback callback);
+ void removeCallback(in android.frameworks.automotive.telemetry.ICarTelemetryCallback callback);
}
diff --git a/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/current/android/frameworks/automotive/telemetry/ICarTelemetryCallback.aidl b/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/current/android/frameworks/automotive/telemetry/ICarTelemetryCallback.aidl
new file mode 100644
index 0000000..2241e29
--- /dev/null
+++ b/automotive/telemetry/aidl/aidl_api/android.frameworks.automotive.telemetry/current/android/frameworks/automotive/telemetry/ICarTelemetryCallback.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2022, 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.automotive.telemetry;
+@VintfStability
+interface ICarTelemetryCallback {
+ void onChange(in int[] ids);
+}
diff --git a/automotive/telemetry/aidl/android/frameworks/automotive/telemetry/CallbackConfig.aidl b/automotive/telemetry/aidl/android/frameworks/automotive/telemetry/CallbackConfig.aidl
new file mode 100644
index 0000000..c477e63
--- /dev/null
+++ b/automotive/telemetry/aidl/android/frameworks/automotive/telemetry/CallbackConfig.aidl
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2021, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.automotive.telemetry;
+
+/**
+ * Configurations associated with a ICarTelemetryCallback.
+ *
+ * <p>Contents of this object should not be parsed by Android framework.
+ *
+ * <p>Please see {@link ICarTelemetry#addCallback(CallbackConfig, ICarTelemetryCallback)}.
+ */
+@VintfStability
+parcelable CallbackConfig {
+ /**
+ * A list of CarData IDs that the callback is interested in.
+ *
+ * <p>The callback will only be invoked for the IDs declared in the CallbackConfig.
+ */
+ int[] carDataIds;
+}
diff --git a/automotive/telemetry/aidl/android/frameworks/automotive/telemetry/ICarTelemetry.aidl b/automotive/telemetry/aidl/android/frameworks/automotive/telemetry/ICarTelemetry.aidl
index f3256d5..c71d670 100644
--- a/automotive/telemetry/aidl/android/frameworks/automotive/telemetry/ICarTelemetry.aidl
+++ b/automotive/telemetry/aidl/android/frameworks/automotive/telemetry/ICarTelemetry.aidl
@@ -16,7 +16,9 @@
package android.frameworks.automotive.telemetry;
+import android.frameworks.automotive.telemetry.CallbackConfig;
import android.frameworks.automotive.telemetry.CarData;
+import android.frameworks.automotive.telemetry.ICarTelemetryCallback;
/**
* This service collects data from varios other services, buffers them, and delivers to the
@@ -33,4 +35,21 @@ interface ICarTelemetry {
* @throws IllegalArgumentException if total {@code dataList#content} size is more than 10KB.
*/
void write(in CarData[] dataList);
+
+ /**
+ * Adds a ICarTelemetryCallback.
+ *
+ * <p>Make sure to call {@code removeCallback} when the callback is no longer active
+ * or when the CallbackConfig needs to be updated.
+ *
+ * @param callback The callback to receive cartelemetryd updates.
+ */
+ void addCallback(in CallbackConfig config, in ICarTelemetryCallback callback);
+
+ /**
+ * Removes a ICarTelemetryCallback from receiving updates from cartelemetryd.
+ *
+ * @param callback The callback to receive cartelemetryd updates.
+ */
+ void removeCallback(in ICarTelemetryCallback callback);
}
diff --git a/automotive/telemetry/aidl/android/frameworks/automotive/telemetry/ICarTelemetryCallback.aidl b/automotive/telemetry/aidl/android/frameworks/automotive/telemetry/ICarTelemetryCallback.aidl
new file mode 100644
index 0000000..ea7de80
--- /dev/null
+++ b/automotive/telemetry/aidl/android/frameworks/automotive/telemetry/ICarTelemetryCallback.aidl
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2022, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.automotive.telemetry;
+
+/**
+ * Callback for cartelemetryd, used by vendor data-collecting components.
+ *
+ * <p>When this interface is extended in the future, the service must check the interface
+ * version to ensure compatibility. See
+ * https://source.android.com/docs/core/architecture/aidl/stable-aidl#querying-the-interface-version-of-the-remote-object
+ */
+@VintfStability
+interface ICarTelemetryCallback {
+
+ /**
+ * Notifies client of currently active CarData IDs that the callback is associated with.
+ *
+ * This is the new set of IDs that we want them to publish.
+ */
+ void onChange(in int[] ids);
+}
diff --git a/automotive/telemetry/aidl/vts/functional/Android.bp b/automotive/telemetry/aidl/vts/functional/Android.bp
index fafe437..82009bd 100644
--- a/automotive/telemetry/aidl/vts/functional/Android.bp
+++ b/automotive/telemetry/aidl/vts/functional/Android.bp
@@ -28,7 +28,7 @@ cc_test {
static_libs: [
"libgflags",
"libgmock",
- "android.frameworks.automotive.telemetry-V1-ndk",
+ "android.frameworks.automotive.telemetry-V2-ndk",
],
test_suites: [
"general-tests",
diff --git a/automotive/telemetry/aidl/vts/functional/VtsHalCarTelemetryTest.cpp b/automotive/telemetry/aidl/vts/functional/VtsHalCarTelemetryTest.cpp
index 763a381..5aa606a 100644
--- a/automotive/telemetry/aidl/vts/functional/VtsHalCarTelemetryTest.cpp
+++ b/automotive/telemetry/aidl/vts/functional/VtsHalCarTelemetryTest.cpp
@@ -17,6 +17,8 @@
#include <aidl/Gtest.h>
#include <aidl/Vintf.h>
+#include <aidl/android/frameworks/automotive/telemetry/BnCarTelemetryCallback.h>
+#include <aidl/android/frameworks/automotive/telemetry/CallbackConfig.h>
#include <aidl/android/frameworks/automotive/telemetry/CarData.h>
#include <aidl/android/frameworks/automotive/telemetry/ICarTelemetry.h>
#include <android-base/logging.h>
@@ -35,8 +37,26 @@ namespace frameworks {
namespace automotive {
namespace telemetry {
+using ::aidl::android::frameworks::automotive::telemetry::BnCarTelemetryCallback;
+using ::aidl::android::frameworks::automotive::telemetry::CallbackConfig;
using ::aidl::android::frameworks::automotive::telemetry::CarData;
using ::aidl::android::frameworks::automotive::telemetry::ICarTelemetry;
+using ::ndk::ScopedAStatus;
+
+class MockCarTelemetryCallback : public BnCarTelemetryCallback {
+ public:
+ MockCarTelemetryCallback() {}
+
+ ScopedAStatus onChange([[maybe_unused]] const std::vector<int32_t>& ids) override {
+ return ScopedAStatus::ok();
+ }
+};
+
+CallbackConfig buildConfig(const std::vector<int32_t>& ids) {
+ CallbackConfig config;
+ config.carDataIds = ids;
+ return config;
+}
CarData buildCarData(int id, const std::vector<uint8_t>& content) {
CarData msg;
@@ -66,6 +86,47 @@ TEST_P(CarTelemetryTest, writeReturnsOk) {
EXPECT_TRUE(status.isOk()) << status.getMessage();
}
+TEST_P(CarTelemetryTest, AddCallbackReturnsOk) {
+ CallbackConfig config = buildConfig({101, 102, 103});
+ std::shared_ptr<MockCarTelemetryCallback> callback =
+ ndk::SharedRefBase::make<MockCarTelemetryCallback>();
+
+ auto status = mService->addCallback(config, callback);
+
+ EXPECT_TRUE(status.isOk()) << status.getMessage();
+}
+
+TEST_P(CarTelemetryTest, AddCallbackErrorsWhenDuplicate) {
+ CallbackConfig config = buildConfig({101, 102, 103});
+ std::shared_ptr<MockCarTelemetryCallback> callback =
+ ndk::SharedRefBase::make<MockCarTelemetryCallback>();
+ mService->addCallback(config, callback);
+
+ auto status = mService->addCallback(config, callback);
+
+ EXPECT_FALSE(status.isOk()) << status.getMessage();
+}
+
+TEST_P(CarTelemetryTest, RemoveCallbackReturnsOk) {
+ CallbackConfig config = buildConfig({101, 102, 103});
+ std::shared_ptr<MockCarTelemetryCallback> callback =
+ ndk::SharedRefBase::make<MockCarTelemetryCallback>();
+ mService->addCallback(config, callback);
+
+ auto status = mService->removeCallback(callback);
+
+ EXPECT_TRUE(status.isOk()) << status.getMessage();
+}
+
+TEST_P(CarTelemetryTest, RemoveCallbackErrorsForNonexistentCallback) {
+ std::shared_ptr<MockCarTelemetryCallback> callback =
+ ndk::SharedRefBase::make<MockCarTelemetryCallback>();
+
+ auto status = mService->removeCallback(callback);
+
+ EXPECT_FALSE(status.isOk()) << status.getMessage();
+}
+
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(CarTelemetryTest);
INSTANTIATE_TEST_SUITE_P(
AutomotiveHal, CarTelemetryTest,
diff --git a/cameraservice/common/aidl/Android.bp b/cameraservice/common/aidl/Android.bp
new file mode 100644
index 0000000..9916d3c
--- /dev/null
+++ b/cameraservice/common/aidl/Android.bp
@@ -0,0 +1,32 @@
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+aidl_interface {
+ name: "android.frameworks.cameraservice.common",
+ vendor_available: true,
+ srcs: ["android/frameworks/cameraservice/common/*.aidl"],
+ stability: "vintf",
+ frozen: true,
+ backend: {
+ cpp: {
+ enabled: false,
+ },
+ java: {
+ enabled: false,
+ },
+ ndk: {
+ vndk: {
+ enabled: true,
+ },
+ },
+ },
+ vndk_use_version: "1",
+ versions_with_info: [
+ {
+ version: "1",
+ imports: [],
+ },
+ ],
+
+}
diff --git a/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/.hash b/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/.hash
new file mode 100644
index 0000000..b6195c4
--- /dev/null
+++ b/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/.hash
@@ -0,0 +1 @@
+4866f510363316b02a311bd8fa256f1fd073bc1d
diff --git a/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/android/frameworks/cameraservice/common/CameraMetadataType.aidl b/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/android/frameworks/cameraservice/common/CameraMetadataType.aidl
new file mode 100644
index 0000000..bce3c87
--- /dev/null
+++ b/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/android/frameworks/cameraservice/common/CameraMetadataType.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.common;
+@Backing(type="int") @VintfStability
+enum CameraMetadataType {
+ BYTE = 0,
+ INT32 = 1,
+ FLOAT = 2,
+ INT64 = 3,
+ DOUBLE = 4,
+ RATIONAL = 5,
+}
diff --git a/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/android/frameworks/cameraservice/common/ProviderIdAndVendorTagSections.aidl b/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/android/frameworks/cameraservice/common/ProviderIdAndVendorTagSections.aidl
new file mode 100644
index 0000000..0c5d73c
--- /dev/null
+++ b/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/android/frameworks/cameraservice/common/ProviderIdAndVendorTagSections.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.common;
+@VintfStability
+parcelable ProviderIdAndVendorTagSections {
+ long providerId;
+ android.frameworks.cameraservice.common.VendorTagSection[] vendorTagSections;
+}
diff --git a/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/android/frameworks/cameraservice/common/Status.aidl b/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/android/frameworks/cameraservice/common/Status.aidl
new file mode 100644
index 0000000..4bef589
--- /dev/null
+++ b/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/android/frameworks/cameraservice/common/Status.aidl
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.common;
+@Backing(type="int") @VintfStability
+enum Status {
+ NO_ERROR = 0,
+ PERMISSION_DENIED = 1,
+ ALREADY_EXISTS = 2,
+ ILLEGAL_ARGUMENT = 3,
+ DISCONNECTED = 4,
+ TIMED_OUT = 5,
+ DISABLED = 6,
+ CAMERA_IN_USE = 7,
+ MAX_CAMERAS_IN_USE = 8,
+ DEPRECATED_HAL = 9,
+ INVALID_OPERATION = 10,
+ UNKNOWN_ERROR = 11,
+}
diff --git a/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/android/frameworks/cameraservice/common/TagBoundaryId.aidl b/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/android/frameworks/cameraservice/common/TagBoundaryId.aidl
new file mode 100644
index 0000000..ee6ffa0
--- /dev/null
+++ b/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/android/frameworks/cameraservice/common/TagBoundaryId.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.common;
+@Backing(type="long") @VintfStability
+enum TagBoundaryId {
+ AOSP = 0x0,
+ VENDOR = 0x80000000L,
+}
diff --git a/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/android/frameworks/cameraservice/common/VendorTag.aidl b/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/android/frameworks/cameraservice/common/VendorTag.aidl
new file mode 100644
index 0000000..22b9d5e
--- /dev/null
+++ b/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/android/frameworks/cameraservice/common/VendorTag.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.common;
+@VintfStability
+parcelable VendorTag {
+ long tagId;
+ String tagName;
+ android.frameworks.cameraservice.common.CameraMetadataType tagType;
+}
diff --git a/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/android/frameworks/cameraservice/common/VendorTagSection.aidl b/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/android/frameworks/cameraservice/common/VendorTagSection.aidl
new file mode 100644
index 0000000..8b741f9
--- /dev/null
+++ b/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/1/android/frameworks/cameraservice/common/VendorTagSection.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.common;
+@VintfStability
+parcelable VendorTagSection {
+ String sectionName;
+ android.frameworks.cameraservice.common.VendorTag[] tags;
+}
diff --git a/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/current/android/frameworks/cameraservice/common/CameraMetadataType.aidl b/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/current/android/frameworks/cameraservice/common/CameraMetadataType.aidl
new file mode 100644
index 0000000..bce3c87
--- /dev/null
+++ b/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/current/android/frameworks/cameraservice/common/CameraMetadataType.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.common;
+@Backing(type="int") @VintfStability
+enum CameraMetadataType {
+ BYTE = 0,
+ INT32 = 1,
+ FLOAT = 2,
+ INT64 = 3,
+ DOUBLE = 4,
+ RATIONAL = 5,
+}
diff --git a/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/current/android/frameworks/cameraservice/common/ProviderIdAndVendorTagSections.aidl b/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/current/android/frameworks/cameraservice/common/ProviderIdAndVendorTagSections.aidl
new file mode 100644
index 0000000..0c5d73c
--- /dev/null
+++ b/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/current/android/frameworks/cameraservice/common/ProviderIdAndVendorTagSections.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.common;
+@VintfStability
+parcelable ProviderIdAndVendorTagSections {
+ long providerId;
+ android.frameworks.cameraservice.common.VendorTagSection[] vendorTagSections;
+}
diff --git a/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/current/android/frameworks/cameraservice/common/Status.aidl b/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/current/android/frameworks/cameraservice/common/Status.aidl
new file mode 100644
index 0000000..4bef589
--- /dev/null
+++ b/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/current/android/frameworks/cameraservice/common/Status.aidl
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.common;
+@Backing(type="int") @VintfStability
+enum Status {
+ NO_ERROR = 0,
+ PERMISSION_DENIED = 1,
+ ALREADY_EXISTS = 2,
+ ILLEGAL_ARGUMENT = 3,
+ DISCONNECTED = 4,
+ TIMED_OUT = 5,
+ DISABLED = 6,
+ CAMERA_IN_USE = 7,
+ MAX_CAMERAS_IN_USE = 8,
+ DEPRECATED_HAL = 9,
+ INVALID_OPERATION = 10,
+ UNKNOWN_ERROR = 11,
+}
diff --git a/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/current/android/frameworks/cameraservice/common/TagBoundaryId.aidl b/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/current/android/frameworks/cameraservice/common/TagBoundaryId.aidl
new file mode 100644
index 0000000..ee6ffa0
--- /dev/null
+++ b/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/current/android/frameworks/cameraservice/common/TagBoundaryId.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.common;
+@Backing(type="long") @VintfStability
+enum TagBoundaryId {
+ AOSP = 0x0,
+ VENDOR = 0x80000000L,
+}
diff --git a/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/current/android/frameworks/cameraservice/common/VendorTag.aidl b/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/current/android/frameworks/cameraservice/common/VendorTag.aidl
new file mode 100644
index 0000000..22b9d5e
--- /dev/null
+++ b/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/current/android/frameworks/cameraservice/common/VendorTag.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.common;
+@VintfStability
+parcelable VendorTag {
+ long tagId;
+ String tagName;
+ android.frameworks.cameraservice.common.CameraMetadataType tagType;
+}
diff --git a/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/current/android/frameworks/cameraservice/common/VendorTagSection.aidl b/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/current/android/frameworks/cameraservice/common/VendorTagSection.aidl
new file mode 100644
index 0000000..8b741f9
--- /dev/null
+++ b/cameraservice/common/aidl/aidl_api/android.frameworks.cameraservice.common/current/android/frameworks/cameraservice/common/VendorTagSection.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.common;
+@VintfStability
+parcelable VendorTagSection {
+ String sectionName;
+ android.frameworks.cameraservice.common.VendorTag[] tags;
+}
diff --git a/cameraservice/common/aidl/android/frameworks/cameraservice/common/CameraMetadataType.aidl b/cameraservice/common/aidl/android/frameworks/cameraservice/common/CameraMetadataType.aidl
new file mode 100644
index 0000000..ccb2aeb
--- /dev/null
+++ b/cameraservice/common/aidl/android/frameworks/cameraservice/common/CameraMetadataType.aidl
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.cameraservice.common;
+
+/**
+ * Camera metadata type.
+ */
+@VintfStability
+@Backing(type="int")
+enum CameraMetadataType {
+ /**
+ * Unsigned 8-bit integer (uint8_t)
+ */
+ BYTE = 0,
+ /**
+ * Signed 32-bit integer (int32_t)
+ */
+ INT32 = 1,
+ /**
+ * 32-bit float (float)
+ */
+ FLOAT = 2,
+ /**
+ * Signed 64-bit integer (int64_t)
+ */
+ INT64 = 3,
+ /**
+ * 64-bit float (double)
+ */
+ DOUBLE = 4,
+ /**
+ * A 64-bit fraction (camera_metadata_rational_t)
+ */
+ RATIONAL = 5,
+}
diff --git a/cameraservice/common/aidl/android/frameworks/cameraservice/common/ProviderIdAndVendorTagSections.aidl b/cameraservice/common/aidl/android/frameworks/cameraservice/common/ProviderIdAndVendorTagSections.aidl
new file mode 100644
index 0000000..b7d4653
--- /dev/null
+++ b/cameraservice/common/aidl/android/frameworks/cameraservice/common/ProviderIdAndVendorTagSections.aidl
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.cameraservice.common;
+
+import android.frameworks.cameraservice.common.VendorTagSection;
+
+@VintfStability
+parcelable ProviderIdAndVendorTagSections {
+ /**
+ * provider id
+ */
+ long providerId;
+ /**
+ * List of VendorTagSections provided by this provider
+ */
+ VendorTagSection[] vendorTagSections;
+}
diff --git a/cameraservice/common/aidl/android/frameworks/cameraservice/common/Status.aidl b/cameraservice/common/aidl/android/frameworks/cameraservice/common/Status.aidl
new file mode 100644
index 0000000..2cf868a
--- /dev/null
+++ b/cameraservice/common/aidl/android/frameworks/cameraservice/common/Status.aidl
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.cameraservice.common;
+
+/**
+ * All camera service and device AIDL calls may return the following
+ * status codes
+ */
+@VintfStability
+@Backing(type="int")
+enum Status {
+ /**
+ * Call succeeded.
+ */
+ NO_ERROR = 0,
+ /**
+ * Call failed due to inadequete permissions.
+ */
+ PERMISSION_DENIED = 1,
+ /**
+ * Call tried added something that already existed, eg: add a duplicate
+ * listener.
+ */
+ ALREADY_EXISTS = 2,
+ /**
+ * Call received illegal argument.
+ */
+ ILLEGAL_ARGUMENT = 3,
+ /**
+ * The camera device is no longer connected.
+ */
+ DISCONNECTED = 4,
+ /**
+ * Request timed out.
+ */
+ TIMED_OUT = 5,
+ /**
+ * The device has been disabled by policy.
+ */
+ DISABLED = 6,
+ /**
+ * The camera device is currently in use.
+ */
+ CAMERA_IN_USE = 7,
+ /**
+ * Too many cameras are connected, more cameras cannot be opened.
+ */
+ MAX_CAMERAS_IN_USE = 8,
+ /**
+ * Camera server is using a camera HAL version that does not support
+ * the current version of android.frameworks.cameraservice.service.ICameraService
+ * and android.frameworks.cameraservice.device.ICameraDeviceUser.
+ */
+ DEPRECATED_HAL = 9,
+ /**
+ * An invalid operation was attempted by the client. Eg: a waitUntilIdle()
+ * call was made, with active repeating requests.
+ */
+ INVALID_OPERATION = 10,
+ /**
+ * An unknown error was encountered by the camera subsystem.
+ */
+ UNKNOWN_ERROR = 11,
+}
diff --git a/cameraservice/common/aidl/android/frameworks/cameraservice/common/TagBoundaryId.aidl b/cameraservice/common/aidl/android/frameworks/cameraservice/common/TagBoundaryId.aidl
new file mode 100644
index 0000000..963bfd3
--- /dev/null
+++ b/cameraservice/common/aidl/android/frameworks/cameraservice/common/TagBoundaryId.aidl
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.cameraservice.common;
+
+/**
+ * Boundaries for VendorTag tagIds.
+ */
+@VintfStability
+@Backing(type="long")
+enum TagBoundaryId {
+ /**
+ * First valid tag id for android-defined tags.
+ */
+ AOSP = 0x0,
+ /**
+ * First valid tag id for vendor extension tags.
+ */
+ VENDOR = 0x80000000L // 1 << 31
+}
diff --git a/cameraservice/common/aidl/android/frameworks/cameraservice/common/VendorTag.aidl b/cameraservice/common/aidl/android/frameworks/cameraservice/common/VendorTag.aidl
new file mode 100644
index 0000000..3ba1621
--- /dev/null
+++ b/cameraservice/common/aidl/android/frameworks/cameraservice/common/VendorTag.aidl
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.cameraservice.common;
+
+import android.frameworks.cameraservice.common.CameraMetadataType;
+
+/**
+ * A single vendor-unique metadata tag.
+ * The full name of the tag is <sectionName>.<tagName>
+ */
+@VintfStability
+parcelable VendorTag {
+ /**
+ * Tag identifier, must be >= TagBoundaryId::VENDOR.
+ */
+ long tagId;
+ /**
+ * Name of tag, not including section name.
+ */
+ String tagName;
+
+ CameraMetadataType tagType;
+}
diff --git a/cameraservice/common/aidl/android/frameworks/cameraservice/common/VendorTagSection.aidl b/cameraservice/common/aidl/android/frameworks/cameraservice/common/VendorTagSection.aidl
new file mode 100644
index 0000000..dbe8b91
--- /dev/null
+++ b/cameraservice/common/aidl/android/frameworks/cameraservice/common/VendorTagSection.aidl
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.cameraservice.common;
+
+import android.frameworks.cameraservice.common.VendorTag;
+
+/**
+ * A set of related vendor tags.
+ */
+@VintfStability
+parcelable VendorTagSection {
+ /**
+ * Section name; must be namespaced within vendor's name.
+ */
+ String sectionName;
+ /**
+ * List of tags in this section
+ */
+ VendorTag[] tags;
+}
diff --git a/cameraservice/device/aidl/Android.bp b/cameraservice/device/aidl/Android.bp
new file mode 100644
index 0000000..f22ad83
--- /dev/null
+++ b/cameraservice/device/aidl/Android.bp
@@ -0,0 +1,41 @@
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+aidl_interface {
+ name: "android.frameworks.cameraservice.device",
+ vendor_available: true,
+ srcs: ["android/frameworks/cameraservice/device/*.aidl"],
+ stability: "vintf",
+ imports: [
+ "android.frameworks.cameraservice.common-V1",
+ "android.hardware.common.fmq-V1",
+ "android.hardware.common-V2",
+ ],
+ frozen: true,
+ backend: {
+ cpp: {
+ enabled: false,
+ },
+ java: {
+ enabled: false,
+ },
+ ndk: {
+ vndk: {
+ enabled: true,
+ },
+ },
+ },
+ vndk_use_version: "1",
+ versions_with_info: [
+ {
+ version: "1",
+ imports: [
+ "android.frameworks.cameraservice.common-V1",
+ "android.hardware.common.fmq-V1",
+ "android.hardware.common-V2",
+ ],
+ },
+ ],
+
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/.hash b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/.hash
new file mode 100644
index 0000000..7bbd225
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/.hash
@@ -0,0 +1 @@
+acf6819da94dc452c4fa1e831c96f324a2be805a
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/CameraMetadata.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/CameraMetadata.aidl
new file mode 100644
index 0000000..08a1310
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/CameraMetadata.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@VintfStability
+parcelable CameraMetadata {
+ byte[] metadata;
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/CaptureMetadataInfo.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/CaptureMetadataInfo.aidl
new file mode 100644
index 0000000..c1d1761
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/CaptureMetadataInfo.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@VintfStability
+union CaptureMetadataInfo {
+ long fmqMetadataSize;
+ android.frameworks.cameraservice.device.CameraMetadata metadata;
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/CaptureRequest.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/CaptureRequest.aidl
new file mode 100644
index 0000000..a19dd10
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/CaptureRequest.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@VintfStability
+parcelable CaptureRequest {
+ android.frameworks.cameraservice.device.PhysicalCameraSettings[] physicalCameraSettings;
+ android.frameworks.cameraservice.device.StreamAndWindowId[] streamAndWindowIds;
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/CaptureResultExtras.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/CaptureResultExtras.aidl
new file mode 100644
index 0000000..2bd2253
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/CaptureResultExtras.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@VintfStability
+parcelable CaptureResultExtras {
+ int requestId;
+ int burstId;
+ long frameNumber;
+ int partialResultCount;
+ int errorStreamId;
+ String errorPhysicalCameraId;
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/ErrorCode.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/ErrorCode.aidl
new file mode 100644
index 0000000..9c361f0
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/ErrorCode.aidl
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@Backing(type="int") @VintfStability
+enum ErrorCode {
+ CAMERA_INVALID_ERROR = (-1) /* -1 */,
+ CAMERA_DISCONNECTED = 0,
+ CAMERA_DEVICE = 1,
+ CAMERA_SERVICE = 2,
+ CAMERA_REQUEST = 3,
+ CAMERA_RESULT = 4,
+ CAMERA_BUFFER = 5,
+ CAMERA_DISABLED = 6,
+ CAMERA_UNKNOWN_ERROR = 7,
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/ICameraDeviceCallback.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/ICameraDeviceCallback.aidl
new file mode 100644
index 0000000..093ff80
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/ICameraDeviceCallback.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@VintfStability
+interface ICameraDeviceCallback {
+ oneway void onCaptureStarted(in android.frameworks.cameraservice.device.CaptureResultExtras resultExtras, in long timestamp);
+ oneway void onDeviceError(in android.frameworks.cameraservice.device.ErrorCode errorCode, in android.frameworks.cameraservice.device.CaptureResultExtras resultExtras);
+ oneway void onDeviceIdle();
+ oneway void onPrepared(in int streamId);
+ oneway void onRepeatingRequestError(in long lastFrameNumber, in int repeatingRequestId);
+ oneway void onResultReceived(in android.frameworks.cameraservice.device.CaptureMetadataInfo result, in android.frameworks.cameraservice.device.CaptureResultExtras resultExtras, in android.frameworks.cameraservice.device.PhysicalCaptureResultInfo[] physicalCaptureResultInfos);
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/ICameraDeviceUser.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/ICameraDeviceUser.aidl
new file mode 100644
index 0000000..1b9b2c2
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/ICameraDeviceUser.aidl
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@VintfStability
+interface ICameraDeviceUser {
+ void beginConfigure();
+ long cancelRepeatingRequest();
+ android.frameworks.cameraservice.device.CameraMetadata createDefaultRequest(in android.frameworks.cameraservice.device.TemplateId templateId);
+ int createStream(in android.frameworks.cameraservice.device.OutputConfiguration outputConfiguration);
+ void deleteStream(in int streamId);
+ void disconnect();
+ void endConfigure(in android.frameworks.cameraservice.device.StreamConfigurationMode operatingMode, in android.frameworks.cameraservice.device.CameraMetadata sessionParams, in long startTimeNs);
+ long flush();
+ android.hardware.common.fmq.MQDescriptor<byte,android.hardware.common.fmq.SynchronizedReadWrite> getCaptureRequestMetadataQueue();
+ android.hardware.common.fmq.MQDescriptor<byte,android.hardware.common.fmq.SynchronizedReadWrite> getCaptureResultMetadataQueue();
+ boolean isSessionConfigurationSupported(in android.frameworks.cameraservice.device.SessionConfiguration sessionConfiguration);
+ void prepare(in int streamId);
+ android.frameworks.cameraservice.device.SubmitInfo submitRequestList(in android.frameworks.cameraservice.device.CaptureRequest[] requestList, in boolean isRepeating);
+ void updateOutputConfiguration(in int streamId, in android.frameworks.cameraservice.device.OutputConfiguration outputConfiguration);
+ void waitUntilIdle();
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/OutputConfiguration.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/OutputConfiguration.aidl
new file mode 100644
index 0000000..8943815
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/OutputConfiguration.aidl
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@VintfStability
+parcelable OutputConfiguration {
+ android.hardware.common.NativeHandle[] windowHandles;
+ android.frameworks.cameraservice.device.OutputConfiguration.Rotation rotation;
+ int windowGroupId;
+ String physicalCameraId;
+ int width;
+ int height;
+ boolean isDeferred;
+ @Backing(type="int") @VintfStability
+ enum Rotation {
+ R0 = 0,
+ R90 = 1,
+ R180 = 2,
+ R270 = 3,
+ }
+ @Backing(type="int") @VintfStability
+ enum WindowGroupId {
+ NONE = (-1) /* -1 */,
+ }
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/PhysicalCameraSettings.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/PhysicalCameraSettings.aidl
new file mode 100644
index 0000000..622b3a1
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/PhysicalCameraSettings.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@VintfStability
+parcelable PhysicalCameraSettings {
+ String id;
+ android.frameworks.cameraservice.device.CaptureMetadataInfo settings;
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/PhysicalCaptureResultInfo.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/PhysicalCaptureResultInfo.aidl
new file mode 100644
index 0000000..7d1b1a9
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/PhysicalCaptureResultInfo.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@VintfStability
+parcelable PhysicalCaptureResultInfo {
+ String physicalCameraId;
+ android.frameworks.cameraservice.device.CaptureMetadataInfo physicalCameraMetadata;
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/SessionConfiguration.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/SessionConfiguration.aidl
new file mode 100644
index 0000000..f6f3773
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/SessionConfiguration.aidl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@VintfStability
+parcelable SessionConfiguration {
+ android.frameworks.cameraservice.device.OutputConfiguration[] outputStreams;
+ int inputWidth;
+ int inputHeight;
+ int inputFormat;
+ android.frameworks.cameraservice.device.StreamConfigurationMode operationMode;
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/StreamAndWindowId.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/StreamAndWindowId.aidl
new file mode 100644
index 0000000..23da63a
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/StreamAndWindowId.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@VintfStability
+parcelable StreamAndWindowId {
+ int streamId;
+ int windowId;
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/StreamConfigurationMode.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/StreamConfigurationMode.aidl
new file mode 100644
index 0000000..ff888f5
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/StreamConfigurationMode.aidl
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@Backing(type="int") @VintfStability
+enum StreamConfigurationMode {
+ NORMAL_MODE = 0,
+ CONSTRAINED_HIGH_SPEED_MODE = 1,
+ VENDOR_MODE_0 = 0x8000,
+ VENDOR_MODE_1,
+ VENDOR_MODE_2,
+ VENDOR_MODE_3,
+ VENDOR_MODE_4,
+ VENDOR_MODE_5,
+ VENDOR_MODE_6,
+ VENDOR_MODE_7,
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/SubmitInfo.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/SubmitInfo.aidl
new file mode 100644
index 0000000..5154ed3
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/SubmitInfo.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@VintfStability
+parcelable SubmitInfo {
+ int requestId;
+ long lastFrameNumber;
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/TemplateId.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/TemplateId.aidl
new file mode 100644
index 0000000..89c5d68
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/1/android/frameworks/cameraservice/device/TemplateId.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@Backing(type="int") @VintfStability
+enum TemplateId {
+ PREVIEW = 1,
+ STILL_CAPTURE = 2,
+ RECORD = 3,
+ VIDEO_SNAPSHOT = 4,
+ ZERO_SHUTTER_LAG = 5,
+ MANUAL = 6,
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/CameraMetadata.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/CameraMetadata.aidl
new file mode 100644
index 0000000..08a1310
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/CameraMetadata.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@VintfStability
+parcelable CameraMetadata {
+ byte[] metadata;
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/CaptureMetadataInfo.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/CaptureMetadataInfo.aidl
new file mode 100644
index 0000000..c1d1761
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/CaptureMetadataInfo.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@VintfStability
+union CaptureMetadataInfo {
+ long fmqMetadataSize;
+ android.frameworks.cameraservice.device.CameraMetadata metadata;
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/CaptureRequest.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/CaptureRequest.aidl
new file mode 100644
index 0000000..a19dd10
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/CaptureRequest.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@VintfStability
+parcelable CaptureRequest {
+ android.frameworks.cameraservice.device.PhysicalCameraSettings[] physicalCameraSettings;
+ android.frameworks.cameraservice.device.StreamAndWindowId[] streamAndWindowIds;
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/CaptureResultExtras.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/CaptureResultExtras.aidl
new file mode 100644
index 0000000..2bd2253
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/CaptureResultExtras.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@VintfStability
+parcelable CaptureResultExtras {
+ int requestId;
+ int burstId;
+ long frameNumber;
+ int partialResultCount;
+ int errorStreamId;
+ String errorPhysicalCameraId;
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/ErrorCode.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/ErrorCode.aidl
new file mode 100644
index 0000000..9c361f0
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/ErrorCode.aidl
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@Backing(type="int") @VintfStability
+enum ErrorCode {
+ CAMERA_INVALID_ERROR = (-1) /* -1 */,
+ CAMERA_DISCONNECTED = 0,
+ CAMERA_DEVICE = 1,
+ CAMERA_SERVICE = 2,
+ CAMERA_REQUEST = 3,
+ CAMERA_RESULT = 4,
+ CAMERA_BUFFER = 5,
+ CAMERA_DISABLED = 6,
+ CAMERA_UNKNOWN_ERROR = 7,
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/ICameraDeviceCallback.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/ICameraDeviceCallback.aidl
new file mode 100644
index 0000000..093ff80
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/ICameraDeviceCallback.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@VintfStability
+interface ICameraDeviceCallback {
+ oneway void onCaptureStarted(in android.frameworks.cameraservice.device.CaptureResultExtras resultExtras, in long timestamp);
+ oneway void onDeviceError(in android.frameworks.cameraservice.device.ErrorCode errorCode, in android.frameworks.cameraservice.device.CaptureResultExtras resultExtras);
+ oneway void onDeviceIdle();
+ oneway void onPrepared(in int streamId);
+ oneway void onRepeatingRequestError(in long lastFrameNumber, in int repeatingRequestId);
+ oneway void onResultReceived(in android.frameworks.cameraservice.device.CaptureMetadataInfo result, in android.frameworks.cameraservice.device.CaptureResultExtras resultExtras, in android.frameworks.cameraservice.device.PhysicalCaptureResultInfo[] physicalCaptureResultInfos);
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/ICameraDeviceUser.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/ICameraDeviceUser.aidl
new file mode 100644
index 0000000..1b9b2c2
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/ICameraDeviceUser.aidl
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@VintfStability
+interface ICameraDeviceUser {
+ void beginConfigure();
+ long cancelRepeatingRequest();
+ android.frameworks.cameraservice.device.CameraMetadata createDefaultRequest(in android.frameworks.cameraservice.device.TemplateId templateId);
+ int createStream(in android.frameworks.cameraservice.device.OutputConfiguration outputConfiguration);
+ void deleteStream(in int streamId);
+ void disconnect();
+ void endConfigure(in android.frameworks.cameraservice.device.StreamConfigurationMode operatingMode, in android.frameworks.cameraservice.device.CameraMetadata sessionParams, in long startTimeNs);
+ long flush();
+ android.hardware.common.fmq.MQDescriptor<byte,android.hardware.common.fmq.SynchronizedReadWrite> getCaptureRequestMetadataQueue();
+ android.hardware.common.fmq.MQDescriptor<byte,android.hardware.common.fmq.SynchronizedReadWrite> getCaptureResultMetadataQueue();
+ boolean isSessionConfigurationSupported(in android.frameworks.cameraservice.device.SessionConfiguration sessionConfiguration);
+ void prepare(in int streamId);
+ android.frameworks.cameraservice.device.SubmitInfo submitRequestList(in android.frameworks.cameraservice.device.CaptureRequest[] requestList, in boolean isRepeating);
+ void updateOutputConfiguration(in int streamId, in android.frameworks.cameraservice.device.OutputConfiguration outputConfiguration);
+ void waitUntilIdle();
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/OutputConfiguration.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/OutputConfiguration.aidl
new file mode 100644
index 0000000..8943815
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/OutputConfiguration.aidl
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@VintfStability
+parcelable OutputConfiguration {
+ android.hardware.common.NativeHandle[] windowHandles;
+ android.frameworks.cameraservice.device.OutputConfiguration.Rotation rotation;
+ int windowGroupId;
+ String physicalCameraId;
+ int width;
+ int height;
+ boolean isDeferred;
+ @Backing(type="int") @VintfStability
+ enum Rotation {
+ R0 = 0,
+ R90 = 1,
+ R180 = 2,
+ R270 = 3,
+ }
+ @Backing(type="int") @VintfStability
+ enum WindowGroupId {
+ NONE = (-1) /* -1 */,
+ }
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/PhysicalCameraSettings.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/PhysicalCameraSettings.aidl
new file mode 100644
index 0000000..622b3a1
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/PhysicalCameraSettings.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@VintfStability
+parcelable PhysicalCameraSettings {
+ String id;
+ android.frameworks.cameraservice.device.CaptureMetadataInfo settings;
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/PhysicalCaptureResultInfo.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/PhysicalCaptureResultInfo.aidl
new file mode 100644
index 0000000..7d1b1a9
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/PhysicalCaptureResultInfo.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@VintfStability
+parcelable PhysicalCaptureResultInfo {
+ String physicalCameraId;
+ android.frameworks.cameraservice.device.CaptureMetadataInfo physicalCameraMetadata;
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/SessionConfiguration.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/SessionConfiguration.aidl
new file mode 100644
index 0000000..f6f3773
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/SessionConfiguration.aidl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@VintfStability
+parcelable SessionConfiguration {
+ android.frameworks.cameraservice.device.OutputConfiguration[] outputStreams;
+ int inputWidth;
+ int inputHeight;
+ int inputFormat;
+ android.frameworks.cameraservice.device.StreamConfigurationMode operationMode;
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/StreamAndWindowId.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/StreamAndWindowId.aidl
new file mode 100644
index 0000000..23da63a
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/StreamAndWindowId.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@VintfStability
+parcelable StreamAndWindowId {
+ int streamId;
+ int windowId;
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/StreamConfigurationMode.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/StreamConfigurationMode.aidl
new file mode 100644
index 0000000..ff888f5
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/StreamConfigurationMode.aidl
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@Backing(type="int") @VintfStability
+enum StreamConfigurationMode {
+ NORMAL_MODE = 0,
+ CONSTRAINED_HIGH_SPEED_MODE = 1,
+ VENDOR_MODE_0 = 0x8000,
+ VENDOR_MODE_1,
+ VENDOR_MODE_2,
+ VENDOR_MODE_3,
+ VENDOR_MODE_4,
+ VENDOR_MODE_5,
+ VENDOR_MODE_6,
+ VENDOR_MODE_7,
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/SubmitInfo.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/SubmitInfo.aidl
new file mode 100644
index 0000000..5154ed3
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/SubmitInfo.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@VintfStability
+parcelable SubmitInfo {
+ int requestId;
+ long lastFrameNumber;
+}
diff --git a/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/TemplateId.aidl b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/TemplateId.aidl
new file mode 100644
index 0000000..89c5d68
--- /dev/null
+++ b/cameraservice/device/aidl/aidl_api/android.frameworks.cameraservice.device/current/android/frameworks/cameraservice/device/TemplateId.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.device;
+@Backing(type="int") @VintfStability
+enum TemplateId {
+ PREVIEW = 1,
+ STILL_CAPTURE = 2,
+ RECORD = 3,
+ VIDEO_SNAPSHOT = 4,
+ ZERO_SHUTTER_LAG = 5,
+ MANUAL = 6,
+}
diff --git a/cameraservice/device/aidl/android/frameworks/cameraservice/device/CameraMetadata.aidl b/cameraservice/device/aidl/android/frameworks/cameraservice/device/CameraMetadata.aidl
new file mode 100644
index 0000000..9e7903e
--- /dev/null
+++ b/cameraservice/device/aidl/android/frameworks/cameraservice/device/CameraMetadata.aidl
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.cameraservice.device;
+
+/**
+ * Wrapper parcelable for CameraMetadata.
+ * See system/camera_metadata.h for the structure of the serialized metadata.
+ */
+@VintfStability
+parcelable CameraMetadata {
+ /**
+ * A serialized metadata buffer created by libcamera_metadata.
+ * Access by casting to a camera_metadata* and using libcamera_metadata methods.
+ */
+ byte[] metadata;
+}
diff --git a/cameraservice/device/aidl/android/frameworks/cameraservice/device/CaptureMetadataInfo.aidl b/cameraservice/device/aidl/android/frameworks/cameraservice/device/CaptureMetadataInfo.aidl
new file mode 100644
index 0000000..e1950ea
--- /dev/null
+++ b/cameraservice/device/aidl/android/frameworks/cameraservice/device/CaptureMetadataInfo.aidl
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.cameraservice.device;
+
+import android.frameworks.cameraservice.device.CameraMetadata;
+
+/**
+ * Either size of the capture request / result metadata sent through FMQ or
+ * the request / result metadata itself.
+ * If the server of the metadata chooses to use FMQ, it must set the
+ * fmqMetadataSize field to the size(> 0) of the metadata held by the FMQ.
+ * Otherwise, the metadata field must contain the metadata.
+ */
+@VintfStability
+union CaptureMetadataInfo {
+ long fmqMetadataSize;
+ CameraMetadata metadata;
+}
diff --git a/cameraservice/device/aidl/android/frameworks/cameraservice/device/CaptureRequest.aidl b/cameraservice/device/aidl/android/frameworks/cameraservice/device/CaptureRequest.aidl
new file mode 100644
index 0000000..f515e70
--- /dev/null
+++ b/cameraservice/device/aidl/android/frameworks/cameraservice/device/CaptureRequest.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.cameraservice.device;
+
+import android.frameworks.cameraservice.device.PhysicalCameraSettings;
+import android.frameworks.cameraservice.device.StreamAndWindowId;
+
+/**
+ * This must contain the information which needs to be submitted with a capture
+ * request, typically to be used with submitRequestList.
+ */
+@VintfStability
+parcelable CaptureRequest {
+ /**
+ * The physical camera settings associated with this CaptureRequest.
+ *
+ * Note: The first capture settings should always match the logical
+ * camera id.
+ */
+ PhysicalCameraSettings[] physicalCameraSettings;
+ /**
+ * A list of (streamId, windowId) pairs which uniquely identifies the
+ * native windows associated with this CaptureRequest.
+ */
+ StreamAndWindowId[] streamAndWindowIds;
+}
diff --git a/cameraservice/device/aidl/android/frameworks/cameraservice/device/CaptureResultExtras.aidl b/cameraservice/device/aidl/android/frameworks/cameraservice/device/CaptureResultExtras.aidl
new file mode 100644
index 0000000..eb36dc5
--- /dev/null
+++ b/cameraservice/device/aidl/android/frameworks/cameraservice/device/CaptureResultExtras.aidl
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.cameraservice.device;
+
+/**
+ * Information about a capture, available to a device client on various
+ * conditions through ICameraDeviceUserCallback callbacks.
+ */
+@VintfStability
+parcelable CaptureResultExtras {
+ /**
+ * An integer to index the request sequence that this result belongs to.
+ */
+ int requestId;
+ /**
+ * An integer to index this result inside a request sequence, starting from 0.
+ */
+ int burstId;
+ /**
+ * A 64bit integer to index the frame number associated with this result.
+ */
+ long frameNumber;
+ /**
+ * The partial result count (index) for this capture result.
+ */
+ int partialResultCount;
+ /**
+ * For buffer drop errors, the stream ID for the stream that lost a buffer.
+ * Otherwise -1.
+ */
+ int errorStreamId;
+ /**
+ * For capture result errors, the physical camera ID in case the respective request contains
+ * a reference to physical camera device. Empty otherwise.
+ * When filled, contains one of the values in ACAMERA_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS entry
+ * in the static metadata of the logical multicamera to which the request was made.
+ */
+ String errorPhysicalCameraId;
+}
diff --git a/cameraservice/device/aidl/android/frameworks/cameraservice/device/ErrorCode.aidl b/cameraservice/device/aidl/android/frameworks/cameraservice/device/ErrorCode.aidl
new file mode 100644
index 0000000..792e97f
--- /dev/null
+++ b/cameraservice/device/aidl/android/frameworks/cameraservice/device/ErrorCode.aidl
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.cameraservice.device;
+
+/**
+ * Error codes for onDeviceError
+ */
+@VintfStability
+@Backing(type="int")
+enum ErrorCode {
+ /**
+ * To indicate all invalid error codes.
+ */
+ CAMERA_INVALID_ERROR = -1,
+ /**
+ * Camera operation has failed because the camera device has been closed,
+ * possibly because a higher priority client has taken ownership of the
+ * device.
+ */
+ CAMERA_DISCONNECTED = 0,
+ /**
+ * The camera device has encountered a fatal error and needs to be
+ * re-opened to use it again.
+ */
+ CAMERA_DEVICE = 1,
+ /**
+ * The camera service has encountered a fatal error.
+ */
+ CAMERA_SERVICE = 2,
+ /**
+ * The camera device encountered an error while processing a request.
+ * No output will be produced for this request. Subsequent requests are
+ * unaffected.
+ */
+ CAMERA_REQUEST = 3,
+ /**
+ * The camera device encountered an error while producing an output result
+ * metadata buffer for a request. Output stream buffers for it must still
+ * be available.
+ */
+ CAMERA_RESULT = 4,
+ /**
+ * A camera device encountered an error occurred due to which an output
+ * buffer was lost.
+ */
+ CAMERA_BUFFER = 5,
+ /**
+ * The camera device has been disabled and cannot be opened.
+ */
+ CAMERA_DISABLED = 6,
+ /**
+ * Camera operation has failed due to an unknown cause.
+ */
+ CAMERA_UNKNOWN_ERROR = 7,
+}
diff --git a/cameraservice/device/aidl/android/frameworks/cameraservice/device/ICameraDeviceCallback.aidl b/cameraservice/device/aidl/android/frameworks/cameraservice/device/ICameraDeviceCallback.aidl
new file mode 100644
index 0000000..a6f1898
--- /dev/null
+++ b/cameraservice/device/aidl/android/frameworks/cameraservice/device/ICameraDeviceCallback.aidl
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.cameraservice.device;
+
+import android.frameworks.cameraservice.device.CaptureResultExtras;
+import android.frameworks.cameraservice.device.ErrorCode;
+import android.frameworks.cameraservice.device.CaptureMetadataInfo;
+import android.frameworks.cameraservice.device.PhysicalCaptureResultInfo;
+
+@VintfStability
+oneway interface ICameraDeviceCallback {
+ /**
+ * Callback called when capture starts.
+ *
+ * @param resultExtras data structure containing information about the
+ * frame number, request id, etc, of the request.
+ * @param timestamp corresponding to the start (in nanoseconds)
+ */
+ void onCaptureStarted(in CaptureResultExtras resultExtras, in long timestamp);
+
+ /**
+ * Callback called when the device encounters an error.
+ *
+ * @param errorCode the error code corresponding to the error.
+ * @param resultExtras data structure containing information about the
+ * frame number, request id, etc, of the request on which the device
+ * error occurred, in case the errorCode was CAMERA_BUFFER.
+ */
+ void onDeviceError(in ErrorCode errorCode, in CaptureResultExtras resultExtras);
+
+ /**
+ * Callback called when the device is idle.
+ */
+ void onDeviceIdle();
+
+ /**
+ * Callback called when the surfaces corresponding to the stream with stream id 'streamId'
+ * have been prepared.
+ *
+ * This callback will only be called as a response to the ICameraDeviceUser.prepare() call.
+ *
+ * @param streamId the stream id of the stream on which ICameraDeviceUser.prepare() was called.
+ */
+ void onPrepared(in int streamId);
+
+ /**
+ * Repeating request encountered an error and was stopped.
+ *
+ * @param lastFrameNumber Frame number of the last frame of the streaming
+ * request.
+ * @param repeatingRequestId the ID of the repeating request
+ * being stopped
+ */
+ void onRepeatingRequestError(in long lastFrameNumber, in int repeatingRequestId);
+
+ /**
+ * Callback called when a capture request is completed.
+ *
+ * Note: The framework must call this callback serially if it opts to
+ * utilize an fmq for either the result metadata and/or any of the
+ * physicalCaptureResultInfo.physicalCameraMetadata values.
+ *
+ * @param result result metadata
+ * @param resultExtras data structure containing information about the
+ * frame number, request id, etc of the request.
+ * @param physicalCaptureResultInfos a list of physicalCaptureResultInfo,
+ * which contains the camera id and metadata related to the physical
+ * cameras involved for the particular capture request, if any.
+ */
+ void onResultReceived(in CaptureMetadataInfo result, in CaptureResultExtras resultExtras,
+ in PhysicalCaptureResultInfo[] physicalCaptureResultInfos);
+}
diff --git a/cameraservice/device/aidl/android/frameworks/cameraservice/device/ICameraDeviceUser.aidl b/cameraservice/device/aidl/android/frameworks/cameraservice/device/ICameraDeviceUser.aidl
new file mode 100644
index 0000000..2cf9a08
--- /dev/null
+++ b/cameraservice/device/aidl/android/frameworks/cameraservice/device/ICameraDeviceUser.aidl
@@ -0,0 +1,265 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.cameraservice.device;
+
+import android.frameworks.cameraservice.device.CameraMetadata;
+import android.frameworks.cameraservice.device.CaptureRequest;
+import android.frameworks.cameraservice.device.OutputConfiguration;
+import android.frameworks.cameraservice.device.SessionConfiguration;
+import android.frameworks.cameraservice.device.StreamConfigurationMode;
+import android.frameworks.cameraservice.device.SubmitInfo;
+import android.frameworks.cameraservice.device.TemplateId;
+import android.hardware.common.fmq.MQDescriptor;
+import android.hardware.common.fmq.SynchronizedReadWrite;
+
+@VintfStability
+interface ICameraDeviceUser {
+
+ /**
+ * Begin device configuration.
+ *
+ * @throws ServiceSpecificException on failure with error code set to Status corresponding to
+ * the specific failure.
+ */
+ void beginConfigure();
+
+ /**
+ * Cancel the current repeating request.
+ *
+ * The current repeating request may be stopped by camera device due to an
+ * error.
+ *
+ * @throws ServiceSpecificException with the following values:
+ * Status::INVALID_OPERATION when there is no active repeating request
+ *
+ * @return the frame number of the last frame that will be
+ * produced from this repeating request. If there are no inflight
+ * repeating requests, this will return -1 as the frameNumber.
+ * If the status is not NO_ERROR, the frame number should not be
+ * used.
+ */
+ long cancelRepeatingRequest();
+
+ /**
+ * Create a default capture request for capturing an image.
+ *
+ * @param templateId the type of capture request to be created.
+ *
+ * @throws ServiceSpecificException on failure with error code set to Status corresponding to
+ * the specific failure.
+ * @return the settings metadata of the request.
+ */
+ CameraMetadata createDefaultRequest(in TemplateId templateId);
+
+ /**
+ * Create an output stream based on the given output configuration.
+ *
+ * Note: createStream() must only be called within a beginConfigure() and an
+ * endConfigure() block.
+ *
+ * @param outputConfiguration size, format, and other parameters for the
+ * stream
+ *
+ * @throws ServiceSpecificException on failure with error code set to Status corresponding to
+ * the specific failure.
+ * @return stream ID of the new stream generated.
+ */
+ int createStream(in OutputConfiguration outputConfiguration);
+
+ /**
+ * delete the stream specified by streamId.
+ *
+ * Note: deleteStream() must only be called within a beginConfigure() and an
+ * endConfigure() block.
+ *
+ * @throws ServiceSpecificException on failure with error code set to Status corresponding to
+ * the specific failure.
+ * @param streamId the stream id of the stream to be deleted
+ */
+ void deleteStream(in int streamId);
+
+ /**
+ * disconnect from using the camera device.
+ * This method must block till in-flight requests are completed and stop
+ * all the requests submitted through submitRequestList().
+ */
+ void disconnect();
+
+ /**
+ * End the device configuration.
+ *
+ * endConfigure must be called after stream configuration is complete
+ * (i.e. after a call to beginConfigure and subsequent
+ * createStream/deleteStream calls). It must be called before any
+ * requests can be submitted.
+ *
+ * @param operatingMode The kind of session to create; either NORMAL_MODE,
+ * CONSTRAINED_HIGH_SPEED_MODE, or one of the vendor modes.
+ * @param sessionParams Session-wide camera parameters. Empty session
+ * parameters are legal inputs.
+ * @param startTimeNs indicate the timestamp when session configuration
+ * starts.
+ *
+ * @throws ServiceSpecificException on failure with error code set to Status corresponding to
+ * the specific failure.
+ */
+ void endConfigure(in StreamConfigurationMode operatingMode, in CameraMetadata sessionParams, in long startTimeNs);
+
+ /**
+ * flush all the requests pending on the device.
+ *
+ * @throws ServiceSpecificException on failure with error code set to Status corresponding to
+ * the specific failure.
+ * @return the frame number of the last frame flushed.
+ */
+ long flush();
+
+ /**
+ * Retrieve the fast message queue to be optionally used in CaptureRequests,
+ * to pass the settings metadata.
+ * If the client decides to use FMQ, it must:
+ * - Call getCaptureRequestMetadataQueue to retrieve the fast message queue
+ * - In submitRequestList calls, for each request set the fmqMetadataSize
+ * in the settings field of physicalCameraSettings, to the size of the
+ * metadata.
+ *
+ * @return the queue that the client writes the request settings
+ * metadata to.
+ */
+ MQDescriptor<byte, SynchronizedReadWrite> getCaptureRequestMetadataQueue();
+
+ /**
+ * Retrieve the fast message queue used along with
+ * ICameraDeviceCallback.onResultReceived.
+ *
+ * Note: The client's use of this function does not affect the hidl
+ * service's decision to use / not use FMQ to pass result metadata to the
+ * client.
+ *
+ * Clients implementing the callback must:
+ * - Retrieve the queue using getCaptureResultMetadataQueue.
+ * - In the implementation of ICameraDeviceCallback.onResultReceived, if
+ * PhysicalCaptureResultInfo.physicalCameraMetadata has a valid
+ * fmqMetadataSize (which is > 0), the metadata must be read from the FMQ,
+ * else, it must be read from the metadata field.
+ * The same applies to resultMetadata.
+ *
+ * @return the queue that the client reads the result metadata from.
+ */
+ MQDescriptor<byte, SynchronizedReadWrite> getCaptureResultMetadataQueue();
+
+ /**
+ * Check whether a particular session configuration has camera device
+ * support.
+ *
+ * @param sessionConfiguration Specific session configuration to be verified.
+ *
+ * @throws ServiceSpecificException on failure with error code set to Status corresponding to
+ * the specific failure.
+ * @return true - in case the stream combination is supported.
+ * false - in case there is no device support.
+ */
+ boolean isSessionConfigurationSupported(in SessionConfiguration sessionConfiguration);
+
+ /**
+ *
+ * <p>Pre-allocate buffers for a stream.</p>
+ *
+ * <p>Normally, the image buffers for a given stream are allocated on-demand,
+ * to minimize startup latency and memory overhead.</p>
+ *
+ * <p>However, in some cases, it may be desirable for the buffers to be allocated before
+ * any requests targeting the window are actually submitted to the device. Large buffers
+ * may take some time to allocate, which can result in delays in submitting requests until
+ * sufficient buffers are allocated to reach steady-state behavior. Such delays can cause
+ * bursts to take longer than desired, or cause skips or stutters in preview output.</p>
+ *
+ * <p>The prepare() call can be used by clients to perform this pre-allocation.
+ * It may only be called for a given output stream before that stream is used as a target for a
+ * request. The number of buffers allocated is the sum of the count needed by the consumer
+ * providing the output stream, and the maximum number needed by the camera device to fill its
+ * pipeline.
+ * Since this may be a larger number than what is actually required for steady-state operation,
+ * using this call may result in higher memory consumption than the normal on-demand behavior
+ * results in. This method will also delay the time to first output to a given stream,
+ * in exchange for smoother frame rate once the allocation is complete.</p>
+ *
+ * <p>For example, a client that creates an
+ * {@link AImageReader} with a maxImages argument of 10,
+ * but only uses 3 simultaneous {@link AImage}s at once, would normally only cause those 3
+ * images to be allocated (plus what is needed by the camera device for smooth operation).
+ * But using prepare() on the {@link AImageReader}'s window will result in all 10
+ * {@link AImage}s being allocated. So clients using this method should exercise caution
+ * while using this call.</p>
+ *
+ * <p>Once allocation is complete, ICameraDeviceCallback.onPrepared
+ * will be invoked with the stream provided to this method. Between the prepare call and the
+ * ICameraDeviceCallback.onPrepared() call, the output provided to prepare must not be used as
+ * a target of a capture qequest submitted
+ * to this session.</p>
+ *
+ * @param streamId the stream id of the stream for which buffer pre-allocation is to be done.
+ */
+ void prepare(in int streamId);
+
+ /**
+ * Submit a list of capture requests.
+ *
+ * Note: Clients must call submitRequestList() serially if they opt
+ * to utilize an fmq (obtained by calling getCaptureRequestMetadataQueue)
+ * for any CaptureRequest's physicalCameraSettings metadata.
+ *
+ * @param requestList The list of CaptureRequests
+ * @param isRepeating Whether the set of requests repeats indefinitely.
+ *
+ * @throws ServiceSpecificException on failure with error code set to Status corresponding to
+ * the specific failure.
+ * @return SubmitInfo data structure containing the request id of the
+ * capture request and the frame number of the last frame that will
+ * be produced(In case the request is not repeating. Otherwise it
+ * contains the frame number of the last request, of the previus
+ * batch of repeating requests, if any. If there is no previous
+ * batch, the frame number returned will be -1.)
+ */
+ SubmitInfo submitRequestList(in CaptureRequest[] requestList, in boolean isRepeating);
+
+ /**
+ * Update a previously set output configuration.
+ *
+ * Note: It is legal to call this method outside of
+ * beginConfigure()/endConfigure() blocks and also when the device
+ * is not idle.
+ *
+ * @param streamId the stream id whose output configuration needs to be
+ * updated.
+ * @param outputConfiguration the new outputConfiguration.
+ *
+ * @throws ServiceSpecificException on failure with error code set to Status corresponding to
+ * the specific failure.
+ */
+ void updateOutputConfiguration(in int streamId, in OutputConfiguration outputConfiguration);
+
+ /**
+ * Block until the device is idle.
+ *
+ * Note: This method will not block if there are active repeating requests.
+ *
+ * @throws ServiceSpecificException with the following values:
+ * Status::INVALID_OPERATION if there are active repeating requests.
+ */
+ void waitUntilIdle();
+}
diff --git a/cameraservice/device/aidl/android/frameworks/cameraservice/device/OutputConfiguration.aidl b/cameraservice/device/aidl/android/frameworks/cameraservice/device/OutputConfiguration.aidl
new file mode 100644
index 0000000..449b80d
--- /dev/null
+++ b/cameraservice/device/aidl/android/frameworks/cameraservice/device/OutputConfiguration.aidl
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.cameraservice.device;
+
+import android.hardware.common.NativeHandle;
+
+/**
+ * This describes camera output. It has configurations specific to a
+ * capture session.
+ */
+@VintfStability
+parcelable OutputConfiguration {
+ /**
+ * Rotation values for camera output
+ */
+ @VintfStability
+ @Backing(type="int")
+ enum Rotation {
+ R0 = 0,
+ R90 = 1,
+ R180 = 2,
+ R270 = 3,
+ }
+ @VintfStability
+ @Backing(type="int")
+ enum WindowGroupId {
+ NONE = -1,
+ }
+ /**
+ * These must be handles to ANativeWindows owned by AImageReader,
+ * obtained by using AImageReader_getWindowNativeHandle. Ref:
+ * (frameworks/av/media/ndk/include/media/NdkImageReader.h).
+ * When this vector has more than one window handle, native window surface
+ * sharing is enabled. Clients may take advantage of this in advanced use
+ * cases when they would require create more streams than the limits the
+ * camera device imposes [1]. In this case, more than one window must be
+ * attached to an OutputConfiguration so that they map to one camera stream.
+ * The outputs will share memory buffers whenever possible. Due to buffer
+ * sharing, client should be careful while adding native window outputs that
+ * modify their input data. If such cases exist, client must have additional
+ * mechanisms to synchronize read and write accesses between consumers.
+ * [1]: Ref : frameworks/av/camera/ndk/include/camera/NdkCameraDevice.h
+ */
+ NativeHandle[] windowHandles;
+ /**
+ * The rotation value for the camera output for this configuration.
+ * Only Rotation::R0 is guaranteed to be supported.
+ */
+ Rotation rotation;
+ /**
+ * A windowGroupId is used to identify which window group this output window belongs to. A
+ * window group is a group of output windows that are not intended to receive camera output
+ * buffer streams simultaneously. The ICameraDevice may be able to share the buffers used
+ * by all the windows from the same window group, therefore may reduce the overall memory
+ * footprint. The client must only set the same set id for the streams that are not
+ * simultaneously streaming. For OutputConfigurations not belonging to any
+ * window group the client must set windowGroupId to WindowGroupId::NONE.
+ */
+ int windowGroupId;
+ /**
+ * The id of the physical camera id, that this OutputConfiguration is meant
+ * for. If the no physical camera id is expected, this must be an empty
+ * string.
+ */
+ String physicalCameraId;
+ /**
+ * The width of the output stream.
+ *
+ * Note: this must only be used when using deferred streams. Otherwise, it
+ * must be set to 0.
+ */
+ int width;
+ /**
+ * The height of the output stream.
+ *
+ * Note: this must only be used when using deferred streams. Otherwise, it
+ * must be set to 0.
+ */
+ int height;
+ /**
+ * This must be set to true, if this OutputConfiguration contains handles to
+ * deferred native windows.
+ * Ref:frameworks/base/core/java/android/hardware/camera2/params/OutputConfiguration.java
+ */
+ boolean isDeferred;
+}
diff --git a/cameraservice/device/aidl/android/frameworks/cameraservice/device/PhysicalCameraSettings.aidl b/cameraservice/device/aidl/android/frameworks/cameraservice/device/PhysicalCameraSettings.aidl
new file mode 100644
index 0000000..0e690cf
--- /dev/null
+++ b/cameraservice/device/aidl/android/frameworks/cameraservice/device/PhysicalCameraSettings.aidl
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.cameraservice.device;
+
+import android.frameworks.cameraservice.device.CaptureMetadataInfo;
+
+/**
+ * Data structure tying camera id and settings metadata.
+ *
+ */
+@VintfStability
+parcelable PhysicalCameraSettings {
+ String id;
+ CaptureMetadataInfo settings;
+}
diff --git a/cameraservice/device/aidl/android/frameworks/cameraservice/device/PhysicalCaptureResultInfo.aidl b/cameraservice/device/aidl/android/frameworks/cameraservice/device/PhysicalCaptureResultInfo.aidl
new file mode 100644
index 0000000..ea41f4b
--- /dev/null
+++ b/cameraservice/device/aidl/android/frameworks/cameraservice/device/PhysicalCaptureResultInfo.aidl
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.cameraservice.device;
+
+import android.frameworks.cameraservice.device.CaptureMetadataInfo;
+
+/**
+ * This ties physical camera metadata to a particular camera device for a
+ * particular capture result.
+ */
+@VintfStability
+parcelable PhysicalCaptureResultInfo {
+ String physicalCameraId;
+ CaptureMetadataInfo physicalCameraMetadata;
+}
diff --git a/cameraservice/device/aidl/android/frameworks/cameraservice/device/SessionConfiguration.aidl b/cameraservice/device/aidl/android/frameworks/cameraservice/device/SessionConfiguration.aidl
new file mode 100644
index 0000000..ab578d8
--- /dev/null
+++ b/cameraservice/device/aidl/android/frameworks/cameraservice/device/SessionConfiguration.aidl
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.cameraservice.device;
+
+import android.frameworks.cameraservice.device.OutputConfiguration;
+import android.frameworks.cameraservice.device.StreamConfigurationMode;
+
+@VintfStability
+parcelable SessionConfiguration {
+ /**
+ * A vector containing all output configurations
+ */
+ OutputConfiguration[] outputStreams;
+ /**
+ * Input stream width
+ *
+ * Note: this must be <= 0 if there is no input stream.
+ */
+ int inputWidth;
+ /**
+ * Input stream height
+ *
+ * Note: this must be <= 0 if there is no input stream.
+ */
+ int inputHeight;
+ /**
+ * Input stream format
+ *
+ * Note: this must be one of the AIMAGE_FORMATS defined in
+ * frameworks/av/media/ndk/include/media/NdkImage.h.
+ */
+ int inputFormat;
+ /**
+ * Operation mode of camera device
+ */
+ StreamConfigurationMode operationMode;
+}
diff --git a/cameraservice/device/aidl/android/frameworks/cameraservice/device/StreamAndWindowId.aidl b/cameraservice/device/aidl/android/frameworks/cameraservice/device/StreamAndWindowId.aidl
new file mode 100644
index 0000000..74518a2
--- /dev/null
+++ b/cameraservice/device/aidl/android/frameworks/cameraservice/device/StreamAndWindowId.aidl
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.cameraservice.device;
+
+/**
+ * Data structure tying stream id and window id for a native window.
+ */
+@VintfStability
+parcelable StreamAndWindowId {
+ /**
+ * This must be the stream id corresponding to the native window (the streamId
+ * returned from the createStream() method, which took in the
+ * OutputConfiguration which contained this native window)
+ */
+ int streamId;
+ /**
+ * This must be the array index of the of the window handle corresponding to
+ * the native window, which was packaged with the OutputConfiguration.
+ */
+ int windowId;
+}
diff --git a/cameraservice/device/aidl/android/frameworks/cameraservice/device/StreamConfigurationMode.aidl b/cameraservice/device/aidl/android/frameworks/cameraservice/device/StreamConfigurationMode.aidl
new file mode 100644
index 0000000..792c92c
--- /dev/null
+++ b/cameraservice/device/aidl/android/frameworks/cameraservice/device/StreamConfigurationMode.aidl
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.cameraservice.device;
+
+/**
+ * This defines the general operation mode for the HAL (for a given stream
+ * configuration) where modes besides NORMAL have different semantics, and
+ * usually limit the generality of the API in exchange for higher performance in
+ * some particular area.
+ */
+@VintfStability
+@Backing(type="int")
+enum StreamConfigurationMode {
+ /**
+ * Normal stream configuration operation mode. This is the default camera
+ * operation mode, where all semantics of HAL APIs and metadata controls
+ * apply.
+ */
+ NORMAL_MODE = 0,
+ /**
+ * Special constrained high speed operation mode for devices that can not
+ * support high speed output in NORMAL mode.
+ */
+ CONSTRAINED_HIGH_SPEED_MODE = 1,
+ /**
+ * A set of vendor-defined operating modes, for custom default camera
+ * application features that can't be implemented in a fully flexible
+ * fashion required for NORMAL_MODE.
+ */
+ VENDOR_MODE_0 = 0x8000,
+ VENDOR_MODE_1,
+ VENDOR_MODE_2,
+ VENDOR_MODE_3,
+ VENDOR_MODE_4,
+ VENDOR_MODE_5,
+ VENDOR_MODE_6,
+ VENDOR_MODE_7,
+}
diff --git a/cameraservice/device/aidl/android/frameworks/cameraservice/device/SubmitInfo.aidl b/cameraservice/device/aidl/android/frameworks/cameraservice/device/SubmitInfo.aidl
new file mode 100644
index 0000000..6a29a9f
--- /dev/null
+++ b/cameraservice/device/aidl/android/frameworks/cameraservice/device/SubmitInfo.aidl
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.cameraservice.device;
+
+/**
+ * The status information returned for a successful capture request submission.
+ *
+ * This includes the request ID for the newly submitted capture request, and the
+ * last frame number of either the previous repeating request (for repeating
+ * requests), or of the request(s) just submitted (for single-shot capture).
+ */
+@VintfStability
+parcelable SubmitInfo {
+ int requestId;
+ long lastFrameNumber;
+}
diff --git a/cameraservice/device/aidl/android/frameworks/cameraservice/device/TemplateId.aidl b/cameraservice/device/aidl/android/frameworks/cameraservice/device/TemplateId.aidl
new file mode 100644
index 0000000..776738f
--- /dev/null
+++ b/cameraservice/device/aidl/android/frameworks/cameraservice/device/TemplateId.aidl
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.cameraservice.device;
+
+/**
+ * TemplateId to be used with createDefaultRequest
+ */
+@VintfStability
+@Backing(type="int")
+enum TemplateId {
+ /**
+ * Create a request suitable for a camera preview window. Specifically, this
+ * means that high frame rate is given priority over the highest-quality
+ * post-processing.
+ */
+ PREVIEW = 1,
+ /**
+ * Create a request suitable for still image capture. Specifically, this
+ * means prioritizing image quality over frame rate
+ */
+ STILL_CAPTURE = 2,
+ /**
+ * Create a request suitable for video recording. Specifically, this means
+ * that a stable frame rate is used, and post-processing is set for
+ * recording quality.
+ */
+ RECORD = 3,
+ /**
+ * Create a request suitable for still image capture while recording
+ * video. Specifically, this means maximizing image quality without
+ * disrupting the ongoing recording.
+ */
+ VIDEO_SNAPSHOT = 4,
+ /**
+ * Create a request suitable for zero shutter lag still capture. This means
+ * means maximizing image quality without compromising preview frame rate.
+ */
+ ZERO_SHUTTER_LAG = 5,
+ /**
+ * A basic template for direct application control of capture
+ * parameters. All automatic control is disabled (auto-exposure, auto-white
+ * balance, auto-focus), and post-processing parameters are set to preview
+ * quality. The manual capture parameters (exposure, sensitivity, and so on)
+ * are set to reasonable defaults, but should be overridden by the
+ * application depending on the intended use case.
+ */
+ MANUAL = 6,
+}
diff --git a/cameraservice/service/aidl/Android.bp b/cameraservice/service/aidl/Android.bp
new file mode 100644
index 0000000..7b9cb3c
--- /dev/null
+++ b/cameraservice/service/aidl/Android.bp
@@ -0,0 +1,39 @@
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+aidl_interface {
+ name: "android.frameworks.cameraservice.service",
+ vendor_available: true,
+ srcs: ["android/frameworks/cameraservice/service/*.aidl"],
+ stability: "vintf",
+ imports: [
+ "android.frameworks.cameraservice.common-V1",
+ "android.frameworks.cameraservice.device-V1",
+ ],
+ frozen: true,
+ backend: {
+ cpp: {
+ enabled: false,
+ },
+ java: {
+ enabled: false,
+ },
+ ndk: {
+ vndk: {
+ enabled: true,
+ },
+ },
+ },
+ vndk_use_version: "1",
+ versions_with_info: [
+ {
+ version: "1",
+ imports: [
+ "android.frameworks.cameraservice.common-V1",
+ "android.frameworks.cameraservice.device-V1",
+ ],
+ },
+ ],
+
+}
diff --git a/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/1/.hash b/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/1/.hash
new file mode 100644
index 0000000..9053457
--- /dev/null
+++ b/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/1/.hash
@@ -0,0 +1 @@
+9af5caea9ed28139c7005ead2e2c851351a4caa1
diff --git a/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/1/android/frameworks/cameraservice/service/CameraDeviceStatus.aidl b/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/1/android/frameworks/cameraservice/service/CameraDeviceStatus.aidl
new file mode 100644
index 0000000..a809751
--- /dev/null
+++ b/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/1/android/frameworks/cameraservice/service/CameraDeviceStatus.aidl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.service;
+@Backing(type="int") @VintfStability
+enum CameraDeviceStatus {
+ STATUS_NOT_AVAILABLE = (-2) /* -2 */,
+ STATUS_UNKNOWN = (-1) /* -1 */,
+ STATUS_NOT_PRESENT = 0,
+ STATUS_PRESENT = 1,
+ STATUS_ENUMERATING = 2,
+}
diff --git a/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/1/android/frameworks/cameraservice/service/CameraStatusAndId.aidl b/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/1/android/frameworks/cameraservice/service/CameraStatusAndId.aidl
new file mode 100644
index 0000000..4a92a45
--- /dev/null
+++ b/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/1/android/frameworks/cameraservice/service/CameraStatusAndId.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.service;
+@VintfStability
+parcelable CameraStatusAndId {
+ android.frameworks.cameraservice.service.CameraDeviceStatus deviceStatus;
+ String cameraId;
+ String[] unavailPhysicalCameraIds;
+}
diff --git a/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/1/android/frameworks/cameraservice/service/ICameraService.aidl b/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/1/android/frameworks/cameraservice/service/ICameraService.aidl
new file mode 100644
index 0000000..9bca528
--- /dev/null
+++ b/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/1/android/frameworks/cameraservice/service/ICameraService.aidl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.service;
+@VintfStability
+interface ICameraService {
+ android.frameworks.cameraservice.service.CameraStatusAndId[] addListener(in android.frameworks.cameraservice.service.ICameraServiceListener listener);
+ android.frameworks.cameraservice.device.ICameraDeviceUser connectDevice(in android.frameworks.cameraservice.device.ICameraDeviceCallback callback, in String cameraId);
+ android.frameworks.cameraservice.device.CameraMetadata getCameraCharacteristics(in String cameraId);
+ android.frameworks.cameraservice.common.ProviderIdAndVendorTagSections[] getCameraVendorTagSections();
+ void removeListener(in android.frameworks.cameraservice.service.ICameraServiceListener listener);
+}
diff --git a/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/1/android/frameworks/cameraservice/service/ICameraServiceListener.aidl b/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/1/android/frameworks/cameraservice/service/ICameraServiceListener.aidl
new file mode 100644
index 0000000..fcce780
--- /dev/null
+++ b/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/1/android/frameworks/cameraservice/service/ICameraServiceListener.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.service;
+@VintfStability
+interface ICameraServiceListener {
+ oneway void onPhysicalCameraStatusChanged(in android.frameworks.cameraservice.service.CameraDeviceStatus status, in String cameraId, in String physicalCameraId);
+ oneway void onStatusChanged(in android.frameworks.cameraservice.service.CameraDeviceStatus status, in String cameraId);
+}
diff --git a/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/current/android/frameworks/cameraservice/service/CameraDeviceStatus.aidl b/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/current/android/frameworks/cameraservice/service/CameraDeviceStatus.aidl
new file mode 100644
index 0000000..a809751
--- /dev/null
+++ b/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/current/android/frameworks/cameraservice/service/CameraDeviceStatus.aidl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.service;
+@Backing(type="int") @VintfStability
+enum CameraDeviceStatus {
+ STATUS_NOT_AVAILABLE = (-2) /* -2 */,
+ STATUS_UNKNOWN = (-1) /* -1 */,
+ STATUS_NOT_PRESENT = 0,
+ STATUS_PRESENT = 1,
+ STATUS_ENUMERATING = 2,
+}
diff --git a/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/current/android/frameworks/cameraservice/service/CameraStatusAndId.aidl b/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/current/android/frameworks/cameraservice/service/CameraStatusAndId.aidl
new file mode 100644
index 0000000..4a92a45
--- /dev/null
+++ b/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/current/android/frameworks/cameraservice/service/CameraStatusAndId.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.service;
+@VintfStability
+parcelable CameraStatusAndId {
+ android.frameworks.cameraservice.service.CameraDeviceStatus deviceStatus;
+ String cameraId;
+ String[] unavailPhysicalCameraIds;
+}
diff --git a/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/current/android/frameworks/cameraservice/service/ICameraService.aidl b/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/current/android/frameworks/cameraservice/service/ICameraService.aidl
new file mode 100644
index 0000000..9bca528
--- /dev/null
+++ b/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/current/android/frameworks/cameraservice/service/ICameraService.aidl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.service;
+@VintfStability
+interface ICameraService {
+ android.frameworks.cameraservice.service.CameraStatusAndId[] addListener(in android.frameworks.cameraservice.service.ICameraServiceListener listener);
+ android.frameworks.cameraservice.device.ICameraDeviceUser connectDevice(in android.frameworks.cameraservice.device.ICameraDeviceCallback callback, in String cameraId);
+ android.frameworks.cameraservice.device.CameraMetadata getCameraCharacteristics(in String cameraId);
+ android.frameworks.cameraservice.common.ProviderIdAndVendorTagSections[] getCameraVendorTagSections();
+ void removeListener(in android.frameworks.cameraservice.service.ICameraServiceListener listener);
+}
diff --git a/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/current/android/frameworks/cameraservice/service/ICameraServiceListener.aidl b/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/current/android/frameworks/cameraservice/service/ICameraServiceListener.aidl
new file mode 100644
index 0000000..fcce780
--- /dev/null
+++ b/cameraservice/service/aidl/aidl_api/android.frameworks.cameraservice.service/current/android/frameworks/cameraservice/service/ICameraServiceListener.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.cameraservice.service;
+@VintfStability
+interface ICameraServiceListener {
+ oneway void onPhysicalCameraStatusChanged(in android.frameworks.cameraservice.service.CameraDeviceStatus status, in String cameraId, in String physicalCameraId);
+ oneway void onStatusChanged(in android.frameworks.cameraservice.service.CameraDeviceStatus status, in String cameraId);
+}
diff --git a/cameraservice/service/aidl/android/frameworks/cameraservice/service/CameraDeviceStatus.aidl b/cameraservice/service/aidl/android/frameworks/cameraservice/service/CameraDeviceStatus.aidl
new file mode 100644
index 0000000..d7c7ee1
--- /dev/null
+++ b/cameraservice/service/aidl/android/frameworks/cameraservice/service/CameraDeviceStatus.aidl
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.cameraservice.service;
+
+/**
+ * The current status of the device.
+ */
+@VintfStability
+@Backing(type="int")
+enum CameraDeviceStatus {
+ /**
+ * Camera is in use by another app and cannot be used exclusively.
+ */
+ STATUS_NOT_AVAILABLE = -2,
+ /**
+ * Use to initialize variables only.
+ */
+ STATUS_UNKNOWN = -1,
+ /**
+ * Device physically unplugged
+ */
+ STATUS_NOT_PRESENT = 0,
+ /**
+ * Device physically has been plugged in and the camera can be used
+ * exclusively.
+ */
+ STATUS_PRESENT = 1,
+ /**
+ * Device physically has been plugged in but it will not be connect-able
+ * until enumeration is complete.
+ */
+ STATUS_ENUMERATING = 2,
+}
diff --git a/cameraservice/service/aidl/android/frameworks/cameraservice/service/CameraStatusAndId.aidl b/cameraservice/service/aidl/android/frameworks/cameraservice/service/CameraStatusAndId.aidl
new file mode 100644
index 0000000..1020f87
--- /dev/null
+++ b/cameraservice/service/aidl/android/frameworks/cameraservice/service/CameraStatusAndId.aidl
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.cameraservice.service;
+
+import android.frameworks.cameraservice.service.CameraDeviceStatus;
+
+/**
+ * The camera Id and its corresponding CameraDeviceStatus
+ */
+@VintfStability
+parcelable CameraStatusAndId {
+ CameraDeviceStatus deviceStatus;
+ String cameraId;
+ /**
+ * The physical cameras that are unavailable to use (via physical streams)
+ * for this logical multi-camera.
+ */
+ String[] unavailPhysicalCameraIds;
+}
diff --git a/cameraservice/service/aidl/android/frameworks/cameraservice/service/ICameraService.aidl b/cameraservice/service/aidl/android/frameworks/cameraservice/service/ICameraService.aidl
new file mode 100644
index 0000000..ed5bc62
--- /dev/null
+++ b/cameraservice/service/aidl/android/frameworks/cameraservice/service/ICameraService.aidl
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.cameraservice.service;
+
+import android.frameworks.cameraservice.common.ProviderIdAndVendorTagSections;
+import android.frameworks.cameraservice.device.CameraMetadata;
+import android.frameworks.cameraservice.device.ICameraDeviceCallback;
+import android.frameworks.cameraservice.device.ICameraDeviceUser;
+import android.frameworks.cameraservice.service.CameraStatusAndId;
+import android.frameworks.cameraservice.service.ICameraServiceListener;
+
+@VintfStability
+interface ICameraService {
+ /**
+ * Add listener for changes to camera device status.
+ *
+ * Also returns the set of currently-known camera IDs and state of each
+ * device. Adding multiple listeners must result in the callbacks defined by
+ * ICameraServiceListener being called on all of them, on change of device
+ * status.
+ *
+ * - The listener contains an onPhysicalCameraStatusChanged function,
+ * which is called by the camera service when a physical camera backing a
+ * logical multi-camera becomes unavailable or available again.
+ * - The function returns a vector of the newer version of CameraStatusAndId
+ * which contains unavailable physical cameras if the specified camera is a
+ * logical multi-camera.
+ *
+ * @param listener the listener interface to be added. The cameraserver will
+ * call callbacks on this interface when a camera device's status
+ * changes.
+ *
+ * @throws ServiceSpecificException on failure with error code set to Status corresponding to
+ * the specific failure.
+ * @return a list of CameraStatusAndIds which stores the deviceIds,
+ * their corresponding statuses, and the unavailable physical camera Ids
+ * if the device is a logical multi-camera.
+ */
+ CameraStatusAndId[] addListener(in ICameraServiceListener listener);
+
+ /**
+ * connectDevice
+ *
+ * Return an ICameraDeviceUser interface for the requested cameraId.
+ *
+ * Note: The client must have camera permissions to call this method
+ * successfully.
+ *
+ * @param callback the ICameraDeviceCallback interface which will get called
+ * the cameraserver when capture is started, results are received
+ * etc.
+ * @param cameraId the cameraId of the camera device to connect to.
+ *
+ * @throws ServiceSpecificException on failure with error code set to Status corresponding to
+ * the specific failure.
+ * @return ICameraDeviceUser interface to the camera device requested.
+ */
+ ICameraDeviceUser connectDevice(in ICameraDeviceCallback callback,
+ in String cameraId);
+
+ /**
+ * Read the static camera metadata for a camera device.
+ *
+ * @param cameraId the camera id of the camera device, whose metadata is
+ * being requested.
+ *
+ * @throws ServiceSpecificException on failure with error code set to Status corresponding to
+ * the specific failure.
+ * @return the static metadata of the camera device requested.
+ */
+ CameraMetadata getCameraCharacteristics(in String cameraId);
+
+ /**
+ * Read in the provider ids and corresponding vendor tag sections from the camera server.
+ * Intended to be used by the native code of CameraMetadata to correctly
+ * interpret camera metadata with vendor tags.
+ *
+ * Note: VendorTag caches may be created in process, by clients. An AIDL api
+ * is not provided for this.
+ *
+ * @throws ServiceSpecificException on failure with error code set to Status corresponding to
+ * the specific failure.
+ * @return the list of provider ids and corresponding vendor tag sections.
+ */
+ ProviderIdAndVendorTagSections[] getCameraVendorTagSections();
+
+ /**
+ * Remove listener for changes to camera device status.
+ *
+ * @param listener the listener to be removed from receiving callbacks on
+ * changes to device state.
+ *
+ * @throws ServiceSpecificException on failure with error code set to Status corresponding to
+ * the specific failure.
+ */
+ void removeListener(in ICameraServiceListener listener);
+}
diff --git a/cameraservice/service/aidl/android/frameworks/cameraservice/service/ICameraServiceListener.aidl b/cameraservice/service/aidl/android/frameworks/cameraservice/service/ICameraServiceListener.aidl
new file mode 100644
index 0000000..2608028
--- /dev/null
+++ b/cameraservice/service/aidl/android/frameworks/cameraservice/service/ICameraServiceListener.aidl
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.cameraservice.service;
+
+import android.frameworks.cameraservice.service.CameraDeviceStatus;
+
+@VintfStability
+oneway interface ICameraServiceListener {
+ /**
+ * Callback called by cameraservice when the status of a physical
+ * camera device backing a logical camera changes
+ *
+ * @param status the current device status
+ * @param cameraId the logical camera device that the physical camera
+ * device belongs to
+ * @param physicalCameraId the physical camera device whose status
+ * change is being reported
+ */
+ void onPhysicalCameraStatusChanged(in CameraDeviceStatus status, in String cameraId,
+ in String physicalCameraId);
+
+ /**
+ * Callback called by cameraservice when the status of a camera device
+ * changes
+ *
+ * @param status the current device status
+ * @param cameraId the camera device whose status change is being reported
+ */
+ void onStatusChanged(in CameraDeviceStatus status, in String cameraId);
+}
diff --git a/cameraservice/vts/functional/Android.bp b/cameraservice/vts/functional/Android.bp
index 1bca510..b162060 100644
--- a/cameraservice/vts/functional/Android.bp
+++ b/cameraservice/vts/functional/Android.bp
@@ -44,3 +44,33 @@ cc_test {
test_suites: ["vts"],
}
+
+cc_test {
+ name: "VtsAidlCameraServiceTargetTest",
+ defaults: [
+ "VtsHalTargetTestDefaults",
+ ],
+
+ vendor: true,
+ srcs: ["VtsAidlCameraServiceTargetTest.cpp"],
+ static_libs: [
+ "android.hardware.common-V2-ndk",
+ "android.hardware.common.fmq-V1-ndk",
+ "android.hardware.camera.common-helper",
+ "android.frameworks.cameraservice.common-V1-ndk",
+ "android.frameworks.cameraservice.device-V1-ndk",
+ "android.frameworks.cameraservice.service-V1-ndk",
+ "libaidlcommonsupport",
+ "libfmq",
+ "libarect",
+ ],
+ shared_libs: [
+ "libbinder_ndk",
+ "libcamera_metadata",
+ "libmediandk",
+ "libnativewindow",
+ "liblog",
+ ],
+
+ test_suites: ["vts"],
+}
diff --git a/cameraservice/vts/functional/VtsAidlCameraServiceTargetTest.cpp b/cameraservice/vts/functional/VtsAidlCameraServiceTargetTest.cpp
new file mode 100644
index 0000000..9b5eab9
--- /dev/null
+++ b/cameraservice/vts/functional/VtsAidlCameraServiceTargetTest.cpp
@@ -0,0 +1,598 @@
+/*
+ * Copyright (C) 2022 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 "VtsAidlCameraServiceTargetTest"
+// #define LOG_NDEBUG 0
+
+#include <CameraMetadata.h>
+#include <aidl/android/frameworks/cameraservice/device/BnCameraDeviceCallback.h>
+#include <aidl/android/frameworks/cameraservice/device/CaptureRequest.h>
+#include <aidl/android/frameworks/cameraservice/device/ICameraDeviceUser.h>
+#include <aidl/android/frameworks/cameraservice/device/OutputConfiguration.h>
+#include <aidl/android/frameworks/cameraservice/device/StreamConfigurationMode.h>
+#include <aidl/android/frameworks/cameraservice/device/SubmitInfo.h>
+#include <aidl/android/frameworks/cameraservice/device/TemplateId.h>
+#include <aidl/android/frameworks/cameraservice/service/BnCameraServiceListener.h>
+#include <aidl/android/frameworks/cameraservice/service/CameraStatusAndId.h>
+#include <aidl/android/frameworks/cameraservice/service/ICameraService.h>
+#include <aidlcommonsupport/NativeHandle.h>
+#include <android/binder_manager.h>
+#include <android/binder_process.h>
+#include <android/log.h>
+#include <fmq/AidlMessageQueue.h>
+#include <gtest/gtest.h>
+#include <hidl/GtestPrinter.h>
+#include <media/NdkImageReader.h>
+#include <stdint.h>
+#include <system/camera_metadata.h>
+#include <system/graphics.h>
+#include <utils/Condition.h>
+#include <utils/Mutex.h>
+#include <utils/StrongPointer.h>
+
+#include <algorithm>
+#include <string>
+#include <unordered_map>
+#include <unordered_set>
+#include <vector>
+
+namespace android {
+
+using ::aidl::android::frameworks::cameraservice::device::BnCameraDeviceCallback;
+using ::aidl::android::frameworks::cameraservice::device::CaptureMetadataInfo;
+using ::aidl::android::frameworks::cameraservice::device::CaptureRequest;
+using ::aidl::android::frameworks::cameraservice::device::CaptureResultExtras;
+using ::aidl::android::frameworks::cameraservice::device::ErrorCode;
+using ::aidl::android::frameworks::cameraservice::device::ICameraDeviceUser;
+using ::aidl::android::frameworks::cameraservice::device::OutputConfiguration;
+using ::aidl::android::frameworks::cameraservice::device::PhysicalCaptureResultInfo;
+using ::aidl::android::frameworks::cameraservice::device::StreamConfigurationMode;
+using ::aidl::android::frameworks::cameraservice::device::SubmitInfo;
+using ::aidl::android::frameworks::cameraservice::device::TemplateId;
+using ::aidl::android::frameworks::cameraservice::service::BnCameraServiceListener;
+using ::aidl::android::frameworks::cameraservice::service::CameraDeviceStatus;
+using ::aidl::android::frameworks::cameraservice::service::CameraStatusAndId;
+using ::aidl::android::frameworks::cameraservice::service::ICameraService;
+using ::aidl::android::hardware::common::fmq::MQDescriptor;
+using ::android::hardware::camera::common::helper::CameraMetadata;
+using ::ndk::SpAIBinder;
+
+using AidlCameraMetadata = ::aidl::android::frameworks::cameraservice::device::CameraMetadata;
+using RequestMetadataQueue = AidlMessageQueue<int8_t, SynchronizedReadWrite>;
+
+static constexpr int kCaptureRequestCount = 10;
+static constexpr int kVGAImageWidth = 640;
+static constexpr int kVGAImageHeight = 480;
+static constexpr int kNumRequests = 4;
+
+#define IDLE_TIMEOUT 2000000000 // ns
+
+class CameraServiceListener : public BnCameraServiceListener {
+ std::map<std::string, CameraDeviceStatus> mCameraStatuses;
+ // map: logical camera id -> set of unavailable physical camera ids
+ std::map<std::string, std::set<std::string>> mUnavailablePhysicalCameras;
+ mutable Mutex mLock;
+
+ public:
+ ~CameraServiceListener() override = default;
+
+ ndk::ScopedAStatus onStatusChanged(CameraDeviceStatus in_status,
+ const std::string& in_cameraId) override {
+ Mutex::Autolock l(mLock);
+ mCameraStatuses[in_cameraId] = in_status;
+ return ndk::ScopedAStatus::ok();
+ }
+
+ ndk::ScopedAStatus onPhysicalCameraStatusChanged(
+ CameraDeviceStatus in_status, const std::string& in_cameraId,
+ const std::string& in_physicalCameraId) override {
+ Mutex::Autolock l(mLock);
+ ALOGI("%s: Physical camera %s : %s status changed to %d", __FUNCTION__, in_cameraId.c_str(),
+ in_physicalCameraId.c_str(), in_status);
+
+ EXPECT_NE(mCameraStatuses.find(in_cameraId), mCameraStatuses.end());
+ EXPECT_EQ(mCameraStatuses[in_cameraId], CameraDeviceStatus::STATUS_PRESENT);
+
+ if (in_status == CameraDeviceStatus::STATUS_PRESENT) {
+ auto res = mUnavailablePhysicalCameras[in_cameraId].erase(in_physicalCameraId);
+ EXPECT_EQ(res, 1);
+ } else {
+ auto res = mUnavailablePhysicalCameras[in_cameraId].emplace(in_physicalCameraId);
+ EXPECT_TRUE(res.second);
+ }
+ return ndk::ScopedAStatus::ok();
+ }
+
+ void initializeStatuses(const std::vector<CameraStatusAndId>& statuses) {
+ Mutex::Autolock l(mLock);
+
+ for (auto& status : statuses) {
+ mCameraStatuses[status.cameraId] = status.deviceStatus;
+ for (auto& physicalId : status.unavailPhysicalCameraIds) {
+ mUnavailablePhysicalCameras[status.cameraId].emplace(physicalId);
+ }
+ }
+ }
+};
+
+// ICameraDeviceCallback implementation
+class CameraDeviceCallback : public BnCameraDeviceCallback {
+ public:
+ enum LocalCameraDeviceStatus {
+ IDLE,
+ ERROR,
+ RUNNING,
+ RESULT_RECEIVED,
+ UNINITIALIZED,
+ REPEATING_REQUEST_ERROR,
+ };
+
+ protected:
+ bool mError = false;
+ LocalCameraDeviceStatus mLastStatus = UNINITIALIZED;
+ mutable std::vector<LocalCameraDeviceStatus> mStatusesHit;
+ // stream id -> prepared count;
+ mutable std::unordered_map<int, int> mStreamsPreparedCount;
+ mutable Mutex mLock;
+ mutable Condition mStatusCondition;
+ mutable Condition mPreparedCondition;
+
+ public:
+ CameraDeviceCallback() {}
+
+ ndk::ScopedAStatus onDeviceError(ErrorCode in_errorCode,
+ const CaptureResultExtras& /*in_resultExtras*/) override {
+ ALOGE("%s: onDeviceError occurred with: %d", __FUNCTION__, static_cast<int>(in_errorCode));
+ Mutex::Autolock l(mLock);
+ mError = true;
+ mLastStatus = ERROR;
+ mStatusesHit.push_back(mLastStatus);
+ mStatusCondition.broadcast();
+ return ndk::ScopedAStatus::ok();
+ }
+
+ ndk::ScopedAStatus onDeviceIdle() override {
+ Mutex::Autolock l(mLock);
+ mLastStatus = IDLE;
+ mStatusesHit.push_back(mLastStatus);
+ mStatusCondition.broadcast();
+ return ndk::ScopedAStatus::ok();
+ }
+
+ ndk::ScopedAStatus onCaptureStarted(const CaptureResultExtras& /*in_resultExtras*/,
+ int64_t /*in_timestamp*/) override {
+ Mutex::Autolock l(mLock);
+ mLastStatus = RUNNING;
+ mStatusesHit.push_back(mLastStatus);
+ mStatusCondition.broadcast();
+ return ndk::ScopedAStatus::ok();
+ }
+
+ ndk::ScopedAStatus onResultReceived(
+ const CaptureMetadataInfo& /*in_result*/, const CaptureResultExtras& /*in_resultExtras*/,
+ const std::vector<PhysicalCaptureResultInfo>& /*in_physicalCaptureResultInfos*/) override {
+ Mutex::Autolock l(mLock);
+ mLastStatus = RESULT_RECEIVED;
+ mStatusesHit.push_back(mLastStatus);
+ mStatusCondition.broadcast();
+ return ndk::ScopedAStatus::ok();
+ }
+
+ ndk::ScopedAStatus onRepeatingRequestError(int64_t /*in_lastFrameNumber*/,
+ int32_t /*in_repeatingRequestId*/) override {
+ Mutex::Autolock l(mLock);
+ mLastStatus = REPEATING_REQUEST_ERROR;
+ mStatusesHit.push_back(mLastStatus);
+ mStatusCondition.broadcast();
+ return ndk::ScopedAStatus::ok();
+ }
+
+ ndk::ScopedAStatus onPrepared(int32_t streamId) override {
+ Mutex::Autolock l(mLock);
+ if (mStreamsPreparedCount.find(streamId) == mStreamsPreparedCount.end()) {
+ mStreamsPreparedCount[streamId] = 0;
+ }
+ mStreamsPreparedCount[streamId]++;
+ mPreparedCondition.broadcast();
+ return ndk::ScopedAStatus::ok();
+ }
+
+ bool waitForPreparedCount(int streamId, int count) const {
+ Mutex::Autolock l(mLock);
+ if ((mStreamsPreparedCount.find(streamId) != mStreamsPreparedCount.end()) &&
+ (mStreamsPreparedCount[streamId] == count)) {
+ return true;
+ }
+
+ while ((mStreamsPreparedCount.find(streamId) == mStreamsPreparedCount.end()) ||
+ (mStreamsPreparedCount[streamId] < count)) {
+ if (mPreparedCondition.waitRelative(mLock, IDLE_TIMEOUT) != android::OK) {
+ return false;
+ }
+ }
+ return (mStreamsPreparedCount[streamId] == count);
+ }
+
+ // Test helper functions:
+ bool waitForStatus(LocalCameraDeviceStatus status) const {
+ Mutex::Autolock l(mLock);
+ if (mLastStatus == status) {
+ return true;
+ }
+
+ while (std::find(mStatusesHit.begin(), mStatusesHit.end(), status) == mStatusesHit.end()) {
+ if (mStatusCondition.waitRelative(mLock, IDLE_TIMEOUT) != android::OK) {
+ mStatusesHit.clear();
+ return false;
+ }
+ }
+ mStatusesHit.clear();
+
+ return true;
+ }
+
+ bool waitForIdle() const { return waitForStatus(IDLE); }
+};
+
+static bool convertFromAidlCloned(const AidlCameraMetadata& metadata, CameraMetadata* rawMetadata) {
+ const camera_metadata* buffer = (camera_metadata_t*)(metadata.metadata.data());
+ size_t expectedSize = metadata.metadata.size();
+ int ret = validate_camera_metadata_structure(buffer, &expectedSize);
+ if (ret == OK || ret == CAMERA_METADATA_VALIDATION_SHIFTED) {
+ *rawMetadata = buffer; // assignment operator clones
+ } else {
+ ALOGE("%s: Malformed camera metadata received from caller", __FUNCTION__);
+ return false;
+ }
+ return true;
+}
+
+struct StreamConfiguration {
+ int32_t width = -1;
+ int32_t height = -1;
+};
+
+class VtsAidlCameraServiceTargetTest : public ::testing::TestWithParam<std::string> {
+ public:
+ void SetUp() override {
+ bool success = ABinderProcess_setThreadPoolMaxThreadCount(5);
+ ASSERT_TRUE(success);
+ ABinderProcess_startThreadPool();
+
+ SpAIBinder cameraServiceBinder =
+ SpAIBinder(AServiceManager_checkService(GetParam().c_str()));
+ ASSERT_NE(cameraServiceBinder.get(), nullptr);
+
+ std::shared_ptr<ICameraService> cameraService =
+ ICameraService::fromBinder(cameraServiceBinder);
+ ASSERT_NE(cameraService.get(), nullptr);
+ mCameraService = cameraService;
+ }
+
+ void TearDown() override {}
+
+ // creates an outputConfiguration with no deferred streams
+ static OutputConfiguration createOutputConfiguration(const std::vector<native_handle_t*>& nhs) {
+ OutputConfiguration output;
+ output.rotation = OutputConfiguration::Rotation::R0;
+ output.windowGroupId = -1;
+ output.width = 0;
+ output.height = 0;
+ output.isDeferred = false;
+ output.windowHandles.reserve(nhs.size());
+ for (auto nh : nhs) {
+ output.windowHandles.push_back(::android::makeToAidl(nh));
+ }
+ return output;
+ }
+
+ static void initializeCaptureRequestPartial(CaptureRequest* captureRequest, int32_t streamId,
+ const std::string& cameraId, size_t settingsSize) {
+ captureRequest->physicalCameraSettings.resize(1);
+ captureRequest->physicalCameraSettings[0].id = cameraId;
+ captureRequest->streamAndWindowIds.resize(1);
+ captureRequest->streamAndWindowIds[0].streamId = streamId;
+ captureRequest->streamAndWindowIds[0].windowId = 0;
+ // Write the settings metadata into the fmq.
+ captureRequest->physicalCameraSettings[0]
+ .settings.set<CaptureMetadataInfo::fmqMetadataSize>(settingsSize);
+ }
+
+ static bool doesCapabilityExist(const CameraMetadata& characteristics, int capability) {
+ camera_metadata_ro_entry rawEntry =
+ characteristics.find(ANDROID_REQUEST_AVAILABLE_CAPABILITIES);
+ EXPECT_TRUE(rawEntry.count > 0);
+ for (size_t i = 0; i < rawEntry.count; i++) {
+ if (rawEntry.data.u8[i] == capability) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ static bool isSecureOnlyDevice(const CameraMetadata& characteristics) {
+ camera_metadata_ro_entry rawEntry =
+ characteristics.find(ANDROID_REQUEST_AVAILABLE_CAPABILITIES);
+ EXPECT_TRUE(rawEntry.count > 0);
+ if (rawEntry.count == 1 &&
+ rawEntry.data.u8[0] == ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SECURE_IMAGE_DATA) {
+ return true;
+ }
+ return false;
+ }
+
+ // Return the first advertised available stream sizes for the given format
+ // and use-case.
+ static StreamConfiguration getStreamConfiguration(const CameraMetadata& characteristics,
+ uint32_t tag, int32_t chosenUse,
+ int32_t chosenFormat) {
+ camera_metadata_ro_entry rawEntry = characteristics.find(tag);
+ StreamConfiguration streamConfig;
+ const size_t STREAM_FORMAT_OFFSET = 0;
+ const size_t STREAM_WIDTH_OFFSET = 1;
+ const size_t STREAM_HEIGHT_OFFSET = 2;
+ const size_t STREAM_INOUT_OFFSET = 3;
+ const size_t STREAM_CONFIG_SIZE = 4;
+ if (rawEntry.count < STREAM_CONFIG_SIZE) {
+ return streamConfig;
+ }
+ EXPECT_TRUE((rawEntry.count % STREAM_CONFIG_SIZE) == 0);
+ for (size_t i = 0; i < rawEntry.count; i += STREAM_CONFIG_SIZE) {
+ int32_t format = rawEntry.data.i32[i + STREAM_FORMAT_OFFSET];
+ int32_t use = rawEntry.data.i32[i + STREAM_INOUT_OFFSET];
+ if (format == chosenFormat && use == chosenUse) {
+ streamConfig.width = rawEntry.data.i32[i + STREAM_WIDTH_OFFSET];
+ streamConfig.height = rawEntry.data.i32[i + STREAM_HEIGHT_OFFSET];
+ return streamConfig;
+ }
+ }
+ return streamConfig;
+ }
+ void BasicCameraTests(bool prepareWindows) {
+ std::shared_ptr<CameraServiceListener> listener =
+ ::ndk::SharedRefBase::make<CameraServiceListener>();
+ std::vector<CameraStatusAndId> cameraStatuses;
+
+ ndk::ScopedAStatus ret = mCameraService->addListener(listener, &cameraStatuses);
+ EXPECT_TRUE(ret.isOk());
+ listener->initializeStatuses(cameraStatuses);
+
+ for (const auto& it : cameraStatuses) {
+ CameraMetadata rawMetadata;
+ if (it.deviceStatus != CameraDeviceStatus::STATUS_PRESENT) {
+ continue;
+ }
+ AidlCameraMetadata aidlMetadata;
+ ret = mCameraService->getCameraCharacteristics(it.cameraId, &aidlMetadata);
+ EXPECT_TRUE(ret.isOk());
+ bool cStatus = convertFromAidlCloned(aidlMetadata, &rawMetadata);
+ EXPECT_TRUE(cStatus);
+ EXPECT_FALSE(rawMetadata.isEmpty());
+
+ std::shared_ptr<CameraDeviceCallback> callbacks =
+ ndk::SharedRefBase::make<CameraDeviceCallback>();
+ std::shared_ptr<ICameraDeviceUser> deviceRemote = nullptr;
+ ret = mCameraService->connectDevice(callbacks, it.cameraId, &deviceRemote);
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_TRUE(deviceRemote != nullptr);
+
+ MQDescriptor<int8_t, SynchronizedReadWrite> mqDesc;
+ ret = deviceRemote->getCaptureRequestMetadataQueue(&mqDesc);
+ EXPECT_TRUE(ret.isOk());
+ std::shared_ptr<RequestMetadataQueue> requestMQ =
+ std::make_shared<RequestMetadataQueue>(mqDesc);
+ EXPECT_TRUE(requestMQ->isValid());
+ EXPECT_TRUE((requestMQ->availableToWrite() >= 0));
+
+ AImageReader* reader = nullptr;
+ bool isDepthOnlyDevice =
+ !doesCapabilityExist(rawMetadata,
+ ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE) &&
+ doesCapabilityExist(rawMetadata,
+ ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT);
+ int chosenImageFormat = AIMAGE_FORMAT_YUV_420_888;
+ int chosenImageWidth = kVGAImageWidth;
+ int chosenImageHeight = kVGAImageHeight;
+ bool isSecureOnlyCamera = isSecureOnlyDevice(rawMetadata);
+ status_t mStatus = OK;
+ if (isSecureOnlyCamera) {
+ StreamConfiguration secureStreamConfig = getStreamConfiguration(
+ rawMetadata, ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS,
+ ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT,
+ HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED);
+ EXPECT_TRUE(secureStreamConfig.width != -1);
+ EXPECT_TRUE(secureStreamConfig.height != -1);
+ chosenImageFormat = AIMAGE_FORMAT_PRIVATE;
+ chosenImageWidth = secureStreamConfig.width;
+ chosenImageHeight = secureStreamConfig.height;
+ mStatus = AImageReader_newWithUsage(
+ chosenImageWidth, chosenImageHeight, chosenImageFormat,
+ AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT, kCaptureRequestCount, &reader);
+
+ } else {
+ if (isDepthOnlyDevice) {
+ StreamConfiguration depthStreamConfig = getStreamConfiguration(
+ rawMetadata, ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS,
+ ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_OUTPUT,
+ HAL_PIXEL_FORMAT_Y16);
+ EXPECT_TRUE(depthStreamConfig.width != -1);
+ EXPECT_TRUE(depthStreamConfig.height != -1);
+ chosenImageFormat = AIMAGE_FORMAT_DEPTH16;
+ chosenImageWidth = depthStreamConfig.width;
+ chosenImageHeight = depthStreamConfig.height;
+ }
+ mStatus = AImageReader_new(chosenImageWidth, chosenImageHeight, chosenImageFormat,
+ kCaptureRequestCount, &reader);
+ }
+
+ EXPECT_EQ(mStatus, AMEDIA_OK);
+ native_handle_t* wh = nullptr;
+ mStatus = AImageReader_getWindowNativeHandle(reader, &wh);
+ EXPECT_TRUE(mStatus == AMEDIA_OK && wh != nullptr);
+
+ ret = deviceRemote->beginConfigure();
+ EXPECT_TRUE(ret.isOk());
+
+ OutputConfiguration output = createOutputConfiguration({wh});
+ int32_t streamId = -1;
+ ret = deviceRemote->createStream(output, &streamId);
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_TRUE(streamId >= 0);
+
+ AidlCameraMetadata sessionParams;
+ ret = deviceRemote->endConfigure(StreamConfigurationMode::NORMAL_MODE, sessionParams,
+ systemTime());
+ EXPECT_TRUE(ret.isOk());
+
+ if (prepareWindows) {
+ ret = deviceRemote->prepare(streamId);
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_TRUE(callbacks->waitForPreparedCount(streamId, 1));
+
+ ret = deviceRemote->prepare(streamId);
+ // We should get another callback;
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_TRUE(callbacks->waitForPreparedCount(streamId, 2));
+ }
+ AidlCameraMetadata aidlSettingsMetadata;
+ ret = deviceRemote->createDefaultRequest(TemplateId::PREVIEW, &aidlSettingsMetadata);
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_GE(aidlSettingsMetadata.metadata.size(), 0);
+ std::vector<CaptureRequest> captureRequests;
+ captureRequests.resize(kNumRequests);
+ for (int i = 0; i < kNumRequests; i++) {
+ CaptureRequest& captureRequest = captureRequests[i];
+ initializeCaptureRequestPartial(&captureRequest, streamId, it.cameraId,
+ aidlSettingsMetadata.metadata.size());
+ // Write the settings metadata into the fmq.
+ bool written = requestMQ->write(
+ reinterpret_cast<int8_t*>(aidlSettingsMetadata.metadata.data()),
+ aidlSettingsMetadata.metadata.size());
+ EXPECT_TRUE(written);
+ }
+
+ SubmitInfo info;
+ // Test a single capture
+ ret = deviceRemote->submitRequestList(captureRequests, false, &info);
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_GE(info.requestId, 0);
+ EXPECT_TRUE(callbacks->waitForStatus(
+ CameraDeviceCallback::LocalCameraDeviceStatus::RESULT_RECEIVED));
+ EXPECT_TRUE(callbacks->waitForIdle());
+
+ // Test repeating requests
+ CaptureRequest captureRequest;
+ initializeCaptureRequestPartial(&captureRequest, streamId, it.cameraId,
+ aidlSettingsMetadata.metadata.size());
+
+ bool written =
+ requestMQ->write(reinterpret_cast<int8_t*>(aidlSettingsMetadata.metadata.data()),
+ aidlSettingsMetadata.metadata.size());
+ EXPECT_TRUE(written);
+
+ ret = deviceRemote->submitRequestList({captureRequest}, true, &info);
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_TRUE(callbacks->waitForStatus(
+ CameraDeviceCallback::LocalCameraDeviceStatus::RESULT_RECEIVED));
+
+ int64_t lastFrameNumber = -1;
+ ret = deviceRemote->cancelRepeatingRequest(&lastFrameNumber);
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_GE(lastFrameNumber, 0);
+
+ // Test waitUntilIdle()
+ auto statusRet = deviceRemote->waitUntilIdle();
+ EXPECT_TRUE(statusRet.isOk());
+
+ // Test deleteStream()
+ statusRet = deviceRemote->deleteStream(streamId);
+ EXPECT_TRUE(statusRet.isOk());
+
+ ret = deviceRemote->disconnect();
+ EXPECT_TRUE(ret.isOk());
+ }
+ ret = mCameraService->removeListener(listener);
+ EXPECT_TRUE(ret.isOk());
+ }
+
+ std::shared_ptr<ICameraService> mCameraService = nullptr;
+};
+
+// Basic AIDL calls for ICameraService
+TEST_P(VtsAidlCameraServiceTargetTest, BasicCameraLifeCycleTest) {
+ BasicCameraTests(/*prepareWindows*/ false);
+ BasicCameraTests(/*prepareWindows*/ true);
+}
+
+TEST_P(VtsAidlCameraServiceTargetTest, CameraServiceListenerTest) {
+ std::shared_ptr<CameraServiceListener> listener =
+ ndk::SharedRefBase::make<CameraServiceListener>();
+ if (mCameraService == nullptr) return;
+
+ std::vector<CameraStatusAndId> cameraStatuses;
+ ndk::ScopedAStatus ret = mCameraService->addListener(listener, &cameraStatuses);
+ EXPECT_TRUE(ret.isOk());
+ listener->initializeStatuses(cameraStatuses);
+
+ for (const auto& it : cameraStatuses) {
+ CameraMetadata rawMetadata;
+ AidlCameraMetadata aidlCameraMetadata;
+ ret = mCameraService->getCameraCharacteristics(it.cameraId, &aidlCameraMetadata);
+ EXPECT_TRUE(ret.isOk());
+ bool cStatus = convertFromAidlCloned(aidlCameraMetadata, &rawMetadata);
+ EXPECT_TRUE(cStatus);
+ EXPECT_FALSE(rawMetadata.isEmpty());
+
+ bool isLogicalCamera = doesCapabilityExist(
+ rawMetadata, ANDROID_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA);
+ if (!isLogicalCamera) {
+ EXPECT_TRUE(it.unavailPhysicalCameraIds.empty());
+ continue;
+ }
+ camera_metadata_entry entry = rawMetadata.find(ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS);
+ EXPECT_GT(entry.count, 0);
+
+ std::unordered_set<std::string> validPhysicalIds;
+ const uint8_t* ids = entry.data.u8;
+ size_t start = 0;
+ for (size_t i = 0; i < entry.count; i++) {
+ if (ids[i] == '\0') {
+ if (start != i) {
+ std::string currentId(reinterpret_cast<const char*>(ids + start));
+ validPhysicalIds.emplace(currentId);
+ }
+ start = i + 1;
+ }
+ }
+
+ std::unordered_set<std::string> unavailablePhysicalIds(it.unavailPhysicalCameraIds.begin(),
+ it.unavailPhysicalCameraIds.end());
+ EXPECT_EQ(unavailablePhysicalIds.size(), it.unavailPhysicalCameraIds.size());
+ for (auto& unavailablePhysicalId : unavailablePhysicalIds) {
+ EXPECT_NE(validPhysicalIds.find(unavailablePhysicalId), validPhysicalIds.end());
+ }
+ }
+
+ ret = mCameraService->removeListener(listener);
+ EXPECT_TRUE(ret.isOk());
+}
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(VtsAidlCameraServiceTargetTest);
+INSTANTIATE_TEST_SUITE_P(PerInstance, VtsAidlCameraServiceTargetTest,
+ testing::ValuesIn({std::string(ICameraService::descriptor) + "/default"}),
+ android::hardware::PrintInstanceNameToString);
+
+} // namespace android
diff --git a/location/OWNERS b/location/OWNERS
new file mode 100644
index 0000000..1937bce
--- /dev/null
+++ b/location/OWNERS
@@ -0,0 +1 @@
+include platform/frameworks/base:/services/core/java/com/android/server/location/OWNERS
diff --git a/location/altitude/aidl/Android.bp b/location/altitude/aidl/Android.bp
new file mode 100644
index 0000000..f4ecf50
--- /dev/null
+++ b/location/altitude/aidl/Android.bp
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+aidl_interface {
+ name: "android.frameworks.location.altitude",
+ srcs: ["android/frameworks/location/altitude/*.aidl"],
+ owner: "google",
+ vendor_available: true,
+ host_supported: true,
+ stability: "vintf",
+ backend: {
+ java: {
+ platform_apis: true,
+ },
+ cpp: {
+ enabled: false,
+ },
+ },
+ versions_with_info: [
+ {
+ version: "1",
+ imports: [],
+ },
+ ],
+ frozen: true,
+
+}
diff --git a/location/altitude/aidl/aidl_api/android.frameworks.location.altitude/1/.hash b/location/altitude/aidl/aidl_api/android.frameworks.location.altitude/1/.hash
new file mode 100644
index 0000000..ab2b34a
--- /dev/null
+++ b/location/altitude/aidl/aidl_api/android.frameworks.location.altitude/1/.hash
@@ -0,0 +1 @@
+763e0415cde10c922c590396b90bf622636470b1
diff --git a/location/altitude/aidl/aidl_api/android.frameworks.location.altitude/1/android/frameworks/location/altitude/AddMslAltitudeToLocationRequest.aidl b/location/altitude/aidl/aidl_api/android.frameworks.location.altitude/1/android/frameworks/location/altitude/AddMslAltitudeToLocationRequest.aidl
new file mode 100644
index 0000000..bc2be18
--- /dev/null
+++ b/location/altitude/aidl/aidl_api/android.frameworks.location.altitude/1/android/frameworks/location/altitude/AddMslAltitudeToLocationRequest.aidl
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2023 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.location.altitude;
+@VintfStability
+parcelable AddMslAltitudeToLocationRequest {
+ double latitudeDegrees;
+ double longitudeDegrees;
+ double altitudeMeters;
+ float verticalAccuracyMeters;
+}
diff --git a/location/altitude/aidl/aidl_api/android.frameworks.location.altitude/1/android/frameworks/location/altitude/AddMslAltitudeToLocationResponse.aidl b/location/altitude/aidl/aidl_api/android.frameworks.location.altitude/1/android/frameworks/location/altitude/AddMslAltitudeToLocationResponse.aidl
new file mode 100644
index 0000000..9e8e471
--- /dev/null
+++ b/location/altitude/aidl/aidl_api/android.frameworks.location.altitude/1/android/frameworks/location/altitude/AddMslAltitudeToLocationResponse.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2023 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.location.altitude;
+@VintfStability
+parcelable AddMslAltitudeToLocationResponse {
+ double mslAltitudeMeters;
+ float mslAltitudeAccuracyMeters;
+}
diff --git a/location/altitude/aidl/aidl_api/android.frameworks.location.altitude/1/android/frameworks/location/altitude/IAltitudeService.aidl b/location/altitude/aidl/aidl_api/android.frameworks.location.altitude/1/android/frameworks/location/altitude/IAltitudeService.aidl
new file mode 100644
index 0000000..9ef2e3a
--- /dev/null
+++ b/location/altitude/aidl/aidl_api/android.frameworks.location.altitude/1/android/frameworks/location/altitude/IAltitudeService.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2023 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.location.altitude;
+@VintfStability
+interface IAltitudeService {
+ android.frameworks.location.altitude.AddMslAltitudeToLocationResponse addMslAltitudeToLocation(in android.frameworks.location.altitude.AddMslAltitudeToLocationRequest request);
+}
diff --git a/location/altitude/aidl/aidl_api/android.frameworks.location.altitude/current/android/frameworks/location/altitude/AddMslAltitudeToLocationRequest.aidl b/location/altitude/aidl/aidl_api/android.frameworks.location.altitude/current/android/frameworks/location/altitude/AddMslAltitudeToLocationRequest.aidl
new file mode 100644
index 0000000..bc2be18
--- /dev/null
+++ b/location/altitude/aidl/aidl_api/android.frameworks.location.altitude/current/android/frameworks/location/altitude/AddMslAltitudeToLocationRequest.aidl
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2023 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.location.altitude;
+@VintfStability
+parcelable AddMslAltitudeToLocationRequest {
+ double latitudeDegrees;
+ double longitudeDegrees;
+ double altitudeMeters;
+ float verticalAccuracyMeters;
+}
diff --git a/location/altitude/aidl/aidl_api/android.frameworks.location.altitude/current/android/frameworks/location/altitude/AddMslAltitudeToLocationResponse.aidl b/location/altitude/aidl/aidl_api/android.frameworks.location.altitude/current/android/frameworks/location/altitude/AddMslAltitudeToLocationResponse.aidl
new file mode 100644
index 0000000..9e8e471
--- /dev/null
+++ b/location/altitude/aidl/aidl_api/android.frameworks.location.altitude/current/android/frameworks/location/altitude/AddMslAltitudeToLocationResponse.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2023 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.location.altitude;
+@VintfStability
+parcelable AddMslAltitudeToLocationResponse {
+ double mslAltitudeMeters;
+ float mslAltitudeAccuracyMeters;
+}
diff --git a/location/altitude/aidl/aidl_api/android.frameworks.location.altitude/current/android/frameworks/location/altitude/IAltitudeService.aidl b/location/altitude/aidl/aidl_api/android.frameworks.location.altitude/current/android/frameworks/location/altitude/IAltitudeService.aidl
new file mode 100644
index 0000000..9ef2e3a
--- /dev/null
+++ b/location/altitude/aidl/aidl_api/android.frameworks.location.altitude/current/android/frameworks/location/altitude/IAltitudeService.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2023 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.location.altitude;
+@VintfStability
+interface IAltitudeService {
+ android.frameworks.location.altitude.AddMslAltitudeToLocationResponse addMslAltitudeToLocation(in android.frameworks.location.altitude.AddMslAltitudeToLocationRequest request);
+}
diff --git a/location/altitude/aidl/android/frameworks/location/altitude/AddMslAltitudeToLocationRequest.aidl b/location/altitude/aidl/android/frameworks/location/altitude/AddMslAltitudeToLocationRequest.aidl
new file mode 100644
index 0000000..c3073db
--- /dev/null
+++ b/location/altitude/aidl/android/frameworks/location/altitude/AddMslAltitudeToLocationRequest.aidl
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.location.altitude;
+
+@VintfStability
+parcelable AddMslAltitudeToLocationRequest {
+
+ /** @see android.location.Location#getLatitude() */
+ double latitudeDegrees;
+
+ /** @see android.location.Location#getLongitude() */
+ double longitudeDegrees;
+
+ /** @see android.location.Location#getAltitude() */
+ double altitudeMeters;
+
+ /** @see android.location.Location#getVerticalAccuracyMeters() */
+ float verticalAccuracyMeters;
+}
diff --git a/location/altitude/aidl/android/frameworks/location/altitude/AddMslAltitudeToLocationResponse.aidl b/location/altitude/aidl/android/frameworks/location/altitude/AddMslAltitudeToLocationResponse.aidl
new file mode 100644
index 0000000..b6190a9
--- /dev/null
+++ b/location/altitude/aidl/android/frameworks/location/altitude/AddMslAltitudeToLocationResponse.aidl
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.location.altitude;
+
+@VintfStability
+parcelable AddMslAltitudeToLocationResponse {
+
+ /** @see android.location.Location#getMslAltitudeMeters() */
+ double mslAltitudeMeters;
+
+ /** @see android.location.Location#getMslAltitudeAccuracyMeters() */
+ float mslAltitudeAccuracyMeters;
+}
diff --git a/location/altitude/aidl/android/frameworks/location/altitude/IAltitudeService.aidl b/location/altitude/aidl/android/frameworks/location/altitude/IAltitudeService.aidl
new file mode 100644
index 0000000..6e93f77
--- /dev/null
+++ b/location/altitude/aidl/android/frameworks/location/altitude/IAltitudeService.aidl
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.frameworks.location.altitude;
+
+import android.frameworks.location.altitude.AddMslAltitudeToLocationRequest;
+import android.frameworks.location.altitude.AddMslAltitudeToLocationResponse;
+
+@VintfStability
+interface IAltitudeService {
+
+ /**
+ * Calls {@link android.location.altitude.AltitudeConverter#addMslAltitudeToLocation(
+ * android.content.Context, android.location.Location)} via system service.
+ */
+ AddMslAltitudeToLocationResponse addMslAltitudeToLocation(
+ in AddMslAltitudeToLocationRequest request);
+}
diff --git a/location/altitude/aidl/vts/functional/Android.bp b/location/altitude/aidl/vts/functional/Android.bp
new file mode 100644
index 0000000..69b9a7c
--- /dev/null
+++ b/location/altitude/aidl/vts/functional/Android.bp
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+cc_test {
+ name: "VtsHalAltitudeServiceTargetTest",
+ defaults: [
+ "VtsHalTargetTestDefaults",
+ "use_libaidlvintf_gtest_helper_static",
+ ],
+ tidy_timeout_srcs: [
+ "VtsHalAltitudeServiceTargetTest.cpp",
+ ],
+ srcs: [
+ "VtsHalAltitudeServiceTargetTest.cpp",
+ ],
+ static_libs: [
+ "android.frameworks.location.altitude-V1-ndk",
+ "libgmock",
+ ],
+ shared_libs: [
+ "libbinder_ndk",
+ ],
+ test_suites: [
+ "general-tests",
+ "vts",
+ ],
+}
diff --git a/location/altitude/aidl/vts/functional/VtsHalAltitudeServiceTargetTest.cpp b/location/altitude/aidl/vts/functional/VtsHalAltitudeServiceTargetTest.cpp
new file mode 100644
index 0000000..eee98d6
--- /dev/null
+++ b/location/altitude/aidl/vts/functional/VtsHalAltitudeServiceTargetTest.cpp
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2023 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 <aidl/Gtest.h>
+#include <aidl/Vintf.h>
+#include <aidl/android/frameworks/location/altitude/AddMslAltitudeToLocationRequest.h>
+#include <aidl/android/frameworks/location/altitude/AddMslAltitudeToLocationResponse.h>
+#include <aidl/android/frameworks/location/altitude/IAltitudeService.h>
+#include <android/binder_manager.h>
+#include <android/binder_process.h>
+
+using ::aidl::android::frameworks::location::altitude::AddMslAltitudeToLocationRequest;
+using ::aidl::android::frameworks::location::altitude::AddMslAltitudeToLocationResponse;
+using ::aidl::android::frameworks::location::altitude::IAltitudeService;
+using ::android::getAidlHalInstanceNames;
+using ::android::PrintInstanceNameToString;
+using ndk::SpAIBinder;
+using ::testing::Eq;
+using ::testing::InitGoogleTest;
+using ::testing::TestWithParam;
+using ::testing::ValuesIn;
+
+class AltitudeServiceTest : public TestWithParam<std::string> {
+ public:
+ void SetUp() override {
+ SpAIBinder binder(AServiceManager_waitForService(GetParam().c_str()));
+ service = IAltitudeService::fromBinder(binder);
+ ASSERT_NE(service, nullptr);
+ }
+ std::shared_ptr<IAltitudeService> service;
+};
+
+TEST_P(AltitudeServiceTest, TestGetDistanceBasedExpiringGeoidHeight) {
+ // Test known location near Hawaii.
+ AddMslAltitudeToLocationRequest request;
+ request.latitudeDegrees = 19.545519;
+ request.longitudeDegrees = -155.998774;
+ request.altitudeMeters = -1;
+ request.verticalAccuracyMeters = 1;
+
+ AddMslAltitudeToLocationResponse response;
+ service->addMslAltitudeToLocation(request, &response);
+ ASSERT_NEAR(response.mslAltitudeMeters, -19.2359, 2);
+ ASSERT_NEAR(response.mslAltitudeAccuracyMeters, 1.05f, 0.5f);
+}
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AltitudeServiceTest);
+INSTANTIATE_TEST_SUITE_P(AltitudeService, AltitudeServiceTest,
+ ValuesIn(getAidlHalInstanceNames(IAltitudeService::descriptor)),
+ PrintInstanceNameToString);
+
+int main(int argc, char** argv) {
+ InitGoogleTest(&argc, argv);
+ ABinderProcess_setThreadPoolMaxThreadCount(1);
+ ABinderProcess_startThreadPool();
+ return RUN_ALL_TESTS();
+}
diff --git a/sensorservice/aidl/Android.bp b/sensorservice/aidl/Android.bp
new file mode 100644
index 0000000..35eea3e
--- /dev/null
+++ b/sensorservice/aidl/Android.bp
@@ -0,0 +1,34 @@
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+aidl_interface {
+ name: "android.frameworks.sensorservice",
+ vendor_available: true,
+ host_supported: true,
+ srcs: ["android/frameworks/sensorservice/*.aidl"],
+ stability: "vintf",
+ imports: [
+ "android.hardware.sensors-V2",
+ "android.hardware.common-V2",
+ ],
+ backend: {
+ cpp: {
+ enabled: false,
+ },
+ java: {
+ enabled: false,
+ },
+ },
+ versions_with_info: [
+ {
+ version: "1",
+ imports: [
+ "android.hardware.sensors-V2",
+ "android.hardware.common-V2",
+ ],
+ },
+ ],
+ frozen: true,
+
+}
diff --git a/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/1/.hash b/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/1/.hash
new file mode 100644
index 0000000..1b15961
--- /dev/null
+++ b/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/1/.hash
@@ -0,0 +1 @@
+514f08f7a595501066b94e5de878d240b4d49456
diff --git a/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/1/android/frameworks/sensorservice/IDirectReportChannel.aidl b/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/1/android/frameworks/sensorservice/IDirectReportChannel.aidl
new file mode 100644
index 0000000..09c491a
--- /dev/null
+++ b/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/1/android/frameworks/sensorservice/IDirectReportChannel.aidl
@@ -0,0 +1,23 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.sensorservice;
+@VintfStability
+interface IDirectReportChannel {
+ int configure(in int sensorHandle, in android.hardware.sensors.ISensors.RateLevel rate);
+}
diff --git a/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/1/android/frameworks/sensorservice/IEventQueue.aidl b/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/1/android/frameworks/sensorservice/IEventQueue.aidl
new file mode 100644
index 0000000..118a1c7
--- /dev/null
+++ b/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/1/android/frameworks/sensorservice/IEventQueue.aidl
@@ -0,0 +1,24 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.sensorservice;
+@VintfStability
+interface IEventQueue {
+ void disableSensor(in int sensorHandle);
+ void enableSensor(in int sensorHandle, in int samplingPeriodUs, in long maxBatchReportLatencyUs);
+}
diff --git a/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/1/android/frameworks/sensorservice/IEventQueueCallback.aidl b/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/1/android/frameworks/sensorservice/IEventQueueCallback.aidl
new file mode 100644
index 0000000..2aaf91a
--- /dev/null
+++ b/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/1/android/frameworks/sensorservice/IEventQueueCallback.aidl
@@ -0,0 +1,23 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.sensorservice;
+@VintfStability
+interface IEventQueueCallback {
+ oneway void onEvent(in android.hardware.sensors.Event event);
+}
diff --git a/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/1/android/frameworks/sensorservice/ISensorManager.aidl b/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/1/android/frameworks/sensorservice/ISensorManager.aidl
new file mode 100644
index 0000000..85cae01
--- /dev/null
+++ b/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/1/android/frameworks/sensorservice/ISensorManager.aidl
@@ -0,0 +1,34 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.sensorservice;
+@VintfStability
+interface ISensorManager {
+ android.frameworks.sensorservice.IDirectReportChannel createAshmemDirectChannel(in android.hardware.common.Ashmem mem, in long size);
+ android.frameworks.sensorservice.IEventQueue createEventQueue(in android.frameworks.sensorservice.IEventQueueCallback callback);
+ android.frameworks.sensorservice.IDirectReportChannel createGrallocDirectChannel(in ParcelFileDescriptor buffer, in long size);
+ android.hardware.sensors.SensorInfo getDefaultSensor(in android.hardware.sensors.SensorType type);
+ android.hardware.sensors.SensorInfo[] getSensorList();
+ const int RESULT_NOT_EXIST = 1;
+ const int RESULT_NO_MEMORY = 2;
+ const int RESULT_NO_INIT = 3;
+ const int RESULT_PERMISSION_DENIED = 4;
+ const int RESULT_BAD_VALUE = 5;
+ const int RESULT_INVALID_OPERATION = 6;
+ const int RESULT_UNKNOWN_ERROR = 7;
+}
diff --git a/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/current/android/frameworks/sensorservice/IDirectReportChannel.aidl b/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/current/android/frameworks/sensorservice/IDirectReportChannel.aidl
new file mode 100644
index 0000000..09c491a
--- /dev/null
+++ b/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/current/android/frameworks/sensorservice/IDirectReportChannel.aidl
@@ -0,0 +1,23 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.sensorservice;
+@VintfStability
+interface IDirectReportChannel {
+ int configure(in int sensorHandle, in android.hardware.sensors.ISensors.RateLevel rate);
+}
diff --git a/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/current/android/frameworks/sensorservice/IEventQueue.aidl b/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/current/android/frameworks/sensorservice/IEventQueue.aidl
new file mode 100644
index 0000000..118a1c7
--- /dev/null
+++ b/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/current/android/frameworks/sensorservice/IEventQueue.aidl
@@ -0,0 +1,24 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.sensorservice;
+@VintfStability
+interface IEventQueue {
+ void disableSensor(in int sensorHandle);
+ void enableSensor(in int sensorHandle, in int samplingPeriodUs, in long maxBatchReportLatencyUs);
+}
diff --git a/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/current/android/frameworks/sensorservice/IEventQueueCallback.aidl b/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/current/android/frameworks/sensorservice/IEventQueueCallback.aidl
new file mode 100644
index 0000000..2aaf91a
--- /dev/null
+++ b/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/current/android/frameworks/sensorservice/IEventQueueCallback.aidl
@@ -0,0 +1,23 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.sensorservice;
+@VintfStability
+interface IEventQueueCallback {
+ oneway void onEvent(in android.hardware.sensors.Event event);
+}
diff --git a/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/current/android/frameworks/sensorservice/ISensorManager.aidl b/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/current/android/frameworks/sensorservice/ISensorManager.aidl
new file mode 100644
index 0000000..85cae01
--- /dev/null
+++ b/sensorservice/aidl/aidl_api/android.frameworks.sensorservice/current/android/frameworks/sensorservice/ISensorManager.aidl
@@ -0,0 +1,34 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.sensorservice;
+@VintfStability
+interface ISensorManager {
+ android.frameworks.sensorservice.IDirectReportChannel createAshmemDirectChannel(in android.hardware.common.Ashmem mem, in long size);
+ android.frameworks.sensorservice.IEventQueue createEventQueue(in android.frameworks.sensorservice.IEventQueueCallback callback);
+ android.frameworks.sensorservice.IDirectReportChannel createGrallocDirectChannel(in ParcelFileDescriptor buffer, in long size);
+ android.hardware.sensors.SensorInfo getDefaultSensor(in android.hardware.sensors.SensorType type);
+ android.hardware.sensors.SensorInfo[] getSensorList();
+ const int RESULT_NOT_EXIST = 1;
+ const int RESULT_NO_MEMORY = 2;
+ const int RESULT_NO_INIT = 3;
+ const int RESULT_PERMISSION_DENIED = 4;
+ const int RESULT_BAD_VALUE = 5;
+ const int RESULT_INVALID_OPERATION = 6;
+ const int RESULT_UNKNOWN_ERROR = 7;
+}
diff --git a/sensorservice/aidl/android/frameworks/sensorservice/IDirectReportChannel.aidl b/sensorservice/aidl/android/frameworks/sensorservice/IDirectReportChannel.aidl
new file mode 100644
index 0000000..de683ea
--- /dev/null
+++ b/sensorservice/aidl/android/frameworks/sensorservice/IDirectReportChannel.aidl
@@ -0,0 +1,41 @@
+package android.frameworks.sensorservice;
+
+import android.hardware.sensors.ISensors.RateLevel;
+
+/**
+ * The interface represents a direct channel created by
+ * ISensorManager.createSharedMemoryDirectChannel() and
+ * ISensorMangaer.createHardwareBufferDirectChannel().
+ */
+@VintfStability
+interface IDirectReportChannel {
+ /**
+ * Configure direct report on channel
+ *
+ * Configure sensor direct report on a direct channel: set rate to value
+ * other than STOP so that sensor event can be directly written into the
+ * shared memory region used for creating the channel; set rate to STOP will
+ * stop the sensor direct report.
+ *
+ * To stop all active sensor direct report configured to a channel, set
+ * sensorHandle to -1 and rate to STOP.
+ *
+ * @param sensorHandle handle of the sensor to operate on. If it is -1
+ * and rate is STOP, the call must stop of all active
+ * sensor direct report.
+ * @param rate rate level value to set on the specified sensor. Values
+ * are defined in android.hardware.sensors.ISensors.RateLevel.
+ *
+ * @return out token the token used to distinguish sensor events from
+ * multiple different sensors of the same type in a
+ * single direct channel, or 0 if: (1) no such token
+ * may be returned or (2) error (in which case result
+ * must be value other than OK).
+ *
+ * @throws ServiceSpecificException with the following ISensorManager::RESULT_* values
+ * BAD_VALUE if parameter is invalid (for example,
+ * rate level is not supported by sensor, etc);
+ * INVALID_OPERATION if functionality is not supported.
+ */
+ int configure(in int sensorHandle, in RateLevel rate);
+}
diff --git a/sensorservice/aidl/android/frameworks/sensorservice/IEventQueue.aidl b/sensorservice/aidl/android/frameworks/sensorservice/IEventQueue.aidl
new file mode 100644
index 0000000..3a04b95
--- /dev/null
+++ b/sensorservice/aidl/android/frameworks/sensorservice/IEventQueue.aidl
@@ -0,0 +1,40 @@
+package android.frameworks.sensorservice;
+
+/**
+ * An IEventQueue is an interface to manage an event queue created by
+ * ISensorManager.
+ */
+@VintfStability
+interface IEventQueue {
+ /**
+ * Disable the selected sensor.
+ *
+ * @param sensorHandle the sensor to disable. Must be a sensor acquired from
+ * the ISensorManager that creates this IEventQueue.
+ * @throws ServiceSpecificException with the following ISensorManager::RESULT_* values
+ * BAD_VALUE if parameter is invalid (for example,
+ * rate level is not supported by sensor, etc);
+ * INVALID_OPERATION if functionality is not supported.
+ */
+ void disableSensor(in int sensorHandle);
+
+ /**
+ * Enable the selected sensor with a specified sampling period and
+ * max batch report latency. If enableSensor is called multiple times on the
+ * same sensor, the previous calls must be overridden by the last call.
+ *
+ * @param sensorHandle the sensor to enable. Must be a sensor acquired from
+ * the ISensorManager that creates this IEventQueue.
+ * @param samplingPeriodUs
+ * sampling period in microseconds.
+ * @param maxBatchReportLatencyUs
+ * max batch report latency in microseconds.
+ * @throws ServiceSpecificException with the following ISensorManager::RESULT_* values
+ * BAD_VALUE if parameter is invalid (for example,
+ * rate level is not supported by sensor, etc);
+ * INVALID_OPERATION if functionality is not supported.
+ * PERMISSION_DENIED if permissions is denied.
+ */
+ void enableSensor(in int sensorHandle, in int samplingPeriodUs,
+ in long maxBatchReportLatencyUs);
+}
diff --git a/sensorservice/aidl/android/frameworks/sensorservice/IEventQueueCallback.aidl b/sensorservice/aidl/android/frameworks/sensorservice/IEventQueueCallback.aidl
new file mode 100644
index 0000000..e3a4682
--- /dev/null
+++ b/sensorservice/aidl/android/frameworks/sensorservice/IEventQueueCallback.aidl
@@ -0,0 +1,22 @@
+package android.frameworks.sensorservice;
+
+import android.hardware.sensors.Event;
+
+/**
+ * An IEventQueueCallback describes the callback that is called upon
+ * any events.
+ */
+@VintfStability
+oneway interface IEventQueueCallback {
+ /**
+ * When any event is obtained from the sensor, this function must be called
+ * with the event data.
+ *
+ * Implementation of this function must finish in short time predictably.
+ * It must never block or run for extended period of time. It must offload
+ * heavy computation to a separate thread.
+ *
+ * @param event the event data.
+ */
+ void onEvent(in Event event);
+}
diff --git a/sensorservice/aidl/android/frameworks/sensorservice/ISensorManager.aidl b/sensorservice/aidl/android/frameworks/sensorservice/ISensorManager.aidl
new file mode 100644
index 0000000..e9097a3
--- /dev/null
+++ b/sensorservice/aidl/android/frameworks/sensorservice/ISensorManager.aidl
@@ -0,0 +1,111 @@
+package android.frameworks.sensorservice;
+
+import android.frameworks.sensorservice.IDirectReportChannel;
+import android.frameworks.sensorservice.IEventQueue;
+import android.frameworks.sensorservice.IEventQueueCallback;
+import android.hardware.common.Ashmem;
+import android.hardware.sensors.SensorInfo;
+import android.hardware.sensors.SensorType;
+
+/**
+ * ISensorManager is an interface to manage sensors
+ *
+ * This file provides a set of functions that uses
+ * ISensorManager to access and list hardware sensors.
+ */
+@VintfStability
+interface ISensorManager {
+ const int RESULT_NOT_EXIST =1;
+ const int RESULT_NO_MEMORY = 2;
+ const int RESULT_NO_INIT = 3;
+ const int RESULT_PERMISSION_DENIED = 4;
+ const int RESULT_BAD_VALUE = 5;
+ const int RESULT_INVALID_OPERATION = 6;
+ const int RESULT_UNKNOWN_ERROR = 7;
+
+ /**
+ * Create direct channel based on shared memory
+ *
+ * Create a direct channel of DIRECT_CHANNEL_ASHMEM type to be used
+ * for configuring sensor direct report.
+ *
+ * The memory layout looks as follows. These offsets can be found in
+ * android.hardware.sensors.ISensors::DIRECT_REPORT_SENSOR_EVENT_OFFSET_*.
+ * offset type name
+ * -----------------------------------
+ * 0x0000 int32_t size (SensorsEventFormatOffset::TOTAL_LENGTH)
+ * 0x0004 int32_t sensor report token
+ * 0x0008 int32_t type (see android.hardware.sensors::SensorType)
+ * 0x000C uint32_t atomic counter
+ * 0x0010 int64_t timestamp (see android.hardware.sensors::Event)
+ * 0x0018 float[16]/ data
+ * int64_t[8]
+ * 0x0058 int32_t[4] reserved (set to zero)
+ *
+ * @param mem the shared memory to use, must be ashmem.
+ * @param size the intended size to be used. The following must be true:
+ * SensorsEventFormatOffset::TOTAL_LENGTH <= size <= mem.size
+ *
+ * @return The created channel, or NULL if failure.
+ * @throws ServiceSpecificException with the following ISensorManager::RESULT_* values
+ * RESULT_BAD_VALUE if size > mem.size();
+ * BAD_VALUE if size < TOTAL_LENGTH;
+ * NO_MEMORY, NO_INIT, BAD_VALUE for underlying errors;
+ * UNKNOWN_ERROR if the underlying error is not recognized;
+ * UNKNOWN_ERROR if the underlying call returns channelId = 0
+ */
+ IDirectReportChannel createAshmemDirectChannel(in Ashmem mem, in long size);
+
+ /**
+ * Create a sensor event queue.
+ *
+ * Create a sensor event queue with an IEventQueueCallback object.
+ * Subsequently, one can enable sensors on the event queue so that sensor
+ * events are passed via the specified callback.
+ *
+ * @param callback the callback to call on events. Must not be null.
+ * @return out queue the event queue created. null on failure.
+ * @throws ServiceSpecificException with the following ISensorManager::RESULT_* values
+ * BAD_VALUE if callback is null,
+ * or other Result values for any underlying errors.
+ */
+ IEventQueue createEventQueue(in IEventQueueCallback callback);
+
+ /**
+ * Create direct channel based on hardware buffer
+ *
+ * Create a direct channel of DIRECT_CHANNEL_GRALLOC type to be used
+ * for configuring sensor direct report.
+ *
+ * @param buffer file descriptor describing the gralloc buffer.
+ * @param size the intended size to be used, must be less than or equal
+ * to the size of the buffer.
+ *
+ * @return The created channel, or NULL if failure.
+ * @throws ServiceSpecificException with the following ISensorManager::RESULT_* values
+ * NO_MEMORY, NO_INIT, BAD_VALUE for underlying errors;
+ * UNKNOWN_ERROR if the underlying error is not recognized;
+ * UNKNOWN_ERROR if the underlying call returns channelId = 0
+ */
+ IDirectReportChannel createGrallocDirectChannel(in ParcelFileDescriptor buffer, in long size);
+
+ /**
+ * Get the default sensor of the specified type.
+ *
+ * @param type the type of default sensor to get
+ * @return the default sensor for the given type, or undetermined
+ * value on failure.
+ * @throws ServiceSpecificException with the following ISensorManager::RESULT_* values
+ * NOT_EXIST if no sensor of that type exists.
+ */
+ SensorInfo getDefaultSensor(in SensorType type);
+
+ /**
+ * Get the list of available sensors.
+ *
+ * @return the list of available sensors, or empty on failure
+ * @throws ServiceSpecificException with the following ISensorManager::RESULT_* values
+ * UNKNOWN_ERROR on failure
+ */
+ SensorInfo[] getSensorList();
+}
diff --git a/sensorservice/aidl/vts/Android.bp b/sensorservice/aidl/vts/Android.bp
new file mode 100644
index 0000000..0d7c34a
--- /dev/null
+++ b/sensorservice/aidl/vts/Android.bp
@@ -0,0 +1,49 @@
+//
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+cc_test {
+ name: "VtsHalSensorManagerTargetTest",
+ defaults: [
+ "VtsHalTargetTestDefaults",
+ "use_libaidlvintf_gtest_helper_static",
+ ],
+ tidy_timeout_srcs: ["VtsHalSensorManagerTargetTest.cpp"],
+ srcs: ["VtsHalSensorManagerTargetTest.cpp"],
+ shared_libs: [
+ "libcutils",
+ "libbinder_ndk",
+ "android.hardware.sensors-V2-ndk",
+ "android.frameworks.sensorservice-V1-ndk",
+ ],
+ static_libs: [
+ "android.hardware.sensors-V1-convert",
+ "libgmock",
+ ],
+ cflags: [
+ "-O0",
+ "-g",
+ "-Werror",
+ ],
+ require_root: true,
+ test_suites: [
+ "vts",
+ "general-test",
+ ],
+}
diff --git a/sensorservice/aidl/vts/VtsHalSensorManagerTargetTest.cpp b/sensorservice/aidl/vts/VtsHalSensorManagerTargetTest.cpp
new file mode 100644
index 0000000..bf8d242
--- /dev/null
+++ b/sensorservice/aidl/vts/VtsHalSensorManagerTargetTest.cpp
@@ -0,0 +1,260 @@
+/*
+ * Copyright (C) 2022 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 "sensor_manager_aidl_hal_test"
+#include <aidl/Gtest.h>
+#include <aidl/Vintf.h>
+#include <aidl/android/frameworks/sensorservice/ISensorManager.h>
+#include <aidl/sensors/convert.h>
+#include <android-base/logging.h>
+#include <android-base/result.h>
+#include <android/binder_manager.h>
+#include <android/sensor.h>
+#include <binder/IServiceManager.h>
+#include <cutils/ashmem.h>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+#include <sys/mman.h>
+
+#include <chrono>
+#include <thread>
+
+using aidl::android::frameworks::sensorservice::IDirectReportChannel;
+using aidl::android::frameworks::sensorservice::ISensorManager;
+using aidl::android::hardware::common::Ashmem;
+using aidl::android::hardware::sensors::Event;
+using aidl::android::hardware::sensors::ISensors;
+using aidl::android::hardware::sensors::SensorInfo;
+using aidl::android::hardware::sensors::SensorType;
+using ::android::sp;
+using ndk::ScopedAStatus;
+using ndk::ScopedFileDescriptor;
+using ::testing::Contains;
+
+static inline ::testing::AssertionResult isOk(const ScopedAStatus& status) {
+ return status.isOk() ? ::testing::AssertionSuccess()
+ : ::testing::AssertionFailure() << status.getDescription();
+}
+
+template <typename I, typename F>
+static ::testing::AssertionResult isIncreasing(I begin, I end, F getField) {
+ typename std::iterator_traits<I>::pointer lastValue = nullptr;
+ I iter;
+ size_t pos;
+ for (iter = begin, pos = 0; iter != end; ++iter, ++pos) {
+ if (iter == begin) {
+ lastValue = &(*iter);
+ continue;
+ }
+ if (getField(*iter) < getField(*lastValue)) {
+ return ::testing::AssertionFailure()
+ << "Not an increasing sequence, pos = " << pos << ", " << getField(*iter)
+ << " < " << getField(*lastValue);
+ }
+ }
+ return ::testing::AssertionSuccess();
+}
+
+#define EXPECT_OK(__ret__) EXPECT_TRUE(isOk(__ret__))
+#define ASSERT_OK(__ret__) ASSERT_TRUE(isOk(__ret__))
+
+class SensorManagerTest : public ::testing::TestWithParam<std::string> {
+ public:
+ virtual void SetUp() override {
+ manager_ = ISensorManager::fromBinder(
+ ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str())));
+ ASSERT_NE(manager_, nullptr);
+ }
+
+ // Call getSensorList. Filter result based on |pred| if it is provided.
+ ndk::ScopedAStatus GetSensorList(std::vector<SensorInfo>* out_info,
+ const std::function<bool(SensorInfo)>& pred = nullptr) {
+ ndk::ScopedAStatus ret = manager_->getSensorList(out_info);
+ if (ret.isOk() && pred) {
+ out_info->erase(std::remove_if(out_info->begin(), out_info->end(), std::not1(pred)),
+ out_info->end());
+ }
+ return ret;
+ }
+
+ std::shared_ptr<ISensorManager> manager_;
+};
+
+using map_region = std::unique_ptr<void, std::function<void(void*)>>;
+
+map_region map(const Ashmem& mem) {
+ if (mem.fd.get() == -1) {
+ return nullptr;
+ }
+ size_t size = mem.size;
+ void* buf = mmap(nullptr, size, PROT_READ, MAP_SHARED, mem.fd.get(), 0);
+ return map_region{buf, [size](void* localBuf) { munmap(localBuf, size); }};
+}
+
+TEST_P(SensorManagerTest, List) {
+ std::vector<SensorInfo> sensorList;
+ auto res = GetSensorList(&sensorList);
+ ASSERT_OK(res) << res.getDescription();
+}
+
+TEST_P(SensorManagerTest, Ashmem) {
+ std::vector<SensorInfo> sensorList;
+ auto res = GetSensorList(&sensorList, [](const auto& info) {
+ return info.flags & SensorInfo::SENSOR_FLAG_BITS_DIRECT_CHANNEL_ASHMEM;
+ });
+ ASSERT_OK(res);
+ if (sensorList.empty()) {
+ GTEST_SKIP() << "DIRECT_CHANNEL_ASHMEM not supported by HAL, skipping";
+ }
+ auto testOne = [this](int64_t memSize, int64_t intendedSize,
+ void (*callback)(const std::shared_ptr<IDirectReportChannel>&,
+ const ScopedAStatus&)) {
+ auto fd = ashmem_create_region("sensorservice_vts", memSize);
+ ASSERT_TRUE(fd != -1);
+ Ashmem ashmem = {ScopedFileDescriptor(fd), memSize};
+ std::shared_ptr<IDirectReportChannel> chan;
+ ScopedAStatus res = manager_->createAshmemDirectChannel(ashmem, intendedSize, &chan);
+ callback(chan, res);
+ };
+
+ testOne(16, 16, [](const auto& chan, const ScopedAStatus& result) {
+ EXPECT_EQ(result.getServiceSpecificError(), ISensorManager::RESULT_BAD_VALUE)
+ << "unexpected result when memory size is too small";
+ EXPECT_EQ(chan, nullptr);
+ });
+
+ testOne(1024, 1024, [](const auto& chan, const ScopedAStatus& result) {
+ EXPECT_OK(result);
+ EXPECT_NE(chan, nullptr);
+ });
+
+ testOne(1024, 2048, [](const auto& chan, const ScopedAStatus& result) {
+ EXPECT_EQ(result.getServiceSpecificError(), ISensorManager::RESULT_BAD_VALUE)
+ << "unexpected result when intended size is too big";
+ EXPECT_EQ(chan, nullptr);
+ });
+
+ testOne(1024, 16, [](const auto& chan, const ScopedAStatus& result) {
+ EXPECT_EQ(result.getServiceSpecificError(), ISensorManager::RESULT_BAD_VALUE)
+ << "unexpected result when intended size is too small";
+ EXPECT_EQ(chan, nullptr);
+ });
+}
+
+static std::vector<Event> parseEvents(uint8_t* buf, size_t memSize) {
+ using android::hardware::sensors::implementation::convertFromSensorEvent;
+ size_t offset = 0;
+ int64_t lastCounter = -1;
+ std::vector<Event> events;
+ Event event;
+
+ while (offset + (size_t)ISensors::DIRECT_REPORT_SENSOR_EVENT_TOTAL_LENGTH <= memSize) {
+ uint8_t* start = buf + offset;
+ int64_t atomicCounter = *reinterpret_cast<uint32_t*>(
+ start + (size_t)ISensors::DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_ATOMIC_COUNTER);
+ if (atomicCounter <= lastCounter) {
+ break;
+ }
+ int32_t size = *reinterpret_cast<int32_t*>(
+ start + (size_t)ISensors::DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_FIELD);
+ if (size != (size_t)ISensors::DIRECT_REPORT_SENSOR_EVENT_TOTAL_LENGTH) {
+ // unknown error, events parsed may be wrong, remove all
+ events.clear();
+ break;
+ }
+
+ convertFromSensorEvent(*reinterpret_cast<const sensors_event_t*>(start), &event);
+ events.push_back(event);
+ lastCounter = atomicCounter;
+ offset += (size_t)ISensors::DIRECT_REPORT_SENSOR_EVENT_TOTAL_LENGTH;
+ }
+ return events;
+}
+
+TEST_P(SensorManagerTest, GetDefaultAccelerometer) {
+ std::vector<SensorInfo> sensorList;
+ auto res = GetSensorList(
+ &sensorList, [](const auto& info) { return info.type == SensorType::ACCELEROMETER; });
+ ASSERT_OK(res);
+
+ SensorInfo info;
+ res = manager_->getDefaultSensor(SensorType::ACCELEROMETER, &info);
+ if (sensorList.empty()) {
+ ASSERT_EQ(ISensorManager::RESULT_NOT_EXIST, res.getServiceSpecificError());
+ } else {
+ ASSERT_OK(res);
+ ASSERT_THAT(sensorList, Contains(info));
+ }
+}
+
+TEST_P(SensorManagerTest, Accelerometer) {
+ using std::literals::chrono_literals::operator""ms;
+
+ std::vector<SensorInfo> sensorList;
+ auto res = GetSensorList(&sensorList, [](const auto& info) {
+ if (info.type != SensorType::ACCELEROMETER) return false;
+ if (!(info.flags & SensorInfo::SENSOR_FLAG_BITS_DIRECT_CHANNEL_ASHMEM)) return false;
+ int maxLevel = (info.flags & SensorInfo::SENSOR_FLAG_BITS_MASK_DIRECT_REPORT) >>
+ SensorInfo::SENSOR_FLAG_SHIFT_DIRECT_REPORT;
+ return maxLevel >= static_cast<int>(ISensors::RateLevel::FAST);
+ });
+ ASSERT_OK(res);
+
+ if (sensorList.empty()) {
+ GTEST_SKIP()
+ << "No accelerometer sensor that supports DIRECT_CHANNEL_ASHMEM and fast report "
+ << "rate, skipping";
+ }
+
+ for (const auto& info : sensorList) {
+ int32_t handle = info.sensorHandle;
+ const size_t memSize = (size_t)ISensors::DIRECT_REPORT_SENSOR_EVENT_TOTAL_LENGTH * 300;
+ auto fd = ashmem_create_region("sensorservice_vts", memSize);
+ ASSERT_TRUE(fd != -1);
+ Ashmem mem = {ScopedFileDescriptor(fd), memSize};
+ map_region buf = map(mem);
+ ASSERT_NE(buf, nullptr);
+ std::shared_ptr<IDirectReportChannel> chan;
+ auto res = manager_->createAshmemDirectChannel(mem, memSize, &chan);
+ ASSERT_OK(res);
+ ASSERT_NE(chan, nullptr);
+
+ int32_t token = 0;
+ ASSERT_OK(chan->configure(handle, ISensors::RateLevel::FAST, &token));
+ ASSERT_GT(token, 0);
+ std::this_thread::sleep_for(500ms);
+ int32_t zeroToken = 0;
+ ASSERT_OK(chan->configure(handle, ISensors::RateLevel::STOP, &zeroToken));
+ ASSERT_OK(res);
+ ASSERT_EQ(zeroToken, 0);
+
+ auto events = parseEvents(static_cast<uint8_t*>(buf.get()), memSize);
+
+ EXPECT_TRUE(isIncreasing(events.begin(), events.end(), [](const auto& event) {
+ return event.timestamp;
+ })) << "timestamp is not monotonically increasing";
+ for (const auto& event : events) {
+ EXPECT_EQ(token, event.sensorHandle)
+ << "configure token and sensor handle don't match.";
+ }
+ }
+}
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(SensorManagerTest);
+INSTANTIATE_TEST_SUITE_P(
+ PerInstance, SensorManagerTest,
+ testing::ValuesIn(android::getAidlHalInstanceNames(ISensorManager::descriptor)),
+ android::PrintInstanceNameToString);
diff --git a/sensorservice/libsensorndkbridge/ALooper.cpp b/sensorservice/libsensorndkbridge/ALooper.cpp
index d3ddbff..a4cb8cf 100644
--- a/sensorservice/libsensorndkbridge/ALooper.cpp
+++ b/sensorservice/libsensorndkbridge/ALooper.cpp
@@ -23,16 +23,14 @@
#include <android-base/logging.h>
using android::Mutex;
-using android::sp;
-using android::wp;
ALooper::ALooper()
: mAwoken(false) {
}
-void ALooper::signalSensorEvents(wp<ASensorEventQueue> queue) {
+void ALooper::signalSensorEvents(const std::shared_ptr<ASensorEventQueue>& queue) {
Mutex::Autolock autoLock(mLock);
- mReadyQueues.insert(queue);
+ mReadyQueues.push_back(std::weak_ptr<ASensorEventQueue>(queue));
mCondition.signal();
}
@@ -74,7 +72,7 @@ int ALooper::pollOnce(
result = ALOOPER_POLL_CALLBACK;
for (auto& queue : mReadyQueues) {
- sp<ASensorEventQueue> promotedQueue = queue.promote();
+ std::shared_ptr<ASensorEventQueue> promotedQueue = queue.lock();
if (promotedQueue != nullptr) {
promotedQueue->dispatchCallback();
}
@@ -91,7 +89,13 @@ int ALooper::pollOnce(
return result;
}
-void ALooper::invalidateSensorQueue(wp<ASensorEventQueue> queue) {
+void ALooper::invalidateSensorQueue(const std::shared_ptr<ASensorEventQueue>& queue) {
Mutex::Autolock autoLock(mLock);
- mReadyQueues.erase(queue);
+
+ mReadyQueues.erase(std::remove_if(mReadyQueues.begin(), mReadyQueues.end(),
+ [&](const std::weak_ptr<ASensorEventQueue>& ptr) {
+ std::shared_ptr<ASensorEventQueue> in = ptr.lock();
+ return (in == nullptr) || (in == queue);
+ }),
+ mReadyQueues.end());
}
diff --git a/sensorservice/libsensorndkbridge/ALooper.h b/sensorservice/libsensorndkbridge/ALooper.h
index 5fa2b62..4a9093f 100644
--- a/sensorservice/libsensorndkbridge/ALooper.h
+++ b/sensorservice/libsensorndkbridge/ALooper.h
@@ -23,25 +23,25 @@
#include <utils/Mutex.h>
#include <utils/RefBase.h>
-#include <set>
+#include <vector>
struct ASensorEventQueue;
struct ALooper {
ALooper();
- void signalSensorEvents(android::wp<ASensorEventQueue> queue);
+ void signalSensorEvents(const std::shared_ptr<ASensorEventQueue>& queue);
void wake();
int pollOnce(int timeoutMillis, int *outFd, int *outEvents, void **outData);
- void invalidateSensorQueue(android::wp<ASensorEventQueue> queue);
+ void invalidateSensorQueue(const std::shared_ptr<ASensorEventQueue>& queue);
private:
android::Mutex mLock;
android::Condition mCondition;
- std::set<android::wp<ASensorEventQueue>> mReadyQueues;
+ std::vector<std::weak_ptr<ASensorEventQueue>> mReadyQueues;
bool mAwoken;
DISALLOW_COPY_AND_ASSIGN(ALooper);
diff --git a/sensorservice/libsensorndkbridge/ASensorEventQueue.cpp b/sensorservice/libsensorndkbridge/ASensorEventQueue.cpp
index bf24f68..2969da1 100644
--- a/sensorservice/libsensorndkbridge/ASensorEventQueue.cpp
+++ b/sensorservice/libsensorndkbridge/ASensorEventQueue.cpp
@@ -20,14 +20,12 @@
#define LOG_TAG "libsensorndkbridge"
#include <android-base/logging.h>
+#include <android/binder_auto_utils.h>
-using android::sp;
-using android::frameworks::sensorservice::V1_0::Result;
-using android::hardware::sensors::V1_0::SensorInfo;
-using android::OK;
+using aidl::android::hardware::sensors::SensorInfo;
using android::BAD_VALUE;
using android::Mutex;
-using android::hardware::Return;
+using android::OK;
ASensorEventQueue::ASensorEventQueue(ALooper* looper, ALooper_callbackFunc callback, void* data)
: mLooper(looper),
@@ -36,7 +34,7 @@ ASensorEventQueue::ASensorEventQueue(ALooper* looper, ALooper_callbackFunc callb
mRequestAdditionalInfo(false),
mValid(true) {}
-void ASensorEventQueue::setImpl(const sp<IEventQueue> &queueImpl) {
+void ASensorEventQueue::setImpl(const std::shared_ptr<IEventQueue>& queueImpl) {
mQueueImpl = queueImpl;
}
@@ -44,10 +42,9 @@ int ASensorEventQueue::registerSensor(
ASensorRef sensor,
int32_t samplingPeriodUs,
int64_t maxBatchReportLatencyUs) {
- Return<Result> ret = mQueueImpl->enableSensor(
- reinterpret_cast<const SensorInfo *>(sensor)->sensorHandle,
- samplingPeriodUs,
- maxBatchReportLatencyUs);
+ ndk::ScopedAStatus ret =
+ mQueueImpl->enableSensor(reinterpret_cast<const SensorInfo*>(sensor)->sensorHandle,
+ samplingPeriodUs, maxBatchReportLatencyUs);
if (!ret.isOk()) {
return BAD_VALUE;
@@ -77,8 +74,8 @@ int ASensorEventQueue::requestAdditionalInfoEvents(bool enable) {
}
int ASensorEventQueue::disableSensor(ASensorRef sensor) {
- Return<Result> ret = mQueueImpl->disableSensor(
- reinterpret_cast<const SensorInfo *>(sensor)->sensorHandle);
+ ndk::ScopedAStatus ret =
+ mQueueImpl->disableSensor(reinterpret_cast<const SensorInfo*>(sensor)->sensorHandle);
return ret.isOk() ? OK : BAD_VALUE;
}
@@ -106,7 +103,7 @@ int ASensorEventQueue::hasEvents() const {
return !mQueue.empty();
}
-Return<void> ASensorEventQueue::onEvent(const Event &event) {
+ndk::ScopedAStatus ASensorEventQueue::onEvent(const Event& event) {
LOG(VERBOSE) << "ASensorEventQueue::onEvent";
if (static_cast<int32_t>(event.sensorType) != ASENSOR_TYPE_ADDITIONAL_INFO ||
@@ -127,17 +124,16 @@ Return<void> ASensorEventQueue::onEvent(const Event &event) {
Mutex::Autolock autoLock(mLock);
mQueue.emplace_back();
sensors_event_t* sensorEvent = &mQueue[mQueue.size() - 1];
- android::hardware::sensors::V1_0::implementation::convertToSensorEvent(event,
- sensorEvent);
+ android::hardware::sensors::implementation::convertToSensorEvent(event, sensorEvent);
}
Mutex::Autolock autoLock(mValidLock);
if (mValid) {
- mLooper->signalSensorEvents(this);
+ mLooper->signalSensorEvents(this->ref<ASensorEventQueue>());
}
}
- return android::hardware::Void();
+ return ndk::ScopedAStatus::ok();
}
void ASensorEventQueue::dispatchCallback() {
@@ -159,7 +155,7 @@ void ASensorEventQueue::invalidate() {
Mutex::Autolock autoLock(mValidLock);
mValid = false;
}
- mLooper->invalidateSensorQueue(this);
+ mLooper->invalidateSensorQueue(this->ref<ASensorEventQueue>());
setImpl(nullptr);
}
diff --git a/sensorservice/libsensorndkbridge/ASensorEventQueue.h b/sensorservice/libsensorndkbridge/ASensorEventQueue.h
index 7139d34..6c7f5c4 100644
--- a/sensorservice/libsensorndkbridge/ASensorEventQueue.h
+++ b/sensorservice/libsensorndkbridge/ASensorEventQueue.h
@@ -18,31 +18,32 @@
#define A_SENSOR_EVENT_QUEUE_H_
-#include <android/frameworks/sensorservice/1.0/IEventQueue.h>
-#include <android/frameworks/sensorservice/1.0/IEventQueueCallback.h>
+#include <aidl/android/frameworks/sensorservice/BnEventQueueCallback.h>
+#include <aidl/android/frameworks/sensorservice/IEventQueue.h>
+#include <aidl/sensors/convert.h>
+#include <android-base/macros.h>
+#include <android/binder_auto_utils.h>
#include <android/looper.h>
#include <android/sensor.h>
-#include <android-base/macros.h>
-#include <sensors/convert.h>
#include <utils/Mutex.h>
+#include <utils/RefBase.h>
#include <atomic>
struct ALooper;
-struct ASensorEventQueue
- : public android::frameworks::sensorservice::V1_0::IEventQueueCallback {
- using Event = android::hardware::sensors::V1_0::Event;
- using IEventQueue = android::frameworks::sensorservice::V1_0::IEventQueue;
+struct ASensorEventQueue : public aidl::android::frameworks::sensorservice::BnEventQueueCallback {
+ using Event = aidl::android::hardware::sensors::Event;
+ using IEventQueue = aidl::android::frameworks::sensorservice::IEventQueue;
ASensorEventQueue(
ALooper *looper,
ALooper_callbackFunc callback,
void *data);
- android::hardware::Return<void> onEvent(const Event &event) override;
+ ndk::ScopedAStatus onEvent(const Event& event) override;
- void setImpl(const android::sp<IEventQueue> &queueImpl);
+ void setImpl(const std::shared_ptr<IEventQueue>& queueImpl);
int registerSensor(
ASensorRef sensor,
@@ -67,7 +68,7 @@ private:
ALooper *mLooper;
ALooper_callbackFunc mCallback;
void *mData;
- android::sp<IEventQueue> mQueueImpl;
+ std::shared_ptr<IEventQueue> mQueueImpl;
android::Mutex mLock;
std::vector<sensors_event_t> mQueue;
diff --git a/sensorservice/libsensorndkbridge/ASensorManager.cpp b/sensorservice/libsensorndkbridge/ASensorManager.cpp
index de552e0..a7180ed 100644
--- a/sensorservice/libsensorndkbridge/ASensorManager.cpp
+++ b/sensorservice/libsensorndkbridge/ASensorManager.cpp
@@ -19,25 +19,25 @@
#include "ASensorManager.h"
#define LOG_TAG "libsensorndkbridge"
+#include <aidl/sensors/convert.h>
#include <android-base/logging.h>
+#include <android/binder_auto_utils.h>
+#include <android/binder_ibinder_platform.h>
+#include <android/binder_manager.h>
+#include <android/binder_process.h>
#include <android/looper.h>
-#include <hidl/HidlTransportSupport.h>
-#include <sensors/convert.h>
-
-using android::hardware::sensors::V1_0::SensorInfo;
-using android::frameworks::sensorservice::V1_0::IEventQueue;
-using android::frameworks::sensorservice::V1_0::ISensorManager;
-using android::frameworks::sensorservice::V1_0::Result;
-using android::hardware::sensors::V1_0::SensorType;
-using android::sp;
-using android::wp;
+
+#include <thread>
+
+using aidl::android::frameworks::sensorservice::IEventQueue;
+using aidl::android::frameworks::sensorservice::ISensorManager;
+using aidl::android::hardware::sensors::SensorInfo;
+using aidl::android::hardware::sensors::SensorType;
+using android::BAD_VALUE;
using android::Mutex;
-using android::status_t;
-using android::OK;
using android::NO_INIT;
-using android::BAD_VALUE;
-using android::hardware::hidl_vec;
-using android::hardware::Return;
+using android::OK;
+using android::status_t;
static Mutex gLock;
@@ -57,8 +57,7 @@ ASensorManager *ASensorManager::getInstance() {
return sInstance;
}
-void ASensorManager::SensorDeathRecipient::serviceDied(
- uint64_t, const wp<::android::hidl::base::V1_0::IBase>&) {
+void ASensorManager::serviceDied(void*) {
LOG(ERROR) << "Sensor service died. Cleanup sensor manager instance!";
Mutex::Autolock autoLock(gLock);
delete sInstance;
@@ -67,14 +66,22 @@ void ASensorManager::SensorDeathRecipient::serviceDied(
ASensorManager::ASensorManager()
: mInitCheck(NO_INIT) {
- mManager = ISensorManager::getService();
+ if (!ABinderProcess_isThreadPoolStarted()) {
+ std::thread([]() {
+ ABinderProcess_joinThreadPool();
+ LOG(ERROR) << "SHOULD NOT EXIT";
+ }).detach();
+ LOG(ERROR) << "The user of libsensorndkbridge did not start a threadpool";
+ }
+ const std::string name = std::string() + ISensorManager::descriptor + "/default";
+ mManager =
+ ISensorManager::fromBinder(ndk::SpAIBinder(AServiceManager_waitForService(name.c_str())));
if (mManager != NULL) {
- mDeathRecipient = new SensorDeathRecipient();
- Return<bool> linked = mManager->linkToDeath(mDeathRecipient, /*cookie*/ 0);
- if (!linked.isOk()) {
- LOG(ERROR) << "Transaction error in linking to sensor service death: " <<
- linked.description().c_str();
- } else if (!linked) {
+ mDeathRecipient =
+ ndk::ScopedAIBinder_DeathRecipient(AIBinder_DeathRecipient_new(serviceDied));
+ auto linked =
+ AIBinder_linkToDeath(mManager->asBinder().get(), mDeathRecipient.get(), nullptr);
+ if (linked != OK) {
LOG(WARNING) << "Unable to link to sensor service death notifications";
} else {
LOG(DEBUG) << "Link to sensor service death notification successful";
@@ -93,16 +100,11 @@ int ASensorManager::getSensorList(ASensorList *out) {
Mutex::Autolock autoLock(mLock);
if (mSensorList == NULL) {
- Return<void> ret =
- mManager->getSensorList([&](const auto &list, auto result) {
- if (result != Result::OK) {
- return;
- }
-
- mSensors = list;
- });
+ ndk::ScopedAStatus ret = mManager->getSensorList(&mSensors);
- (void)ret.isOk();
+ if (!ret.isOk()) {
+ LOG(ERROR) << "Failed to get sensor list: " << ret;
+ }
mSensorList.reset(new ASensorRef[mSensors.size()]);
for (size_t i = 0; i < mSensors.size(); ++i) {
@@ -123,24 +125,21 @@ ASensorRef ASensorManager::getDefaultSensor(int type) {
ASensorRef defaultSensor = NULL;
- Return<void> ret = mManager->getDefaultSensor(
- static_cast<SensorType>(type),
- [&](const auto &sensor, auto result) {
- if (result != Result::OK) {
- return;
- }
+ SensorInfo sensor;
+
+ ndk::ScopedAStatus ret = mManager->getDefaultSensor(static_cast<SensorType>(type), &sensor);
- for (size_t i = 0; i < mSensors.size(); ++i) {
- if (sensor == mSensors[i]) {
- defaultSensor =
- reinterpret_cast<ASensorRef>(&mSensors[i]);
+ if (!ret.isOk()) {
+ LOG(ERROR) << "Failed to get default sensor of type " << type << " with error: " << ret;
+ }
- break;
- }
- }
- });
+ for (size_t i = 0; i < mSensors.size(); ++i) {
+ if (sensor == mSensors[i]) {
+ defaultSensor = reinterpret_cast<ASensorRef>(&mSensors[i]);
- (void)ret.isOk();
+ break;
+ }
+ }
return defaultSensor;
}
@@ -158,28 +157,23 @@ ASensorEventQueue *ASensorManager::createEventQueue(
void *data) {
LOG(VERBOSE) << "ASensorManager::createEventQueue";
- sp<ASensorEventQueue> queue =
- new ASensorEventQueue(looper, callback, data);
+ std::shared_ptr<ASensorEventQueue> queue =
+ ndk::SharedRefBase::make<ASensorEventQueue>(looper, callback, data);
- ::android::hardware::setMinSchedulerPolicy(queue, SCHED_FIFO, 98);
- Result result;
- Return<void> ret =
- mManager->createEventQueue(
- queue, [&](const sp<IEventQueue> &queueImpl, auto tmpResult) {
- result = tmpResult;
- if (result != Result::OK) {
- return;
- }
+ AIBinder_setMinSchedulerPolicy(queue->asBinder().get(), SCHED_FIFO, 98);
+ std::shared_ptr<IEventQueue> eventQueue;
+ ndk::ScopedAStatus ret = mManager->createEventQueue(queue, &eventQueue);
- queue->setImpl(queueImpl);
- });
-
- if (!ret.isOk() || result != Result::OK) {
- LOG(ERROR) << "FAILED to create event queue";
+ if (!ret.isOk()) {
+ LOG(ERROR) << "FAILED to create event queue: " << ret;
return NULL;
}
+ queue->setImpl(eventQueue);
- queue->incStrong(NULL /* id */);
+ {
+ Mutex::Autolock autoLock(mQueuesLock);
+ mQueues.push_back(queue);
+ }
LOG(VERBOSE) << "Returning event queue " << queue.get();
return queue.get();
@@ -190,8 +184,14 @@ void ASensorManager::destroyEventQueue(ASensorEventQueue *queue) {
queue->invalidate();
- queue->decStrong(NULL /* id */);
- queue = NULL;
+ {
+ Mutex::Autolock autoLock(mQueuesLock);
+ mQueues.erase(std::remove_if(mQueues.begin(), mQueues.end(),
+ [&](const std::shared_ptr<ASensorEventQueue>& ptr) {
+ return ptr.get() == queue;
+ }),
+ mQueues.end());
+ }
}
////////////////////////////////////////////////////////////////////////////////
@@ -374,7 +374,7 @@ float ASensor_getResolution(ASensor const* sensor) {
int ASensor_getMinDelay(ASensor const* sensor) {
RETURN_IF_SENSOR_IS_NULL(ASENSOR_DELAY_INVALID);
- return reinterpret_cast<const SensorInfo *>(sensor)->minDelay;
+ return reinterpret_cast<const SensorInfo*>(sensor)->minDelayUs;
}
int ASensor_getFifoMaxEventCount(ASensor const* sensor) {
diff --git a/sensorservice/libsensorndkbridge/ASensorManager.h b/sensorservice/libsensorndkbridge/ASensorManager.h
index 4e91122..e45cbfe 100644
--- a/sensorservice/libsensorndkbridge/ASensorManager.h
+++ b/sensorservice/libsensorndkbridge/ASensorManager.h
@@ -18,8 +18,8 @@
#define A_SENSOR_MANAGER_H_
+#include <aidl/android/frameworks/sensorservice/ISensorManager.h>
#include <android-base/macros.h>
-#include <android/frameworks/sensorservice/1.0/ISensorManager.h>
#include <android/sensor.h>
#include <utils/Mutex.h>
#include <utils/RefBase.h>
@@ -48,26 +48,23 @@ struct ASensorManager {
// ALooper.
void destroyEventQueue(ASensorEventQueue *queue);
-private:
+ static void serviceDied(void* cookie);
- struct SensorDeathRecipient : public android::hardware::hidl_death_recipient
- {
- // hidl_death_recipient interface
- virtual void serviceDied(uint64_t cookie,
- const ::android::wp<::android::hidl::base::V1_0::IBase>& who) override;
- };
-
- using ISensorManager = android::frameworks::sensorservice::V1_0::ISensorManager;
- using SensorInfo = android::hardware::sensors::V1_0::SensorInfo;
+ private:
+ using ISensorManager = aidl::android::frameworks::sensorservice::ISensorManager;
+ using SensorInfo = aidl::android::hardware::sensors::SensorInfo;
static ASensorManager *sInstance;
- android::sp<SensorDeathRecipient> mDeathRecipient = nullptr;
+ ndk::ScopedAIBinder_DeathRecipient mDeathRecipient;
android::status_t mInitCheck;
- android::sp<ISensorManager> mManager;
+ std::shared_ptr<ISensorManager> mManager;
+
+ mutable android::Mutex mQueuesLock;
+ std::vector<std::shared_ptr<ASensorEventQueue>> mQueues;
mutable android::Mutex mLock;
- android::hardware::hidl_vec<SensorInfo> mSensors;
+ std::vector<SensorInfo> mSensors;
std::unique_ptr<ASensorRef[]> mSensorList;
DISALLOW_COPY_AND_ASSIGN(ASensorManager);
diff --git a/sensorservice/libsensorndkbridge/Android.bp b/sensorservice/libsensorndkbridge/Android.bp
index 33b9619..f5de01c 100644
--- a/sensorservice/libsensorndkbridge/Android.bp
+++ b/sensorservice/libsensorndkbridge/Android.bp
@@ -24,16 +24,19 @@ cc_library_shared {
"ASensorEventQueue.cpp",
"ASensorManager.cpp",
],
- cflags: ["-Wall", "-Werror"],
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
shared_libs: [
"libbase",
- "libhidlbase",
+ "libbinder_ndk",
"libutils",
- "android.frameworks.sensorservice@1.0",
- "android.hardware.sensors@1.0",
+ "android.frameworks.sensorservice-V1-ndk",
+ "android.hardware.sensors-V2-ndk",
],
static_libs: [
- "android.hardware.sensors@1.0-convert",
+ "android.hardware.sensors-V1-convert",
],
header_libs: [
@@ -43,4 +46,11 @@ cc_library_shared {
export_header_lib_headers: [
"libandroid_sensor_headers",
],
+
+ export_shared_lib_headers: [
+ "android.frameworks.sensorservice-V1-ndk",
+ ],
+ export_static_lib_headers: [
+ "android.hardware.sensors-V1-convert",
+ ],
}
diff --git a/sensorservice/utils/Android.bp b/sensorservice/utils/Android.bp
new file mode 100644
index 0000000..1617700
--- /dev/null
+++ b/sensorservice/utils/Android.bp
@@ -0,0 +1,31 @@
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+cc_library_static {
+ name: "libsensorndkutils",
+ srcs: [
+ "direct_channel_buffer_reader.cc",
+ ],
+ cflags: ["-Wall", "-Werror"],
+ shared_libs: [
+ "libbase",
+ ],
+ header_libs: [
+ "libhardware_headers",
+ ],
+ host_supported: true,
+}
+
+cc_test {
+ name: "libsensorndkutils_test",
+ srcs: ["direct_channel_buffer_reader_test.cc"],
+ shared_libs: [
+ "libbase",
+ ],
+ static_libs: [
+ "libgtest",
+ "libsensorndkutils",
+ ],
+ host_supported: true,
+}
diff --git a/sensorservice/utils/direct_channel_buffer_reader.cc b/sensorservice/utils/direct_channel_buffer_reader.cc
new file mode 100644
index 0000000..b639405
--- /dev/null
+++ b/sensorservice/utils/direct_channel_buffer_reader.cc
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) 2022 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 "direct_channel_buffer_reader.h"
+
+#include <android-base/logging.h>
+#include <hardware/sensors.h>
+
+namespace {
+
+// DirectChannelBufferReader::Read() keeps reading until it catches up with the
+// write head. To avoid infinite reads in case of corrupted buffer, put an upper
+// bound on number of reads. Read() would read at most
+// <kMaxReadRounds * buffer_size_samples> samples.
+constexpr int kMaxReadRounds = 2;
+
+} // namespace
+
+DirectChannelBufferReader::DirectChannelBufferReader(const sensors_event_t* direct_channel_buffer,
+ int buffer_size_samples)
+ : direct_channel_buffer_(direct_channel_buffer), buffer_size_samples_(buffer_size_samples) {}
+
+int DirectChannelBufferReader::Read(int* num_samples_skipped) {
+ int num_samples_read = 0;
+ int64_t last_atomic_counter_before_read = last_atomic_counter_;
+ // Keep reading samples until reaching the write head.
+ // Example: 1 2 3 4 0
+ // ^
+ // head
+ //
+ // Example: 11 12 13 14 5 6 7 8 9 10
+ // ^
+ // head
+ //
+ // Example: UINT32_MAX-1 UINT32_MAX 1 UINT32_MAX-3 UINT32_MAX-2
+ // ^
+ // head
+ //
+ // Here is a more interesting corner case:
+ // 1 2 <- samples obtained in previous calls to Read()
+ // 1 2 3
+ // ^
+ // Got a new sample. Keep reading.
+ //
+ // 1 2 3 14 15 16 7
+ // -------- ^
+ // Reached the head but only got 3 samples with
+ // consecutive counter values. Sample 3 may be
+ // corrupted so it should be discarded. Also we
+ // are still missing sample 8-13. Keep reading.
+ //
+ // 1 2 3 14 15 16 7 8 9 10 (Got 8-10. Keep reading)
+ //
+ // 11 12 13 14 15 16 7 8 9 10
+ // ^
+ // Reached the head and got all 10 consecutive
+ // samples. Stop reading. Sample 3 was discarded
+ // when buffer_ was truncated.
+ while (true) {
+ buffer_.push_back(ReadOneSample(index_));
+ num_samples_read++;
+ int64_t atomic_counter = static_cast<uint32_t>(buffer_.back().reserved0);
+ bool reached_zero_counter_head = atomic_counter == 0;
+ bool reached_regular_head =
+ atomic_counter ==
+ ((last_atomic_counter_ + UINT32_MAX - buffer_size_samples_) % UINT32_MAX) + 1;
+ bool has_enough_consecutive_samples = streak_ >= buffer_size_samples_;
+ if (reached_zero_counter_head || (reached_regular_head && has_enough_consecutive_samples)) {
+ buffer_.pop_back();
+ num_samples_read--;
+ // At this point the samples in <buffer_> are guaranteed to be free
+ // of corruption from data race. Here's the proof.
+ // Case 1: reached_zero_counter_head = true. The writer has not
+ // started overwriting any samples so all samples that have been
+ // read so far are valid.
+ // Case 2: reached_regular_head = true. E.g. suppose
+ // last_atomic_counter_ = 15 and buffer_size_samples_ = 10, now
+ // buffer_ would be [7, 8, 9, 10, 11, 12, 13, 14, 15]. The fact that we just
+ // saw a counter value of 6 means the writer has not start
+ // overwriting samples 7-15 yet. Therefore these samples are all
+ // valid.
+ break;
+ }
+ if (atomic_counter != (last_atomic_counter_ % UINT32_MAX) + 1) {
+ streak_ = 0;
+ }
+ streak_++;
+ last_atomic_counter_ = atomic_counter;
+ index_ = (index_ + 1) % buffer_size_samples_;
+ TruncateBuffer();
+ if (num_samples_read > kMaxReadRounds * buffer_size_samples_) {
+ buffer_.clear();
+ return kErrorHeadOfBufferNotFound;
+ }
+ }
+ num_samples_read = std::min(num_samples_read, buffer_size_samples_ - 1);
+ if (num_samples_skipped != nullptr) {
+ *num_samples_skipped =
+ last_atomic_counter_ - last_atomic_counter_before_read - num_samples_read;
+ }
+ return num_samples_read;
+}
+
+const sensors_event_t DirectChannelBufferReader::ReadOneSample(int index) {
+ sensors_event_t event;
+ // reserved0 is the atomic counter and should be read first.
+ event.reserved0 = direct_channel_buffer_[index].reserved0;
+ event.version = direct_channel_buffer_[index].version;
+ event.sensor = direct_channel_buffer_[index].sensor;
+ event.type = direct_channel_buffer_[index].type;
+ event.timestamp = direct_channel_buffer_[index].timestamp;
+ event.u64.data[0] = direct_channel_buffer_[index].u64.data[0];
+ event.u64.data[1] = direct_channel_buffer_[index].u64.data[1];
+ event.u64.data[2] = direct_channel_buffer_[index].u64.data[2];
+ event.u64.data[3] = direct_channel_buffer_[index].u64.data[3];
+ event.u64.data[4] = direct_channel_buffer_[index].u64.data[4];
+ event.u64.data[5] = direct_channel_buffer_[index].u64.data[5];
+ event.u64.data[6] = direct_channel_buffer_[index].u64.data[6];
+ event.u64.data[7] = direct_channel_buffer_[index].u64.data[7];
+ return event;
+}
+
+void DirectChannelBufferReader::TruncateBuffer() {
+ while (buffer_.size() > buffer_size_samples_ - 1) {
+ buffer_.pop_front();
+ }
+}
diff --git a/sensorservice/utils/direct_channel_buffer_reader.h b/sensorservice/utils/direct_channel_buffer_reader.h
new file mode 100644
index 0000000..5c91ea5
--- /dev/null
+++ b/sensorservice/utils/direct_channel_buffer_reader.h
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#pragma once
+
+#include <hardware/sensors.h>
+
+#include <algorithm>
+#include <deque>
+
+// A utility class that reads sensor samples from a direct channel buffer.
+// Direct channel operates in a lockless manner and uses an atomic counter for
+// synchronization. This class implements the counter based synchronization
+// protocol and therefore guarantees data consistency. See
+// https://developer.android.com/reference/android/hardware/SensorDirectChannel
+// for more details on the atomic counter.
+//
+// Besides reading samples, the reader also supports keeping track of recently
+// obtained samples.
+//
+// DirectChannelBufferReader is not thread safe. It's the caller's responsibility
+// to serialize the calls, including the access to the returned sample
+// container.
+//
+// Example usage:
+// DirectChannelBufferReader reader(buf, 100);
+//
+// int num_samples = reader.Read();
+// const std::deque<sensors_event_t>& samples = reader.GetSampleContainer();
+// for (auto it = samples.end() - num_samples; it != samples.end(); it++) {
+// HandleNewSamples(*it);
+// }
+//
+// int num_samples_skipped;
+// reader.Read(&num_samples_skipped);
+// if (num_samples_skipped > 0) {
+// ReportMissedSamples(num_samples_skipped);
+// }
+//
+//
+// Another example:
+//
+// DirectChannelBufferReader reader(buf, 100);
+//
+// std::vector<sensors_event_t> Query(int start_time, int end_time) {
+// reader.Read();
+// std::vector<sensors_event_t> output;
+// for (auto& sample : reader_.GetSampleContainer()) {
+// if (sample.timestamp >= start_time && sample.timestamp < end_time) {
+// output.push_back(sample);
+// }
+// }
+// return output;
+// }
+
+class DirectChannelBufferReader {
+ public:
+ static constexpr int kErrorHeadOfBufferNotFound = -1;
+
+ // Constructor
+ // direct_channel_buffer: Pointer to the shared buffer where sensor samples
+ // are written into.
+ // buffer_size_samples: The size of direct_channel_buffer in number of
+ // samples.
+ DirectChannelBufferReader(const sensors_event_t* direct_channel_buffer,
+ int buffer_size_samples);
+
+ virtual ~DirectChannelBufferReader() {}
+
+ // Attempts to read samples from the direct channel buffer. Returns
+ // the number of samples read, or kErrorHeadOfBufferNotFound if the reader
+ // can not find the write head e.g. due to corrupted data in the buffer.
+ // The function is non-blocking and returns 0 if new samples are not available.
+ // The caller should control its polling based on external factors like
+ // events in a different subsystem (e.g. camera frame ready)
+ // After the call completes, the caller can use GetSampleContainer() to
+ // access the samples. Sometimes it may be possible for one or more samples
+ // in the direct channel buffer to be overwritten by the writter before the
+ // reader has a chance to read it, e.g. when the reader does not keep up
+ // with the writer. The number of samples that were lost / skipped is
+ // written to <num_samples_skipped>, if the argument is not null.
+ int Read(int* num_samples_skipped = nullptr);
+
+ // Returns the container that holds recent samples. New samples are appended
+ // to the end of the container when Read() is called. Samples from previous
+ // rounds of Read() are kept around in the container, except when the total
+ // samples exceeds <buffer_size_samples> - 1, in which case older samples
+ // would be truncated. The caller is free to remove samples from the
+ // container, e.g. after the samples are consumed.
+ //
+ // Calls to the returned container must be synchronized with calls to this
+ // instance of DirectChannelBufferReader.
+ std::deque<sensors_event_t>& GetSampleContainer() { return buffer_; }
+
+ protected:
+ // For test only.
+ virtual const sensors_event_t ReadOneSample(int index);
+
+ private:
+ // Truncates the head of <buffer_> until its size <= buffer_size_samples - 1.
+ void TruncateBuffer();
+
+ // Points to the direct channel buffer where the sensor writes samples into.
+ const volatile sensors_event_t* direct_channel_buffer_;
+
+ // The number of samples that <direct_channel_buffer_> is able to hold.
+ const int buffer_size_samples_;
+
+ // The atomic counter value of the last valid sample.
+ int64_t last_atomic_counter_ = 0;
+
+ // The index into <direct_channel_buffer_> that should be read next time.
+ int index_ = 0;
+
+ // The number of successive sensors_event_t reads with consecutive atomic
+ // counters values.
+ // E.g. 1 => streak_ = 1
+ // 5 6 7 => streak_ = 3
+ // 1 2 3 14 => streak_ = 1
+ // 1 2 3 14 15 => streak_ = 2
+ int streak_ = 0;
+
+ // The buffer holding recent samples.
+ std::deque<sensors_event_t> buffer_;
+};
diff --git a/sensorservice/utils/direct_channel_buffer_reader_test.cc b/sensorservice/utils/direct_channel_buffer_reader_test.cc
new file mode 100644
index 0000000..07ea8d1
--- /dev/null
+++ b/sensorservice/utils/direct_channel_buffer_reader_test.cc
@@ -0,0 +1,337 @@
+/*
+ * Copyright (C) 2022 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 "direct_channel_buffer_reader.h"
+
+#include <android-base/logging.h>
+#include <android-base/thread_annotations.h>
+#include <gtest/gtest.h>
+#include <stdlib.h>
+
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+
+namespace {
+
+// A derived class of DirectChannelBufferReader that allows blocking memory read
+// for concurrency tests.
+class TestableDirectChannelBufferReader : public DirectChannelBufferReader {
+ public:
+ TestableDirectChannelBufferReader(const sensors_event_t* direct_channel_buffer,
+ int buffer_size_samples)
+ : DirectChannelBufferReader(direct_channel_buffer, buffer_size_samples) {}
+
+ const sensors_event_t ReadOneSample(int index) {
+ {
+ std::unique_lock lk(mutex_);
+ reader_waiting_ = true;
+ lk.unlock();
+ cv_.notify_one();
+ }
+ {
+ std::unique_lock lk(mutex_);
+ cv_.wait(lk, [this] { return !should_block_reads_ || num_reads_unblocked_ > 0; });
+ reader_waiting_ = false;
+ auto return_value = DirectChannelBufferReader::ReadOneSample(index);
+ num_reads_unblocked_--;
+ lk.unlock();
+ cv_.notify_one();
+ return return_value;
+ }
+ }
+
+ void BlockReads() {
+ std::unique_lock lk(mutex_);
+ should_block_reads_ = true;
+ num_reads_unblocked_ = 0;
+ lk.unlock();
+ cv_.notify_one();
+ }
+
+ void UnblockReads() {
+ std::unique_lock lk(mutex_);
+ should_block_reads_ = false;
+ lk.unlock();
+ cv_.notify_one();
+ }
+
+ void UnblockAndWaitForReads(int num_reads) {
+ {
+ std::unique_lock lk(mutex_);
+ CHECK_EQ(num_reads_unblocked_, 0);
+ num_reads_unblocked_ = num_reads;
+ lk.unlock();
+ cv_.notify_one();
+ }
+ {
+ std::unique_lock lk(mutex_);
+ // Only proceed when reads are all done AND the reader is blocked again.
+ // This way we ensure nothing is done on the reader thread (like sample
+ // validation) when more samples are being written.
+ cv_.wait(lk, [this] { return num_reads_unblocked_ == 0 && reader_waiting_; });
+ }
+ }
+
+ private:
+ std::mutex mutex_;
+ std::condition_variable cv_;
+ bool should_block_reads_ GUARDED_BY(mutex_) = false;
+ bool reader_waiting_ GUARDED_BY(mutex_) = false;
+ int num_reads_unblocked_ GUARDED_BY(mutex_) = 0;
+};
+
+class DirectChannelBufferReaderTest : public ::testing::Test {
+ protected:
+ DirectChannelBufferReaderTest() : buffer_{}, reader_(&buffer_[0], kBufferSize) {}
+
+ void WriteOneSample() {
+ WritePartialSample();
+ FinishWritingSample();
+ }
+
+ void WritePartialSample() { buffer_[next_buffer_index_].timestamp = next_atomic_counter_; }
+
+ void FinishWritingSample() {
+ buffer_[next_buffer_index_].data[0] = next_atomic_counter_;
+ buffer_[next_buffer_index_].reserved0 = next_atomic_counter_;
+ next_buffer_index_ = (next_buffer_index_ + 1) % kBufferSize;
+ next_atomic_counter_ = (next_atomic_counter_ % UINT32_MAX) + 1;
+ }
+
+ void WriteHalfSample() {
+ if (buffer_[next_buffer_index_].timestamp != next_atomic_counter_) {
+ WritePartialSample();
+ } else {
+ FinishWritingSample();
+ }
+ }
+
+ void ValidateReaderSamples() {
+ auto& samples = reader_.GetSampleContainer();
+ for (int i = 0; i < samples.size(); i++) {
+ int64_t expected_value =
+ ((next_atomic_counter_ - samples.size() + i - 1 + UINT32_MAX) % UINT32_MAX) + 1;
+ EXPECT_EQ(static_cast<uint32_t>(samples[i].reserved0), expected_value) << " i = " << i;
+ EXPECT_EQ(samples[i].timestamp, expected_value);
+ EXPECT_EQ(samples[i].data[0], expected_value);
+ }
+ }
+
+ void StartReaderThread() {
+ reader_.BlockReads();
+ reader_thread_ = std::make_unique<std::thread>([this] {
+ while (keep_reading_) {
+ reader_.Read();
+ // At this point we want to validate the samples and check the values
+ // against next_atomic_counter_. To prevent next_atomic_counter_ from
+ // being modified by the writer thread, we make the writer thread
+ // blocked inside UnblockAndWaitForReads() until the validation is done
+ // and reader_.Read() is called again.
+ ValidateReaderSamples();
+ }
+ });
+ }
+
+ void StopAndJoinReaderThread() {
+ reader_.UnblockReads();
+ keep_reading_ = false;
+ reader_thread_->join();
+ }
+
+ static constexpr int kBufferSize = 20;
+ std::array<sensors_event_t, kBufferSize> buffer_;
+ TestableDirectChannelBufferReader reader_;
+
+ int next_buffer_index_ = 0;
+ int64_t next_atomic_counter_ = 1;
+
+ std::unique_ptr<std::thread> reader_thread_;
+ bool keep_reading_ = true;
+};
+
+TEST_F(DirectChannelBufferReaderTest, ReturnNoDataForEmptyBuffer) {
+ EXPECT_EQ(reader_.Read(), 0);
+ EXPECT_EQ(reader_.GetSampleContainer().size(), 0);
+}
+
+TEST_F(DirectChannelBufferReaderTest, ReturnOneSample) {
+ WriteOneSample();
+ EXPECT_EQ(reader_.Read(), 1);
+ EXPECT_EQ(reader_.GetSampleContainer().size(), 1);
+}
+
+TEST_F(DirectChannelBufferReaderTest, ReturnSamplesWithFullBuffer) {
+ for (int i = 0; i < kBufferSize; i++) {
+ WriteOneSample();
+ }
+ EXPECT_EQ(reader_.Read(), kBufferSize - 1);
+ EXPECT_EQ(reader_.GetSampleContainer().size(), kBufferSize - 1);
+ ValidateReaderSamples();
+}
+
+TEST_F(DirectChannelBufferReaderTest, ReturnSamplesWithInterleavedWriteRead) {
+ WriteOneSample();
+ EXPECT_EQ(reader_.Read(), 1);
+ WriteOneSample();
+ WriteOneSample();
+ EXPECT_EQ(reader_.Read(), 2);
+ EXPECT_EQ(reader_.GetSampleContainer().size(), 3);
+ ValidateReaderSamples();
+}
+
+TEST_F(DirectChannelBufferReaderTest, ReturnNothingAfterPartialWrite) {
+ WriteOneSample();
+ EXPECT_EQ(reader_.Read(), 1);
+ WritePartialSample();
+ EXPECT_EQ(reader_.Read(), 0);
+ FinishWritingSample();
+ EXPECT_EQ(reader_.Read(), 1);
+ EXPECT_EQ(reader_.GetSampleContainer().size(), 2);
+ ValidateReaderSamples();
+}
+
+TEST_F(DirectChannelBufferReaderTest, DiscardPartiallyWrittenSample) {
+ WriteOneSample();
+ EXPECT_EQ(reader_.Read(), 1);
+ for (int i = 0; i < kBufferSize; i++) {
+ WriteOneSample();
+ }
+ // State of the buffer: 21 2 3 4 5 .... 20
+ // ^
+ // Both read and write head point here
+
+ WritePartialSample();
+ // State of the buffer: 21 2 3 4 5 .... 20
+ // ^
+ // Partially overwritten with sample 22
+ // The next Read() should get sample 3-21. Sample 2 should be discarded.
+ EXPECT_EQ(reader_.Read(), kBufferSize - 1);
+ EXPECT_EQ(reader_.GetSampleContainer().front().timestamp, 3);
+ EXPECT_EQ(reader_.GetSampleContainer().back().timestamp, 21);
+}
+
+TEST_F(DirectChannelBufferReaderTest, ReturnCorrectSamplesAfterWriterOverflow) {
+ WriteOneSample();
+ reader_.Read();
+ for (int i = 0; i < kBufferSize + 5; i++) {
+ WriteOneSample();
+ }
+ EXPECT_EQ(reader_.Read(), kBufferSize - 1);
+ EXPECT_EQ(reader_.GetSampleContainer().size(), kBufferSize - 1);
+ ValidateReaderSamples();
+}
+
+TEST_F(DirectChannelBufferReaderTest, ReturnNumOfSkippedSamples) {
+ WriteOneSample();
+ reader_.Read();
+ for (int i = 0; i < kBufferSize + 5; i++) {
+ WriteOneSample();
+ }
+ int num_samples_skipped = 0;
+ reader_.Read(&num_samples_skipped);
+ EXPECT_EQ(num_samples_skipped, 6);
+}
+
+TEST_F(DirectChannelBufferReaderTest, WrapAroundUINT32Max) {
+ next_atomic_counter_ = UINT32_MAX - 3;
+ for (int i = 0; i < kBufferSize; i++) {
+ WriteOneSample();
+ }
+ EXPECT_EQ(reader_.Read(), kBufferSize - 1);
+ EXPECT_EQ(reader_.GetSampleContainer().size(), kBufferSize - 1);
+ ValidateReaderSamples();
+}
+
+TEST_F(DirectChannelBufferReaderTest, ConcurrentWriteReadSequence) {
+ WriteOneSample();
+ // Buffer: 1 0 0 0 ...
+ // Writer head: ^
+
+ reader_.Read();
+ // Buffer: 1 0 0 0 ...
+ // Writer head: ^
+ // What reader sees so far: 1
+
+ StartReaderThread();
+ for (int i = 0; i < kBufferSize; i++) {
+ WriteOneSample();
+ }
+ // Buffer: 21 2 3 4 ...
+ // Writer head: ^
+ // What reader sees so far: 1
+
+ WriteHalfSample();
+ // Buffer: 21 <counter:2,content:22> 3 4 ...
+ // Writer head: ^
+ // What reader sees so far: 1
+
+ reader_.UnblockAndWaitForReads(2);
+ // Buffer: 21 <counter:2,content:22> 3 4 ...
+ // Writer head: ^
+ // What reader sees so far: 1 2* 3
+ // (sample 2 is corrupted)
+
+ WriteHalfSample();
+ // Buffer: 21 22 3 4 5 ...
+ // Writer head: ^
+ // What reader sees so far: 1 2 3
+
+ WriteOneSample();
+ WriteOneSample();
+ // Buffer: 21 22 23 24 5 6 ...
+ // Writer head: ^
+ // What reader sees so far: 1 2 3
+
+ WriteHalfSample();
+ // Buffer: 21 22 23 24 <counter:5,content:25> 6 ...
+ // Writer head: ^
+ // What reader sees so far: 1 2 3
+
+ StopAndJoinReaderThread();
+ // Buffer: 21 22 23 24 <counter:5,content:25> 6 ...
+ // Writer head: ^
+ // What reader sees so far: 21 22 23 24 5* 6 ...
+ // (sample 5 is corrupted)
+ //
+ // The validation performed on the reader thread would ensure that sample 2
+ // and 5 were not returned.
+}
+
+TEST_F(DirectChannelBufferReaderTest, GeneratedConcurrentWriteReadSequence) {
+ constexpr int kNumRounds = 5000;
+ constexpr int kMaxReadWritePerRound = kBufferSize + 5;
+ StartReaderThread();
+ // For deterministic results, use an arbitrary fixed seed for random number
+ // generator.
+ srand(12345);
+ for (int i = 0; i < kNumRounds; i++) {
+ bool write = rand() % 2 == 0;
+ if (write) {
+ // Multiply by 2 since each call only writes half a sample.
+ int num_writes = rand() % (kMaxReadWritePerRound * 2);
+ for (int j = 0; j < num_writes; j++) {
+ WriteHalfSample();
+ }
+ } else {
+ int num_reads = rand() % kMaxReadWritePerRound;
+ reader_.UnblockAndWaitForReads(num_reads);
+ }
+ }
+ StopAndJoinReaderThread();
+}
+
+} // namespace
diff --git a/stats/aidl/Android.bp b/stats/aidl/Android.bp
index 364e1f2..26302b7 100644
--- a/stats/aidl/Android.bp
+++ b/stats/aidl/Android.bp
@@ -24,7 +24,7 @@ aidl_interface {
stability: "vintf",
backend: {
cpp: {
- enabled: false,
+ enabled: true,
},
java: {
enabled: true,
@@ -34,5 +34,17 @@ aidl_interface {
enabled: true,
},
},
- versions: ["1"],
+ versions_with_info: [
+ {
+ version: "1",
+ imports: [],
+ },
+ {
+ version: "2",
+ imports: [],
+ },
+
+ ],
+ host_supported: true,
+ frozen: true,
}
diff --git a/stats/aidl/TEST_MAPPING b/stats/aidl/TEST_MAPPING
new file mode 100644
index 0000000..2c6994f
--- /dev/null
+++ b/stats/aidl/TEST_MAPPING
@@ -0,0 +1,7 @@
+{
+ "presubmit": [
+ {
+ "name": "VtsVendorAtomHostJavaTest"
+ }
+ ]
+}
diff --git a/stats/aidl/aidl_api/android.frameworks.stats/2/.hash b/stats/aidl/aidl_api/android.frameworks.stats/2/.hash
new file mode 100644
index 0000000..55fa1ff
--- /dev/null
+++ b/stats/aidl/aidl_api/android.frameworks.stats/2/.hash
@@ -0,0 +1 @@
+7afdd459ab55ba70fdae6987d3296514822c03a4
diff --git a/stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/Annotation.aidl b/stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/Annotation.aidl
new file mode 100644
index 0000000..825db0d
--- /dev/null
+++ b/stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/Annotation.aidl
@@ -0,0 +1,39 @@
+//
+// Copyright (C) 2023 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.stats;
+@VintfStability
+parcelable Annotation {
+ android.frameworks.stats.AnnotationId annotationId = android.frameworks.stats.AnnotationId.UNKNOWN;
+ android.frameworks.stats.AnnotationValue value;
+}
diff --git a/stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/AnnotationId.aidl b/stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/AnnotationId.aidl
new file mode 100644
index 0000000..63e6efa
--- /dev/null
+++ b/stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/AnnotationId.aidl
@@ -0,0 +1,56 @@
+//
+// Copyright (C) 2023 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.stats;
+@Backing(type="int") @VintfStability
+enum AnnotationId {
+ UNKNOWN = 0,
+ IS_UID = 1,
+ TRUNCATE_TIMESTAMP = 2,
+ PRIMARY_FIELD = 3,
+ EXCLUSIVE_STATE = 4,
+ PRIMARY_FIELD_FIRST_UID = 5,
+ DEFAULT_STATE = 6,
+ TRIGGER_STATE_RESET = 7,
+ STATE_NESTED = 8,
+ RESTRICTION_CATEGORY = 9,
+ FIELD_RESTRICTION_PERIPHERAL_DEVICE_INFO = 10,
+ FIELD_RESTRICTION_APP_USAGE = 11,
+ FIELD_RESTRICTION_APP_ACTIVITY = 12,
+ FIELD_RESTRICTION_HEALTH_CONNECT = 13,
+ FIELD_RESTRICTION_ACCESSIBILITY = 14,
+ FIELD_RESTRICTION_SYSTEM_SEARCH = 15,
+ FIELD_RESTRICTION_USER_ENGAGEMENT = 16,
+ FIELD_RESTRICTION_AMBIENT_SENSING = 17,
+ FIELD_RESTRICTION_DEMOGRAPHIC_CLASSIFICATION = 18,
+}
diff --git a/stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/AnnotationSet.aidl b/stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/AnnotationSet.aidl
new file mode 100644
index 0000000..4d78469
--- /dev/null
+++ b/stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/AnnotationSet.aidl
@@ -0,0 +1,39 @@
+//
+// Copyright (C) 2023 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.stats;
+@VintfStability
+parcelable AnnotationSet {
+ int valueIndex;
+ android.frameworks.stats.Annotation[] annotations;
+}
diff --git a/stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/AnnotationValue.aidl b/stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/AnnotationValue.aidl
new file mode 100644
index 0000000..316ee19
--- /dev/null
+++ b/stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/AnnotationValue.aidl
@@ -0,0 +1,39 @@
+//
+// Copyright (C) 2023 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.stats;
+@VintfStability
+union AnnotationValue {
+ int intValue;
+ boolean boolValue;
+}
diff --git a/stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/IStats.aidl b/stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/IStats.aidl
new file mode 100644
index 0000000..5be1d2f
--- /dev/null
+++ b/stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/IStats.aidl
@@ -0,0 +1,38 @@
+//
+// Copyright (C) 2021 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.stats;
+@VintfStability
+interface IStats {
+ oneway void reportVendorAtom(in android.frameworks.stats.VendorAtom vendorAtom);
+}
diff --git a/stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/RestrictionCategory.aidl b/stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/RestrictionCategory.aidl
new file mode 100644
index 0000000..e94e59c
--- /dev/null
+++ b/stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/RestrictionCategory.aidl
@@ -0,0 +1,42 @@
+//
+// Copyright (C) 2023 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.stats;
+@Backing(type="int") @VintfStability
+enum RestrictionCategory {
+ UNKNOWN = 0,
+ DIAGNOSTIC = 1,
+ SYSTEM_INTELLIGENCE = 2,
+ AUTHENTICATION = 3,
+ FRAUD_AND_ABUSE = 4,
+}
diff --git a/stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/VendorAtom.aidl b/stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/VendorAtom.aidl
new file mode 100644
index 0000000..3174d5f
--- /dev/null
+++ b/stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/VendorAtom.aidl
@@ -0,0 +1,42 @@
+//
+// Copyright (C) 2021 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.stats;
+@VintfStability
+parcelable VendorAtom {
+ String reverseDomainName;
+ int atomId;
+ android.frameworks.stats.VendorAtomValue[] values;
+ @nullable android.frameworks.stats.AnnotationSet[] valuesAnnotations;
+ @nullable android.frameworks.stats.Annotation[] atomAnnotations;
+}
diff --git a/stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/VendorAtomValue.aidl b/stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/VendorAtomValue.aidl
new file mode 100644
index 0000000..0c9c39c
--- /dev/null
+++ b/stats/aidl/aidl_api/android.frameworks.stats/2/android/frameworks/stats/VendorAtomValue.aidl
@@ -0,0 +1,48 @@
+//
+// Copyright (C) 2021 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.stats;
+@VintfStability
+union VendorAtomValue {
+ int intValue;
+ long longValue;
+ float floatValue;
+ String stringValue;
+ boolean boolValue;
+ @nullable int[] repeatedIntValue;
+ @nullable long[] repeatedLongValue;
+ @nullable float[] repeatedFloatValue;
+ @nullable String[] repeatedStringValue;
+ @nullable boolean[] repeatedBoolValue;
+ @nullable byte[] byteArrayValue;
+}
diff --git a/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/Annotation.aidl b/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/Annotation.aidl
new file mode 100644
index 0000000..825db0d
--- /dev/null
+++ b/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/Annotation.aidl
@@ -0,0 +1,39 @@
+//
+// Copyright (C) 2023 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.stats;
+@VintfStability
+parcelable Annotation {
+ android.frameworks.stats.AnnotationId annotationId = android.frameworks.stats.AnnotationId.UNKNOWN;
+ android.frameworks.stats.AnnotationValue value;
+}
diff --git a/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/AnnotationId.aidl b/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/AnnotationId.aidl
new file mode 100644
index 0000000..63e6efa
--- /dev/null
+++ b/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/AnnotationId.aidl
@@ -0,0 +1,56 @@
+//
+// Copyright (C) 2023 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.stats;
+@Backing(type="int") @VintfStability
+enum AnnotationId {
+ UNKNOWN = 0,
+ IS_UID = 1,
+ TRUNCATE_TIMESTAMP = 2,
+ PRIMARY_FIELD = 3,
+ EXCLUSIVE_STATE = 4,
+ PRIMARY_FIELD_FIRST_UID = 5,
+ DEFAULT_STATE = 6,
+ TRIGGER_STATE_RESET = 7,
+ STATE_NESTED = 8,
+ RESTRICTION_CATEGORY = 9,
+ FIELD_RESTRICTION_PERIPHERAL_DEVICE_INFO = 10,
+ FIELD_RESTRICTION_APP_USAGE = 11,
+ FIELD_RESTRICTION_APP_ACTIVITY = 12,
+ FIELD_RESTRICTION_HEALTH_CONNECT = 13,
+ FIELD_RESTRICTION_ACCESSIBILITY = 14,
+ FIELD_RESTRICTION_SYSTEM_SEARCH = 15,
+ FIELD_RESTRICTION_USER_ENGAGEMENT = 16,
+ FIELD_RESTRICTION_AMBIENT_SENSING = 17,
+ FIELD_RESTRICTION_DEMOGRAPHIC_CLASSIFICATION = 18,
+}
diff --git a/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/AnnotationSet.aidl b/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/AnnotationSet.aidl
new file mode 100644
index 0000000..4d78469
--- /dev/null
+++ b/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/AnnotationSet.aidl
@@ -0,0 +1,39 @@
+//
+// Copyright (C) 2023 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.stats;
+@VintfStability
+parcelable AnnotationSet {
+ int valueIndex;
+ android.frameworks.stats.Annotation[] annotations;
+}
diff --git a/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/AnnotationValue.aidl b/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/AnnotationValue.aidl
new file mode 100644
index 0000000..316ee19
--- /dev/null
+++ b/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/AnnotationValue.aidl
@@ -0,0 +1,39 @@
+//
+// Copyright (C) 2023 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.stats;
+@VintfStability
+union AnnotationValue {
+ int intValue;
+ boolean boolValue;
+}
diff --git a/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/RestrictionCategory.aidl b/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/RestrictionCategory.aidl
new file mode 100644
index 0000000..e94e59c
--- /dev/null
+++ b/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/RestrictionCategory.aidl
@@ -0,0 +1,42 @@
+//
+// Copyright (C) 2023 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.stats;
+@Backing(type="int") @VintfStability
+enum RestrictionCategory {
+ UNKNOWN = 0,
+ DIAGNOSTIC = 1,
+ SYSTEM_INTELLIGENCE = 2,
+ AUTHENTICATION = 3,
+ FRAUD_AND_ABUSE = 4,
+}
diff --git a/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/VendorAtom.aidl b/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/VendorAtom.aidl
index c91e4e0..3174d5f 100644
--- a/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/VendorAtom.aidl
+++ b/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/VendorAtom.aidl
@@ -37,4 +37,6 @@ parcelable VendorAtom {
String reverseDomainName;
int atomId;
android.frameworks.stats.VendorAtomValue[] values;
+ @nullable android.frameworks.stats.AnnotationSet[] valuesAnnotations;
+ @nullable android.frameworks.stats.Annotation[] atomAnnotations;
}
diff --git a/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/VendorAtomValue.aidl b/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/VendorAtomValue.aidl
index 31f26f7..0c9c39c 100644
--- a/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/VendorAtomValue.aidl
+++ b/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/VendorAtomValue.aidl
@@ -38,4 +38,11 @@ union VendorAtomValue {
long longValue;
float floatValue;
String stringValue;
+ boolean boolValue;
+ @nullable int[] repeatedIntValue;
+ @nullable long[] repeatedLongValue;
+ @nullable float[] repeatedFloatValue;
+ @nullable String[] repeatedStringValue;
+ @nullable boolean[] repeatedBoolValue;
+ @nullable byte[] byteArrayValue;
}
diff --git a/stats/aidl/android/frameworks/stats/Annotation.aidl b/stats/aidl/android/frameworks/stats/Annotation.aidl
new file mode 100644
index 0000000..4c90ac9
--- /dev/null
+++ b/stats/aidl/android/frameworks/stats/Annotation.aidl
@@ -0,0 +1,28 @@
+//
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+package android.frameworks.stats;
+
+import android.frameworks.stats.AnnotationId;
+import android.frameworks.stats.AnnotationValue;
+
+/*
+ * Atom/Field annotation single entry
+ */
+@VintfStability
+parcelable Annotation {
+ AnnotationId annotationId = AnnotationId.UNKNOWN;
+ AnnotationValue value;
+}
diff --git a/stats/aidl/android/frameworks/stats/AnnotationId.aidl b/stats/aidl/android/frameworks/stats/AnnotationId.aidl
new file mode 100644
index 0000000..7f05512
--- /dev/null
+++ b/stats/aidl/android/frameworks/stats/AnnotationId.aidl
@@ -0,0 +1,127 @@
+//
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+package android.frameworks.stats;
+
+/*
+ * Mimics packages/modules/StatsD/lib/libstatssocket/include/stats_annotations.h
+ * These ids must stay consistent with those in stats_annotations.h
+ */
+@VintfStability
+@Backing(type="int")
+enum AnnotationId {
+ UNKNOWN = 0,
+ /**
+ * Annotation ID constant for logging UID field.
+ */
+ IS_UID = 1,
+
+ /**
+ * Annotation ID constant to indicate logged atom event's timestamp should be truncated.
+ */
+ TRUNCATE_TIMESTAMP = 2,
+
+ /**
+ * Annotation ID constant for a state atom's primary field.
+ */
+ PRIMARY_FIELD = 3,
+
+ /**
+ * Annotation ID constant for state atom's state field.
+ */
+ EXCLUSIVE_STATE = 4,
+
+ /**
+ * Annotation ID constant to indicate the first UID in the attribution chain
+ * is a primary field.
+ */
+ PRIMARY_FIELD_FIRST_UID = 5,
+
+ /**
+ * Annotation ID constant to indicate which state is default for the state atom.
+ */
+ DEFAULT_STATE = 6,
+
+ /**
+ * Annotation ID constant to signal that all states should be reset to the default state.
+ */
+ TRIGGER_STATE_RESET = 7,
+
+ /**
+ * Annotation ID constant to indicate state changes need to account for nesting.
+ * This should only be used with binary state atoms.
+ */
+ STATE_NESTED = 8,
+
+ /**
+ * Annotation ID constant to indicate the restriction category of an atom.
+ * This annotation must only be attached to the atom id. This is an int annotation.
+ */
+ RESTRICTION_CATEGORY = 9,
+
+ /**
+ * Annotation ID to indicate that a field of an atom contains peripheral device info.
+ * This is a bool annotation.
+ */
+ FIELD_RESTRICTION_PERIPHERAL_DEVICE_INFO = 10,
+
+ /**
+ * Annotation ID to indicate that a field of an atom contains app usage information.
+ * This is a bool annotation.
+ */
+ FIELD_RESTRICTION_APP_USAGE = 11,
+
+ /**
+ * Annotation ID to indicate that a field of an atom contains app activity information.
+ * This is a bool annotation.
+ */
+ FIELD_RESTRICTION_APP_ACTIVITY = 12,
+
+ /**
+ * Annotation ID to indicate that a field of an atom contains health connect information.
+ * This is a bool annotation.
+ */
+ FIELD_RESTRICTION_HEALTH_CONNECT = 13,
+
+ /**
+ * Annotation ID to indicate that a field of an atom contains accessibility information.
+ * This is a bool annotation.
+ */
+ FIELD_RESTRICTION_ACCESSIBILITY = 14,
+
+ /**
+ * Annotation ID to indicate that a field of an atom contains system search information.
+ * This is a bool annotation.
+ */
+ FIELD_RESTRICTION_SYSTEM_SEARCH = 15,
+
+ /**
+ * Annotation ID to indicate that a field of an atom contains user engagement information.
+ * This is a bool annotation.
+ */
+ FIELD_RESTRICTION_USER_ENGAGEMENT = 16,
+
+ /**
+ * Annotation ID to indicate that a field of an atom contains ambient sensing information.
+ * This is a bool annotation.
+ */
+ FIELD_RESTRICTION_AMBIENT_SENSING = 17,
+
+ /**
+ * Annotation ID to indicate that a field of an atom contains demographic classification
+ * information. This is a bool annotation.
+ */
+ FIELD_RESTRICTION_DEMOGRAPHIC_CLASSIFICATION = 18,
+}
diff --git a/stats/aidl/android/frameworks/stats/AnnotationSet.aidl b/stats/aidl/android/frameworks/stats/AnnotationSet.aidl
new file mode 100644
index 0000000..4d3fb9a
--- /dev/null
+++ b/stats/aidl/android/frameworks/stats/AnnotationSet.aidl
@@ -0,0 +1,34 @@
+//
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+package android.frameworks.stats;
+
+import android.frameworks.stats.Annotation;
+
+/*
+ * Single VendorAtomValue could have multiple annotations associated with it
+ */
+@VintfStability
+parcelable AnnotationSet {
+ /*
+ * Index to map VendorAtomValueAnnotation array with an individual VendorAtomValue
+ * from VendorAtom.values
+ */
+ int valueIndex;
+ /*
+ * Vector of annotations associated with VendorAtom.values[valueIndex]
+ */
+ Annotation[] annotations;
+}
diff --git a/stats/aidl/android/frameworks/stats/AnnotationValue.aidl b/stats/aidl/android/frameworks/stats/AnnotationValue.aidl
new file mode 100644
index 0000000..7beb196
--- /dev/null
+++ b/stats/aidl/android/frameworks/stats/AnnotationValue.aidl
@@ -0,0 +1,25 @@
+//
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+package android.frameworks.stats;
+
+/*
+ * Supported field types for this struct.
+ */
+@VintfStability
+union AnnotationValue {
+ int intValue;
+ boolean boolValue;
+}
diff --git a/stats/aidl/android/frameworks/stats/RestrictionCategory.aidl b/stats/aidl/android/frameworks/stats/RestrictionCategory.aidl
new file mode 100644
index 0000000..3411d68
--- /dev/null
+++ b/stats/aidl/android/frameworks/stats/RestrictionCategory.aidl
@@ -0,0 +1,46 @@
+//
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+package android.frameworks.stats;
+
+/*
+ * Mimics packages/modules/StatsD/lib/libstatssocket/include/stats_annotations.h
+ * These ids must stay consistent with those in stats_annotations.h
+ */
+@VintfStability
+@Backing(type="int")
+enum RestrictionCategory {
+ UNKNOWN = 0,
+
+ /**
+ * Restriction category for atoms about diagnostics.
+ */
+ DIAGNOSTIC = 1,
+
+ /**
+ * Restriction category for atoms about system intelligence.
+ */
+ SYSTEM_INTELLIGENCE = 2,
+
+ /**
+ * Restriction category for atoms about authentication.
+ */
+ AUTHENTICATION = 3,
+
+ /**
+ * Restriction category for atoms about fraud and abuse.
+ */
+ FRAUD_AND_ABUSE = 4,
+}
diff --git a/stats/aidl/android/frameworks/stats/VendorAtom.aidl b/stats/aidl/android/frameworks/stats/VendorAtom.aidl
index 9f34395..58038ad 100644
--- a/stats/aidl/android/frameworks/stats/VendorAtom.aidl
+++ b/stats/aidl/android/frameworks/stats/VendorAtom.aidl
@@ -15,6 +15,8 @@
//
package android.frameworks.stats;
+import android.frameworks.stats.Annotation;
+import android.frameworks.stats.AnnotationSet;
import android.frameworks.stats.VendorAtomValue;
/*
@@ -50,5 +52,42 @@ parcelable VendorAtom {
* Vector of fields in the order that the LogEvent should be filled.
*/
VendorAtomValue[] values;
-}
+ /*
+ * Vector of annotations associated with VendorAtom.values
+ *
+ * Having the atom with below definition
+ *
+ * message SimpleVendorAtom {
+ * optional string reverse_domain_name = 1;
+ * optional int field1 = 2 [annotation1 = 1, annotation2 = true];
+ * optional float field2 = 3;
+ * optional float field3 = 4 [annotation1 = 2, annotation2 = false];
+ * }
+ *
+ * The valuesAnnotations will contain 2 entries
+ * - valuesAnnotations[0] for field1
+ * - valuesAnnotations[1] for field3
+ *
+ * The VendorAtomAnnotationSet[i].valueIndex used for mapping each individual
+ * annotation set to specific atom value by VendorAtom.values array index:
+ *
+ * valuesAnnotations[0].valueIndex = 0 // index of field1 in VendorAtom.values[] array
+ * valuesAnnotations[0].annotations[0].type = annotation1
+ * valuesAnnotations[0].annotations[0].value = 1
+ * valuesAnnotations[0].annotations[1].type = annotation2
+ * valuesAnnotations[0].annotations[1].value = true
+ *
+ * valuesAnnotations[1].valueIndex = 2 // index of field1 in VendorAtom.values[] array
+ * valuesAnnotations[1].annotations[0].type = annotation1
+ * valuesAnnotations[1].annotations[0].value = 2
+ * valuesAnnotations[1].annotations[1].type = annotation2
+ * valuesAnnotations[1].annotations[1].value = false
+ */
+ @nullable AnnotationSet[] valuesAnnotations;
+
+ /*
+ * Vector of annotations associated with VendorAtom
+ */
+ @nullable Annotation[] atomAnnotations;
+}
diff --git a/stats/aidl/android/frameworks/stats/VendorAtomValue.aidl b/stats/aidl/android/frameworks/stats/VendorAtomValue.aidl
index 9ae0372..a5203af 100644
--- a/stats/aidl/android/frameworks/stats/VendorAtomValue.aidl
+++ b/stats/aidl/android/frameworks/stats/VendorAtomValue.aidl
@@ -24,4 +24,11 @@ union VendorAtomValue {
long longValue;
float floatValue;
String stringValue;
+ boolean boolValue;
+ @nullable int[] repeatedIntValue;
+ @nullable long[] repeatedLongValue;
+ @nullable float[] repeatedFloatValue;
+ @nullable String[] repeatedStringValue;
+ @nullable boolean[] repeatedBoolValue;
+ @nullable byte[] byteArrayValue;
}
diff --git a/stats/aidl/test_client/AidlStatsClient.cpp b/stats/aidl/test_client/AidlStatsClient.cpp
index f6782e6..3d4085b 100644
--- a/stats/aidl/test_client/AidlStatsClient.cpp
+++ b/stats/aidl/test_client/AidlStatsClient.cpp
@@ -14,17 +14,13 @@
* limitations under the License.
*/
#include <aidl/android/frameworks/stats/IStats.h>
-
#include <android/binder_manager.h>
-
+#include <getopt.h>
#include <statslog.h>
-#include <getopt.h>
#include <iostream>
-using aidl::android::frameworks::stats::IStats;
-using aidl::android::frameworks::stats::VendorAtom;
-using aidl::android::frameworks::stats::VendorAtomValue;
+using namespace aidl::android::frameworks::stats;
void expect_message(int32_t action) {
std::cout << "expect the following log in logcat:\n";
@@ -40,6 +36,90 @@ void show_help() {
std::cout << "\n\n you can use multiple arguments to trigger multiple events.\n";
}
+VendorAtom buildVendorAtom() {
+ std::vector<VendorAtomValue> values;
+ VendorAtomValue tmp;
+ tmp.set<VendorAtomValue::longValue>(70000);
+ values.push_back(tmp);
+ tmp.set<VendorAtomValue::intValue>(7);
+ values.push_back(tmp);
+ tmp.set<VendorAtomValue::floatValue>(8.5);
+ values.push_back(tmp);
+ tmp.set<VendorAtomValue::stringValue>("test");
+ values.push_back(tmp);
+ tmp.set<VendorAtomValue::intValue>(3);
+ values.push_back(tmp);
+ tmp.set<VendorAtomValue::boolValue>(true);
+ values.push_back(tmp);
+ tmp.set<VendorAtomValue::boolValue>(false);
+ values.push_back(tmp);
+ std::vector<int> emptyRepeatedIntValue = {};
+ tmp.set<VendorAtomValue::repeatedIntValue>(emptyRepeatedIntValue);
+ values.push_back(tmp);
+ std::vector<int> repeatedIntValue = {3, 1, 2};
+ tmp.set<VendorAtomValue::repeatedIntValue>(repeatedIntValue);
+ values.push_back(tmp);
+ std::vector<int64_t> repeatedLongValue = {500000, 430000, 1000001};
+ tmp.set<VendorAtomValue::repeatedLongValue>(repeatedLongValue);
+ values.push_back(tmp);
+ std::vector<float> repeatedFloatValue = {1.5, 2.3, 7.9};
+ tmp.set<VendorAtomValue::repeatedFloatValue>(repeatedFloatValue);
+ values.push_back(tmp);
+ std::vector<std::optional<std::string>> repeatedStringValue = {"str1", "str2", "str3"};
+ tmp.set<VendorAtomValue::repeatedStringValue>(repeatedStringValue);
+ values.push_back(tmp);
+ std::vector<bool> repeatedBoolValue = {true, false, true};
+ tmp.set<VendorAtomValue::repeatedBoolValue>(repeatedBoolValue);
+ values.push_back(tmp);
+ std::vector<uint8_t> byteArrayValue = {21, 50, 3};
+ tmp.set<VendorAtomValue::byteArrayValue>(byteArrayValue);
+ values.push_back(tmp);
+
+ VendorAtom atom = {
+ .atomId = 104999,
+ .values = values,
+ };
+
+ return atom;
+}
+
+VendorAtom buildVendorAtomWithAnnotations() {
+ // example of atom level annotation for VendorAtom from buildVendorAtom() API
+ Annotation atomAnnotation{AnnotationId::TRUNCATE_TIMESTAMP, true};
+ std::vector<std::optional<Annotation>> atomAnnotations;
+ atomAnnotations.push_back(std::make_optional<Annotation>(atomAnnotation));
+
+ // values annotation
+ std::vector<std::optional<AnnotationSet>> valuesAnnotations;
+ {
+ AnnotationSet valueAnnotationSet;
+ valueAnnotationSet.valueIndex = 0;
+ valueAnnotationSet.annotations.push_back(Annotation{AnnotationId::PRIMARY_FIELD, true});
+ valuesAnnotations.push_back(std::make_optional<AnnotationSet>(valueAnnotationSet));
+ }
+ {
+ AnnotationSet valueAnnotationSet;
+ valueAnnotationSet.valueIndex = 1;
+ valueAnnotationSet.annotations.push_back(Annotation{AnnotationId::IS_UID, true});
+ valuesAnnotations.push_back(std::make_optional<AnnotationSet>(valueAnnotationSet));
+ }
+ {
+ AnnotationSet valueAnnotationSet;
+ valueAnnotationSet.valueIndex = 4;
+ valueAnnotationSet.annotations.push_back(Annotation{AnnotationId::EXCLUSIVE_STATE, true});
+ valueAnnotationSet.annotations.push_back(Annotation{AnnotationId::STATE_NESTED, true});
+ valueAnnotationSet.annotations.push_back(Annotation{AnnotationId::TRIGGER_STATE_RESET, 0});
+ valuesAnnotations.push_back(std::make_optional<AnnotationSet>(valueAnnotationSet));
+ }
+
+ VendorAtom atom = buildVendorAtom();
+ atom.atomAnnotations =
+ std::make_optional<std::vector<std::optional<Annotation>>>(atomAnnotations);
+ atom.valuesAnnotations =
+ std::make_optional<std::vector<std::optional<AnnotationSet>>>(valuesAnnotations);
+ return atom;
+}
+
int main(int argc, char* argv[]) {
// get instance of the aidl version
const std::string instance = std::string() + IStats::descriptor + "/default";
@@ -67,23 +147,19 @@ int main(int argc, char* argv[]) {
break;
}
case 'v': {
- std::vector<VendorAtomValue> values;
- VendorAtomValue tmp;
- tmp.set<VendorAtomValue::longValue>(70000);
- values.push_back(tmp);
- tmp.set<VendorAtomValue::intValue>(7);
- values.push_back(tmp);
- tmp.set<VendorAtomValue::floatValue>(8.5);
- values.push_back(tmp);
- tmp.set<VendorAtomValue::stringValue>("test");
- values.push_back(tmp);
- tmp.set<VendorAtomValue::intValue>(3);
- values.push_back(tmp);
- VendorAtom atom = {
- .reverseDomainName = "", .atomId = 100001, .values = values};
- const ndk::ScopedAStatus ret = service->reportVendorAtom(atom);
+ // TODO: fill the vector and run through the vector
+ VendorAtom sampleAtom = buildVendorAtom();
+ ndk::ScopedAStatus ret = service->reportVendorAtom(sampleAtom);
+ if (!ret.isOk()) {
+ std::cerr << "reportVendorAtom failed: " << ret.getServiceSpecificError()
+ << ". Message: " << ret.getMessage() << std::endl;
+ ++failed_calls;
+ }
+ ++hal_calls;
+ VendorAtom sampleAtomWithAnnotations = buildVendorAtomWithAnnotations();
+ ret = service->reportVendorAtom(sampleAtomWithAnnotations);
if (!ret.isOk()) {
- std::cout << "reportVendorAtom failed: " << ret.getServiceSpecificError()
+ std::cerr << "reportVendorAtom failed: " << ret.getServiceSpecificError()
<< ". Message: " << ret.getMessage() << std::endl;
++failed_calls;
}
diff --git a/stats/aidl/test_client/Android.bp b/stats/aidl/test_client/Android.bp
index 8a8c895..5698619 100644
--- a/stats/aidl/test_client/Android.bp
+++ b/stats/aidl/test_client/Android.bp
@@ -31,7 +31,7 @@ cc_binary {
"AidlStatsClient.cpp",
],
shared_libs: [
- "android.frameworks.stats-V1-ndk",
+ "android.frameworks.stats-V2-ndk",
"libbase",
"libbinder_ndk",
"libutils",
diff --git a/stats/aidl/vts/OWNERS b/stats/aidl/vts/OWNERS
new file mode 100644
index 0000000..cb67d9e
--- /dev/null
+++ b/stats/aidl/vts/OWNERS
@@ -0,0 +1,7 @@
+# Bug component: 366902
+jeffreyhuang@google.com
+muhammadq@google.com
+sharaienko@google.com
+singhtejinder@google.com
+tsaichristine@google.com
+yaochen@google.com
diff --git a/stats/aidl/vts/functional/Android.bp b/stats/aidl/vts/functional/Android.bp
index 3a63bb0..f530f00 100644
--- a/stats/aidl/vts/functional/Android.bp
+++ b/stats/aidl/vts/functional/Android.bp
@@ -32,7 +32,7 @@ cc_test {
"libvndksupport",
],
static_libs: [
- "android.frameworks.stats-V1-ndk",
+ "android.frameworks.stats-V2-ndk",
],
test_suites: [
"general-tests",
diff --git a/stats/aidl/vts/functional/VtsHalStatsTargetTest.cpp b/stats/aidl/vts/functional/VtsHalStatsTargetTest.cpp
index 576fa04..45e7edc 100644
--- a/stats/aidl/vts/functional/VtsHalStatsTargetTest.cpp
+++ b/stats/aidl/vts/functional/VtsHalStatsTargetTest.cpp
@@ -54,7 +54,33 @@ TEST_P(StatsAidlTest, reportVendorAtom) {
values.push_back(tmp);
tmp.set<VendorAtomValue::intValue>(3);
values.push_back(tmp);
- VendorAtom atom = {.reverseDomainName = "", .atomId = 100001, .values = values};
+ tmp.set<VendorAtomValue::boolValue>(true);
+ values.push_back(tmp);
+ tmp.set<VendorAtomValue::boolValue>(false);
+ values.push_back(tmp);
+ std::vector<int> emptyRepeatedIntValue = {};
+ tmp.set<VendorAtomValue::repeatedIntValue>(emptyRepeatedIntValue);
+ values.push_back(tmp);
+ std::vector<int> repeatedIntValue = {3, 1, 2};
+ tmp.set<VendorAtomValue::repeatedIntValue>(repeatedIntValue);
+ values.push_back(tmp);
+ std::vector<int64_t> repeatedLongValue = {500000, 430000, 1000001};
+ tmp.set<VendorAtomValue::repeatedLongValue>(repeatedLongValue);
+ values.push_back(tmp);
+ std::vector<float> repeatedFloatValue = {1.5, 2.3, 7.9};
+ tmp.set<VendorAtomValue::repeatedFloatValue>(repeatedFloatValue);
+ values.push_back(tmp);
+ std::vector<std::optional<std::string>> repeatedStringValue = {"str1", "str2", "str3"};
+ tmp.set<VendorAtomValue::repeatedStringValue>(repeatedStringValue);
+ values.push_back(tmp);
+ std::vector<bool> repeatedBoolValue = {true, false, true};
+ tmp.set<VendorAtomValue::repeatedBoolValue>(repeatedBoolValue);
+ values.push_back(tmp);
+ std::vector<uint8_t> byteArrayValue = {21, 50, 3, 10};
+ tmp.set<VendorAtomValue::byteArrayValue>(byteArrayValue);
+ values.push_back(tmp);
+
+ VendorAtom atom = {.reverseDomainName = "", .atomId = 104999, .values = values};
const ndk::ScopedAStatus ret = client->reportVendorAtom(atom);
ASSERT_TRUE(ret.isOk());
diff --git a/stats/aidl/vts/java/Android.bp b/stats/aidl/vts/java/Android.bp
new file mode 100644
index 0000000..ada0d9d
--- /dev/null
+++ b/stats/aidl/vts/java/Android.bp
@@ -0,0 +1,55 @@
+//
+// Copyright (C) 2022 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+java_test_host {
+ name: "VtsVendorAtomHostJavaTest",
+ srcs: [
+ "src/**/*.java",
+ "test_vendor_atom.proto",
+ ":libstats_atom_options_protos",
+ ],
+ test_suites: [
+ "vts",
+ "general-tests",
+ ],
+ libs: [
+ "compatibility-host-util",
+ "cts-tradefed",
+ "host-libprotobuf-java-full",
+ "platformprotos",
+ "tradefed",
+ "truth-prebuilt",
+ ],
+ static_libs: [
+ "cts-statsd-atom-host-test-utils",
+ "//hardware/google/pixel:pixelatoms-java_host",
+ ],
+ data: [
+ ":VtsVendorAtomJavaTest",
+ "//hardware/google/pixel:pixelatoms-java_host",
+ ],
+ proto: {
+ type: "full",
+ include_dirs: [
+ "external/protobuf/src",
+ "frameworks/proto_logging/stats",
+ ],
+ },
+}
diff --git a/stats/aidl/vts/java/AndroidManifest.xml b/stats/aidl/vts/java/AndroidManifest.xml
new file mode 100644
index 0000000..ba2a7bd
--- /dev/null
+++ b/stats/aidl/vts/java/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2022 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.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.test.stats">
+
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:targetPackage="android.test.stats"
+ android:label="Java tests for stats aidl">
+ </instrumentation>
+</manifest> \ No newline at end of file
diff --git a/stats/aidl/vts/java/AndroidTest.xml b/stats/aidl/vts/java/AndroidTest.xml
new file mode 100644
index 0000000..3bcba77
--- /dev/null
+++ b/stats/aidl/vts/java/AndroidTest.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2023 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.
+-->
+<configuration description="Config for VTS IStats host test cases">
+ <option name="test-suite-tag" value="vts" />
+ <option name="config-descriptor:metadata" key="component" value="statsd" />
+ <option name="config-descriptor:metadata" key="token" value="SIM_CARD" />
+ <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="parameter" value="all_foldable_states" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="VtsVendorAtomJavaTest.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="VtsVendorAtomHostJavaTest.jar" />
+ </test>
+</configuration>
diff --git a/stats/aidl/vts/java/apps/vtsistatsapp/Android.bp b/stats/aidl/vts/java/apps/vtsistatsapp/Android.bp
new file mode 100644
index 0000000..b028eba
--- /dev/null
+++ b/stats/aidl/vts/java/apps/vtsistatsapp/Android.bp
@@ -0,0 +1,36 @@
+//
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+android_test {
+ name: "VtsVendorAtomJavaTest",
+ platform_apis: true,
+ srcs: [
+ "src/**/*.java",
+ ],
+ privileged: true,
+ static_libs: [
+ "junit",
+ "android.frameworks.stats-V2-java",
+ "compatibility-device-util-axt",
+ ],
+ libs: [
+ "android.test.runner",
+ ],
+}
diff --git a/stats/aidl/vts/java/apps/vtsistatsapp/AndroidManifest.xml b/stats/aidl/vts/java/apps/vtsistatsapp/AndroidManifest.xml
new file mode 100644
index 0000000..223fcde
--- /dev/null
+++ b/stats/aidl/vts/java/apps/vtsistatsapp/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2022 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.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.vts.istats.vendoratom">
+
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:targetPackage="com.android.vts.istats.vendoratom"
+ android:label="Java VTS tests for IStats aidl">
+ </instrumentation>
+</manifest>
diff --git a/stats/aidl/vts/java/apps/vtsistatsapp/src/VtsVendorAtomJavaTest.java b/stats/aidl/vts/java/apps/vtsistatsapp/src/VtsVendorAtomJavaTest.java
new file mode 100644
index 0000000..a65992c
--- /dev/null
+++ b/stats/aidl/vts/java/apps/vtsistatsapp/src/VtsVendorAtomJavaTest.java
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.vts.istats.vendoratom;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import android.frameworks.stats.IStats;
+import android.frameworks.stats.VendorAtom;
+import android.frameworks.stats.VendorAtomValue;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.util.Log;
+import java.util.NoSuchElementException;
+import java.util.Optional;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public class VtsVendorAtomJavaTest {
+ private static final String TAG = "VtsTest";
+ Optional<IStats> statsService;
+
+ private static final int TestVendorAtomId = 109999;
+
+ @Before
+ public void setUp() {
+ try {
+ final String[] instances = ServiceManager.getDeclaredInstances(IStats.DESCRIPTOR);
+ assertEquals(1, instances.length);
+ assertEquals(instances[0], "default");
+
+ final String instanceName = IStats.DESCRIPTOR + "/default";
+ if (!ServiceManager.isDeclared(instanceName)) {
+ Log.e(TAG, "IStats is not registered");
+ statsService = Optional.empty();
+ } else {
+ statsService = Optional.ofNullable(
+ IStats.Stub.asInterface(ServiceManager.waitForDeclaredService(instanceName)));
+ }
+ assertTrue(statsService.isPresent());
+ } catch (SecurityException e) {
+ Log.e(TAG, "Failed to connect to IStats service", e);
+ } catch (NullPointerException e) {
+ Log.e(TAG, "Failed to connect to IStats service", e);
+ }
+ Log.i(TAG, "Setup done");
+ }
+
+ @Test
+ public void testIStatsPresent() {
+ assertTrue(statsService.isPresent());
+ }
+
+ /*
+ * Test IStats::reportVendorAtom with int field
+ */
+ @Test
+ public void testReportVendorAtomInt() {
+ VendorAtom atom = new VendorAtom();
+ atom.atomId = TestVendorAtomId;
+ atom.reverseDomainName = "com.test.domain";
+ atom.values = new VendorAtomValue[1];
+ atom.values[0] = VendorAtomValue.intValue(7);
+
+ try {
+ statsService.get().reportVendorAtom(atom);
+ } catch (NoSuchElementException e) {
+ Log.e(TAG, "Failed to get IStats service", e);
+ fail();
+ } catch (RemoteException e) {
+ Log.e(TAG, "Failed to log atom to IStats service", e);
+ fail();
+ }
+ }
+
+ /*
+ * Test IStats::reportVendorAtom with wrong atom code - this event will be dropped.
+ */
+ @Test
+ public void testReportVendorAtomWrongId() {
+ VendorAtom atom = new VendorAtom();
+ atom.atomId = 1000;
+ atom.reverseDomainName = "com.test.domain";
+ atom.values = new VendorAtomValue[1];
+ atom.values[0] = VendorAtomValue.intValue(7);
+ try {
+ statsService.get().reportVendorAtom(atom);
+ } catch (NoSuchElementException e) {
+ Log.e(TAG, "Failed to get IStats service", e);
+ fail();
+ } catch (RemoteException e) {
+ Log.e(TAG, "Failed to log atom to IStats service", e);
+ fail();
+ }
+ }
+
+ /*
+ * Test IStats::reportVendorAtom with repeated fields.
+ */
+ @Test
+ public void testReportVendorAtomRepeated() {
+ VendorAtom atom = new VendorAtom();
+ atom.atomId = TestVendorAtomId;
+ atom.reverseDomainName = "com.test.domain";
+ atom.values = new VendorAtomValue[10];
+ atom.values[0] = VendorAtomValue.intValue(7);
+ atom.values[1] = VendorAtomValue.longValue(70000L);
+ atom.values[2] = VendorAtomValue.floatValue(8.5f);
+ atom.values[3] = VendorAtomValue.stringValue("testString");
+ atom.values[4] = VendorAtomValue.boolValue(true);
+ atom.values[5] = VendorAtomValue.repeatedIntValue(new int[] {11, 12, 13});
+ atom.values[6] = VendorAtomValue.repeatedLongValue(new long[] {11000L, 12000L, 13000L});
+ atom.values[7] = VendorAtomValue.repeatedFloatValue(new float[] {0.1f, 0.2f, 0.3f});
+ atom.values[8] = VendorAtomValue.repeatedStringValue(new String[] {"abc", "def", "xyz"});
+ atom.values[9] =
+ VendorAtomValue.repeatedBoolValue(new boolean[] {true, false, false, true});
+
+ try {
+ statsService.get().reportVendorAtom(atom);
+ } catch (NoSuchElementException e) {
+ Log.e(TAG, "Failed to get IStats service", e);
+ fail();
+ } catch (RemoteException e) {
+ Log.e(TAG, "Failed to log atom to IStats service", e);
+ fail();
+ }
+ }
+}
diff --git a/stats/aidl/vts/java/src/com/android/vts/istats/VendorAtomTests.java b/stats/aidl/vts/java/src/com/android/vts/istats/VendorAtomTests.java
new file mode 100644
index 0000000..d7e4622
--- /dev/null
+++ b/stats/aidl/vts/java/src/com/android/vts/istats/VendorAtomTests.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.vts.istats;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.cts.statsdatom.lib.AtomTestUtils;
+import android.cts.statsdatom.lib.ConfigUtils;
+import android.cts.statsdatom.lib.DeviceUtils;
+import android.cts.statsdatom.lib.ReportUtils;
+import android.hardware.istats.TestVendorAtom;
+import com.android.compatibility.common.util.NonApiTest;
+import com.android.os.StatsLog.EventMetricData;
+import com.android.tradefed.build.IBuildInfo;
+import com.android.tradefed.device.DeviceNotAvailableException;
+import com.android.tradefed.device.ITestDevice;
+import com.android.tradefed.log.LogUtil.CLog;
+import com.android.tradefed.result.TestRunResult;
+import com.android.tradefed.testtype.DeviceTestCase;
+import com.android.tradefed.testtype.IBuildReceiver;
+import com.google.protobuf.CodedInputStream;
+import com.google.protobuf.CodedOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.Arrays;
+import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+/* VTS test to verify IStats reportVendorAtom APIs. */
+@NonApiTest(exemptionReasons = {}, justification = "METRIC")
+public class VendorAtomTests extends DeviceTestCase implements IBuildReceiver {
+ private static final String ISTATS_TEST_PKG = "com.android.vts.istats.vendoratom";
+
+ private IBuildInfo mVtsBuild;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ assertThat(mVtsBuild).isNotNull();
+ ConfigUtils.removeConfig(getDevice());
+ ReportUtils.clearReports(getDevice());
+ Thread.sleep(AtomTestUtils.WAIT_TIME_LONG);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ ConfigUtils.removeConfig(getDevice());
+ ReportUtils.clearReports(getDevice());
+ super.tearDown();
+ }
+
+ @Override
+ public void setBuild(IBuildInfo buildInfo) {
+ mVtsBuild = buildInfo;
+ }
+
+ public void testReportVendorAtomWrongId() throws Exception {
+ assertThat(isIStatsPresentOnDevice()).isTrue();
+ ConfigUtils.uploadConfigForPushedAtom(getDevice(), ISTATS_TEST_PKG, 1000);
+ List<EventMetricData> data = runVendorAtomDeviceTests("testReportVendorAtomWrongId");
+ assertThat(data).hasSize(0);
+ }
+
+ public void testReportVendorAtomInt() throws Exception {
+ assertThat(isIStatsPresentOnDevice()).isTrue();
+ ConfigUtils.uploadConfigForPushedAtom(getDevice(), ISTATS_TEST_PKG,
+ TestVendorAtom.Atom.TEST_VENDOR_ATOM_REPORTED_FIELD_NUMBER);
+
+ List<EventMetricData> data = runVendorAtomDeviceTests("testReportVendorAtomInt");
+ final TestVendorAtom.TestVendorAtomReported vendorAtom = getVendorAtom(data);
+ assertThat(vendorAtom.getReverseDomainName()).isEqualTo("com.test.domain");
+ assertThat(vendorAtom.getIntValue()).isEqualTo(7);
+ }
+
+ public void testReportVendorAtomRepeated() throws Exception {
+ assertThat(isIStatsPresentOnDevice()).isTrue();
+ ConfigUtils.uploadConfigForPushedAtom(getDevice(), ISTATS_TEST_PKG,
+ TestVendorAtom.Atom.TEST_VENDOR_ATOM_REPORTED_FIELD_NUMBER);
+
+ List<EventMetricData> data = runVendorAtomDeviceTests("testReportVendorAtomRepeated");
+ final TestVendorAtom.TestVendorAtomReported vendorAtom = getVendorAtom(data);
+ assertThat(vendorAtom.getReverseDomainName()).isEqualTo("com.test.domain");
+ assertThat(vendorAtom.getIntValue()).isEqualTo(7);
+ assertThat(vendorAtom.getLongValue()).isEqualTo(70000L);
+ assertThat(vendorAtom.getFloatValue()).isEqualTo(8.5f);
+ assertThat(vendorAtom.getStringValue()).isEqualTo("testString");
+ assertThat(vendorAtom.getBoolValue()).isEqualTo(true);
+
+ assertThat(vendorAtom.getRepeatedIntValueList()).isEqualTo(Arrays.asList(11, 12, 13));
+ assertThat(vendorAtom.getRepeatedLongValueList())
+ .isEqualTo(Arrays.asList(11000L, 12000L, 13000L));
+ assertThat(vendorAtom.getRepeatedFloatValueList())
+ .isEqualTo(Arrays.asList(0.1f, 0.2f, 0.3f));
+ assertThat(vendorAtom.getRepeatedStringValueList())
+ .isEqualTo(Arrays.asList("abc", "def", "xyz"));
+ assertThat(vendorAtom.getRepeatedBoolValueList())
+ .isEqualTo(Arrays.asList(true, false, false, true));
+ }
+
+ private boolean isIStatsPresentOnDevice() throws Exception {
+ return checkDeviceFor("testIStatsPresent");
+ }
+
+ private boolean checkDeviceFor(String methodName) throws Exception {
+ try {
+ runDeviceTestsOnVendorAtom(getDevice(), methodName);
+ // Test passes, meaning that the answer is true.
+ CLog.d(methodName + "() indicates true.");
+ return true;
+ } catch (AssertionError e) {
+ // Method is designed to fail if the answer is false.
+ CLog.d(methodName + "() indicates false.");
+ return false;
+ }
+ }
+
+ private TestVendorAtom.TestVendorAtomReported getVendorAtom(@Nonnull List<EventMetricData> data)
+ throws Exception {
+ assertThat(data).hasSize(1);
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ CodedOutputStream codedos = CodedOutputStream.newInstance(outputStream);
+ data.get(0).getAtom().writeTo(codedos);
+ codedos.flush();
+
+ ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
+ CodedInputStream codedis = CodedInputStream.newInstance(inputStream);
+ final TestVendorAtom.Atom atom = TestVendorAtom.Atom.parseFrom(codedis);
+ assertThat(atom.hasTestVendorAtomReported()).isTrue();
+
+ return atom.getTestVendorAtomReported();
+ }
+
+ private List<EventMetricData> runVendorAtomDeviceTests(String testMethodName) throws Exception {
+ runDeviceTestsOnVendorAtom(getDevice(), testMethodName);
+ Thread.sleep(AtomTestUtils.WAIT_TIME_LONG);
+ // Sorted list of events in order in which they occurred.
+ return ReportUtils.getEventMetricDataList(getDevice());
+ }
+
+ /** Runs device side tests from the com.android.vts.istats.vendoratom package. */
+ private static @Nonnull TestRunResult runDeviceTestsOnVendorAtom(
+ ITestDevice device, @Nullable String testMethodName) throws DeviceNotAvailableException {
+ return DeviceUtils.runDeviceTests(
+ device, ISTATS_TEST_PKG, ".VtsVendorAtomJavaTest", testMethodName);
+ }
+}
diff --git a/stats/aidl/vts/java/test_vendor_atom.proto b/stats/aidl/vts/java/test_vendor_atom.proto
new file mode 100644
index 0000000..c7145a3
--- /dev/null
+++ b/stats/aidl/vts/java/test_vendor_atom.proto
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2023 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.
+ */
+
+syntax = "proto2";
+
+package android.hardware.istats;
+
+option java_package = "android.hardware.istats";
+option java_outer_classname = "TestVendorAtom";
+
+import "frameworks/proto_logging/stats/atom_field_options.proto";
+
+/* Allocated atom IDs. */
+message Atom {
+ oneof pushed {
+ TestVendorAtomReported test_vendor_atom_reported = 109999
+ [(android.os.statsd.module) = "istatsvts"];
+ }
+}
+
+message TestVendorAtomNestedMessage {
+ optional int32 int_value = 1;
+ optional int64 long_value = 2;
+ optional float float_value = 3;
+}
+
+/**
+ * Logs the test vendor atom for IStats VTS
+ */
+message TestVendorAtomReported {
+ optional string reverse_domain_name = 1;
+ optional int32 int_value = 2;
+ optional int64 long_value = 3;
+ optional float float_value = 4;
+ optional string string_value = 5;
+ optional bool bool_value = 6;
+ repeated int32 repeated_int_value = 7;
+ repeated int64 repeated_long_value = 8;
+ repeated float repeated_float_value = 9;
+ repeated string repeated_string_value = 10;
+ repeated bool repeated_bool_value = 11;
+ optional TestVendorAtomNestedMessage byte_array_value = 12
+ [(android.os.statsd.log_mode) = MODE_BYTES];
+}