Register change Uri and notify changes in bugreportServices.
Bug: 28767380
Change-Id: Ia4d1f5a2e44881d300f2869c628d4990406caf40
(cherry picked from commit 6c9ff513c6d7d3de7ab8920d88111c2b1dc1bb1f)
(cherry picked from commit 93fafd67a6127a35ba9b7a0f7de3a0b54309d4c2)
diff --git a/packages/Shell/src/com/android/shell/BugreportProgressService.java b/packages/Shell/src/com/android/shell/BugreportProgressService.java
index 474e3e6..6bc4df7 100644
--- a/packages/Shell/src/com/android/shell/BugreportProgressService.java
+++ b/packages/Shell/src/com/android/shell/BugreportProgressService.java
@@ -815,6 +815,14 @@
*/
private void onBugreportFinished(int id, Intent intent) {
final File bugreportFile = getFileExtra(intent, EXTRA_BUGREPORT);
+ // Since BugreportProvider and BugreportProgressService aren't tightly coupled,
+ // we need to make sure they are explicitly tied to a single unique notification URI
+ // so that the service can alert the provider of changes it has done (ie. new bug
+ // reports)
+ // See { @link Cursor#setNotificationUri } and {@link ContentResolver#notifyChanges }
+ final Uri notificationUri = BugreportStorageProvider.getNotificationUri();
+ mContext.getContentResolver().notifyChange(notificationUri, null, false);
+
if (bugreportFile == null) {
// Should never happen, dumpstate always set the file.
Log.wtf(TAG, "Missing " + EXTRA_BUGREPORT + " on intent " + intent);