Skip to content

Commit 82ea13d

Browse files
romtsnclaude
andcommitted
ref(feedback): Restore handler.post(clear) in stop()
Both fd callbacks and posted Messages are serialized by the Looper, so there is no concurrent access risk. Explicit clear is cleaner than relying on timestamp purge alone. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d21215e commit 82ea13d

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

sentry-android-core/src/main/java/io/sentry/android/core/SentryShakeDetector.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,14 @@ public void stop() {
9494
if (sensorManager != null) {
9595
sensorManager.unregisterListener(this);
9696
}
97-
// No need to clear the queue here — stale samples are purged by timestamp
98-
// in add(), so they age out within 0.5s when detection resumes.
97+
final @Nullable Handler h = handler;
98+
if (h != null) {
99+
h.post(
100+
() -> {
101+
//noinspection Convert2MethodRef
102+
queue.clear();
103+
});
104+
}
99105
}
100106

101107
/** Stops detection and releases the background thread. */

0 commit comments

Comments
 (0)