srctree

Robin Linden parent 03a0592a 5a45b30d
Suppress specific lint checks instead of demoting them all to warnings

inlinesplit
domain/build.gradle.kts added: 8, removed: 5, total 3
@@ -35,9 +35,6 @@ android {
}
lint {
disable += "InvalidPackage" // tox4j is still not really allowed on Android. :/
// The macOS domain:lint task fails due to not guarding AudioRecord with permission checks in this module.
// This doesn't fail locally, and use of the audio code is guarded in the UI in the aTox module.
abortOnError = false
}
packagingOptions {
// Work around scala-compiler and scala-library (via tox4j) trying to place files in the
 
domain/src/main/kotlin/av/AudioCapture.kt added: 8, removed: 5, total 3
@@ -4,6 +4,7 @@
 
package ltd.evilcorp.domain.av
 
import android.annotation.SuppressLint
import android.media.AudioFormat
import android.media.AudioRecord
import android.media.MediaRecorder
@@ -16,6 +17,11 @@ private fun intToChannel(channels: Int) = when (channels) {
else -> AudioFormat.CHANNEL_IN_STEREO
}
 
// The permission linting doesn't work very well unless you sprinkle
// ContextCompat.checkSelfPermission in way too many places. It doesn't even
// agree with results from ActivityResultContracts.RequestPermission, requiring
// an extra permission check in there as well.
@SuppressLint("MissingPermission")
private fun findAudioRecord(sampleRate: Int, channels: Int): AudioRecord? {
val audioFormat = AudioFormat.ENCODING_PCM_16BIT
val channelConfig = intToChannel(channels)