From 4d384f886ef4bb4e08beee44e0ae60650aa2acd3 Mon Sep 17 00:00:00 2001 From: LuK1337 Date: Wed, 4 Oct 2023 10:52:46 +0200 Subject: [PATCH] Recorder: Use Math.abs() instead of manually inverting sign Change-Id: I07b421d40939ad2fea93724933375d12b5ac3d6a --- .../org/lineageos/recorder/service/HighQualityRecorder.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/src/main/java/org/lineageos/recorder/service/HighQualityRecorder.java b/app/src/main/java/org/lineageos/recorder/service/HighQualityRecorder.java index fd4e15c9..14a6aa4a 100644 --- a/app/src/main/java/org/lineageos/recorder/service/HighQualityRecorder.java +++ b/app/src/main/java/org/lineageos/recorder/service/HighQualityRecorder.java @@ -155,10 +155,7 @@ private void recordingThreadImpl() { if (status != 0) { if (mTrackAmplitude.get()) { for (int i = 0; i < status; i = i + 2) { - int value = data[i] & 0xff | data[i + 1] << 8; - if (value < 0) { - value = -value; - } + int value = Math.abs(data[i] & 0xff | data[i + 1] << 8); if (mMaxAmplitude < value) { mMaxAmplitude = value; }