mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-29 20:27:12 +01:00
- Added exception handler for the new SecurityException in USBDevice getSerialNumber
This commit is contained in:
parent
ae9ff11bae
commit
eea450bc99
@ -53,8 +53,14 @@ class HIDDeviceUSB implements HIDDevice {
|
|||||||
public String getSerialNumber() {
|
public String getSerialNumber() {
|
||||||
String result = null;
|
String result = null;
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
|
try {
|
||||||
result = mDevice.getSerialNumber();
|
result = mDevice.getSerialNumber();
|
||||||
}
|
}
|
||||||
|
catch (SecurityException exception) {
|
||||||
|
Log.w(TAG, "App permissions mean we cannot get serial number for device " + getDeviceName() + " message: " + exception.getMessage());
|
||||||
|
result = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
result = "";
|
result = "";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user