Skip to content

Commit 522e93a

Browse files
programminghoch10bgcngm
authored andcommitted
SPenActions: Include useful gesture debugging code
Change-Id: Ib7e24fc5ca669924987a6519a93bc0361065cd55
1 parent 698f268 commit 522e93a

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

packages/SPenActions/src/org/lineageos/spenactions/SPenGattCallback.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2021-2025 The LineageOS Project
2+
* SPDX-FileCopyrightText: 2021-2026 The LineageOS Project
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

@@ -24,12 +24,14 @@
2424
import org.lineageos.spenactions.settings.SettingsUtils;
2525

2626
import java.util.ArrayList;
27+
import java.util.Arrays;
2728
import java.util.List;
2829
import java.util.UUID;
2930

3031
public class SPenGattCallback extends BluetoothGattCallback {
3132

3233
private static final String LOG_TAG = "SPenActions/SPenGattCallback";
34+
private static final boolean DEBUG = false;
3335

3436
private static final int MOTION_THRESHOLD = 500;
3537

@@ -139,6 +141,9 @@ private void setCharacteristicNotification(BluetoothGatt gatt,
139141
private void handleButtonEvent(byte[] data) {
140142
int type = data[0] & 0xFF;
141143

144+
if (DEBUG) Log.d(LOG_TAG, "BUTTON_EVENT raw: len=" + data.length +
145+
" data=" + Arrays.toString(data));
146+
142147
ButtonAction button = ButtonAction.fromType(type);
143148
if (button != null) {
144149
switch (button.getAction()) {
@@ -174,6 +179,8 @@ private void handleGesture(MotionEvent move) {
174179
short dx = move.getDX();
175180
short dy = move.getDY();
176181

182+
if (DEBUG) Log.d(LOG_TAG, "Motion sample dx=" + dx + " dy=" + dy);
183+
177184
if (Math.abs(dx) <= MOTION_THRESHOLD && Math.abs(dy) <= MOTION_THRESHOLD) {
178185
return;
179186
}

0 commit comments

Comments
 (0)