Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop legacy and unsupported Android 9, small reformating #160

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ BCR is a simple Android call recording app for rooted devices or devices running

### Features

* Supports Android 9 through 13
* Supports Android 10 through 13
* Supports output in various formats:
* OGG/Opus - Lossy, smallest files, default on Android 10+
* M4A/AAC - Lossy, smaller files, default on Android 9
* OGG/Opus - Lossy, smallest files, default
* M4A/AAC - Lossy, smaller files
* FLAC - Lossless, larger files
* WAV/PCM - Lossless, largest files, least CPU usage
* Supports Android's Storage Access Framework (can record to SD cards, USB devices, etc.)
Expand Down
2 changes: 1 addition & 1 deletion app/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/build
/build
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ android {

defaultConfig {
applicationId = "com.chiller3.bcr"
minSdk = 28
minSdk = 29
targetSdk = 33
versionCode = gitVersionCode
versionName = gitVersionName
Expand Down
2 changes: 1 addition & 1 deletion app/magisk/updates/release/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"changelog": "https://github.com/chenxiaolong/BCR/raw/v1.37/app/magisk/updates/release/changelog.txt",
"version": "1.37",
"versionCode": 75008
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ class ExampleInstrumentedTest {
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.chiller3.bcr", appContext.packageName)
}
}
}
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@
</intent-filter>
</activity>
</application>
</manifest>
</manifest>
9 changes: 1 addition & 8 deletions app/src/main/java/com/chiller3/bcr/AudioFormatExtension.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
package com.chiller3.bcr

import android.media.AudioFormat
import android.os.Build

val AudioFormat.frameSizeInBytesCompat: Int
get() = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
frameSizeInBytes
} else{
// Hardcoded for Android 9 compatibility only
assert(encoding == AudioFormat.ENCODING_PCM_16BIT)
2 * channelCount
}
get() = frameSizeInBytes
2 changes: 1 addition & 1 deletion app/src/main/java/com/chiller3/bcr/ChipGroupCentered.kt
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,4 @@ class ChipGroupCentered(context: Context, attrs: AttributeSet?, defStyleAttr: In
}
}
}
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/chiller3/bcr/FilenameTemplate.kt
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,4 @@ class FilenameTemplate private constructor(props: Properties) {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ class LongClickablePreference(context: Context, attrs: AttributeSet?) : Preferen
interface OnPreferenceLongClickListener {
fun onPreferenceLongClick(preference: Preference): Boolean
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ class NotificationActionService : Service() {

START_NOT_STICKY
}
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/chiller3/bcr/Notifications.kt
Original file line number Diff line number Diff line change
Expand Up @@ -340,4 +340,4 @@ class Notifications(
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ class OpenPersistentDocumentTree : ActivityResultContracts.OpenDocumentTree() {

return intent
}
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/chiller3/bcr/OutputDirUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ class OutputDirUtils(private val context: Context, private val redactor: Redacto

fun redact(uri: Uri): String
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ class OutputDirectoryBottomSheetFragment : BottomSheetDialogFragment(), Slider.O
companion object {
val TAG: String = OutputDirectoryBottomSheetFragment::class.java.simpleName
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,4 @@ class OutputFormatBottomSheetFragment : BottomSheetDialogFragment(),
companion object {
val TAG: String = OutputFormatBottomSheetFragment::class.java.simpleName
}
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/chiller3/bcr/Permissions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ object Permissions {
intent.data = Uri.fromParts("package", context.packageName, null)
return intent
}
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/chiller3/bcr/Preferences.kt
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,4 @@ class Preferences(private val context: Context) {
var sampleRate: SampleRate?
get() = getOptionalUint(PREF_SAMPLE_RATE)?.let { SampleRate(it) }
set(sampleRate) = setOptionalUint(PREF_SAMPLE_RATE, sampleRate?.value)
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/chiller3/bcr/RecorderApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ class RecorderApplication : Application() {
companion object {
private val TAG = RecorderApplication::class.java.simpleName
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -316,4 +316,4 @@ class RecorderInCallService : InCallService(), RecorderThread.OnRecordingComplet
notifyFailure(errorMsg, file)
}
}
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/chiller3/bcr/RecorderProvider.kt
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ class RecorderProvider : ContentProvider() {
selection: String?,
selectionArgs: Array<String>?,
): Int = 0
}
}
12 changes: 5 additions & 7 deletions app/src/main/java/com/chiller3/bcr/RecorderThread.kt
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,10 @@ class RecorderThread(
return@evaluate formatter.format(callTimestamp)
}
it == "direction" -> {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
when (details.callDirection) {
Call.Details.DIRECTION_INCOMING -> return@evaluate "in"
Call.Details.DIRECTION_OUTGOING -> return@evaluate "out"
Call.Details.DIRECTION_UNKNOWN -> {}
}
when (details.callDirection) {
Call.Details.DIRECTION_INCOMING -> return@evaluate "in"
Call.Details.DIRECTION_OUTGOING -> return@evaluate "out"
Call.Details.DIRECTION_UNKNOWN -> {}
}
}
it == "sim_slot" -> {
Expand Down Expand Up @@ -660,4 +658,4 @@ class RecorderThread(
*/
fun onRecordingFailed(thread: RecorderThread, errorMsg: String?, file: OutputFile?)
}
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/chiller3/bcr/RecorderTileService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ class RecorderTileService : TileService(), SharedPreferences.OnSharedPreferenceC

tile.updateTile()
}
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/chiller3/bcr/SettingsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,4 @@ class SettingsActivity : AppCompatActivity() {
}
}
}
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/chiller3/bcr/UriExtensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ val Uri.formattedString: String
}
}
else -> toString()
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/chiller3/bcr/format/AacFormat.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ object AacFormat : Format() {

override fun getContainer(fd: FileDescriptor): Container =
MediaMuxerContainer(fd, MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4)
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/chiller3/bcr/format/Encoder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ abstract class Encoder(
* @param isEof No more data can be submitted after this method is called once with EOF == true.
*/
abstract fun encode(buffer: ByteBuffer, isEof: Boolean)
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/chiller3/bcr/format/FlacContainer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,4 @@ class FlacContainer(private val fd: FileDescriptor) : Container {
private val TAG = FlacContainer::class.java.simpleName
private val FLAC_MAGIC = ubyteArrayOf(0x66u, 0x4cu, 0x61u, 0x43u) // fLaC
}
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/chiller3/bcr/format/FlacFormat.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ object FlacFormat : Format() {

override fun getContainer(fd: FileDescriptor): Container =
FlacContainer(fd)
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/chiller3/bcr/format/Format.kt
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,4 @@ sealed class Format {
return Pair(format, param)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ object NoParamInfo : FormatParamInfo(0u) {
override fun toNearest(param: UInt): UInt = param

override fun format(param: UInt): String = ""
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@ class MediaCodecEncoder(
return codec
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ class MediaMuxerContainer(
override fun writeSamples(trackIndex: Int, byteBuffer: ByteBuffer,
bufferInfo: MediaCodec.BufferInfo) =
muxer.writeSampleData(trackIndex, byteBuffer, bufferInfo)
}
}
5 changes: 2 additions & 3 deletions app/src/main/java/com/chiller3/bcr/format/OpusFormat.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ object OpusFormat : Format() {
override val mimeTypeContainer: String = "audio/ogg"
override val mimeTypeAudio: String = MediaFormat.MIMETYPE_AUDIO_OPUS
override val passthrough: Boolean = false
override val supported: Boolean = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q
override val supported: Boolean = true

override fun updateMediaFormat(mediaFormat: MediaFormat, param: UInt) {
mediaFormat.apply {
Expand All @@ -29,7 +29,6 @@ object OpusFormat : Format() {
}
}

@RequiresApi(Build.VERSION_CODES.Q)
override fun getContainer(fd: FileDescriptor): Container =
MediaMuxerContainer(fd, MediaMuxer.OutputFormat.MUXER_OUTPUT_OGG)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ class PassthroughEncoder(

numFrames += frames
}
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/chiller3/bcr/format/SampleRate.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ value class SampleRate(val value: UInt) {
return default
}
}
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/chiller3/bcr/format/WaveContainer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,4 @@ class WaveContainer(private val fd: FileDescriptor) : Container {
private val FMT_MAGIC = ubyteArrayOf(0x66u, 0x6du, 0x74u, 0x20u) // "fmt "
private val DATA_MAGIC = ubyteArrayOf(0x64u, 0x61u, 0x74u, 0x61u) // data
}
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/chiller3/bcr/format/WaveFormat.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ object WaveFormat : Format() {

override fun getContainer(fd: FileDescriptor): Container =
WaveContainer(fd)
}
}
2 changes: 1 addition & 1 deletion app/src/main/res/layout/bottom_sheet_chip.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
<com.google.android.material.chip.Chip xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/Widget.Material3.Chip.Filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content" />
2 changes: 1 addition & 1 deletion app/src/main/res/layout/output_directory_bottom_sheet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@
android:text="@string/bottom_sheet_reset"
style="?attr/materialButtonOutlinedStyle" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.core.widget.NestedScrollView>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/output_format_bottom_sheet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@
android:text="@string/bottom_sheet_reset"
style="?attr/materialButtonOutlinedStyle" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.core.widget.NestedScrollView>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/settings_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
android:id="@+id/settings"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</LinearLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/mipmap-anydpi/ic_launcher.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
</adaptive-icon>
2 changes: 1 addition & 1 deletion app/src/main/res/mipmap-anydpi/ic_launcher_round.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
</adaptive-icon>
2 changes: 1 addition & 1 deletion app/src/main/res/values-iw/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@

<!-- Quick settings tile -->
<string name="quick_settings_label">הקלטת שיחה</string>
</resources>
</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
<dimen name="bottom_sheet_overall_padding">28dp</dimen>
<dimen name="bottom_sheet_title_margin_bottom">16dp</dimen>
<dimen name="bottom_sheet_section_separation">28dp</dimen>
</resources>
</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
<item name="android:windowLightStatusBar">?attr/isLightTheme</item>
<item name="windowActionModeOverlay">true</item>
</style>
</resources>
</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/xml/root_preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@
app:title="@string/pref_version_name"
app:iconSpaceReserved="false" />
</PreferenceCategory>
</PreferenceScreen>
</PreferenceScreen>
2 changes: 1 addition & 1 deletion app/src/test/java/com/chiller3/bcr/ExampleUnitTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ class ExampleUnitTest {
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.nonTransitiveRClass=true