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

Commit f44bdcbc authored by Dorin Drimus's avatar Dorin Drimus Committed by Android (Google) Code Review
Browse files

Merge "Fix NPE from ClipboardService using VDM" into main

parents 5d813ce8 9b30785f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -468,6 +468,12 @@ public class ClipboardService extends SystemService {
            return clipboardDeviceId;
        }

        // The app is running on the default device, even if it requests access to some virtual
        // device clipboard, fallback to the default clipboard.
        if (virtualDeviceIds.isEmpty()) {
            return DEVICE_ID_DEFAULT;
        }

        // Fallback to the device where the app is running, unless it uses the default clipboard.
        int fallbackDeviceId = virtualDeviceIds.valueAt(0);
        return deviceUsesDefaultClipboard(fallbackDeviceId) ? DEVICE_ID_DEFAULT : fallbackDeviceId;