Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query APIs do not return local contacts in Xiaomi devices when passing null to accounts functions #296

Closed
6 tasks done
vestrel00 opened this issue Aug 13, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@vestrel00
Copy link
Owner

vestrel00 commented Aug 13, 2023

Problem

Similar to #257, using query APIs' accounts function to match local (Raw)Contacts (and groups), those that have a null Account and are not synced outside of the device, does not work for Xiaomi devices running MiUI.

The following will NOT return any contacts;

query.accounts(null).find()

This issue occurs because "Phone contacts" (local contacts and groups) in Xiaomi devices are assigned to the following "account"; name "default", type "com.android.contacts.default". RawContacts that are inserted with a null account will, immediately or at a later time, be automatically associated to this local account. This account is not returned by the Android AccountManager. Either because 3rd party apps do not have access to it or it is not an actual real account.

Solution

Update the accounts function of all query APIs to also match the local account name and type of Xiaomi devices instead of just null when null is passed.

Apply this solution to all query APIs with an accounts function;

  • Query
  • BroadQuery
  • ProfileQuery
  • RawContactsQuery
  • DataQuery
  • GroupsQuery

Other considerations

Given that Xiaomi is automatically assigning local RawContacts to account name "default", type "com.android.contacts.default", there is no need to refactor insert and update APIs.

@vestrel00 vestrel00 self-assigned this Aug 13, 2023
@vestrel00 vestrel00 added the bug Something isn't working label Aug 13, 2023
@vestrel00 vestrel00 added this to In progress in Consumer issues Aug 13, 2023
@vestrel00 vestrel00 moved this from In progress to Done in Consumer issues Aug 13, 2023
@vestrel00
Copy link
Owner Author

🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥
This is now release in 0.3.1!
🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

1 participant