phhusson / treble_experimentations

Notes about tinkering with Android Project Treble
3.37k stars 657 forks source link

[Moto G6] Audio is distorted and crackling #184

Closed julianbraha closed 5 years ago

julianbraha commented 6 years ago

Whether the phone is playing audio through the speakers, or through the headphone jack, the audio is severely distorted.

phhusson commented 6 years ago

Ok, first, please give me your getprop ro.vendor.build.fingerprint

Then, try this: adb root adb remount adb shell mount -o bind /mnt/phh/empty_dir /system/lib/soundfx adb shell mount -o bind /mnt/phh/empty_dir /system/lib64/soundfx adb shell setprop ctl.restart audio-hal-2-0 adb shell stop adb shell start This will soft-restart Android. Do not reboot after this as the change is not persistent. Once android is started, check if this fixes the issue

julianbraha commented 6 years ago

ro.vendor.build.fingerprint: Xiaomi/sagit/sagit:7.1.1/NMF26X/V8.2.17.0.NCACNEC:user/release-keys

So, a few things:

  1. I installed the magisk module, viper, which partially fixed the audio, but not completely. Like the audio isn't distorted in certain cases, like using youtube or the dialer app. However, it hasn't fixed the issue for the alarm sound, or any sound in google duo. So I don't know if viper is the reason for the following:

  2. When I enter the following commands: adb shell mount -o bind /mnt/phh/empty_dir /system/lib/soundfx adb shell mount -o bind /mnt/phh/empty_dir /system/lib64/soundfx I get: failed: No such file or directory

  3. I'm also unable to use adb root while the phone is booted into android, as it returns: adbd cannot run as root in production builds However, I am able to use adb root while the phone is in the twrp recovery, which is what I attempted.

phhusson commented 6 years ago

Why the fuck does the title say Moto G6 if it's a xiaomi?

julianbraha commented 6 years ago

My device is definitely a Moto G6. I have no clue why it says xiaomi in the thing you asked me to retrieve. I bought my device through the Google store with project fi. It says motorola on the front of it. I don't have anything else plugged into my computer except for this device.

phhusson commented 6 years ago

You used magisk's resetprop or something...?

julianbraha commented 6 years ago

I have magiskhide enabled, and universal safetynet fix installed. I don't recall using anything called resetprop though.

phhusson commented 6 years ago

Ok, so please try it all again without magisk enabled. I'm pretty sure adb root works without magisk

julianbraha commented 6 years ago

ro.vendor.build.fingerprint: motorola/ali/ali:8.0.0/OPS27.82-72/88:user/release-keys

I uninstalled the modules, as well as magisk, and this time, adb root did work, but: adb shell mount -o bind /mnt/phh/empty_dir /system/lib/soundfx adb shell mount -o bind /mnt/phh/empty_dir /system/lib64/soundfx still returned "failed: No such file or directory"

Anyway, I entered the rest of the commands and the sound is still distorted and crackling.

phhusson commented 6 years ago

Ok better, thanks. Having the second command fail is okay, since it's a 32bit Android.

Please dump, inside adb shell: lsof |grep soundfx

If there is some process running it, kill them with pid

julianbraha commented 6 years ago

Here's what it returned: audio@2.0-servi 9070 audioserve mem REG 259,18 585260 1815 /vendor/lib/soundfx/libswdap.so audio@2.0-servi 9070 audioserve mem REG 259,18 16256 1811 /vendor/lib/soundfx/libqcomvoiceprocessing.so audio@2.0-servi 9070 audioserve mem REG 259,18 20484 1808 /vendor/lib/soundfx/libldnhncr.so audio@2.0-servi 9070 audioserve mem REG 259,18 20476 1806 /vendor/lib/soundfx/libdownmix.so audio@2.0-servi 9070 audioserve mem REG 259,18 20324 1816 /vendor/lib/soundfx/libvisualizer.so audio@2.0-servi 9070 audioserve mem REG 259,18 41688 1812 /vendor/lib/soundfx/libreverbwrapper.so audio@2.0-servi 9070 audioserve mem REG 259,18 76800 1805 /vendor/lib/soundfx/libbundlewrapper.so audio@2.0-servi 9070 audioserve mem REG 259,18 91152 1809 /vendor/lib/soundfx/libmmieffectswrapper.so audio@2.0-servi 9070 audioserve mem REG 259,18 16180 1807 /vendor/lib/soundfx/libeffectproxy.so audio@2.0-servi 9070 audioserve mem REG 259,18 24668 1810 /vendor/lib/soundfx/libqcomvisualizer.so audio@2.0-servi 9070 audioserve mem REG 259,18 54004 1814 /vendor/lib/soundfx/libspeakerbundle.so

phhusson commented 6 years ago

Ok. Then in adb, do kill -9 9070 Then check if sound is better. If it still doesn't work check again the lsof. After the kill the lsof should be empty

julianbraha commented 6 years ago

So I killed the process like you said, but then the audio was still distorted. So I did the lsof command again, and a new process popped up. So I killed that one and tried again. Still distorted. I checked lsof again, and there was a new process. This happened several times:

phhgsi_arm_a:/ # lsof |grep soundfx audio@2.0-servi 9070 audioserve mem REG 259,18 585260 1815 /vendor/lib/soundfx/libswdap.so audio@2.0-servi 9070 audioserve mem REG 259,18 16256 1811 /vendor/lib/soundfx/libqcomvoiceprocessing.so audio@2.0-servi 9070 audioserve mem REG 259,18 20484 1808 /vendor/lib/soundfx/libldnhncr.so audio@2.0-servi 9070 audioserve mem REG 259,18 20476 1806 /vendor/lib/soundfx/libdownmix.so audio@2.0-servi 9070 audioserve mem REG 259,18 20324 1816 /vendor/lib/soundfx/libvisualizer.so audio@2.0-servi 9070 audioserve mem REG 259,18 41688 1812 /vendor/lib/soundfx/libreverbwrapper.so audio@2.0-servi 9070 audioserve mem REG 259,18 76800 1805 /vendor/lib/soundfx/libbundlewrapper.so audio@2.0-servi 9070 audioserve mem REG 259,18 91152 1809 /vendor/lib/soundfx/libmmieffectswrapper.so audio@2.0-servi 9070 audioserve mem REG 259,18 16180 1807 /vendor/lib/soundfx/libeffectproxy.so audio@2.0-servi 9070 audioserve mem REG 259,18 24668 1810 /vendor/lib/soundfx/libqcomvisualizer.so audio@2.0-servi 9070 audioserve mem REG 259,18 54004 1814 /vendor/lib/soundfx/libspeakerbundle.so phhgsi_arm_a:/ # kill -9 9070 phhgsi_arm_a:/ # lsof |grep soundfx
audio@2.0-servi 20160 audioserve mem REG 259,18 585260 1815 /vendor/lib/soundfx/libswdap.so audio@2.0-servi 20160 audioserve mem REG 259,18 16256 1811 /vendor/lib/soundfx/libqcomvoiceprocessing.so audio@2.0-servi 20160 audioserve mem REG 259,18 20484 1808 /vendor/lib/soundfx/libldnhncr.so audio@2.0-servi 20160 audioserve mem REG 259,18 20476 1806 /vendor/lib/soundfx/libdownmix.so audio@2.0-servi 20160 audioserve mem REG 259,18 20324 1816 /vendor/lib/soundfx/libvisualizer.so audio@2.0-servi 20160 audioserve mem REG 259,18 41688 1812 /vendor/lib/soundfx/libreverbwrapper.so audio@2.0-servi 20160 audioserve mem REG 259,18 76800 1805 /vendor/lib/soundfx/libbundlewrapper.so audio@2.0-servi 20160 audioserve mem REG 259,18 91152 1809 /vendor/lib/soundfx/libmmieffectswrapper.so audio@2.0-servi 20160 audioserve mem REG 259,18 16180 1807 /vendor/lib/soundfx/libeffectproxy.so audio@2.0-servi 20160 audioserve mem REG 259,18 24668 1810 /vendor/lib/soundfx/libqcomvisualizer.so audio@2.0-servi 20160 audioserve mem REG 259,18 54004 1814 /vendor/lib/soundfx/libspeakerbundle.so phhgsi_arm_a:/ # kill 20160
phhgsi_arm_a:/ # lsof |grep soundfx
audio@2.0-servi 20651 audioserve mem REG 259,18 585260 1815 /vendor/lib/soundfx/libswdap.so audio@2.0-servi 20651 audioserve mem REG 259,18 16256 1811 /vendor/lib/soundfx/libqcomvoiceprocessing.so audio@2.0-servi 20651 audioserve mem REG 259,18 20484 1808 /vendor/lib/soundfx/libldnhncr.so audio@2.0-servi 20651 audioserve mem REG 259,18 20476 1806 /vendor/lib/soundfx/libdownmix.so audio@2.0-servi 20651 audioserve mem REG 259,18 20324 1816 /vendor/lib/soundfx/libvisualizer.so audio@2.0-servi 20651 audioserve mem REG 259,18 41688 1812 /vendor/lib/soundfx/libreverbwrapper.so audio@2.0-servi 20651 audioserve mem REG 259,18 76800 1805 /vendor/lib/soundfx/libbundlewrapper.so audio@2.0-servi 20651 audioserve mem REG 259,18 91152 1809 /vendor/lib/soundfx/libmmieffectswrapper.so audio@2.0-servi 20651 audioserve mem REG 259,18 16180 1807 /vendor/lib/soundfx/libeffectproxy.so audio@2.0-servi 20651 audioserve mem REG 259,18 24668 1810 /vendor/lib/soundfx/libqcomvisualizer.so audio@2.0-servi 20651 audioserve mem REG 259,18 54004 1814 /vendor/lib/soundfx/libspeakerbundle.so phhgsi_arm_a:/ # kill 20651
phhgsi_arm_a:/ # lsof |grep soundfx
audio@2.0-servi 20751 audioserve mem REG 259,18 585260 1815 /vendor/lib/soundfx/libswdap.so audio@2.0-servi 20751 audioserve mem REG 259,18 16256 1811 /vendor/lib/soundfx/libqcomvoiceprocessing.so audio@2.0-servi 20751 audioserve mem REG 259,18 20484 1808 /vendor/lib/soundfx/libldnhncr.so audio@2.0-servi 20751 audioserve mem REG 259,18 20476 1806 /vendor/lib/soundfx/libdownmix.so audio@2.0-servi 20751 audioserve mem REG 259,18 20324 1816 /vendor/lib/soundfx/libvisualizer.so audio@2.0-servi 20751 audioserve mem REG 259,18 41688 1812 /vendor/lib/soundfx/libreverbwrapper.so audio@2.0-servi 20751 audioserve mem REG 259,18 76800 1805 /vendor/lib/soundfx/libbundlewrapper.so audio@2.0-servi 20751 audioserve mem REG 259,18 91152 1809 /vendor/lib/soundfx/libmmieffectswrapper.so audio@2.0-servi 20751 audioserve mem REG 259,18 16180 1807 /vendor/lib/soundfx/libeffectproxy.so audio@2.0-servi 20751 audioserve mem REG 259,18 24668 1810 /vendor/lib/soundfx/libqcomvisualizer.so audio@2.0-servi 20751 audioserve mem REG 259,18 54004 1814 /vendor/lib/soundfx/libspeakerbundle.so phhgsi_arm_a:/ # kill 20751
phhgsi_arm_a:/ # lsof |grep soundfx
audio@2.0-servi 20817 audioserve mem REG 259,18 585260 1815 /vendor/lib/soundfx/libswdap.so audio@2.0-servi 20817 audioserve mem REG 259,18 16256 1811 /vendor/lib/soundfx/libqcomvoiceprocessing.so audio@2.0-servi 20817 audioserve mem REG 259,18 20484 1808 /vendor/lib/soundfx/libldnhncr.so audio@2.0-servi 20817 audioserve mem REG 259,18 20476 1806 /vendor/lib/soundfx/libdownmix.so audio@2.0-servi 20817 audioserve mem REG 259,18 20324 1816 /vendor/lib/soundfx/libvisualizer.so audio@2.0-servi 20817 audioserve mem REG 259,18 41688 1812 /vendor/lib/soundfx/libreverbwrapper.so audio@2.0-servi 20817 audioserve mem REG 259,18 76800 1805 /vendor/lib/soundfx/libbundlewrapper.so audio@2.0-servi 20817 audioserve mem REG 259,18 91152 1809 /vendor/lib/soundfx/libmmieffectswrapper.so audio@2.0-servi 20817 audioserve mem REG 259,18 16180 1807 /vendor/lib/soundfx/libeffectproxy.so audio@2.0-servi 20817 audioserve mem REG 259,18 24668 1810 /vendor/lib/soundfx/libqcomvisualizer.so audio@2.0-servi 20817 audioserve mem REG 259,18 54004 1814 /vendor/lib/soundfx/libspeakerbundle.so phhgsi_arm_a:/ # kill 20817
phhgsi_arm_a:/ # lsof |grep soundfx
audio@2.0-servi 20904 audioserve mem REG 259,18 585260 1815 /vendor/lib/soundfx/libswdap.so audio@2.0-servi 20904 audioserve mem REG 259,18 16256 1811 /vendor/lib/soundfx/libqcomvoiceprocessing.so audio@2.0-servi 20904 audioserve mem REG 259,18 20484 1808 /vendor/lib/soundfx/libldnhncr.so audio@2.0-servi 20904 audioserve mem REG 259,18 20476 1806 /vendor/lib/soundfx/libdownmix.so audio@2.0-servi 20904 audioserve mem REG 259,18 20324 1816 /vendor/lib/soundfx/libvisualizer.so audio@2.0-servi 20904 audioserve mem REG 259,18 41688 1812 /vendor/lib/soundfx/libreverbwrapper.so audio@2.0-servi 20904 audioserve mem REG 259,18 76800 1805 /vendor/lib/soundfx/libbundlewrapper.so audio@2.0-servi 20904 audioserve mem REG 259,18 91152 1809 /vendor/lib/soundfx/libmmieffectswrapper.so audio@2.0-servi 20904 audioserve mem REG 259,18 16180 1807 /vendor/lib/soundfx/libeffectproxy.so audio@2.0-servi 20904 audioserve mem REG 259,18 24668 1810 /vendor/lib/soundfx/libqcomvisualizer.so audio@2.0-servi 20904 audioserve mem REG 259,18 54004 1814 /vendor/lib/soundfx/libspeakerbundle.so phhgsi_arm_a:/ # kill 20904
phhgsi_arm_a:/ # lsof |grep soundfx
audio@2.0-servi 20969 audioserve mem REG 259,18 585260 1815 /vendor/lib/soundfx/libswdap.so audio@2.0-servi 20969 audioserve mem REG 259,18 16256 1811 /vendor/lib/soundfx/libqcomvoiceprocessing.so audio@2.0-servi 20969 audioserve mem REG 259,18 20484 1808 /vendor/lib/soundfx/libldnhncr.so audio@2.0-servi 20969 audioserve mem REG 259,18 20476 1806 /vendor/lib/soundfx/libdownmix.so audio@2.0-servi 20969 audioserve mem REG 259,18 20324 1816 /vendor/lib/soundfx/libvisualizer.so audio@2.0-servi 20969 audioserve mem REG 259,18 41688 1812 /vendor/lib/soundfx/libreverbwrapper.so audio@2.0-servi 20969 audioserve mem REG 259,18 76800 1805 /vendor/lib/soundfx/libbundlewrapper.so audio@2.0-servi 20969 audioserve mem REG 259,18 91152 1809 /vendor/lib/soundfx/libmmieffectswrapper.so audio@2.0-servi 20969 audioserve mem REG 259,18 16180 1807 /vendor/lib/soundfx/libeffectproxy.so audio@2.0-servi 20969 audioserve mem REG 259,18 24668 1810 /vendor/lib/soundfx/libqcomvisualizer.so audio@2.0-servi 20969 audioserve mem REG 259,18 54004 1814 /vendor/lib/soundfx/libspeakerbundle.so phhgsi_arm_a:/ # kill 20969
phhgsi_arm_a:/ # lsof |grep soundfx
audio@2.0-servi 21030 audioserve mem REG 259,18 585260 1815 /vendor/lib/soundfx/libswdap.so audio@2.0-servi 21030 audioserve mem REG 259,18 16256 1811 /vendor/lib/soundfx/libqcomvoiceprocessing.so audio@2.0-servi 21030 audioserve mem REG 259,18 20484 1808 /vendor/lib/soundfx/libldnhncr.so audio@2.0-servi 21030 audioserve mem REG 259,18 20476 1806 /vendor/lib/soundfx/libdownmix.so audio@2.0-servi 21030 audioserve mem REG 259,18 20324 1816 /vendor/lib/soundfx/libvisualizer.so audio@2.0-servi 21030 audioserve mem REG 259,18 41688 1812 /vendor/lib/soundfx/libreverbwrapper.so audio@2.0-servi 21030 audioserve mem REG 259,18 76800 1805 /vendor/lib/soundfx/libbundlewrapper.so audio@2.0-servi 21030 audioserve mem REG 259,18 91152 1809 /vendor/lib/soundfx/libmmieffectswrapper.so audio@2.0-servi 21030 audioserve mem REG 259,18 16180 1807 /vendor/lib/soundfx/libeffectproxy.so audio@2.0-servi 21030 audioserve mem REG 259,18 24668 1810 /vendor/lib/soundfx/libqcomvisualizer.so audio@2.0-servi 21030 audioserve mem REG 259,18 54004 1814 /vendor/lib/soundfx/libspeakerbundle.so

phhusson commented 6 years ago

Oops my bad. In the mount comment I've given, change system to vendor

julianbraha commented 6 years ago

Running that command returns:

mount: '/mnt/phh/empty_dir'->'/vendor/lib/soundfx': No such file or directory

phhusson commented 6 years ago

Oh you meant both commands were returning that error, ok. Do this then: mount -o bind /system/phh /vendor/lib/soundfx

And kill again the process found with lsof

julianbraha commented 6 years ago

Success! The sound is working great after that. Will it stick on reboot?

phhusson commented 6 years ago

no, I need to do something in the ROM for it to stick. But I'll include it in next release, which should be soon.

Le lun. 17 sept. 2018 à 18:22, Julian Braha notifications@github.com a écrit :

Success! The sound is working great after that. Will it stick on reboot?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/phhusson/treble_experimentations/issues/184#issuecomment-422079989, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAOOh7SCPa4La9wFaWnYtddMw0dFQGEks5ub8xfgaJpZM4WihuQ .

julianbraha commented 6 years ago

Despite the changelog for version 105, I can confirm after installing it on my device that the issue is not yet fixed.

Dadud commented 6 years ago

can also confirm its not fixed.

phhusson commented 6 years ago

Ok Please do: adb root adb shell sh -x /system/bin/rw-system.sh and paste the resulting logs here

julianbraha commented 6 years ago

C:\Users\Julian>adb shell sh -x /system/bin/rw-system.sh

Dadud commented 6 years ago
codejoe87 commented 5 years ago

Ok Please do: adb root adb shell sh -x /system/bin/rw-system.sh and paste the resulting logs here

Can also confirm that its not fixed. My phone is Moto G6 Plus version. Here is logs: https://ghostbin.com/paste/9wh4e

Wabo0 commented 5 years ago

Can confirm the issue on a Moto G6 running release v106 (system-arm-aonly-vanilla-nosu.img).

Initially described manual method:

$ adb root
$ adb shell
$ mount -o bind /system/phh /vendor/lib/soundfx
$ lsof | grep soundfx
$ kill -9 <PidFromOutputAbove>

Still fixes the issue until reboot. Also music playback over Bluetooth headphones (#126) seems to work after that.

On the first reboot after trying the above the phone got stuck on the "Decryption Unsuccessful" screen after entering the password. Ignoring the "Factory Rest" button and re flashing the system image resulted in a successful decryption and boot. Not sure if this is related though. I wasn't able to reproduce it.

Wabo0 commented 5 years ago

I'm still having this issue in a current build including the fix. At first I thought it was just the different fingerprints motorola/ali_n/ali_n vs motorola/ali/ali, but changing that didn't fix anything.

When is rw-system.sh being executed? And is there a way to write something to logcat from such an sh script?

Wabo0 commented 5 years ago

Fixed for me in v109 (Moto G6, system-arm-aonly-vanilla-nosu.img) Thanks :D

anoraktrend commented 5 years ago

This issue persists on the G6 play, however. I'll provide logs and such if requested.

julianbraha commented 5 years ago

I can confirm this issue is fixed (tested on v110).

phhusson commented 5 years ago

@anoraktrend https://github.com/phhusson/device_phh_treble/commit/d06769c042feda0bf50aac923db729f903991f72 this should do the trick

MiningMarsh commented 4 years ago

I know this issue is closed, but I just wanted to reconfirm for anyone else that has been looking for a fix:

On another Moto G6 flashed with the latest Pie stock vendor (specifically a RETUS variant), and v117, this issue still exists, and the described method of mounting over /vendor/lib/soundfx and killing the audio server still works.

Interestingly, using an Oreo vendor on the Pie rom does not have this problem, but that vendor stopped working on the latest releases.

A lazy but permanent fix on my device has simply been a mv /vendor/lib/soundfx /vendor/lib/soundfx.bak.

leodexe commented 4 years ago

I have a Moto Z2 Play that has this same issue, however, it only happens on Stock Pie 9.0 firmware, after digging on the XDA forums for quite some time I found out there was actually a solution.

Just like @MiningMarsh stated, on Stock Oreo firmware the audio works without any problems. So the actual solution is keeping the modem firmware from Stock Oreo, while keeping the rest of the Stock Pie firmware intact. This way it fixes the audio issue on the Z2 Play.

You could try for example flashing the Stock Oreo modem on your Moto G6 with Stock Pie 9.0 firmware to try fixing the issue, if it doesn't work you can flash again the Pie firmware again.