Skip to content

Commit

Permalink
Merge pull request #13 from chenxiaolong/caller-id
Browse files Browse the repository at this point in the history
RecorderThread: Add caller display name to the filename for incoming calls
  • Loading branch information
chenxiaolong committed May 22, 2022
2 parents e862b4c + 39f0055 commit 911a26f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/src/main/java/com/chiller3/bcr/RecorderThread.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class RecorderThread(
} else {
null
}
private val displayName: String? = call.details.callerDisplayName

init {
Log.i(TAG, "[${id}] Created thread for call: $call")
Expand All @@ -72,6 +73,15 @@ class RecorderThread(
append('_')
append(handleUri.schemeSpecificPart)
}

// AOSP's SAF automatically replaces invalid characters with underscores, but just in
// case an OEM fork breaks that, do the replacement ourselves to prevent directory
// traversal attacks.
val name = displayName?.replace('/', '_')?.trim()
if (!name.isNullOrBlank()) {
append('_')
append(name)
}
}

override fun run() {
Expand Down

0 comments on commit 911a26f

Please sign in to comment.