Eleven: Fix crash with enabled visualizer but missing permission
* When the visualizer was enabled but the permission wasn't granted,
swiping the visualizer into view would close the app
* This happens since the request code for both permission requests
used to be equal
* move both codes to PreferenceUtils and give them distinct numbers
* In settings activity, the switch state didn't represent when it was
enabled but the permission denied (either directly after enabling or
also later, via Settings app)
* Fixed by setting the check-state programmatically
* AudioPlayerFragment: Would spam the logs with repeated requests since
HomeActivity's onWindowFocusChanged would be called after each request
when we denied the permission
* introduce a variable mIgnoreAfterRequest to ignore a second
setVisualizerVisible() call, indirectly triggered by
requestRecordAudio
Fixes: https://gitlab.com/LineageOS/issues/android/-/issues/3526
Change-Id: I1115a2fdd502f8317d8bf30bad463100d4ef4a54
(cherry picked from commit 16ba414d4a0d41ffb0137a958259383212b2de09)
5 files changed