CVE-2026-28643 AI-generated analysis
platform/frameworks/base, VirtualDeviceManager service (services/companion, com.android.server.companion.virtual.VirtualDeviceImpl)
Adds caller-ownership checks to four VirtualDeviceImpl methods (setListeners, close, getVirtualCameraId, playSoundEffect) so that only the virtual device owner can invoke them. In the final Android 16 form the system UID is also allowed, and apps running on the device may play sound effects. This stops a non-owner from closing or reconfiguring another process's virtual device.
Root cause
In services/companion/java/com/android/server/companion/virtual/VirtualDeviceImpl.java, three Binder-call methods (setListeners(), close() and getVirtualCameraId()) and the package-private playSoundEffect() did not check that the calling UID is the device owner (mOwnerUid). Any process holding the IVirtualDevice binder could call close() to tear down a virtual device it did not create (the bulletin classifies the CVE as a High DoS). It could also replace the activity and sound-effect listeners with its own, or query the virtual camera id. The class already had a checkCallerIsDeviceOwner() helper, but these methods did not call it. playSoundEffect() also dereferenced mSoundEffectListener without a null check.
How the fix works
- Commit 1 (5e717959bef1, android-security-16.0.0_r8): in VirtualDeviceImpl.java, setListeners, close, getVirtualCameraId and playSoundEffect each gain a leading checkCallerIsDeviceOwner() call, which throws SecurityException when Binder.getCallingUid() != mOwnerUid. playSoundEffect also gains an early return when mSoundEffectListener == null.
- Commit 2 (1afa874f867f, android-security-16.0.0_r10): full revert of commit 1. The reason given is b/525681148, which the material does not describe.
- Commit 3 (fdd64be39021, android-security-16.0.0_r10, Revert^2): re-applies the checks on setListeners, close and getVirtualCameraId. checkCallerIsDeviceOwner() now delegates to a new checkUidIsDeviceOwner(int uid). The predicate becomes uid != mOwnerUid && uid != Process.SYSTEM_UID, so the system UID is also allowed. playSoundEffect now reads Binder.getCallingUid() and calls checkUidIsDeviceOwner() only when !isAppRunningOnVirtualDevice(callingUid). The owner, the system UID and apps running on the virtual device can therefore play sound effects. The mSoundEffectListener null guard is kept. The commit adds import android.os.Process.
- Android 17 (5cf100905634, android-security-17.0.0_r1): the same four checkCallerIsDeviceOwner() insertions as commit 1 (the null guard in playSoundEffect already existed there). It also changes VirtualDeviceShellCommand.java so the shell 'close' path calls virtualDevice.close() inside Binder.withCleanCallingIdentity().
Completeness
- The fix covers exactly four methods: setListeners, close, getVirtualCameraId and playSoundEffect. The material does not show the other Binder methods of VirtualDeviceImpl, so whether they already call checkCallerIsDeviceOwner() cannot be judged from the diff.
- The check in close() runs before mService.removeVirtualDevice(mDeviceId), so a rejected caller cannot remove the device from the service.
- The final Android 16 form is less strict than commit 1. Process.SYSTEM_UID is accepted for all four methods, and any UID for which isAppRunningOnVirtualDevice() is true may call playSoundEffect. The diff calls isAppRunningOnVirtualDevice but does not add it, so the method must already exist in the class.
- The Android 16 commits do not touch VirtualDeviceShellCommand.java; the Android 17 commit does (withCleanCallingIdentity around close()). The material does not show how the shell close path behaves on Android 16.
Behavior changes
- In the Android 16 final form, setListeners(), close() and getVirtualCameraId() throw SecurityException("Caller is not the owner of this virtual device") when the caller's UID is neither mOwnerUid nor Process.SYSTEM_UID. In the Android 17 commit shown, only mOwnerUid is accepted.
- On Android 16, playSoundEffect() throws SecurityException when the caller is not the owner, not the system UID and not an app running on the virtual device. When no sound-effect listener is set, it now returns without doing anything instead of dereferencing a null listener.
- Android 17 only: 'close' via VirtualDeviceShellCommand runs with a cleared calling identity.
- Android 16: the strict owner-only checks landed in android-security-16.0.0_r8. Both the revert and the Revert^2 landed in android-security-16.0.0_r10, so r10 has the final form.
Per major
- Android 14: Not affected per the bulletin. At android-security-14.0.0_r31 only 4/8 lines of the patched region are present, and no fix is recorded.
- Android 15: Not affected per the bulletin. At android-security-15.0.0_r19 only 4/8 lines of the patched region are present, and no fix is recorded.
- Android 16: Three-commit sequence: the original checks (5e717959bef1, r8), a full revert (1afa874f867f, r10), then a Revert^2 with a refined policy (fdd64be39021, r10). The refined policy also allows SYSTEM_UID, and apps running on the device for sound effects. All 8/8 lines of the patched region are present at android-security-16.0.0_r10.
- Android 17: Adapted fix: 5cf100905634 in android-security-17.0.0_r1 applies the original strict owner-only checks (no SYSTEM_UID allowance shown). It also wraps the shell 'close' command in Binder.withCleanCallingIdentity in VirtualDeviceShellCommand.java. All 8/8 lines of the patched region are present at android-security-17.0.0_r3.
Unknowns
- What b/525681148, the reason for the revert and the refined policy, is about.
- Whether the refined Revert^2 form (SYSTEM_UID allowance, isAppRunningOnVirtualDevice gating) also landed on Android 17 after android-security-17.0.0_r1. Only the strict form is shown for 17.
- Whether the shell 'close' command still works on Android 16 after fdd64be39021, given that VirtualDeviceShellCommand is unchanged there.
- Which service entry point calls playSoundEffect(), and how a non-owner obtains an IVirtualDevice binder.
- Whether other Binder methods of VirtualDeviceImpl already enforce checkCallerIsDeviceOwner().