Always check device policy for device aware permission check
and AppOp mode checking

Before, when the deviceId in the Context is explicitly set, we don't
account for virtual device's camera/audio policy when doing permission
check. So if the virtual device doesn't have custom policy, the
permission check will not fall back to the default device.

With this fix, we always fall back to the default device if virtual
device uses the default policy, no matter if the device Id is explicitly
set in the Context or not.

Bug: 396422648
Test: atest android.permission.cts.DevicePermissionsTest
Flag: EXEMPT bug fix
Change-Id: I5bc731c275429bd6ed8d7117d2226bd41f4b7c34
3 files changed