Loading packages/Shell/src/com/android/shell/BugreportProgressService.java +8 −0 Original line number Diff line number Diff line Loading @@ -815,6 +815,14 @@ public class BugreportProgressService extends Service { */ 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); Loading packages/Shell/src/com/android/shell/BugreportStorageProvider.java +10 −0 Original line number Diff line number Diff line Loading @@ -19,9 +19,11 @@ package com.android.shell; import android.database.Cursor; import android.database.MatrixCursor; import android.database.MatrixCursor.RowBuilder; import android.net.Uri; import android.os.CancellationSignal; import android.os.FileUtils; import android.os.ParcelFileDescriptor; import android.provider.DocumentsContract; import android.provider.DocumentsContract.Document; import android.provider.DocumentsContract.Root; import android.provider.DocumentsProvider; Loading @@ -32,6 +34,7 @@ import java.io.File; import java.io.FileNotFoundException; public class BugreportStorageProvider extends DocumentsProvider { private static final String AUTHORITY = "com.android.shell.documents"; private static final String DOC_ID_ROOT = "bugreport"; private static final String[] DEFAULT_ROOT_PROJECTION = new String[] { Loading Loading @@ -103,6 +106,7 @@ public class BugreportStorageProvider extends DocumentsProvider { for (File file : files) { addFileRow(result, file); } result.setNotificationUri(getContext().getContentResolver(), getNotificationUri()); } } return result; Loading Loading @@ -130,6 +134,12 @@ public class BugreportStorageProvider extends DocumentsProvider { } } // This is used by BugreportProgressService so that the notification uri shared by // BugreportProgressService and BugreportStorageProvider are guaranteed the same and unique protected static Uri getNotificationUri() { return DocumentsContract.buildChildDocumentsUri(AUTHORITY, DOC_ID_ROOT); } private static String[] resolveRootProjection(String[] projection) { return projection != null ? projection : DEFAULT_ROOT_PROJECTION; } Loading Loading
packages/Shell/src/com/android/shell/BugreportProgressService.java +8 −0 Original line number Diff line number Diff line Loading @@ -815,6 +815,14 @@ public class BugreportProgressService extends Service { */ 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); Loading
packages/Shell/src/com/android/shell/BugreportStorageProvider.java +10 −0 Original line number Diff line number Diff line Loading @@ -19,9 +19,11 @@ package com.android.shell; import android.database.Cursor; import android.database.MatrixCursor; import android.database.MatrixCursor.RowBuilder; import android.net.Uri; import android.os.CancellationSignal; import android.os.FileUtils; import android.os.ParcelFileDescriptor; import android.provider.DocumentsContract; import android.provider.DocumentsContract.Document; import android.provider.DocumentsContract.Root; import android.provider.DocumentsProvider; Loading @@ -32,6 +34,7 @@ import java.io.File; import java.io.FileNotFoundException; public class BugreportStorageProvider extends DocumentsProvider { private static final String AUTHORITY = "com.android.shell.documents"; private static final String DOC_ID_ROOT = "bugreport"; private static final String[] DEFAULT_ROOT_PROJECTION = new String[] { Loading Loading @@ -103,6 +106,7 @@ public class BugreportStorageProvider extends DocumentsProvider { for (File file : files) { addFileRow(result, file); } result.setNotificationUri(getContext().getContentResolver(), getNotificationUri()); } } return result; Loading Loading @@ -130,6 +134,12 @@ public class BugreportStorageProvider extends DocumentsProvider { } } // This is used by BugreportProgressService so that the notification uri shared by // BugreportProgressService and BugreportStorageProvider are guaranteed the same and unique protected static Uri getNotificationUri() { return DocumentsContract.buildChildDocumentsUri(AUTHORITY, DOC_ID_ROOT); } private static String[] resolveRootProjection(String[] projection) { return projection != null ? projection : DEFAULT_ROOT_PROJECTION; } Loading