Expose timestamp source & thumbnail sizes characteristic
... for virtual camera.
Also fix .setAvailableCharacteristicKeys so it takes effect once
the .build() is called so it's not order dependent.
Bug: 301023410
Bug: 322965201
Test: atest android.hardware.cts.CameraGLTest
Test: atest android.hardware.camera2.cts.ImageReaderTest
Test: presubmit
Change-Id: I1fac9c4561c910f128fa67b7ce11d8e4c6c31b09
diff --git a/services/camera/virtualcamera/util/Util.h b/services/camera/virtualcamera/util/Util.h
index e0a31c0..9f81bb1 100644
--- a/services/camera/virtualcamera/util/Util.h
+++ b/services/camera/virtualcamera/util/Util.h
@@ -52,6 +52,27 @@
int width, int height,
::aidl::android::companion::virtualcamera::Format format, int maxFps);
+// Representation of resolution / size.
+struct Resolution {
+ Resolution(const int w, const int h) : width(w), height(h) {
+ }
+
+ // Order by increasing pixel count, and by width for same pixel count.
+ bool operator<(const Resolution& other) const {
+ const int pixCount = width * height;
+ const int otherPixCount = other.width * other.height;
+ return pixCount == otherPixCount ? width < other.width
+ : pixCount < otherPixCount;
+ }
+
+ bool operator==(const Resolution& other) const {
+ return width == other.width && height == other.height;
+ }
+
+ const int width;
+ const int height;
+};
+
} // namespace virtualcamera
} // namespace companion
} // namespace android