Only register receiver for the length of a screenshot
We're currently registering a broadcast receiver in the init method of
ScreenshotHelper, which never gets cleaned up. This can cause sysui to
crash if many screenshots are taken using the accessibility shortcut,
since that creates a new ScreenshotHelper instance for each screenshot,
and the resulting receiver is never unregistered.
This change switches to registering the broadcast receiver as part of
the screenshot handling method, and unregistering it when we reset the
screenshot connection.
Bug: 326350415
Test: manual -- verified using logs that successive screenshots taken
from the accessibility shortcut do not increase the total number of
receivers registered by system UI
Change-Id: I116cc97fac318ffa60e2cc3f9a9b033e96b2a3f6
1 file changed