Skip to content

Instantly share code, notes, and snippets.

@Kethen
Created June 13, 2021 08:43
Show Gist options
  • Save Kethen/eeeecfb1887f7efddc02849fb046e638 to your computer and use it in GitHub Desktop.
Save Kethen/eeeecfb1887f7efddc02849fb046e638 to your computer and use it in GitHub Desktop.
remove country restriction on call recording, only use this when it's legal to call record
# patch Dialer to remove call record country restriction
(
cd packages/apps/Dialer
git checkout .
)
OLD_IFS=$IFS
IFS=$'\n'
echo patching call recorder to ignore country restrictions, please refer to your country\'s law and use at your own risk
echo > /tmp/CallRecorder.java
cat packages/apps/Dialer/java/com/android/incallui/call/CallRecorder.java | while read -r LINE
do
if [ -z "$write_disabled" ]
then
echo "$LINE" >> /tmp/CallRecorder.java
fi
if [ -n "$(echo $LINE | grep 'public boolean canRecordInCurrentCountry() {')" ]
then
echo "return true;" >> /tmp/CallRecorder.java
write_disabled=true
fi
if [ -n "$(echo $LINE | grep 'private CallRecorder() {')" ]
then
echo '}' >> /tmp/CallRecorder.java
echo "$LINE" >> /tmp/CallRecorder.java
write_disabled=""
fi
done
IFS=$OLD_IFS
cp /tmp/CallRecorder.java packages/apps/Dialer/java/com/android/incallui/call/CallRecorder.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment