Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 69c0292a authored by Felipe Leme's avatar Felipe Leme
Browse files

Created a new bug report workflow so user can keep track of its progress.

The old workflow was:

1. dumpstate starts.
2. When dumpstate finishes, it sends a BUGREPORT_FINISHED intent.
3. Shell's BugreportReceiver receives the BUGREPORT_FINISHED and issues a
   system notification so user can share the bug report.

The new workflow is:

1. When dumpstate starts, it sends a BUGREPORT_STARTED with its pid and
   the estimated total effort.
2. When Shell's BugreportReceiver receives the BUGREPORT_STARTED, it:
  2.1 Issues a system notification so user can watch the
      progresss (which is 0% initially).
  2.2 Starts a service (BugreportProgressService) responsible for
      polling the dumpstate progress (using system properties and the
      pid) and updating the system notification.
3. As dumpstate progress, it updates the proper system property.
4. When dumpstate finishes, it sends a BUGREPORT_FINISHED event.
5. When Shell's BugreportReceiver receives the BUGREPORT_FINISHED, it:
  5.1 Finishes the service if necessary.
  5.2 Issues a system notification so user can share the bug report.

This CL handles the Shell changes only, the dumpstate changes will be
changed in a separate CL.

BUG: 25794470
Change-Id: Icbd0b42dd48e8db376b60544348b6818c6374338
parent c14a2630
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -144,6 +144,7 @@
            android:name=".BugreportReceiver"
            android:permission="android.permission.DUMP">
            <intent-filter>
                <action android:name="android.intent.action.BUGREPORT_STARTED" />
                <action android:name="android.intent.action.BUGREPORT_FINISHED" />
            </intent-filter>
        </receiver>
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
<resources>
    <string name="app_label">Shell</string>

    <!-- Title of notification indicating a bugreport process is in progress. [CHAR LIMIT=50] -->
    <string name="bugreport_in_progress_title">Bug report in progress</string>
    <!-- Title of notification indicating a bugreport has been successfully captured. [CHAR LIMIT=50] -->
    <string name="bugreport_finished_title">Bug report captured</string>

+383 −27

File changed.

Preview size limit exceeded, changes collapsed.

+7 −2
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
package com.android.shell;

import static com.android.shell.BugreportProgressService.EXTRA_BUGREPORT;
import static com.android.shell.BugreportProgressService.EXTRA_ORIGINAL_INTENT;
import static com.android.shell.BugreportProgressService.INTENT_BUGREPORT_FINISHED;
import static com.android.shell.BugreportProgressService.getFileExtra;

import java.io.File;
@@ -50,13 +52,16 @@ public class BugreportReceiver extends BroadcastReceiver {
        // Clean up older bugreports in background
        cleanupOldFiles(intent);

        // Delegate to service.
        // Delegate intent handling to service.
        Intent serviceIntent = new Intent(context, BugreportProgressService.class);
        serviceIntent.putExtras(intent.getExtras());
        serviceIntent.putExtra(EXTRA_ORIGINAL_INTENT, intent);
        context.startService(serviceIntent);
    }

    private void cleanupOldFiles(Intent intent) {
        if (!INTENT_BUGREPORT_FINISHED.equals(intent.getAction())) {
            return;
        }
        final File bugreportFile = getFileExtra(intent, EXTRA_BUGREPORT);
        final PendingResult result = goAsync();
        new AsyncTask<Void, Void, Void>() {
+52 −1

File changed.

Preview size limit exceeded, changes collapsed.

Loading