<string name="bugreport_in_progress_title">Bug report <xliff:g id="id">#%d</xliff:g> is being generated</string>
<!-- Title of notification indicating a bugreport has been successfully captured. [CHAR LIMIT=50] -->
<string name="bugreport_finished_title">Bug report <xliff:g id="id">#%d</xliff:g> captured</string>
+ <!-- Title of notification indicating a bugreport has been successfully captured, but screenshot is not finished yet. [CHAR LIMIT=50] -->
+ <string name="bugreport_finished_pending_screenshot_title">Bug report <xliff:g id="id">#%d</xliff:g> captured but screenshot pending</string>
<!-- Title of notification indicating a bugreport is being updated before it can be shared. [CHAR LIMIT=50] -->
<string name="bugreport_updating_title">Adding details to the bug report</string>
<!-- Content notification indicating a bugreport is being updated before it can be shared, asking the user to wait [CHAR LIMIT=50] -->
<string name="bugreport_finished_text" product="watch">Swipe left to share your bug report</string>
<!-- Text of notification indicating that tapping will share the captured bugreport. [CHAR LIMIT=100] -->
<string name="bugreport_finished_text" product="default">Tap to share your bug report</string>
-
+ <!-- Text of notification indicating that swipe left will share the captured bugreport, but giving user the option to wait for the screenshot. [CHAR LIMIT=100] -->
+ <string name="bugreport_finished_pending_screenshot_text" product="watch">Tap to share your bug report without a screenshot or wait for the screenshot to finish</string>
+ <!-- Text of notification indicating that tapping will share the captured bugreport, but giving user the option to wait for the screenshot. [CHAR LIMIT=100] -->
+ <string name="bugreport_finished_pending_screenshot_text" product="default">Tap to share your bug report without a screenshot or wait for the screenshot to finish</string>
<!-- Body of dialog informing user about contents of a bugreport. [CHAR LIMIT=NONE] -->
<string name="bugreport_confirm">Bug reports contain data from the system\'s various log files, including personal and private information. Only share bug reports with apps and people you trust.</string>
if (info.finished) {
Log.d(TAG, "Screenshot finished after bugreport; updating share notification");
info.renameScreenshots(mScreenshotsDir);
- sendBugreportNotification(mContext, info);
+ sendBugreportNotification(mContext, info, mTakingScreenshot);
}
msg = mContext.getString(R.string.bugreport_screenshot_taken);
} else {
boolean isPlainText = info.bugreportFile.getName().toLowerCase().endsWith(".txt");
if (!isPlainText) {
// Already zipped, send it right away.
- sendBugreportNotification(context, info);
+ sendBugreportNotification(context, info, mTakingScreenshot);
} else {
// Asynchronously zip the file first, then send it.
- sendZippedBugreportNotification(context, info);
+ sendZippedBugreportNotification(context, info, mTakingScreenshot);
}
}
/**
* Sends a notification indicating the bugreport has finished so use can share it.
*/
- private static void sendBugreportNotification(Context context, BugreportInfo info) {
+ private static void sendBugreportNotification(Context context, BugreportInfo info,
+ boolean takingScreenshot) {
// Since adding the details can take a while, do it before notifying user.
addDetailsToZipFile(context, info);
shareIntent.putExtra(EXTRA_ID, info.id);
shareIntent.putExtra(EXTRA_INFO, info);
- final String title = context.getString(R.string.bugreport_finished_title, info.id);
+ final String title, content;
+ if (takingScreenshot) {
+ title = context.getString(R.string.bugreport_finished_pending_screenshot_title,
+ info.id);
+ content = context.getString(R.string.bugreport_finished_pending_screenshot_text);
+ } else {
+ title = context.getString(R.string.bugreport_finished_title, info.id);
+ content = context.getString(R.string.bugreport_finished_text);
+ }
final Notification.Builder builder = new Notification.Builder(context)
.setSmallIcon(com.android.internal.R.drawable.stat_sys_adb)
.setContentTitle(title)
.setTicker(title)
- .setContentText(context.getString(R.string.bugreport_finished_text))
+ .setContentText(content)
.setContentIntent(PendingIntent.getService(context, info.id, shareIntent,
PendingIntent.FLAG_UPDATE_CURRENT))
.setDeleteIntent(newCancelIntent(context, info))
* Sends a zipped bugreport notification.
*/
private static void sendZippedBugreportNotification(final Context context,
- final BugreportInfo info) {
+ final BugreportInfo info, final boolean takingScreenshot) {
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
zipBugreport(info);
- sendBugreportNotification(context, info);
+ sendBugreportNotification(context, info, takingScreenshot);
return null;
}
}.execute();
private static final boolean RENAMED_SCREENSHOTS = true;
private static final boolean DIDNT_RENAME_SCREENSHOTS = false;
+ private static final boolean PENDING_SCREENSHOT = true;
+ private static final boolean NOT_PENDING_SCREENSHOT = false;
+
private String mDescription;
private String mPlainTextPath;
sendBugreportStarted(ID2, PID2, NAME2, 1000);
- Bundle extras = sendBugreportFinishedAndGetSharedIntent(ID, mZipPath, mScreenshotPath);
- assertActionSendMultiple(extras, BUGREPORT_CONTENT, SCREENSHOT_CONTENT, ID, PID, TITLE,
- NEW_NAME, TITLE, DESCRIPTION, 1, RENAMED_SCREENSHOTS);
+ sendBugreportFinished(ID, mZipPath, mScreenshotPath);
+ Bundle extras = acceptBugreportAndGetSharedIntent(ID, PENDING_SCREENSHOT);
detailsUi = new DetailsUi(mUiBot, ID2);
detailsUi.assertName(NAME2);
private Bundle sendBugreportFinishedAndGetSharedIntent(int id, String bugreportPath,
String screenshotPath) {
sendBugreportFinished(id, bugreportPath, screenshotPath);
- return acceptBugreportAndGetSharedIntent(id);
+ return acceptBugreportAndGetSharedIntent(id, NOT_PENDING_SCREENSHOT);
}
/**
* @return extras sent in the shared intent.
*/
private Bundle acceptBugreportAndGetSharedIntent(int id) {
- acceptBugreport(id);
+ return acceptBugreportAndGetSharedIntent(id, NOT_PENDING_SCREENSHOT);
+ }
+
+ private Bundle acceptBugreportAndGetSharedIntent(int id, boolean pendingScreenshot) {
+ acceptBugreport(id, pendingScreenshot);
mUiBot.chooseActivity(UI_NAME);
return mListener.getExtras();
}
* Accepts the notification to share the finished bugreport.
*/
private void acceptBugreport(int id) {
- mUiBot.clickOnNotification(mContext.getString(R.string.bugreport_finished_title, id));
+ acceptBugreport(id, NOT_PENDING_SCREENSHOT);
+ }
+
+ private void acceptBugreport(int id, boolean pendingScreenshot) {
+ final int res = pendingScreenshot ? R.string.bugreport_finished_pending_screenshot_title
+ : R.string.bugreport_finished_title;
+ mUiBot.clickOnNotification(mContext.getString(res, id));
}
/**