Stop active MediaProjection callbacks before registering new callbacks

A race condition when starting a new mediaprojection session during an active one was caused by new callbacks being registered then immediately stopped when cleaning up callbacks from the previous session. Instead, existing callbacks should be stopped before new callbacks are registered.

Bug: 279417791
Test: atest FrameworksServicesTests:MediaProjectionManagerServiceTest#testCreateProjection_priorProjectionGrant
Test: smoke test on Felix & Tangor
Change-Id: I7c61f0da14f9be5c5a49792c9b336070b9a40e6e
2 files changed