AudioService: add restriction on audio mode selection

Do not allow an app to change audio mode via AudioManager.setMode()
when the mode is already IN_CALL or IN_COMMUNICATION unless:
1) the app has MODIFY_PHONE_STATE permission
Or
2) the app is current audio mode owner.

Bug: 148368476
Test: manual cell and VoIP calls
Test: atest AudioManagerTest#testAccessMode
Change-Id: Ieaf3e4355380722529792d2b36413c6b3a16d327
1 file changed