Camera: Heic: Allow grids settings override in onFormatChanged
Test: Vendor test
Bug: 261412297
Change-Id: Ide7ff404b337bfeeb56d407291b275717cab783a
diff --git a/services/camera/libcameraservice/api2/HeicCompositeStream.cpp b/services/camera/libcameraservice/api2/HeicCompositeStream.cpp
index 2cc8e33..0feded2 100644
--- a/services/camera/libcameraservice/api2/HeicCompositeStream.cpp
+++ b/services/camera/libcameraservice/api2/HeicCompositeStream.cpp
@@ -437,15 +437,27 @@
newFormat->setString(KEY_MIME, mimeHeic);
newFormat->setInt32(KEY_WIDTH, mOutputWidth);
newFormat->setInt32(KEY_HEIGHT, mOutputHeight);
- if (mUseGrid) {
+ }
+
+ if (mUseGrid || mUseHeic) {
+ int32_t gridRows, gridCols, tileWidth, tileHeight;
+ if (newFormat->findInt32(KEY_GRID_ROWS, &gridRows) &&
+ newFormat->findInt32(KEY_GRID_COLUMNS, &gridCols) &&
+ newFormat->findInt32(KEY_TILE_WIDTH, &tileWidth) &&
+ newFormat->findInt32(KEY_TILE_HEIGHT, &tileHeight)) {
+ mGridWidth = tileWidth;
+ mGridHeight = tileHeight;
+ mGridRows = gridRows;
+ mGridCols = gridCols;
+ } else {
newFormat->setInt32(KEY_TILE_WIDTH, mGridWidth);
newFormat->setInt32(KEY_TILE_HEIGHT, mGridHeight);
newFormat->setInt32(KEY_GRID_ROWS, mGridRows);
newFormat->setInt32(KEY_GRID_COLUMNS, mGridCols);
- int32_t left, top, right, bottom;
- if (newFormat->findRect("crop", &left, &top, &right, &bottom)) {
- newFormat->setRect("crop", 0, 0, mOutputWidth - 1, mOutputHeight - 1);
- }
+ }
+ int32_t left, top, right, bottom;
+ if (newFormat->findRect("crop", &left, &top, &right, &bottom)) {
+ newFormat->setRect("crop", 0, 0, mOutputWidth - 1, mOutputHeight - 1);
}
}
newFormat->setInt32(KEY_IS_DEFAULT, 1 /*isPrimary*/);