Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 75d66023 authored by Shuzhen Wang's avatar Shuzhen Wang
Browse files

Camera: Allow addSurface due to mismatched dataSpace for PRIVATE format

For surface with PRIVATE format, camera device may override the dataSpace.
So do not enforce matching dataSpaces for such surfaces within the same
OutputConfiguration.

Test: Camera CTS
Bug: 33777818
Change-Id: I1374511946c04ab158fa16ed6d596d747d31f385
parent ef8297e2
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -373,13 +373,17 @@ public final class OutputConfiguration implements Parcelable {
                    ", the pre-configured size will be used.");
        }

        if (mConfiguredDataspace != SurfaceUtils.getSurfaceDataspace(surface)) {
            throw new IllegalArgumentException("The dataspace of added surface doesn't match");
        }
        if (mConfiguredFormat != SurfaceUtils.getSurfaceFormat(surface)) {
            throw new IllegalArgumentException("The format of added surface format doesn't match");
        }

        // If the surface format is PRIVATE, do not enforce dataSpace because camera device may
        // override it.
        if (mConfiguredFormat != ImageFormat.PRIVATE &&
                mConfiguredDataspace != SurfaceUtils.getSurfaceDataspace(surface)) {
            throw new IllegalArgumentException("The dataspace of added surface doesn't match");
        }

        mSurfaces.add(surface);
    }