Home | History | Annotate | Download | only in shell

Lines Matching refs:info

164     static final String EXTRA_INFO = "android.intent.extra.INFO";
307 writer.println(mProcesses.valueAt(i).info);
420 return listener.info;
446 final BugreportInfo info = new BugreportInfo(mContext, id, pid, name, max);
452 final DumpstateListener listener = new DumpstateListener(info);
453 mProcesses.put(info.id, listener);
455 updateProgress(info);
466 private void updateProgress(BugreportInfo info) {
467 if (info.max <= 0 || info.progress < 0) {
468 Log.e(TAG, "Invalid progress values for " + info);
472 if (info.finished) {
474 + info + ")");
481 final String percentageText = nf.format((double) info.progress / info.max);
483 String title = mContext.getString(R.string.bugreport_in_progress_title, info.id);
489 final String watchPercentageText = nf.format((double) info.progress / info.max);
494 info.name != null ? info.name : mContext.getString(R.string.bugreport_unnamed);
500 .setProgress(info.max, info.progress, false)
503 // Wear bugreport doesn't need the bug info dialog, screenshot and cancel action.
506 com.android.internal.R.string.cancel), newCancelIntent(mContext, info)).build();
509 infoIntent.putExtra(EXTRA_ID, info.id);
511 PendingIntent.getService(mContext, info.id, infoIntent,
518 screenshotIntent.putExtra(EXTRA_ID, info.id);
520 .getService(mContext, info.id, screenshotIntent,
529 final int progress = (info.progress * 100) / info.max;
531 if ((info.progress == 0) || (info.progress >= 100) ||
533 Log.d(TAG, "Progress #" + info.id + ": " + percentageText);
537 sendForegroundabledNotification(info.id, builder.build());
554 private static PendingIntent newCancelIntent(Context context, BugreportInfo info) {
557 intent.putExtra(EXTRA_ID, info.id);
558 return PendingIntent.getService(context, info.id, intent,
586 final BugreportInfo info = getInfo(id);
587 if (info != null && !info.finished) {
590 deleteScreenshots(info);
601 final BugreportInfo info = getInfo(id);
602 if (info == null) {
624 mMainThreadHandler.post(() -> mInfoDialog.initialize(mContext, info));
672 final BugreportInfo info = getInfo(id);
673 if (info == null) {
677 new File(mScreenshotsDir, info.getPathNextScreenshot()).getAbsolutePath();
691 final BugreportInfo info = mProcesses.valueAt(i).info;
692 if (info.finished) {
693 Log.d(TAG, "Not updating progress for " + info.id + " while taking screenshot"
697 updateProgress(info);
713 final BugreportInfo info = getInfo(resultMsg.arg1);
714 if (info == null) {
721 info.addScreenshot(screenshotFile);
722 if (info.finished) {
724 info.renameScreenshots(mScreenshotsDir);
725 sendBugreportNotification(info, mTakingScreenshot);
738 private void deleteScreenshots(BugreportInfo info) {
739 for (File file : info.screenshotFiles) {
763 final BugreportInfo info = mProcesses.valueAt(i).info;
764 if (!info.finished) {
765 updateProgress(info);
795 BugreportInfo info = getInfo(id);
796 if (info == null) {
798 Log.v(TAG, "Creating info for untracked ID " + id);
799 info = new BugreportInfo(mContext, id);
800 mProcesses.put(id, new DumpstateListener(info));
802 info.renameScreenshots(mScreenshotsDir);
803 info.bugreportFile = bugreportFile;
808 info.max = max;
813 info.addScreenshot(screenshot);
818 info.title = shareTitle;
821 info.shareDescription= shareDescription;
823 Log.d(TAG, "Bugreport title is " + info.title + ","
824 + " shareDescription is " + info.shareDescription);
826 info.finished = true;
831 triggerLocalNotification(mContext, info);
840 private void triggerLocalNotification(final Context context, final BugreportInfo info) {
841 if (!info.bugreportFile.exists() || !info.bugreportFile.canRead()) {
842 Log.e(TAG, "Could not read bugreport file " + info.bugreportFile);
844 stopProgress(info.id);
848 boolean isPlainText = info.bugreportFile.getName().toLowerCase().endsWith(".txt");
851 sendBugreportNotification(info, mTakingScreenshot);
854 sendZippedBugreportNotification(info, mTakingScreenshot);
867 private static Intent buildSendIntent(Context context, BugreportInfo info) {
872 bugreportUri = getUri(context, info.bugreportFile);
876 Log.wtf(TAG, "Could not get URI for " + info.bugreportFile, e);
886 final String subject = !TextUtils.isEmpty(info.title) ?
887 info.title : bugreportUri.getLastPathSegment();
893 final StringBuilder messageBody = new StringBuilder("Build info: ")
898 if (!TextUtils.isEmpty(info.description)) {
899 messageBody.append("\nDescription: ").append(info.description);
900 descriptionLength = info.description.length();
907 for (File screenshot : info.screenshotFiles) {
941 BugreportInfo info = getInfo(id);
942 if (info == null) {
944 info = sharedInfo;
945 Log.d(TAG, "shareBugreport(): no info for ID " + id + " on managed processes ("
946 + mProcesses + "), using info from intent instead (" + info + ")");
948 Log.v(TAG, "shareBugReport(): id " + id + " info = " + info);
951 addDetailsToZipFile(info);
953 final Intent sendIntent = buildSendIntent(mContext, info);
999 private void sendBugreportNotification(BugreportInfo info, boolean takingScreenshot) {
1002 addDetailsToZipFile(info);
1007 shareIntent.putExtra(EXTRA_ID, info.id);
1008 shareIntent.putExtra(EXTRA_INFO, info);
1015 if (TextUtils.isEmpty(info.title)) {
1016 title = mContext.getString(R.string.bugreport_finished_title, info.id);
1018 title = info.title;
1019 if (!TextUtils.isEmpty(info.shareDescription)) {
1020 if(!takingScreenshot) content = info.shareDescription;
1028 .setContentIntent(PendingIntent.getService(mContext, info.id, shareIntent,
1030 .setDeleteIntent(newCancelIntent(mContext, info));
1032 if (!TextUtils.isEmpty(info.name)) {
1033 builder.setSubText(info.name);
1036 Log.v(TAG, "Sending 'Share' notification for ID " + info.id + ": " + title);
1037 NotificationManager.from(mContext).notify(info.id, builder.build());
1075 private void sendZippedBugreportNotification( final BugreportInfo info,
1080 zipBugreport(info);
1081 sendBugreportNotification(info, takingScreenshot);
1091 private static void zipBugreport(BugreportInfo info) {
1092 final String bugreportPath = info.bugreportFile.getAbsolutePath();
1096 try (InputStream is = new FileInputStream(info.bugreportFile);
1099 addEntry(zos, info.bugreportFile.getName(), is);
1101 final boolean deleted = info.bugreportFile.delete();
1107 info.bugreportFile = bugreportZippedFile;
1114 * Adds the user-provided info into the bugreport zip file.
1119 private void addDetailsToZipFile(BugreportInfo info) {
1121 addDetailsToZipFileLocked(info);
1125 private void addDetailsToZipFileLocked(BugreportInfo info) {
1126 if (info.bugreportFile == null) {
1128 Log.wtf(TAG, "addDetailsToZipFile(): no bugreportFile on " + info);
1131 if (TextUtils.isEmpty(info.title) && TextUtils.isEmpty(info.description)) {
1135 if (info.addedDetailsToZip || info.addingDetailsToZip) {
1136 Log.d(TAG, "Already added details to zip file for " + info);
1139 info.addingDetailsToZip = true;
1143 sendBugreportBeingUpdatedNotification(mContext, info.id); // ...and that takes time
1145 final File dir = info.bugreportFile.getParentFile();
1146 final File tmpZip = new File(dir, "tmp-" + info.bugreportFile.getName());
1148 try (ZipFile oldZip = new ZipFile(info.bugreportFile);
1163 // Then add the user-provided info.
1164 addEntry(zos, "title.txt", info.title);
1165 addEntry(zos, "description.txt", info.description);
1173 info.addedDetailsToZip = true;
1174 info.addingDetailsToZip = false;
1175 stopForegroundWhenDone(info.id);
1178 if (!tmpZip.renameTo(info.bugreportFile)) {
1179 Log.e(TAG, "Could not rename " + tmpZip + " to " + info.bugreportFile);
1339 final BugreportInfo info = getInfo(id);
1340 if (info == null) {
1343 if (title != null && !title.equals(info.title)) {
1347 info.title = title;
1348 if (description != null && !description.equals(info.description)) {
1352 info.description = description;
1353 if (name != null && !name.equals(info.name)) {
1356 info.name = name;
1357 updateProgress(info);
1448 void initialize(final Context context, BugreportInfo info) {
1450 context.getString(R.string.bugreport_info_dialog_title, info.id);
1509 mSavedName = mTempName = info.name;
1510 mId = info.id;
1511 mPid = info.pid;
1512 if (!TextUtils.isEmpty(info.name)) {
1513 mInfoName.setText(info.name);
1515 if (!TextUtils.isEmpty(info.title)) {
1516 mInfoTitle.setText(info.title);
1518 if (!TextUtils.isEmpty(info.description)) {
1519 mInfoDescription.setText(info.description);
1890 private final BugreportInfo info;
1893 DumpstateListener(BugreportInfo info) {
1894 this.info = info;
1902 Log.d(TAG, "connect(): " + info.id + " already connected");
1924 if (!info.finished) {
1930 Log.w(TAG, "Dumpstate process died:\n" + info);
1931 stopProgress(info.id);
1940 * - info.progress / info.max represents the displayed progress
1941 * - info.realProgress / info.realMax represents the real progress
1946 info.realProgress = progress;
1947 final int oldPercentage = (CAPPED_MAX * info.progress) / info.max;
1948 int newPercentage = (CAPPED_MAX * info.realProgress) / info.realMax;
1949 int max = info.realMax;
1958 if (progress != info.progress) {
1959 Log.v(TAG, "Updating progress for PID " + info.pid + "(id: " + info.id
1960 + ") from " + info.progress + " to " + progress);
1962 if (max != info.max) {
1963 Log.v(TAG, "Updating max progress for PID " + info.pid + "(id: " + info.id
1964 + ") from " + info.max + " to " + max);
1967 info.progress = progress;
1968 info.max = max;
1969 info.lastUpdate = System.currentTimeMillis();
1971 updateProgress(info);
1978 info.realMax = maxProgress;