diff options
author | Wei Liu <luciferleo@google.com> | 2015-06-19 06:02:54 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-06-19 06:02:54 +0000 |
commit | 01e5cf9ddffa2d2b11d2c8ece58ab4f734a597d9 (patch) | |
tree | b2f2459d670e468a6d8755486e3bcfc006e83f70 /packages/Shell | |
parent | 687b32591b29442a5c2d181e7acd72a94ce93eab (diff) | |
parent | 940335ba5b68f3382d7b42ba4fd781c8120bc370 (diff) | |
download | frameworks_base-01e5cf9ddffa2d2b11d2c8ece58ab4f734a597d9.zip frameworks_base-01e5cf9ddffa2d2b11d2c8ece58ab4f734a597d9.tar.gz frameworks_base-01e5cf9ddffa2d2b11d2c8ece58ab4f734a597d9.tar.bz2 |
am 940335ba: Merge "resolved conflicts for merge of 1dac6bd9 to mnc-dev" into mnc-dev
* commit '940335ba5b68f3382d7b42ba4fd781c8120bc370':
Wear doesn't need Shell to send notification when bugreport captured.
Diffstat (limited to 'packages/Shell')
-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); |