GrapheneOS / os-issue-tracker

Issue tracker for GrapheneOS Android Open Source Project hardening work. Standalone projects like Auditor, AttestationServer and hardened_malloc have their own dedicated trackers.
https://grapheneos.org/
336 stars 18 forks source link

Feature Request: Automatic call recording #2083

Open ASerbinski opened 1 year ago

ASerbinski commented 1 year ago

The new call recording code is EXCELLENT, and solves 99% of the problem. The 1% missing is having the recording initiate automatically rather than having to press the button to start recording.

When call recording is used for maintaining evidence of a conversation, sometimes you don't know that its necessary to record the call until the background information is already lost. The best way to address this problem is to always record all calls.

I'd like to see a setting for call recording to always record all calls. A "nice to have" but not critical second part would be to automatically delete recordings by age, say after 2 weeks or a month.

The below is a patch I was using some time ago for automatic call recording in conjunction with the lineageos call recording patch, prior to it being cleaned up for GrapheneOS;

From 945c17eabfdf9f108b26eda3d54266c0a2255234 Mon Sep 17 00:00:00 2001
From: Adam <adam@AdamWork.lan>
Date: Mon, 8 Nov 2021 14:17:51 -0500
Subject: [PATCH] Automatic call recording

Change-Id: Icdb26fa6729e6a13dc6190a42dc75453900a6345
---
 .../dialer/app/res/values/cm_strings.xml      |  2 ++
 .../dialer/app/res/xml/sound_settings.xml     |  5 ++++
 .../dialer/callrecord/res/values/config.xml   |  4 +--
 .../android/incallui/CallButtonPresenter.java | 30 +++++++++++++++++--
 4 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/java/com/android/dialer/app/res/values/cm_strings.xml b/java/com/android/dialer/app/res/values/cm_strings.xml
index 1dcdb2b81..3f7602d44 100644
--- a/java/com/android/dialer/app/res/values/cm_strings.xml
+++ b/java/com/android/dialer/app/res/values/cm_strings.xml
@@ -38,6 +38,8 @@
     <string name="call_recording_format">Audio format</string>
     <string name="wb_amr_format" translatable="false">AMR-WB</string>
     <string name="aac_format" translatable="false">AAC</string>
+    <string name="auto_call_recording_title">Auto call recording</string>
+    <string name="auto_call_recording_key" translatable="false">auto_call_recording</string>

     <string name="call_via">Call via</string>
     <string name="call_via_dialog_title">Call via\u2026</string>
diff --git a/java/com/android/dialer/app/res/xml/sound_settings.xml b/java/com/android/dialer/app/res/xml/sound_settings.xml
index aa025874f..d31ea9e5c 100644
--- a/java/com/android/dialer/app/res/xml/sound_settings.xml
+++ b/java/com/android/dialer/app/res/xml/sound_settings.xml
@@ -83,6 +83,11 @@
       android:entryValues="@array/call_recording_encoder_values"
       android:defaultValue="0" />

+    <SwitchPreference
+      android:defaultValue="false"
+      android:key="@string/auto_call_recording_key"
+      android:title="@string/auto_call_recording_title"/>
+
   </PreferenceCategory>

 </PreferenceScreen>
diff --git a/java/com/android/dialer/callrecord/res/values/config.xml b/java/com/android/dialer/callrecord/res/values/config.xml
index 7aabd6cac..2832c87bc 100644
--- a/java/com/android/dialer/callrecord/res/values/config.xml
+++ b/java/com/android/dialer/callrecord/res/values/config.xml
@@ -16,8 +16,8 @@
 -->

 <resources>
-    <bool name="call_recording_enabled">false</bool>
+    <bool name="call_recording_enabled">true</bool>
     <!-- 1 (MIC) for microphone audio source (default)
          4 (VOICE_CALL) if supported by device for voice call uplink + downlink audio source -->
-    <integer name="call_recording_audio_source">1</integer>
+    <integer name="call_recording_audio_source">4</integer>
 </resources>
diff --git a/java/com/android/incallui/CallButtonPresenter.java b/java/com/android/incallui/CallButtonPresenter.java
index 0fa833edd..175fe7cc2 100644
--- a/java/com/android/incallui/CallButtonPresenter.java
+++ b/java/com/android/incallui/CallButtonPresenter.java
@@ -21,6 +21,7 @@ import android.content.Context;
 import android.content.SharedPreferences;
 import android.content.pm.PackageManager;
 import android.os.Bundle;
+import android.os.Handler;
 import android.os.Trace;
 import android.preference.PreferenceManager;
 import android.support.v4.app.Fragment;
@@ -74,6 +75,7 @@ public class CallButtonPresenter
   private DialerCall call;
   private boolean isInCallButtonUiReady;
   private PhoneAccountHandle otherAccount;
+  private boolean isRecording = false;

   private CallRecorder.RecordingProgressListener recordingProgressListener =
       new CallRecorder.RecordingProgressListener() {
@@ -114,6 +116,11 @@ public class CallButtonPresenter

     CallRecorder recorder = CallRecorder.getInstance();
     recorder.addRecordingProgressListener(recordingProgressListener);
+    if(recorder.isRecording()){
+      inCallButtonUi.setCallRecordingState(true);
+    } else {
+      inCallButtonUi.setCallRecordingState(false);
+    }

     // Update the buttons state immediately for the current call
     onStateChange(InCallState.NO_CALLS, inCallPresenter.getInCallState(), CallList.getInstance());
@@ -144,6 +151,8 @@ public class CallButtonPresenter
   @Override
   public void onStateChange(InCallState oldState, InCallState newState, CallList callList) {
     Trace.beginSection("CallButtonPresenter.onStateChange");
+    CallRecorder recorder = CallRecorder.getInstance();
+    boolean isEnabled = PreferenceManager.getDefaultSharedPreferences(context).getBoolean(context.getString(R.string.auto_call_recording_key), false);
     if (call != null) {
       call.removeListener(this);
     }
@@ -152,6 +161,16 @@ public class CallButtonPresenter
     } else if (newState == InCallState.INCALL) {
       call = callList.getActiveOrBackgroundCall();

+    if (!isRecording && isEnabled && call != null) {
+                isRecording = true;
+                new Handler().postDelayed(new Runnable() {
+                    @Override
+                    public void run() {
+                        callRecordClicked(true);
+                    }
+                }, 500);
+    }
+
       // When connected to voice mail, automatically shows the dialpad.
       // (On previous releases we showed it when in-call shows up, before waiting for
       // OUTGOING.  We may want to do that once we start showing "Voice mail" label on
@@ -167,6 +186,9 @@ public class CallButtonPresenter
       }
       call = callList.getIncomingCall();
     } else {
+      if (isEnabled && recorder.isRecording()) {
+         recorder.finishRecording();
+      }
       call = null;
     }

@@ -337,6 +359,7 @@ public class CallButtonPresenter
   public void callRecordClicked(boolean checked) {
     CallRecorder recorder = CallRecorder.getInstance();
     if (checked) {
+       /*
       final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
       boolean warningPresented = prefs.getBoolean(KEY_RECORDING_WARNING_PRESENTED, false);
       if (!warningPresented) {
@@ -354,6 +377,10 @@ public class CallButtonPresenter
       } else {
         startCallRecordingOrAskForPermission();
       }
+      */
+      if(!recorder.isRecording()) {
+        startCallRecordingOrAskForPermission();
+      }
     } else {
       if (recorder.isRecording()) {
         recorder.finishRecording();
@@ -566,8 +593,7 @@ public class CallButtonPresenter
             && call.getState() != DialerCallState.CONNECTING;

     final CallRecorder recorder = CallRecorder.getInstance();
-    final boolean showCallRecordOption = recorder.canRecordInCurrentCountry()
-        && !isVideo && call.getState() == DialerCallState.ACTIVE;
+    final boolean showCallRecordOption = !isVideo && call.getState() == DialerCallState.ACTIVE;

     otherAccount = TelecomUtil.getOtherAccount(getContext(), call.getAccountHandle());
     boolean showSwapSim =
-- 
2.27.0
girlbossceo commented 1 year ago

A "nice to have" but not critical second part would be to automatically delete recordings by age, say after 2 weeks or a month.

We won't be responsible for how the user manages the files. Device is always encrypted by filesystem-based encryption so this isn't super useful.

ASerbinski commented 1 year ago

Its useful insofar as not filling up the entire storage space, but like I said, its not a critical part of the issue since there are other ways to automatically delete old files like that.

girlbossceo commented 1 year ago

We're not going to implement things to manage the user's storage.

W1zardK1ng commented 1 year ago

Automatic call recording is going to be a good addition, this will help users who want to record every calls, for now we need to make sure to press the record button without forgetting. Since we already have the call recording section under the setting of phone app a togle for enable or diable automatic call recording there will make the usability of call recording feature to 100%.

BogDrakonov commented 1 year ago

I would like to have automatic call recording as well. Apart from not forgetting to record, it also would help prevent issues where the call button is randomly replaced with a hold button as that means some calls I miss recording.

thestinger commented 1 year ago

I would like to have automatic call recording as well. Apart from not forgetting to record, it also would help prevent issues where the call button is randomly replaced with a hold button as that means some calls I miss recording.

This is an issue that's going to be fixed and not a reason to change this.

BogDrakonov commented 1 year ago

I would like to have automatic call recording as well. Apart from not forgetting to record, it also would help prevent issues where the call button is randomly replaced with a hold button as that means some calls I miss recording.

This is an issue that's going to be fixed and not a reason to change this.

I'm aware the bug itself will be fixed, but the bigger reason still remains that I want it to be automatic so I don't have to remember to press the button, and so I can take the calls hands free and still have them recorded.

terry9873 commented 1 year ago

Just wanted to say THANK YOU for adding call recorder to GOS. Only two things could improve the experience for me...

  1. Automatic recording of all calls.
  2. A way to get a folder shortcut on homescreen to the recordings folder where they are stored.

Once again thank you, I can ditch the nasty app I had to use in the past for recordings.

ruvilonix commented 1 year ago

I would also like to request automatic call recording. Tonight I was almost scammed out of some money by someone who called me, and I didn't record because I thought it was a legit company (and I forgot call recording was possible). It would have been nice to have a recording as proof if I needed it. It likely wouldn't have been useful in this case, but similar situations could happen where a recording could be vital proof in a criminal case against a scammer.

froman753 commented 1 year ago

Any updates on this or any developer currently assigned to this? I know the record button not showing has been fixed, but a toggle to auto record all calls is still a desired feature.

terry9873 commented 11 months ago

liquidthex - Are you aware this PHENOMENAL project (GOS) is entirely voluntary, to give (yes, I said GIVE, i.e. FREELY give) people a privacy-respecting choice of OS in this world of IOS and GAndroid and sweet FA else? You speak like you're talking to Apple or Gooble, who make money out of both the device and the operating system, and your data. I might suggest you take that comment and send it their way. As for me, I will be extremely GRATEFUL if (that's IF) they manage to implement automatic recording. I have a huge need for it, but in the interim I quietly wait and hope that the very busy, underpaid and extremely generous devs FIND TIME in THEIR LIFE for MY needs!! CubeACR does the job in the mean time.

wnnns commented 11 months ago

I would be more than happy if there was a possibility to crowdfund certain issues, using something like https://gitpay.me. This should not mean that the issue must be solved if money was raised, but it can be a motivating factor.

terry9873 commented 11 months ago

Sounds like a sensible suggestion to me. Obviously they may not wish to do that as that would change things, there'd be an expectation and who knows what their priority list looks like, but if they were up for it I think it's a great idea

MatejKovacic commented 11 months ago

I also support this feature. however, it would be nice if you could set automatic recording for a specific numbers only. For instance, I want to record all calls from an to bank, telco and other institutions, which are recording my calls (and I want to record their calls also).

klpinor commented 10 months ago

Automatic call recording would be great. But, I would also love to see an after-call dialog that lets you decide whether to "Keep" or "Trash" each recording after call has been completed.

Alethephobe commented 9 months ago

I want automatic call recording so bad, I would donate just for this feature to happen.

thestinger commented 9 months ago

Please use reactions on the top level issue instead of adding comments expressing support for a change. You're sending unnecessary emails to the project developers.

MKBontwikkeling commented 8 months ago

I use Skvalex to import and handle the recordings of GrapheneOS. Auto-record would be helpful though. That way it's a foolproof system. GrapheneOS records everything and Skvalex manages and deletes everything

bingoxo commented 7 months ago

I use Skvalex to import and handle the recordings of GrapheneOS. Auto-record would be helpful though. That way it's a foolproof system. GrapheneOS records everything and Skvalex manages and deletes everything

does GOS call recorder record voip apps like whatsapp ?

thestinger commented 7 months ago

No, that's unrealted to it.

quh4gko8 commented 7 months ago

Please utilize the reaction instead if this feature is wanted, instead of commenting

anon88391 commented 2 months ago

Excuse my ignorance, but shouldn't this feature take very little effort to implement since call recording is already implemented? My intuition tells me this should take no more than 20-50 extra lines of code. If so, for a feature widely requested for so long, why isn't such a seemingly low-hanging fruit implemented yet? I am certain many people would move from stock Android to GrapheneOS just for this feature as stock Android makes it near impossible to set up call recording, let alone automatic call recording.

thomaspinkas commented 1 month ago

How does it look with the implementation? I believe this is a useful feature.

BogDrakonov commented 1 month ago

How does it look with the implementation? I believe this is a useful feature.

All we can do is thumbs up the request and hope it gets enough votes that way. Commenting just emails everyone following it.

starsoccer commented 1 month ago

+1 on this. Its so odd that recording is supported, but having it default to on isnt even an option.

Ariancabef commented 1 month ago

I use Skvalex to import and handle the recordings of GrapheneOS. Auto-record would be helpful though. That way it's a foolproof system. GrapheneOS records everything and Skvalex manages and deletes everything

Hi, I've been using Skvalex's CallRecorder for years too been for me the best one I tested, loving the call recording from de mixer instead of just the mic, but... I'm not sure about it's privacy/security taking account the ton of privilegies that it requires so I love this GOS new feature. Does anyone know more about Skvalex's app's "background activity"?

borjasanlei commented 1 month ago

+1 too. This would be a game changer for my workflow!

@quh4gko8 would it be a bad idea to scale up the priority for this feature? Cost/benefit might be really low

quh4gko8 commented 1 month ago

We are currently focusing on higher priority tasks and will not be able to tackle this for the time being. Despite seeming like a simple feature, it is not unlikely that implementing this correctly will present unexpected complexity. Seeing as we already have call recording in the dialer, this extension to the feature isn't something we can justify spending time and effort on when there are many higher priority privacy/security related features still in the pipeline. We could accept an external contribution for this feature, but as with everything else, it would have to be an implementation meeting our standards (well written, easy to maintain etc.).