Respect deviceId in SensorManager cache.
Do not use the cached SensorManager if the device association of the underlying package has changed. Since the SensorManager is cached per package, if the deviceId changes, then the native SensorManager will always return the wrong sensors. This is seen in the failing CTS. The most straight-forward solution is to refresh the cache when the device for that UID has changed. It would be better to have an API that takes a deviceId but that's a longer term fix - b/306575095 This change is effectively flagged by the read-only flag android.companion.virtual.flags.enable_native_vdm. When it is disabled, the deviceId will always be 0 (i.e. default device). Test: atest VirtualSensorNativeTest Bug: 306575095 Fix: 317495754 Change-Id: If02beb9f3eceec19c104ae03fcb0a8fefb46f85f
Loading
Please register or sign in to comment