Skip to content

Commit

Permalink
RecorderThread: Add caller display name to the filename for incoming …
Browse files Browse the repository at this point in the history
…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
1 parent e862b4c commit 2503115
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 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,14 @@ class RecorderThread(
append('_')
append(handleUri.schemeSpecificPart)
}

if (!displayName.isNullOrBlank()) {
// 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.
append('_')
append(displayName.replace('/', '_'))
}
}

override fun run() {
Expand Down

0 comments on commit 2503115

Please sign in to comment.