Only show error if screenshot process dies within timeout period

Currently, we show a "Couldn't take screenshot" error any time the
screenshot process disconnects. However, if the screenshot process
remains up, this can result in strange superfluous notifications,
where hours later the screenshot process gets frozen/killed due to
memory pressure, and we show the notification despite the user not
trying to take a screenshot at that point.

This change adds a check so that we only show the error notification
if the screenshot process is disconnected within the timeout period
(10 seconds).

Bug: 156064134
Fix: 156064134
Test: manual -- killed the process with 'adb shell ps | grep screenshot'
and then 'adb shell kill <pid>' to verify that the error notification
appeared, then made sure it did not appear post-change.

Change-Id: I2419634ad888300abc8b50aadab5888ce653e363
1 file changed