SystemUI: Adapt screenshot sound to ringer modes

Squashed:

SystemUI: Screenshots: Refactor shutter sound logic

* Commit 2f09bacae02fe7a99d62355331c3a26b83752a6a introduced some
  duplicated code
* Move it to an own method to reduce the footprint in the AOSP code parts
  and to reduce duplication

Change-Id: I57eaaee4db401d16cc6ef65c68604cdb4053ca01
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>

SystemUI: Fix shutter sound

* When shutter sound for camera is forced on as required in some states,
  (config_camera_sound_forced, set via mcc/mnc), we also want to
  (or should) play it when a screenshot is taken from the preview
  instead of an actual picture
* This change is loosely based on
  https://android-review.googlesource.com/c/platform/frameworks/base/+/1517742/
  but uses publicly available APIs

Testing:
- Set config_camera_sound_forced to true and push a build to device
- Turn down all stream volumes to muted
- Take screenshot of any normal screen
  -> No sound played
- Open camera, take screenshot
  -> Sound played
- Turn up volume and repeat the screenshots
  -> Sound played in all cases

Change-Id: Iacbb577c64f73b79cdfae7fb0487fc6a34ffe41c

[ghostrider-reborn] updated for android 12, 13
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
Change-Id: I5fca6c6207672a6d2fcdf20544c76dd7c5b6ab23
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
1 file changed