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
Loading
Please register or sign in to comment