WindowTracing: fix snapshot scheduling race condition

This is a fix to handle this flow:
1. ongoing WM tracing (frequency = frame)
2. Request to schedule WM snapshot on frame (set mScheduled = true)
3. Stop WM tracing (mScheduled remains true)
4. Start WM tracing (mScheduled is still true). Here mScheduled = true is an invalid state.
   There is no snapshot scheduled and it prevents subsequent snapshots to be scheduled).

Fix: 408175513
Test: atest com.android.server.wm.WindowTracingPerfettoTest
Flag: EXEMPT bugfix
Change-Id: I4101906a64b658748c68fa99efe6d9ab28a6d96a
2 files changed