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

RecorderThread: Add caller display name to the filename for incoming calls #13

Merged
merged 1 commit into from
May 22, 2022
Merged
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
RecorderThread: Add caller display name to the filename for incoming …
…calls

This is based on CNAP only and does not perform lookups against the
user's contacts. Note that only the initial CNAP value at the time the
call becomes active is used. CNAP changes are ignored.

Issue: #3
Signed-off-by: Andrew Gunnerson <chillermillerlong@hotmail.com>
  • Loading branch information
chenxiaolong committed May 22, 2022
commit 39f0055fa24409ba2bfed2aa76d684a49a3461a9
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