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

Commit d1e0f129 authored by Felipe Leme's avatar Felipe Leme
Browse files

Handle bugreport screenshots on Shell.

Currently, the bugreport screenshots are taken by dumpstate and passed to
Shell as a path on BUGREPORT_RECEIVED; this change not only delegates the
screenshot taking to Shell, but also allows user to take more
screenshots while the bugreport is being generated.

As a result of this change, the final ACTION_SEND_MULTIPLE intent might
contain multiple screenshot attachments, all of them named
"screenshot-PREFIX-NUMBER.png", where PREFIX is the bugreport
name (either initial date provided by dumpstate or a name entered by the
user) and NUMBER is the sequential number of the screenshot as taken by
the user.

The screenshot is taken using screencap, which not only is simpler than
using Framework APIs, but also faster and less intrusive. The only
drawback is that it might fail if an OEM is not providing screencap; if
that happens in the field, we'll need to add fallback option to do it
using such APIs.

Prior to this change, all work done on BugreportProgressService was
executed in one single thread (through the ServiceHandler class) but the
code was guarded by unnecessary synchronization. Now there is another
thread (ScreenshotHandler) that will be used just for taking the
screenshot (so it doesn't handle the main thread). Despite the addition
of a new thread, the code was simplified to remove most synchronization
locks, excepted for the areas touched by both threads.

Once this change is submitted, the bugreport service will be changed so
it does not ask dumpstate to take a screenshot.

BUG: 26274653
Change-Id: I1df883e3c0ca6e3e3cad2522a6a99585f71abb75
parent 98a400ed
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -494,6 +494,13 @@
    <!-- Format for build summary info [CHAR LIMIT=NONE] -->
    <string name="bugreport_status" translatable="false">%s (%s)</string>

    <!--  Toast message informing user in how many seconds a bugreport screenshot will be taken -->
    <!-- DO NOT TRANSLATE YET: final phrasing still being discussed -->
    <plurals name="bugreport_countdown">
        <item quantity="one">Taking screenshot for bug report in <xliff:g id="number">%d</xliff:g> second.</item>
        <item quantity="other">Taking screenshot for bug report in <xliff:g id="number">%d</xliff:g> seconds.</item>
    </plurals>

    <!-- label for item that enables silent mode in phone options dialog -->
    <string name="global_action_toggle_silent_mode">Silent mode</string>

+1 −0
Original line number Diff line number Diff line
@@ -1100,6 +1100,7 @@
  <java-symbol type="string" name="config_ethernet_tcp_buffers" />
  <java-symbol type="string" name="config_wifi_tcp_buffers" />

  <java-symbol type="plurals" name="bugreport_countdown" />
  <java-symbol type="plurals" name="duration_hours" />
  <java-symbol type="plurals" name="duration_minutes" />
  <java-symbol type="plurals" name="duration_seconds" />
+1 −0
Original line number Diff line number Diff line
@@ -107,6 +107,7 @@
    <uses-permission android:name="android.permission.REGISTER_CONNECTION_MANAGER" />
    <uses-permission android:name="android.permission.REGISTER_SIM_SUBSCRIPTION" />
    <uses-permission android:name="android.permission.GET_APP_OPS_STATS" />
    <uses-permission android:name="android.permission.VIBRATE" />

    <application android:label="@string/app_label"
                 android:forceDeviceEncrypted="true"
+8 −0
Original line number Diff line number Diff line
@@ -45,6 +45,14 @@
    <!-- Title of the notification action that opens the dialog for the user-defined bug report details. -->
    <string name="bugreport_info_action">Details</string>

    <!-- Title of the notification action that takes aditional screenshots. -->
    <string name="bugreport_screenshot_action">Screenshot</string>

    <!-- Toast message sent when the a screenshot for the bug report was taken successfully. -->
    <string name="bugreport_screenshot_taken">Screenshot taken succesfully.</string>
    <!-- Toast message sent when the a screenshot for the bug report was not taken due to an error. -->
    <string name="bugreport_screenshot_failed">Screenshot could not be taken.</string>

    <!--  Title of the dialog asking for user-defined bug report details like name, title, and description. -->
    <string name="bugreport_info_dialog_title">Bug report details</string>

+430 −168

File changed.

Preview size limit exceeded, changes collapsed.

Loading