henrichg / PhoneProfilesPlus

Profile manager for Android - event triggered
Apache License 2.0
397 stars 32 forks source link

[BUG] Call sensor do NOT detects call from contact from selected GROUP #137

Open StanTody opened 6 days ago

StanTody commented 6 days ago

Version: 6.5.1.1, Android 14, OneUI 6.0 Steps to reproduce:

henrichg commented 6 days ago

Hm, I must test it. How you setup contact group only in phone (not synced with Google)? Thanks.

henrichg commented 6 days ago

I'm configured one group in One UI Contacts application. Group exists, is possible to add it in PPP Call sensor, but in it are not contacts. PPP displays 0 contacts in it. By me, One UI Contacts application do not properly working with Android SDK API for managing Contacts. Hm.

PPP displays 3 versions of group: Samsung account, Telephony app, Google account. All 3 are empty. But Contacts application displays added contacts in group. Interesting. :-(

Tested in Galaxy S23, One UI 6.1.1.

StanTody commented 5 days ago

I am using TruePhone for managing contacts and PPP shows actual count of contacts in the groups (14 in my case). And yes, I have 2 versions of groups too - Phone and Google. It is normal, AIK.

just-Nob commented 5 days ago

To set up contact group in phone only:

I think that TruePhone adds a new local account (which isn't synchronized with Google) where the user is able to store contacts. I'm using MyLocalAccount for that (although MyLocalAccount is also closed source like TruePhone, I consider MyLocalAccount trustworthy; it's from the same author like there well known MyPhoneExplorer app).

I don't have much time at the moment, but if I can manage it, I will try to reproduce the issue with MyLocalAccount.

Anyway, MyPhoneExplorer could be a good countercheck to test whether the described issue is caused by TruePhone or PPP.

StanTody commented 5 days ago

Here are some more tests: " I have created a new group with built-in Contacts app and added one contact to it (again with built-in app) - same result, the event does NOT executed. " I have uninstalled PPP (with Clear data) and installed a old version (4.2.0.3) with same settings, profiles and events - same result.

Conclusion: may be the problem is in A14 ?

henrichg commented 5 days ago

Checked again group created yesterday. And is synced with Google account. PPP displays for Google account added contact. In mobile, Samsung account stays 0. Galaxy S23, Android 14.

Result: problem is, by me, changed format of data in mobile, Samsung account.

Next test tomorrow: Galaxy S10, Android 11.

henrichg commented 4 days ago

Galaxy S10:

PPP uses this DB query: String[] projection = new String[]{ ContactsContract.Groups._ID, ContactsContract.Groups.TITLE, ContactsContract.Groups.SUMMARY_COUNT, ContactsContract.Groups.ACCOUNT_TYPE }; String selection = ContactsContract.Groups.DELETED + "=0"; Cursor mCursor = context.getContentResolver().query(ContactsContract.Groups.CONTENT_SUMMARY_URI, projection, selection, null, null);

And return is:

2024-10-04 13:37:13.667 18282-18844 ContactGro...tGroupList sk.henrichg.phoneprofilesplus E count=0 2024-10-04 13:37:13.667 18282-18844 ContactGro...tGroupList sk.henrichg.phoneprofilesplus E accountType=com.osp.app.signin

2024-10-04 13:37:13.667 18282-18844 ContactGro...tGroupList sk.henrichg.phoneprofilesplus E count=0 2024-10-04 13:37:13.667 18282-18844 ContactGro...tGroupList sk.henrichg.phoneprofilesplus E accountType=vnd.sec.contact.phone

2024-10-04 13:37:13.667 18282-18844 ContactGro...tGroupList sk.henrichg.phoneprofilesplus E count=1 2024-10-04 13:37:13.667 18282-18844 ContactGro...tGroupList sk.henrichg.phoneprofilesplus E accountType=com.google

Only for ACCOUNT_TYPE="com.google" is returned SUMMARY_COUNT=1. For "com.osp.app.signin" and "vnd.sec.contact.phone" is returned 0.

I do not know, why. Maybe for account types with SUMMARY_COUNT = 0 are not updated SUMMARY_COUNT. Then, maybe SUMMARY_COUNT is not good to using it. Then, I must rewrite, how to get contacts from group. I will looking on it.

henrichg commented 4 days ago

Hm, changed, how to get count of contacts in group (SUMMARY_COUNT is not used), but my contact added to group is only in accountType=com.google. One UI Contacts app do not add it into 2 other accountTypes. Then bug is in Contacts app.

Then use in PPP Google accountType, if your contacts app adds contact to this accountType.

And: Contacts app do not displays groups: "My contacts" but PPP yes (exists Samsung and Google accoutType). Next bug in Contacts? Hm, intersting.

henrichg commented 4 days ago

Intersting. Group added in S10 is synced with S21 and in S21 is 1 contact in it. This is OK. But group in S21 is only with accountType=Samsung and is empty. How Samsung syncing contacts, I do not know. :-)

After force sync Samsung and Google account in S21, added is Google account type with contact in it.

Result: Google account working, Samsung account not.

StanTody commented 4 days ago

As I know, different accounts are separate "containers" - so contact, added to group "Family" in Google account is NOT visible in group "Family" in Samsung account. I.e., the two above groups are different, regardless equal names.

So, may be groups must be kept and handled as name+account ?

henrichg commented 4 days ago

Hm, fixed is filling contacts with groups. One contact may by in several groups (group_id), but name of group may be the same for several group_id.

Fixed is this: My own contact has 3 tel. numbers and after this fix is displayed 3 tel. numbers in "Starred" Google group.

Problem persists: All contacts are in "Coogle" accountType. "Samsung" and "Phone" stays empty, even when also these accountTypes are filled with contacts. But maybe, in your device with this fix, will be working also contact in Phone group.

Look: Phone actionType: 2024-10-04 20:02:41.086 20838-20935 ContactGro...tGroupList sk.henrichg.phoneprofilesplus E (2) name=Starred 2024-10-04 20:02:41.086 20838-20935 ContactGro...tGroupList sk.henrichg.phoneprofilesplus E (2) contactGroupId=18 2024-10-04 20:02:41.086 20838-20935 ContactGro...tGroupList sk.henrichg.phoneprofilesplus E (2) accountType=vnd.sec.contact.phone Samsung actionType: 2024-10-04 20:02:41.091 20838-20935 ContactGro...tGroupList sk.henrichg.phoneprofilesplus E (2) name=Starred 2024-10-04 20:02:41.091 20838-20935 ContactGro...tGroupList sk.henrichg.phoneprofilesplus E (2) contactGroupId=23 2024-10-04 20:02:41.091 20838-20935 ContactGro...tGroupList sk.henrichg.phoneprofilesplus E (2) accountType=com.osp.app.signin Google actionType: 2024-10-04 20:02:41.102 20838-20935 ContactGro...tGroupList sk.henrichg.phoneprofilesplus E (2) name=Starred 2024-10-04 20:02:41.102 20838-20935 ContactGro...tGroupList sk.henrichg.phoneprofilesplus E (2) contactGroupId=32 2024-10-04 20:02:41.102 20838-20935 ContactGro...tGroupList sk.henrichg.phoneprofilesplus E (2) accountType=com.google 2024-10-04 20:02:41.105 20838-20935 ContactGro...tGroupList sk.henrichg.phoneprofilesplus E added contactId=668 to contactGroupId=32 2024-10-04 20:02:41.105 20838-20935 ContactGro...tGroupList sk.henrichg.phoneprofilesplus E added contactId=668 to contactGroupId=32 2024-10-04 20:02:41.105 20838-20935 ContactGro...tGroupList sk.henrichg.phoneprofilesplus E added contactId=668 to contactGroupId=32 2024-10-04 20:02:41.105 20838-20935 ContactGro...tGroupList sk.henrichg.phoneprofilesplus E count of contacts in group=3

** Good news: In my S23 are added contacts also into "Phone" group "Restored from Samsung device ...". 13 tel. numbers.

If you want, install this fix: https://drive.google.com/file/d/1Hd788By6Te58HMOeIsyA0H0Q1eB2ivLA/view?usp=drivesdk

StanTody commented 4 days ago

Unfortunately, the test version requires newer version of the Extender

henrichg commented 4 days ago

8.1.6 is required. You have older version? In Droid-ify, GitHub is 8.1.7. Install it from Droid-ify (recommended) or GitHub.

GitHub: https://github.com/henrichg/PhoneProfilesPlusExtender/releases

StanTody commented 4 days ago

Unfortunately, the call sensor still does NOT detects call from selected (local) group :'(

Samsung S23, A14, One UI 6.0

henrichg commented 4 days ago

Check "Contact groups" parameter. In it is displayed count of contacts in each group. In my S23, only "Restored from device Samsung..." are in "Phone application" group. All others are in "Google account".

henrichg commented 4 days ago

Which application you using? I will test it. Write me download link, name. Thanks.

StanTody commented 3 days ago

"Check "Contact groups" parameter" - in PPP 6.5.1.1 and in 6.6b when I setting up the parameter I CAN see CORRECT count of the contacts in each group incl. these from Phone account (BTW, I don't use Google for storing and syncing contacts, so ALL my contacts are in Phone account, separated by groups -see attachment). I use True Phone for managing contacts, as I described before. Screenshot_20241005_110413_PhoneProfilesPlus Screenshot_20241005_110403_PhoneProfilesPlus Screenshot_20241005_110229_PhoneProfilesPlus

https://play.google.com/store/apps/details?id=com.hb.dialer.free

henrichg commented 3 days ago

Installed True caller.

  1. Which application is set as default dialer in your device? In mine is True caller.
  2. Created group is in "Phone" accountType? I'm created it in "Phone".
  3. You tested incomming or outgoing call?

True caller do not allow add into group contacts, which not are in Phone accountType. Ok added new contact to Phone accountType, then is possible to add it to Phone accountType group.

One UI Contacts application display also contact and group from True caller. Good.

Will be tested. Pleae wait.

henrichg commented 3 days ago

EDIT: Working. Incomming call. But I will debugging it. Maybe will be found phone number from Google account (in my mobile is tested phone number in phone and google account).

StanTody commented 3 days ago

On my device I use True Phone and it is default call app. (not True caller - they are different, see link above).

I am testing incoming call.

henrichg commented 3 days ago

Sorry, installed is True Phone. From your link. Then tested is True Phone, not True caller. 😀

One contact with two my test phone numbers (I own 3 SIM cards, two are for testing dual SIM support in PPP 😀):

Screenshot_20241005_130428_True Phone

Screenshot_20241005_130442_True Phone

Screenshot_20241005_131323_PhoneProfilesPlus

Screenshot_20241005_131331_PhoneProfilesPlus

henrichg commented 3 days ago

Please test this: Do Exit in PPP menu and start PPP again. It fixes the contact and contact group cache used in PPP. Because I had a problem too. The cache was not updated after the changes in True Phone. And quitting and starting PPP fixed the cache.

I will debugging create/update of these caches (must be used cache, because contacts BD is very slow).

StanTody commented 3 days ago

In my case contacts are in the corresponding groups till stone age ;) , so cache is not of importance

henrichg commented 3 days ago

Cache is importance. Events use only cache. I'm added logging into PPP. Will be tested by me and then send you new beta version. Stay tuned. :-)

henrichg commented 3 days ago

OK, test this beta: https://drive.google.com/file/d/1Hd788By6Te58HMOeIsyA0H0Q1eB2ivLA/view?usp=drivesdk

After end of tests do this: In Editor menu use: "Support"/"E-mail debug log files to author".

Thanks.

StanTody commented 3 days ago

"In Editor menu use: "Support"/"E-mail debug log files to author"" -> done.

henrichg commented 3 days ago

And where is the email with the log file? :-) Is not received in henrich.gron@gmail.com.

StanTody commented 3 days ago

I thought it will be sent automatically from the menu.... Now I have found and sent the log file.

henrichg commented 3 days ago

Read e-mail from me. For security reason (phone numbers in it) is better to send email with tel. numbers. Comments from GitHub are removed.