Lines Matching defs:info

392         final BugreportInfo info = mProcesses.get(id);
393 if (info == null) {
396 return info;
422 final BugreportInfo info = new BugreportInfo(mContext, id, pid, name, max);
428 mProcesses.put(info.id, info);
429 updateProgress(info);
436 private void updateProgress(BugreportInfo info) {
437 if (info.max <= 0 || info.progress < 0) {
438 Log.e(TAG, "Invalid progress values for " + info);
445 final String percentageText = nf.format((double) info.progress / info.max);
447 com.android.internal.R.string.cancel), newCancelIntent(mContext, info)).build();
450 infoIntent.putExtra(EXTRA_ID, info.id);
452 PendingIntent.getService(mContext, info.id, infoIntent,
459 screenshotIntent.putExtra(EXTRA_ID, info.id);
461 .getService(mContext, info.id, screenshotIntent,
467 final String title = mContext.getString(R.string.bugreport_in_progress_title, info.id);
470 info.name != null ? info.name : mContext.getString(R.string.bugreport_unnamed);
476 .setProgress(info.max, info.progress, false)
482 if (info.finished) {
484 + info + ")");
488 Log.d(TAG, "Sending 'Progress' notification for id " + info.id + " (pid " + info.pid
491 sendForegroundabledNotification(info.id, notification);
508 private static PendingIntent newCancelIntent(Context context, BugreportInfo info) {
511 intent.putExtra(EXTRA_ID, info.id);
512 return PendingIntent.getService(context, info.id, intent,
539 final BugreportInfo info = getInfo(id);
540 if (info != null && !info.finished) {
543 deleteScreenshots(info);
560 final BugreportInfo info = mProcesses.valueAt(i);
561 if (info == null) {
562 Log.wtf(TAG, "pollProgress(): null info at index " + i + "(ID = "
567 final int pid = info.pid;
568 final int id = info.id;
569 if (info.finished) {
575 info.realProgress = SystemProperties.getInt(progressKey, 0);
576 if (info.realProgress == 0) {
580 info.realMax = SystemProperties.getInt(maxKey, info.max);
581 if (info.realMax <= 0 ) {
582 Log.w(TAG, "Property " + maxKey + " is not positive: " + info.max);
587 * - info.progress / info.max represents the displayed progress
588 * - info.realProgress / info.realMax represents the real progress
593 final int oldPercentage = (CAPPED_MAX * info.progress) / info.max;
594 int newPercentage = (CAPPED_MAX * info.realProgress) / info.realMax;
595 int max = info.realMax;
596 int progress = info.realProgress;
605 if (progress != info.progress) {
607 + info.progress + " to " + progress);
609 if (max != info.max) {
611 + info.max + " to " + max);
614 info.progress = progress;
615 info.max = max;
616 info.lastUpdate = System.currentTimeMillis();
617 updateProgress(info);
619 long inactiveTime = System.currentTimeMillis() - info.lastUpdate;
622 + info.getFormattedLastUpdate());
623 stopProgress(info.id);
639 final BugreportInfo info = getInfo(id);
640 if (info == null) {
652 mInfoDialog.initialize(mContext, info);
700 final BugreportInfo info = getInfo(id);
701 if (info == null) {
705 new File(mScreenshotsDir, info.getPathNextScreenshot()).getAbsolutePath();
719 final BugreportInfo info = mProcesses.valueAt(i);
720 if (info.finished) {
721 Log.d(TAG, "Not updating progress for " + info.id + " while taking screenshot"
725 updateProgress(info);
741 final BugreportInfo info = getInfo(resultMsg.arg1);
742 if (info == null) {
749 info.addScreenshot(screenshotFile);
750 if (info.finished) {
752 info.renameScreenshots(mScreenshotsDir);
753 sendBugreportNotification(info, mTakingScreenshot);
767 private void deleteScreenshots(BugreportInfo info) {
768 for (File file : info.screenshotFiles) {
792 final BugreportInfo info = mProcesses.valueAt(i);
793 if (!info.finished) {
794 updateProgress(info);
832 BugreportInfo info = getInfo(id);
833 if (info == null) {
835 Log.v(TAG, "Creating info for untracked ID " + id);
836 info = new BugreportInfo(mContext, id);
837 mProcesses.put(id, info);
839 info.renameScreenshots(mScreenshotsDir);
840 info.bugreportFile = bugreportFile;
845 info.max = max;
850 info.addScreenshot(screenshot);
852 info.finished = true;
859 triggerLocalNotification(mContext, info);
869 private void triggerLocalNotification(final Context context, final BugreportInfo info) {
870 if (!info.bugreportFile.exists() || !info.bugreportFile.canRead()) {
871 Log.e(TAG, "Could not read bugreport file " + info.bugreportFile);
873 stopProgress(info.id);
877 boolean isPlainText = info.bugreportFile.getName().toLowerCase().endsWith(".txt");
880 sendBugreportNotification(info, mTakingScreenshot);
883 sendZippedBugreportNotification(info, mTakingScreenshot);
896 private static Intent buildSendIntent(Context context, BugreportInfo info) {
901 bugreportUri = getUri(context, info.bugreportFile);
905 Log.wtf(TAG, "Could not get URI for " + info.bugreportFile, e);
915 final String subject = !TextUtils.isEmpty(info.title) ?
916 info.title : bugreportUri.getLastPathSegment();
922 final StringBuilder messageBody = new StringBuilder("Build info: ")
926 if (!TextUtils.isEmpty(info.description)) {
927 messageBody.append("\nDescription: ").append(info.description);
933 for (File screenshot : info.screenshotFiles) {
955 BugreportInfo info = getInfo(id);
956 if (info == null) {
958 info = sharedInfo;
959 Log.d(TAG, "shareBugreport(): no info for ID " + id + " on managed processes ("
960 + mProcesses + "), using info from intent instead (" + info + ")");
962 Log.v(TAG, "shareBugReport(): id " + id + " info = " + info);
965 addDetailsToZipFile(info);
967 final Intent sendIntent = buildSendIntent(mContext, info);
994 private void sendBugreportNotification(BugreportInfo info, boolean takingScreenshot) {
997 addDetailsToZipFile(info);
1002 shareIntent.putExtra(EXTRA_ID, info.id);
1003 shareIntent.putExtra(EXTRA_INFO, info);
1005 final String title = mContext.getString(R.string.bugreport_finished_title, info.id);
1013 .setContentIntent(PendingIntent.getService(mContext, info.id, shareIntent,
1015 .setDeleteIntent(newCancelIntent(mContext, info));
1017 if (!TextUtils.isEmpty(info.name)) {
1018 builder.setSubText(info.name);
1021 Log.v(TAG, "Sending 'Share' notification for ID " + info.id + ": " + title);
1022 NotificationManager.from(mContext).notify(info.id, builder.build());
1058 private void sendZippedBugreportNotification( final BugreportInfo info,
1063 zipBugreport(info);
1064 sendBugreportNotification(info, takingScreenshot);
1074 private static void zipBugreport(BugreportInfo info) {
1075 final String bugreportPath = info.bugreportFile.getAbsolutePath();
1079 try (InputStream is = new FileInputStream(info.bugreportFile);
1082 addEntry(zos, info.bugreportFile.getName(), is);
1084 final boolean deleted = info.bugreportFile.delete();
1090 info.bugreportFile = bugreportZippedFile;
1097 * Adds the user-provided info into the bugreport zip file.
1102 private void addDetailsToZipFile(BugreportInfo info) {
1103 if (info.bugreportFile == null) {
1105 Log.wtf(TAG, "addDetailsToZipFile(): no bugreportFile on " + info);
1108 if (TextUtils.isEmpty(info.title) && TextUtils.isEmpty(info.description)) {
1112 if (info.addedDetailsToZip || info.addingDetailsToZip) {
1113 Log.d(TAG, "Already added details to zip file for " + info);
1116 info.addingDetailsToZip = true;
1120 sendBugreportBeingUpdatedNotification(mContext, info.id); // ...and that takes time
1122 final File dir = info.bugreportFile.getParentFile();
1123 final File tmpZip = new File(dir, "tmp-" + info.bugreportFile.getName());
1125 try (ZipFile oldZip = new ZipFile(info.bugreportFile);
1140 // Then add the user-provided info.
1141 addEntry(zos, "title.txt", info.title);
1142 addEntry(zos, "description.txt", info.description);
1150 info.addedDetailsToZip = true;
1151 info.addingDetailsToZip = false;
1152 stopForegroundWhenDone(info.id);
1155 if (!tmpZip.renameTo(info.bugreportFile)) {
1156 Log.e(TAG, "Could not rename " + tmpZip + " to " + info.bugreportFile);
1307 final BugreportInfo info = getInfo(id);
1308 if (info == null) {
1311 if (title != null && !title.equals(info.title)) {
1314 info.title = title;
1315 if (description != null && !description.equals(info.description)) {
1318 info.description = description;
1319 if (name != null && !name.equals(info.name)) {
1321 info.name = name;
1322 updateProgress(info);
1407 private void initialize(final Context context, BugreportInfo info) {
1409 context.getString(R.string.bugreport_info_dialog_title, info.id);
1467 mSavedName = mTempName = info.name;
1468 mId = info.id;
1469 mPid = info.pid;
1470 if (!TextUtils.isEmpty(info.name)) {
1471 mInfoName.setText(info.name);
1473 if (!TextUtils.isEmpty(info.title)) {
1474 mInfoTitle.setText(info.title);
1476 if (!TextUtils.isEmpty(info.description)) {
1477 mInfoDescription.setText(info.description);