Silence icon indicating copy to clipboard operation
Silence copied to clipboard

Trouble with Repeated setting

Open mddvul22 opened this issue 2 years ago • 20 comments

This is a nice app! I'm excited to start using it. However, I'm having trouble with the configuration for Repeated calls. I have enabled "Repeated" in the main configuration section. Then, in the repeated settings, I have this set:

count=3 minutes=5 timeout=0

However, in my testing from an unknown number, I called 5 times within 5 minutes and all five calls were blocked. Am I misunderstanding the settings? Shouldn't calls 4 and 5 have been accepted?

Thanks!

mddvul22 avatar Sep 27 '22 16:09 mddvul22

Hi, do you allow calls from unknown numbers? If not, Silence will block these calls, even with this setting (repeated calls) is correctly defined

The operation of this option is as follows (if I am not mistaken): in your example, Silence will let the third call from the same number through, if this number calls more than 3 times in 5 minutes

To allow calls from unknown numbers, go to Silence -> Extra -> check the "Unknown numbers" option

Ilithy avatar Sep 27 '22 17:09 Ilithy

Thanks! I'll give this a try this evening. I did not have "allow calls from unknown numbers" checked.

mddvul22 avatar Sep 27 '22 17:09 mddvul22

@mddvul22 All depends what do you mean by Unknown number. If it has a number, but this number is not known to you, then repeated option has to work.

x13a avatar Sep 27 '22 17:09 x13a

Thanks for the clarification. I was calling from a number that was not known to me, but did have a number. It was not hidden. I think the problem might be in my Groups settings. In my main settings, I have enabled "Allow calls from numbers within the selected groups". But in my Groups settings, nothing is checked.

So I may be misunderstanding these settings. For example, in the Groups setting:

"Allow calls from numbers with the same country code as your." I read that to mean that checking this box allows ALL numbers from my country code, even if they would otherwise be blocked. Is that correct? Or instead, does checking that box allow ALL numbers from my country code IF they would otherwise be allowed?

mddvul22 avatar Sep 27 '22 18:09 mddvul22

@mddvul22 By default all, what is not in your contacts blocked. Most options are to allow something. Except Plus numbers. Call screening API has a cache, try to make a calls with some interval, like 1 minute.

x13a avatar Sep 27 '22 21:09 x13a

Thank you for the explanation. I think I understand the settings, now. However, I don't think it is working correctly, for me. I have enable the following:

Allow calls from numbers you have called Allow calls from numbers you have sent a message to Allow repeats: Count=2 minutes=1440, timeout=15 Allow calls from numbers that sent you a message Allow calls from numbers in your contacts.

With that configuration, I should be able to call my cell phone from a number that is not in my contacts -- if I call my cell twice in a 24 hours and at least 15 seconds between calls. However, it doesn't matter how long I wait, Silence keeps blocking this number that is not in my contacts. I've tried at least 5 times times over a 20 minute period.

mddvul22 avatar Sep 28 '22 01:09 mddvul22

@mddvul22 Got it, what is your Android version?

x13a avatar Sep 29 '22 21:09 x13a

Android 12.1 / Lineage 19.1

mddvul22 avatar Sep 30 '22 02:09 mddvul22

@mddvul22 I can not reproduce this in emulator.

x13a avatar Oct 14 '22 11:10 x13a

Thanks for trying.

mddvul22 avatar Oct 17 '22 20:10 mddvul22

Having exactly the same problem on Android 12.1 / Lineage 19.1. Recently upgraded the OS and now all unknown numbers are simply rejected. With this flaw the app cannot work as the spam blocker, only as the simple white list.

Efenstor avatar Oct 31 '22 07:10 Efenstor

I have checked the previous versions down to v1.11.4 and the problem is present there as well, so it has nothing to do with the burst protection.

Efenstor avatar Oct 31 '22 07:10 Efenstor

If I set the repeated count to 1 then it allows incoming calls (but makes the function useless of course). May be that helps a bit to pinpoint the problem. I tried playing with all the other settings and nothing helps to workaround this problem.

Efenstor avatar Oct 31 '22 07:10 Efenstor

So, summarizing what I've tested and found:

Not working (calls are always rejected):

  • Repeated calls (except for 1 attempt)
  • Calls from numbers that you have contacted (Main -> Contacted)
  • Calls from mobile numbers found in incoming messages (Messages -> Text).

Concerning the last issue: I press the "Goto" button at the bottom and allow access to the notifications. That does not change anything: the calls are still rejected. I tried sending SMS containing my test number with and without spaces and dashes, with and without the + sign and the country code (sometimes it's replaced with 8 in our country): still the calls are rejected.

Everything else seems to be working:

  • Numbers in your contacts (Extra -> Contacts)
  • Numbers that you have sent a message to (Contacted -> Message)
  • Calls from numbers that sent you a message (Messages -> Inbox)
  • Allow all calls from a specific SIM
  • Groups (tested "Local" and "Local & Mobile", can't test the rest)
  • Extra -> Plus numbers
  • ... and probably everything else

Efenstor avatar Oct 31 '22 08:10 Efenstor

Hmm, maybe I have broken something, maybe Google. Will check.

x13a avatar Nov 02 '22 21:11 x13a

Returning back to the issue. I made logs from my failed call attempts, got those using adb logcat, purging the log before every attempt so those are pretty clean and short. Sending those to your email.

Efenstor avatar Nov 11 '22 12:11 Efenstor

Since I really need this feature to work I decided to dig into the issue myself (although I had zero experience in Android programming). Anyway, I found that amazingly contentResolver.query in the checkRepeated function (CallScreeningHelper.kt) returns an empty cursor if any selectionArgs was specified at all, only null works. Replacing it with the following unsafe contraption cures the problem:

        try {
            cursor = ctx.contentResolver.query(
                makeContentUri(CallLog.Calls.CONTENT_FILTER_URI, number),
                arrayOf(CallLog.Calls._ID, CallLog.Calls.DATE),
                "${CallLog.Calls.TYPE} = ${CallLog.Calls.BLOCKED_TYPE} AND ${CallLog.Calls.DATE} > ${System.currentTimeMillis() - prefs.repeatedMinutes * 60 * 1000}",
                null,
                CallLog.Calls.DEFAULT_SORT_ORDER,
            )
        } catch (exc: SecurityException) { return false }

I suspect this is a bug in contentResolver that has got into the LineageOS source code. Since everywhere it's written that specifying arguments in the query string is absolutely unsafe, I don't know whether it's worth making a pull request with this code or not. But this is a solution and it works.

Efenstor avatar Dec 22 '22 19:12 Efenstor

I've made a fork (https://github.com/Efenstor/Silence) and published the temporarily-fixed version there. I've replaced all the contentResolver.query calls with their functional analogues without selectionArgs. In anyone needs such a version you can use it.

Efenstor avatar Dec 24 '22 13:12 Efenstor

I seem to have the same problem on GrapheneOS (Android 13). Everything works correctly except repeated setting. It always blocks call for anyone who is not in contacts.

olologin avatar May 13 '23 09:05 olologin

Seems to be fixed after the recent GrapheneOS update (And I believe it is fixed on stock pixel firmware as well). Now repeating call setting works fine.

olologin avatar Jun 28 '23 09:06 olologin

Thank you all for this. Closing as completed

x13a avatar Apr 15 '24 10:04 x13a