summaryrefslogtreecommitdiff
path: root/core/java/android/database/ContentObserver.java
Commit message (Collapse)AuthorAgeFilesLines
* Add @SystemApi registerContentObserverForAllUsers in ContentResolverXiaoyu Jin2021-11-161-1/+23
| | | | | | | | | | | Also add ContentObserver#onChange(boolean, Collection, int, UserHandle) so clients can know the corresponding UserHandle for the notification. Bug: 203606981 Test: atest CtsContentTestCases and manual testing to verify the observer can get notifications for all the users. Change-Id: Icec7e70b71d7de1c15faf1736539f169856304a8
* Give hidden API behavior to legacy apps.Jeff Sharkey2020-03-101-9/+36
| | | | | | | | | | | | | | | | | | | | | | Starting in R, there is a new public API overload that delivers a flags argument. Some apps may be relying on a previous hidden API that delivered a userId argument, and this change is used to control delivery of the new flags argument in its place. There are dozens of these hidden API users are in the system UID, either in the system process or the Settings app, so we hard-code giving them the legacy behavior, since refactoring would be messy between internal and AOSP branches. Also adjust incoming and outgoing method signatures to use slightly more flexible Collection<Uri>, which has handy methods like contains() and isEmpty(). Bug: 150939131 Test: atest --test-mapping packages/providers/MediaProvider Test: atest FrameworksServicesTests:com.android.server.devicepolicy.DevicePolicyManagerTest Exempt-From-Owner-Approval: trivial refactoring Change-Id: If6a77449e19215cf1c60d4217e62fc04b0959bfc
* Use flags to indicate reason for Uri changes.Jeff Sharkey2020-03-051-59/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | As part of MediaProvider becoming a Mainline module, some partners need to understand more details about what triggered a Uri change notification. This helps listening apps avoid making expensive and race-condition-prone calls back into MediaProvider; typically when they're only interested in insert and delete operations. This change uses the existing "flags" argument to communicate the reason. This change adds overloads to ContentObserver for listening apps to receive these flags. In addition, we add overloads that deliver a clustered set of multiple Uris together in a single Binder transaction to improve overall efficiency. (This matches well with the existing CR.notifyChange() API that we added earlier this year, since they both work with Iterable<Uri>.) Tests to verify that we only collapse Uris together when all other method arguments are identical. Bug: 147778404, 144464323 Test: atest CtsDatabaseTestCases Test: atest CtsContentTestCases:android.content.cts.ContentResolverTest Test: atest FrameworksServicesTests:com.android.server.content.ObserverNodeTest Test: atest --test-mapping packages/providers/MediaProvider Change-Id: I0bbd8a8b4a898ab6f891d085de0ecb4d68cbe302
* Use new UnsupportedAppUsage annotation.Artur Satayev2020-01-061-1/+1
| | | | | | | | Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library. Bug: 145132366 Test: m && diff unsupportedappusage_index.csv Change-Id: I0c336de56bc4a041dc97ff9b7927f62f0b44b457
* Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-101-0/+2
| | | | | | | | | | | | | | | | | For packages: android.database.sqlite android.database This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: I2bcc7f0eee31a1775dd7a5dd0f291d0d37bc1292
* Revert "Fix ContentObserver unregister issue"Fyodor Kupolov2017-07-131-10/+0
| | | | | | | | | This reverts commit 2df4e144a913b705c50bde929c75744b251967d9. It was causing failures in packages/apps/DocumentsUI tests Bug: 63638102 Bug: 63154326 Change-Id: I51fb54f705f58f159f4fcc30bfed41ababcba950
* Fix ContentObserver unregister issuedaqi2017-07-061-0/+10
| | | | | | | | | | | | | | [Cause of Defect] In the ContentObserver callback procedure, the binder thread has no sync mechanism with handler thread. The ContentObserver#onChange method can get called after ContentResolver#unregisterContentObserver called in the very low probability. Bug: https://issuetracker.google.com/issues/63154326 Test: manual - check https://github.com/nanjingdaqi/ContentObserverDemo Change-Id: I0e3831eba7a9cc1a5bf0d30abe5dd0ec8259b0d4 Signed-off-by: daqi <daqi@xiaomi.com>
* Print services setting changes not handled for managed profiles.Svetoslav2014-08-261-6/+42
| | | | | | | | | | | | | | | We keep per user settings for enabled print services which are observed to update the print manager service state. We were listening to all user changes but the handling code was not updating the state of the user whose settings changed, rather the current user. Added hidden APIs in content observer to know which user changed and now the print manager serivce handles content changes for the correct user. bug:16977006 Change-Id: I71ec88c8f3f38cb405844c13ab83695c2029eb79
* Inform ContentObservers about the changed content Uri.Jeff Brown2012-01-231-9/+70
| | | | | | | | Added a new method ContentObserver.onChange(boolean, Uri) that receives the changed content Uri. This can help applications make better decisions about how to interpret a change notification. Change-Id: I8e35378b6485fe22c5bc240ba07557d269af0836
* Clean up content observer code.Jeff Brown2012-01-231-61/+65
| | | | | | | | | | | | | | | | Improved the documentation a little bit. Fixed a bug in ContentService wherein if a ContentObserver was passed as an argument and its deliverSelfNotifications() method returned true, then notifyChange would tell all observers that the change was a self-change even though it was only a self-change from the perspective of the provided observer. Deprecated ContentObservable.notifyChange since it is never used and in general it shouldn't be because we want the notification to be posted to the handler. Change-Id: Idde49eb40777e011a068f2adae8a32f779dfb923
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-0/+138
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-138/+0
|
* Initial ContributionThe Android Open Source Project2008-10-211-0/+138