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

Show a notification at sync when ContentProvider inaccessible #1278

Open
wants to merge 3 commits into
base: main-ose
Choose a base branch
from

Conversation

sunkup
Copy link
Member

@sunkup sunkup commented Jan 30, 2025

Purpose

When content providers like contacts or calendar storage are inaccessible we can not sync and should notify the user about it.

Short description

  • extract the notification handling from SyncManager
  • send notification when content provider inacessible

Use for testing

adb shell pm disable-user --user 0 com.android.providers.calendar
adb shell pm enable com.android.providers.calendar

adb shell pm uninstall -k --user 0 com.android.providers.calendar
adb shell cmd package install-existing com.android.providers.calendar

Checklist

  • The PR has a proper title, description and label.
  • I have self-reviewed the PR.
  • I have added documentation to complex functions and functions that can be used by other modules.
  • I have added reasonable tests or consciously decided to not add tests.

@sunkup sunkup added the enhancement New feature or request label Jan 30, 2025
@sunkup sunkup self-assigned this Jan 30, 2025
@sunkup sunkup linked an issue Jan 30, 2025 that may be closed by this pull request
@sunkup sunkup force-pushed the 1253-show-a-notification-at-sync-when-contentprovider-inaccessible branch 4 times, most recently from c67f024 to 5d5ffab Compare February 6, 2025 10:30
@sunkup sunkup requested a review from ArnyminerZ February 6, 2025 10:32
@sunkup sunkup marked this pull request as ready for review February 6, 2025 10:32
Copy link
Member

@ArnyminerZ ArnyminerZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't work for me, I've tried disabling and uninstalling as shown, and no notification is shown.

@sunkup
Copy link
Member Author

sunkup commented Feb 12, 2025

It doesn't work for me, I've tried disabling and uninstalling as shown, and no notification is shown.

@ArnyminerZ The notification is only shown upon sync. You need to disable the content provider select collections for synchronization and initiate a sync manually / wait for periodic.

@ArnyminerZ
Copy link
Member

ArnyminerZ commented Feb 12, 2025

You need to disable the content provider select collections for synchronization and initiate a sync manually / wait for periodic.

Yup, I was doing that. I tried:

  1. Configure an account, and enable some collection with calendar
  2. Run: adb shell pm disable-user --user 0 com.android.providers.calendar
  3. Synchronize.
  4. No notification is shown
  5. Run: adb shell pm enable com.android.providers.calendar
  6. Run: adb shell pm uninstall -k --user 0 com.android.providers.calendar
  7. Synchronize.
  8. No notification is shown
  9. Run: adb shell pm disable-user --user 0 com.android.providers.calendar
  10. Synchronize.
  11. No notification is shown

Running on the emulator SDK 35.

@sunkup
Copy link
Member Author

sunkup commented Feb 12, 2025

You're right. It's because I try to dismiss the notification once the content provider is available again ... Will take a look!

@sunkup sunkup force-pushed the 1253-show-a-notification-at-sync-when-contentprovider-inaccessible branch from 291b21d to 8cf7291 Compare February 12, 2025 09:30
@sunkup sunkup force-pushed the 1253-show-a-notification-at-sync-when-contentprovider-inaccessible branch from 8cf7291 to 7e8f784 Compare February 12, 2025 09:30
@sunkup
Copy link
Member Author

sunkup commented Feb 12, 2025

@ArnyminerZ Please take a look now.

Also, I am also wondering whether it's smart/possible to pass the sync data type instead of the authority to SyncNotificationManager - the only issue I see is that we want to show the correct authority in the debug data. What do you think, is it possible? Should go in a separate PR then though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show a notification at sync when ContentProvider inaccessible
2 participants