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

Commit 47c4d452 authored by Vladimir Komsiyski's avatar Vladimir Komsiyski
Browse files

Disallow hardware buffer direct channels on virtual devices

During the channel creation we don't know the actual sensor.
But we do know that virtual sensors do not support hardware
buffer direct channels at all

Bug: 420822939
Flag: EXEMPT bugfix
Test: presubmit
Change-Id: I186c75ccaa11aac7de14187b7406a33b2a334266
parent ca3ad4f3
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -776,6 +776,10 @@ public class SystemSensorManager extends SensorManager {
            }
            type = SensorDirectChannel.TYPE_MEMORY_FILE;
        } else if (hardwareBuffer != null) {
            if (deviceId != DEVICE_ID_DEFAULT) {
                throw new UnsupportedOperationException(
                        "HardwareBuffer direct channel is only supported for default device");
            }
            if (hardwareBuffer.getFormat() != HardwareBuffer.BLOB) {
                throw new IllegalArgumentException("Format of HardwareBuffer must be BLOB");
            }