ActiveModeWarden: Fix scan mode change handling when wifi is on

When wifi is already toggled on & then we receive a scan mode change
(from either location toggle or "wifi scanning" toggle), we should
send the role change to ClientModeManager with role=PRIMARY,
requestorWs=<previous Ws set when primary was created>. Currently, we
send role change to ClientModeManager with role=PRIMARY,
requestorWs=Process.WIFI_UID (requestorWs attached for scan mode
toggles). This results in the primary CMM's requestor priority being
reset in HalDeviceManager & causes it to be torn down when another
request comes in.

To handle this, cache the last requestorWs used to create the primary
or scan only CMM. Always attach that requestorWs when sending the
corresponding role change to primary.

Bug: 179800839
Test: atest ActiveModeWardenTest
Change-Id: I4f9317111f1a8f1b33a157184c24a404c3b637ee
2 files changed