[Google Pixel 2 XL Guides, News, & Discussion] co4:
Since I originally wrote this I have found an even easier way that works 100% without root using Setting database editor so I've updated this guide to the better method.

as a few of us 2XL owners will know Google derped sounds on the factory image of Q and our nice charging sound has been replaced with a horrible Error sound (Google Bug tracker.)

after a few weeks of waiting & trying to fix the issue myself I have finally managed to figure it out...

turns out they're trying to access sounds from the WRONG location

UI sounds on factory Q image seem to trigger from /product/media/audio/ui but this directory only has boot animations, no audio as these files are actually located in /system/media/audio/ui

it's probably why upgrading from 9 to 10 keeps the audio settings but factory flashing doesn't.

https://play.google.com/store/apps/details?id=by4a.setedit22

Install the settings database editor (link above)

open a terminal app and type(or copy paste) the line below;

pm grant by4a.setedit22 android.permission.WRITE_SECURE_SETTINGS

or using adb:

adb shell

pm grant by4a.setedit22 android.permission.WRITE_SECURE_SETTINGS

using setedit go to the global tab and look for each of the UI audio settings, switch /product/media/audio*.* to /system/media/audio/*.*

Restart your phone to apply the settings.

car_dock_sound /system/media/audio/ui/Dock.ogg

car_undock_sound /system/media/audio/ui/Undock.ogg

desk_dock_sound /system/media/audio/ui/Dock.ogg

desk_undock_sound /system/media/audio/ui/Undock.ogg

lock_sound /system/media/audio/ui/Lock.ogg

low_battery_sound /system/media/audio/ui/LowBattery.ogg

trusted_sound /system/media/audio/ui/Trusted.ogg

unlock_sound /system/media/audio/ui/Unlock.ogg

wireless_charging_started_sound /system/media/audio/ui/ChargingStarted.ogg

Minor notes:

I'm unsure why the charging sound is dictated by wireless_charging setting.

I've had a report that settings revert after a few reboots, I've not had this myself and I've rebooted a lot but if it happens just reapply the changes in setedit.

You can also change the sounds to files on your system, I've not had luck pinpointing my sdcard folder but I have been able to change Lock.ogg to Dock.ogg as a test.

(/Sdcard/download didn't work)

_________( Old method )_________

This is my first write up so please bear with me

please note I'm not responsible for any messups you make doing this

it can be done on a terminal emulator, I prefer ADB shell

in order to sucessfully do this you will need HiddenSettings magisk module

Thank you skittles9823

I'm unsure if you need busybox but the module certainly looks for it

[B][COLOR="red"]adb shell[/COLOR][/B] or launch your [I]TerminalApp[/I]
taimen:/ $[B][COLOR="red"]su[/COLOR][/B]
taimen:/ [I]#[/I] [B][COLOR="red"]hidden[/COLOR][/B]

4 - All settings

[CHOICE]:[B][COLOR="red"]4[/COLOR][/B]

3 - Modify settings

[CHOICE]:[B][COLOR="red"]3[/COLOR][/B]

===== Modify Settings =====

[Search?]:[B][COLOR="Red"]wireless_charging_started_sound /system/media/audio/ui/ChargingStarted.ogg[/COLOR][/B]

press enter & reboot your phone.

That is pretty much it, hopfully the android team fix this next patch.

I'll add some notes from what I have found through tinkering

you must reboot after modifying EACH setting.

you can see the "=" is not added when changing the settings wireless_charging_started_sound=/system/media/audio/ui/ChargingStarted.ogg (wrong)

wireless_charging_started_sound /system/media/audio/ui/ChargingStarted.ogg (Right)

Here are all the settings i can find

car_dock_sound /system/media/audio/ui/Dock.ogg

car_undock_sound /system/media/audio/ui/Undock.ogg

desk_dock_sound /system/media/audio/ui/Dock.ogg

desk_undock_sound /system/media/audio/ui/Undock.ogg

lock_sound /system/media/audio/ui/Lock.ogg (this causes an error on my phone)

low_battery_sound /system/media/audio/ui/LowBattery.ogg

trusted_sound /system/media/audio/ui/Trusted.ogg

unlock_sound /system/media/audio/ui/Unlock.ogg

wireless_charging_started_sound /system/media/audio/ui/ChargingStarted.ogg