[Partial screen sharing] Handle system-requested media projection stop in SysUI screen recorder

Stops the recording when the system notified that
it is going to stop the media projection session
or destroy the virtual display.

When the system stops the recording it will perform the same
operations as if the user clicked on 'stop' button.
If the recording is empty (e.g. system couldn't setup
screen recording and immediately stopped it) we won't save
the file and show an error toast.

Bug: 220727636
Test: com.android.systemui.screenrecord.RecordingServiceTest
Test: start screen sharing and emulate setup failure in ContentRecorder
Test: start partial screen sharing and kill the target app
Change-Id: Ic3c2342c01fbaa5f87e36418483eb431d6484a38
3 files changed