chenxiaolong / BCR

A Basic Call Recorder for rooted Android devices
GNU General Public License v3.0
1.49k stars 98 forks source link

Unable to add more than 2 contact rules #554

Closed Cheetoacidosis closed 3 weeks ago

Cheetoacidosis commented 3 weeks ago

Device: Pixel 3 (blueline) ROM: LineageOS 21 (Android 14) BCR vers: 1.63

Basically, I'm limited to only adding 2 contact rules. The first 2 add just fine, and I can choose any 2 contacts. Any others don't get added to the list, but I can remove 1 (or both) of the rules that are showing up and switch them out with different contacts.

Intended functionality Go to BCR app Visit the Auto-record rules I can add as many rules as desired, for as many contacts as I have

Actual function Open BCR app and go to auto-record rules Add 1 person (works fine) Add a second person (works fine) Add a third person. The app gives the message that it "Added new rule", but only the first 2 are displaying Add an Nth person, same result

chenxiaolong commented 3 weeks ago

Hmm, that's really odd. I'm curious if the contact IDs for your contacts aren't unique. Can you give this a try?

  1. Add 2 contacts
  2. Deny the Contacts permission for BCR
  3. Go back to the auto-record rules and take a screenshot. It should show IDs like this instead of names: Screenshot_20240604-164724
  4. Reenable the Contacts permission
  5. Remove the 2 contacts and select another 2
  6. Deny the Contacts permission again
  7. Take another screenshot of the auto-record rules

If the contact IDs aren't unique, this might be a bit harder to fix.

Cheetoacidosis commented 3 weeks ago

Thanks for getting back! It looks like they are unique :/

Screenshot_20240604-161750_BCR Screenshot_20240604-161640_BCR

chenxiaolong commented 3 weeks ago

Thanks for testing that! I'm not really sure what could cause this then.

I'd like to see if I can reproduce this bug with your settings. Can you try adding 3 or more contacts and then make a copy of BCR's settings file at /data/data/com.chiller3.bcr/shared_prefs/com.chiller3.bcr_preferences.xml with a root file manager and upload that? The file contains all of BCR's settings, including the contact IDs like in the screenshots. It does not include contact names or phone numbers.

Cheetoacidosis commented 3 weeks ago

Sure thing! I renamed it to a TXT because github didnt want to upload it. If you need the unmodified XML file I can get it to you. com.chiller3.bcr_preferences.xml.txt

chenxiaolong commented 3 weeks ago

Nope, no need, the file was fine! I was able to load those settings, but unfortunately, I still can't reproduce the issue. When I add additional contacts, they appear after your 2 entries. I'm kind of baffled why this is happening for you.

I'd like to try and get some debug logs to hopefully track this down. Can you give this a try?

  1. Remove all contact rules from BCR.
  2. Create 3 dummy contacts for testing because the debug log created below will include contact names. They don't need to have any fields filled in besides the name.
  3. Install this test build: BCR-1.63.r6.g304395d-release.zip
  4. Add all 3 test contacts to the rules.
  5. Hit the [DEBUG] Tap to save logs to output directory option at the top of the record rules screen.
  6. Upload record_rules_debug.log.txt from the output directory.
Cheetoacidosis commented 3 weeks ago

Done! Weird thing happened though. In this build when I added the 2nd contact, it was the only one showing up. Not even the default rules were there. With a 3rd contact only 2 and 3 were showing. I tried adding a 4th, and it didnt add to the list or change anything. I got the message that the rule was added, so it seems to have done the thing in the original bug report.

Contacts used: Dummy1, Dummy2, Dummy3, AT&T. (in that order)

record_rules_debug.log.txt

chenxiaolong commented 3 weeks ago

Thanks for the logs! That was incredibly helpful. I didn't account for the fact that Android might unload BCR.

On your device, when you add a rule and go to Android's contact picker screen, Android is unloading BCR from memory. After selecting a contact, BCR loads again from scratch and it tries to load the saved settings and add the new contact at the same time. This race condition leads to the weird behavior.

On my device, BCR happens to always stay loaded in memory, so after returning from the contact picker, it was only adding the new contact (and not reloading the settings).

I think this test build should resolve the problem: BCR-1.63.r7.g35fce3b-release.zip. If you still hit weird issues, please upload a new record_rules_debug.log.txt.

Cheetoacidosis commented 3 weeks ago

That makes sense! I have my phone set to unload apps when I'm not actively using them.

Also, the test build fixed it!

Thank you so much for your responsiveness and help here, you've made an absolutely wonderful application, and seem to be just as wonderful of a person. Is there any place to donate to you or the project?

chenxiaolong commented 3 weeks ago

Glad to hear the test build worked! I'll merge the fix and release a new version of BCR in a bit.

Is there any place to donate to you or the project?

Thank you, the kind words are enough :heart: