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

Commit e94b3fe9 authored by Yin-Chia Yeh's avatar Yin-Chia Yeh
Browse files

Revert "Camera2: create new streams if surface size has changed"

This change is redundant after the following change is merged:

Camera2: Handle surface size change

When comparing if two OutputConfigurations are equal, also check
the width, height, format, dataspace when the output configurations
were created. With this, CameraDeviceImpl knows that the surface has
changed sizes and will reconfigure the stream.

Bug: 12250682
Change-Id: I4216260a0a08ad87b835ed97e9eaddf1df317fcc
This reverts commit f49f8b0b.
parent f49f8b0b
Loading
Loading
Loading
Loading
+1 −13
Original line number Diff line number Diff line
@@ -95,8 +95,6 @@ public class CameraDeviceImpl extends CameraDevice {
            new SimpleEntry<>(REQUEST_ID_NONE, null);
    private final SparseArray<OutputConfiguration> mConfiguredOutputs =
            new SparseArray<>();
    private final SparseArray<Size> mConfiguredOutputSizes =
            new SparseArray<>();

    private final String mCameraId;
    private final CameraCharacteristics mCharacteristics;
@@ -389,17 +387,10 @@ public class CameraDeviceImpl extends CameraDevice {

                if (!outputs.contains(outConfig)) {
                    deleteList.add(streamId);
                } else {
                    // Even if same surface and rotation, the surface can have re-sized.
                    // If so, we must create a new stream to ensure HAL is configured correctly.
                    Size outSize = SurfaceUtils.getSurfaceSize(outConfig.getSurface());
                    if (!outSize.equals(mConfiguredOutputSizes.valueAt(i))) {
                        deleteList.add(streamId);
                } else {
                    addSet.remove(outConfig);  // Don't create a stream previously created
                }
            }
            }

            mDeviceHandler.post(mCallOnBusy);
            stopRepeating();
@@ -430,16 +421,13 @@ public class CameraDeviceImpl extends CameraDevice {
                for (Integer streamId : deleteList) {
                    mRemoteDevice.deleteStream(streamId);
                    mConfiguredOutputs.delete(streamId);
                    mConfiguredOutputSizes.delete(streamId);
                }

                // Add all new streams
                for (OutputConfiguration outConfig : outputs) {
                    if (addSet.contains(outConfig)) {
                        int streamId = mRemoteDevice.createStream(outConfig);
                        Size outSize = SurfaceUtils.getSurfaceSize(outConfig.getSurface());
                        mConfiguredOutputs.put(streamId, outConfig);
                        mConfiguredOutputSizes.put(streamId, outSize);
                    }
                }