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

Commit 7357549b authored by Biswarup Pal's avatar Biswarup Pal
Browse files

Handle invalid deviceId in device-aware system services

When virtual camera, sensors, etc are being accessed from a
foreground service using an explicit device context (by calling
Context#createDeviceContext with a virtual device id), there are
situations where the camera, sensors, etc APIs fallback to the
ones corresponding to the default device if the virtual device
gets destroyed. As a result, a FGS expecting virtual camera, sensors,
etc might end up using default device camera, sensors, etc
unintentionally when the virtual device goes away. We introduce
DEVICE_POLICY_INVALID in VDM and make VDM#getDevicePolicy return
DEVICE_POLICY_INVALID for invalid deviceIds, so that system services
calling this method can detect this use case and handle the same in
a manner they see fit.

Test: atest CtsVirtualDevicesSensorTestCases
Test: atest CtsVirtualDevicesCameraTestCases
Test: atest CtsVirtualDevicesTestCases
Bug: 394613051
Flag: android.companion.virtualdevice.flags.handle_invalid_device_id
Change-Id: I7cac7e1dcb3396d8daabd72052b7f30e15261514
parent ba983ba6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment