Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit ef880523 authored by William Escande's avatar William Escande
Browse files

Remove MODIFY_PHONE_STATE permission from startVoiceRecognition

Multiple reason:
1. This API was wrongly annotated with the permission, looking at the
   symmetrical stopVoiceRecognition that is no enforcing the permission

2. Legacy code was only enforcing the permission if:
  * The device passed was null (impossible according to Fwk code)
  * the device passed was not the active device AND:
    * the previous active device is not disconnected but is null
      (impossible to be both null and not disconnected)
    * Or the flag for managing the sco by audio framework is off and
      there is ongoing leaudio on the previous device and the
      connectAudio on the new device failed so it try to call
      removeActive that in turn will call stopScoUsingVirtualVoiceCall
      that require the permission, but it's impossible since we only do
      this when mVirtualCallStarted is false and here it has to be true

Since this permission was indicated on the API but never enforce, and it
looks like it shouldn't be, removing the enforcement that was put in
place with aosp/3160581 and updating the documentation of the API
accordingly

This CL is also updating the code to clarify some impossible path
discover while looking at this issue:
* startVoiceRecognition wants a non null device. if it's null it's a
  malicious binder call
* setActiveDevice has a impossible situation in which a null device
  could be connected, I removed the null device

Bug: 357736834
Fix: 357736834
Bug: 349682934
Test: m Bluetooth
Flag: Exempt partial revert
Change-Id: I0c9cef34776db20d732ab766c89206d4967a3971
parent 176136b1
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment