Allow clipboard on virtual devices when the default device is locked.

Clipboard access is currently blocked on virtual devices if the default
device is locked, even if the virtual device is "always unlocked".

Virtual devices are considered insecure by default and there's already
an attempt to return false from isDeviceLocked/isDeviceSecure based on
whether the display belongs to a virtual device.

However, when the KeyguardManager is created from the system context,
its displayId association is always the default display, so this is
broken. Adding new overloads in KeyguardManager that explicitly take
the deviceId fixes the problem with the clipboard. Also changing the
existing displayId argument to deviceId to avoid an unnecessary call
into VDM to determine the device. When this was added, deviceId wasn't
available from Context.

Fix: 306620764
Bug: 300402201
Test: see CTS in topic
Change-Id: I7aedd47c13d3acd8d2954f99fa5ea671a1b888e7
5 files changed