Do not create UHID thread if not used
The HandlerThread is used only via the looper queue.
This commit is contained in:
parent
dd47cefa47
commit
523f939532
@ -33,13 +33,13 @@ public final class UhidManager {
|
|||||||
private final ByteBuffer buffer = ByteBuffer.allocate(SIZE_OF_UHID_EVENT).order(ByteOrder.nativeOrder());
|
private final ByteBuffer buffer = ByteBuffer.allocate(SIZE_OF_UHID_EVENT).order(ByteOrder.nativeOrder());
|
||||||
|
|
||||||
private final DeviceMessageSender sender;
|
private final DeviceMessageSender sender;
|
||||||
private final HandlerThread thread = new HandlerThread("UHidManager");
|
|
||||||
private final MessageQueue queue;
|
private final MessageQueue queue;
|
||||||
|
|
||||||
public UhidManager(DeviceMessageSender sender) {
|
public UhidManager(DeviceMessageSender sender) {
|
||||||
this.sender = sender;
|
this.sender = sender;
|
||||||
thread.start();
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
HandlerThread thread = new HandlerThread("UHidManager");
|
||||||
|
thread.start();
|
||||||
queue = thread.getLooper().getQueue();
|
queue = thread.getLooper().getQueue();
|
||||||
} else {
|
} else {
|
||||||
queue = null;
|
queue = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user