diff options
author | Wei Liu <luciferleo@google.com> | 2015-06-18 22:52:37 -0700 |
---|---|---|
committer | Wei Liu <luciferleo@google.com> | 2015-06-18 22:52:37 -0700 |
commit | 9fbee9ba98585382bc5f974a614d8949a362eb8b (patch) | |
tree | 368cbfc248aeea3057c8436aaa75ff3c29faac31 /packages | |
parent | 3233a0a65c8bd2acce4b8fdfe6ce8e6c20b9a24d (diff) | |
parent | 1dac6bd9fb2b7dbfb64686c67910e496913a4dca (diff) | |
download | frameworks_base-9fbee9ba98585382bc5f974a614d8949a362eb8b.zip frameworks_base-9fbee9ba98585382bc5f974a614d8949a362eb8b.tar.gz frameworks_base-9fbee9ba98585382bc5f974a614d8949a362eb8b.tar.bz2 |
resolved conflicts for merge of 1dac6bd9 to mnc-dev
Change-Id: I000b35f5e2658a065c780396254bcb88f1cbce5e
Diffstat (limited to 'packages')
-rw-r--r-- | packages/Shell/src/com/android/shell/BugreportReceiver.java | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/packages/Shell/src/com/android/shell/BugreportReceiver.java b/packages/Shell/src/com/android/shell/BugreportReceiver.java index 13747ed..0c84fa1 100644 --- a/packages/Shell/src/com/android/shell/BugreportReceiver.java +++ b/packages/Shell/src/com/android/shell/BugreportReceiver.java @@ -27,6 +27,7 @@ import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import android.content.res.Configuration; import android.net.Uri; import android.os.AsyncTask; import android.os.FileUtils; @@ -77,21 +78,12 @@ public class BugreportReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { + final Configuration conf = context.getResources().getConfiguration(); final File bugreportFile = getFileExtra(intent, EXTRA_BUGREPORT); final File screenshotFile = getFileExtra(intent, EXTRA_SCREENSHOT); - // Files are kept on private storage, so turn into Uris that we can - // grant temporary permissions for. - final Uri bugreportUri = FileProvider.getUriForFile(context, AUTHORITY, bugreportFile); - final Uri screenshotUri = FileProvider.getUriForFile(context, AUTHORITY, screenshotFile); - - boolean isPlainText = bugreportFile.getName().toLowerCase().endsWith(".txt"); - if (!isPlainText) { - // Already zipped, send it right away. - sendBugreportNotification(context, bugreportFile, screenshotFile); - } else { - // Asynchronously zip the file first, then send it. - sendZippedBugreportNotification(context, bugreportFile, screenshotFile); + if ((conf.uiMode & Configuration.UI_MODE_TYPE_MASK) != Configuration.UI_MODE_TYPE_WATCH) { + triggerLocalNotification(context, bugreportFile, screenshotFile); } // Clean up older bugreports in background @@ -107,6 +99,29 @@ public class BugreportReceiver extends BroadcastReceiver { }.execute(); } + /** + * Responsible for triggering a notification that allows the user to start a + * "share" intent with the bug report. On watches we have other methods to allow the user to + * start this intent (usually by triggering it on another connected device); we don't need to + * display the notification in this case. + */ + private void triggerLocalNotification(final Context context, final File bugreportFile, + final File screenshotFile) { + // Files are kept on private storage, so turn into Uris that we can + // grant temporary permissions for. + final Uri bugreportUri = FileProvider.getUriForFile(context, AUTHORITY, bugreportFile); + final Uri screenshotUri = FileProvider.getUriForFile(context, AUTHORITY, screenshotFile); + + boolean isPlainText = bugreportFile.getName().toLowerCase().endsWith(".txt"); + if (!isPlainText) { + // Already zipped, send it right away. + sendBugreportNotification(context, bugreportFile, screenshotFile); + } else { + // Asynchronously zip the file first, then send it. + sendZippedBugreportNotification(context, bugreportFile, screenshotFile); + } + } + private static Intent buildWarningIntent(Context context, Intent sendIntent) { final Intent intent = new Intent(context, BugreportWarningActivity.class); intent.putExtra(Intent.EXTRA_INTENT, sendIntent); |