[HOWTO] Finally! a REAL solution to disable noise reduction

Search This thread

drorsi

New member
Jun 22, 2007
4
21
I searched a solution to disable NR in the beginning of the call. I had an echo problem in my phone, and the only way to fix it was to disable the NR.

The problem - each time you place or answer a call we need to go to menu and disable it.

All the codes that posted here didn't disable the NR. they only disabled the menu.

After digging for a few days in the smali of the Phone.apk I found the solution -

You need to edit CallNotifier.smali -

Search for - turnOnNoiseSuppression and rem the line

In my case it looks like this.

Code:
.line 957
    .local v3, noise_reduction:Z
    iget-object v8, p0, Lcom/android/phone/CallNotifier;->mApplication:Lcom/android/phone/PhoneApp;

    const/4 v9, 0x1

    [COLOR="Red"]# [/COLOR]invoke-static {v8, v3, v9}, Lcom/android/phone/PhoneUtils;->turnOnNoiseSuppression(Landroid/content/Context;ZZ)V


And in PhoneApp$PhoneAppBroadcastReceiver.smali (not all APk's needs it)-

Code:
.line 1930
    sget-object v1, Lcom/android/phone/PhoneUtils$AMRState;->WB:Lcom/android/phone/PhoneUtils$AMRState;

    invoke-static {v1}, Lcom/android/phone/PhoneUtils;->setAMRCodec(Lcom/android/phone/PhoneUtils$AMRState;)V

    .line 1940
    :goto_9
    iget-object v1, p0, Lcom/android/phone/PhoneApp$PhoneAppBroadcastReceiver;->this$0:Lcom/android/phone/PhoneApp;

    invoke-virtual {v1}, Lcom/android/phone/PhoneApp;->getApplicationContext()Landroid/content/Context;

    move-result-object v1

    invoke-static {v1}, Lcom/android/phone/PhoneUtils;->isSupportedNoiseReductionInWBMode(Landroid/content/Context;)Z

    move-result v1

    if-nez v1, :cond_21

    if-ne v0, v5, :cond_21

    iget-object v0, p0, Lcom/android/phone/PhoneApp$PhoneAppBroadcastReceiver;->this$0:Lcom/android/phone/PhoneApp;

    invoke-virtual {v0}, Lcom/android/phone/PhoneApp;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    invoke-static {v0}, Lcom/android/phone/PhoneUtils;->isNoiseSuppressionOn(Landroid/content/Context;)Z

    move-result v0

    if-ne v0, v5, :cond_21

    .line 1943
    iget-object v0, p0, Lcom/android/phone/PhoneApp$PhoneAppBroadcastReceiver;->this$0:Lcom/android/phone/PhoneApp;

    invoke-virtual {v0}, Lcom/android/phone/PhoneApp;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    [COLOR="Red"]# [/COLOR]invoke-static {v0, v4, v4}, Lcom/android/phone/PhoneUtils;->turnOnNoiseSuppression(Landroid/content/Context;ZZ)V

Different apk's versions may have different line number and variables numbers.

This change will make the phone starts calls with NR off. (may not work in the first call after the phone boots up - looking for a fix)
you can still turn it on if you want, during the call

Enjoy!
 

ctomgee

Senior Member
Dec 21, 2010
3,563
901
This is driving me insane.

I cannot, for the life of me, get a smali folder when I decompile Phone.apk. I've tried using APKManager 4.9, and directly using APKTool.

Using APKManager, I set my project, decompile with dependencies, drag twframework-res.apk when asked.

Using APKTool, I type:
apktool d Phone.apk

Both methods, all I get are a res folder, AndroidManifest.xml, and apktool.yml.

Is there something I am missing?
 
  • Like
Reactions: organic2

petsasj

Retired Recognized Developer
Mar 22, 2010
1,605
1,501
33
Athens
This is driving me insane.

I cannot, for the life of me, get a smali folder when I decompile Phone.apk. I've tried using APKManager 4.9, and directly using APKTool.

Using APKManager, I set my project, decompile with dependencies, drag twframework-res.apk when asked.

Using APKTool, I type:
apktool d Phone.apk

Both methods, all I get are a res folder, AndroidManifest.xml, and apktool.yml.

Is there something I am missing?

Yeah, you're missing the fact that your ROM is probably odexed and not deodexed.
 
  • Like
Reactions: ctomgee

ctomgee

Senior Member
Dec 21, 2010
3,563
901
Yeah, you're missing the fact that your ROM is probably odexed and not deodexed.

Such a simple answer... *sigh*

You are correct. So how can I edit the .smali file of an odexed Phone.apk?

EDIT: Nevermind... I supposed I can just find a deodexed Phone.apk to make the change on, yeah?
 
Last edited:

petsasj

Retired Recognized Developer
Mar 22, 2010
1,605
1,501
33
Athens
Such a simple answer... *sigh*

You are correct. So how can I edit the .smali file of an odexed Phone.apk?

EDIT: Nevermind... I supposed I can just find a deodexed Phone.apk to make the change on, yeah?

Finding a deodexed Phone.apk is probably easiest fo you. I don't think you're accustomed to smali/baksmali deodexing procedures? There's a nice How-To by sicopat, but still, get a deodexed Phone.apk
 
  • Like
Reactions: clavicle

ctomgee

Senior Member
Dec 21, 2010
3,563
901
Finding a deodexed Phone.apk is probably easiest fo you. I don't think you're accustomed to smali/baksmali deodexing procedures? There's a nice How-To by sicopat, but still, get a deodexed Phone.apk

Just started learning about deodexing, yeah. I think I've found a deodexed Phone.apk for my ROM version, thanks for your help.
 
Last edited:

yay1974

Senior Member
Aug 27, 2011
389
132
Anyone can confirm it really works?

Thank you for the solution but can anyone post deodexed phone.apk with this solution here (xxki4 or xwkj3)?
 

ctomgee

Senior Member
Dec 21, 2010
3,563
901
Thank you for the solution but can anyone post deodexed phone.apk with this solution here (xxki4 or xwkj3)?

I can confirm that it DOES work. I was able to edit a deodexed Phone.apk from XXKI3, and now it defaults NR to being OFF during calls. (though, as drorsi states in the OP, it is still on for the first call after the phone boots). You still have the option of turning it on during the call if you wish.

You can find what you need to know on how to decompile/recompile .apk files at http://forum.xda-developers.com/showthread.php?t=695701.
 
  • Like
Reactions: organic2

v0dKa.mL

Senior Member
Jun 28, 2010
305
24
Cologne
i try to do this fix into the phone.apk from checkrom with call record but i didn´t find the CallNotifier.smali so i give up ;( maybe someone can help me please `

Greetz Marcel
 

eseregin

Senior Member
Jun 23, 2010
2,165
531
Moscow
Guys, could somebody be so kindly and share with us Phone.apk with NR off as default for last software KJ3 please?

ps
v0dKa, that the apk is it? from what version, why, could you explain please?
 
Last edited:

v0dKa.mL

Senior Member
Jun 28, 2010
305
24
Cologne
Sorry its the apk from the checkrom rom :) with call record

When someone have a patched apk without record but with non increasing ringtone for the kj3 please upload it

Sent from my GT-I9100 using Tapatalk
 
Last edited:
May 13, 2011
15
0
I've got the same problem with CM7 (and other ROM's btw).
Driving me insane as well.

Is there anyone kind enough to help me with this problem?

I tried the villain rom as well, with the villain tweak. But that doesnt seem to work either....
 

code72

Senior Member
Jun 1, 2005
712
203
Help

A question:

i used apkmanager and followed 1st post instructions for .smali files but when i recompile apk it asks to delete modified files from "keep" folder, what must i do?
 

ctomgee

Senior Member
Dec 21, 2010
3,563
901
A question:

i used apkmanager and followed 1st post instructions for .smali files but when i recompile apk it asks to delete modified files from "keep" folder, what must i do?

When recompiling, there will be a "keep" folder at some point. (you will be prompted on this step) Delete any file you might have edited from this folder at this step. If you edited any xml files, you'll need to delete the resources.arsc file.

Sent from my GT-I9100 using XDA App
 
Last edited:

code72

Senior Member
Jun 1, 2005
712
203
When recompiling, there will be a "keep" folder at some point. (you will be prompted on this step) Delete any file you might have edited from this folder at this step. If you edited any xml files, you'll need to delete the resources.arsc file.

Sent from my GT-I9100 using XDA App

Ok, but in "keep" folder there aren't .smali file so how can i delete them?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 21
    I searched a solution to disable NR in the beginning of the call. I had an echo problem in my phone, and the only way to fix it was to disable the NR.

    The problem - each time you place or answer a call we need to go to menu and disable it.

    All the codes that posted here didn't disable the NR. they only disabled the menu.

    After digging for a few days in the smali of the Phone.apk I found the solution -

    You need to edit CallNotifier.smali -

    Search for - turnOnNoiseSuppression and rem the line

    In my case it looks like this.

    Code:
    .line 957
        .local v3, noise_reduction:Z
        iget-object v8, p0, Lcom/android/phone/CallNotifier;->mApplication:Lcom/android/phone/PhoneApp;
    
        const/4 v9, 0x1
    
        [COLOR="Red"]# [/COLOR]invoke-static {v8, v3, v9}, Lcom/android/phone/PhoneUtils;->turnOnNoiseSuppression(Landroid/content/Context;ZZ)V


    And in PhoneApp$PhoneAppBroadcastReceiver.smali (not all APk's needs it)-

    Code:
    .line 1930
        sget-object v1, Lcom/android/phone/PhoneUtils$AMRState;->WB:Lcom/android/phone/PhoneUtils$AMRState;
    
        invoke-static {v1}, Lcom/android/phone/PhoneUtils;->setAMRCodec(Lcom/android/phone/PhoneUtils$AMRState;)V
    
        .line 1940
        :goto_9
        iget-object v1, p0, Lcom/android/phone/PhoneApp$PhoneAppBroadcastReceiver;->this$0:Lcom/android/phone/PhoneApp;
    
        invoke-virtual {v1}, Lcom/android/phone/PhoneApp;->getApplicationContext()Landroid/content/Context;
    
        move-result-object v1
    
        invoke-static {v1}, Lcom/android/phone/PhoneUtils;->isSupportedNoiseReductionInWBMode(Landroid/content/Context;)Z
    
        move-result v1
    
        if-nez v1, :cond_21
    
        if-ne v0, v5, :cond_21
    
        iget-object v0, p0, Lcom/android/phone/PhoneApp$PhoneAppBroadcastReceiver;->this$0:Lcom/android/phone/PhoneApp;
    
        invoke-virtual {v0}, Lcom/android/phone/PhoneApp;->getApplicationContext()Landroid/content/Context;
    
        move-result-object v0
    
        invoke-static {v0}, Lcom/android/phone/PhoneUtils;->isNoiseSuppressionOn(Landroid/content/Context;)Z
    
        move-result v0
    
        if-ne v0, v5, :cond_21
    
        .line 1943
        iget-object v0, p0, Lcom/android/phone/PhoneApp$PhoneAppBroadcastReceiver;->this$0:Lcom/android/phone/PhoneApp;
    
        invoke-virtual {v0}, Lcom/android/phone/PhoneApp;->getApplicationContext()Landroid/content/Context;
    
        move-result-object v0
    
        [COLOR="Red"]# [/COLOR]invoke-static {v0, v4, v4}, Lcom/android/phone/PhoneUtils;->turnOnNoiseSuppression(Landroid/content/Context;ZZ)V

    Different apk's versions may have different line number and variables numbers.

    This change will make the phone starts calls with NR off. (may not work in the first call after the phone boots up - looking for a fix)
    you can still turn it on if you want, during the call

    Enjoy!
    5
    Most ROM have a slightly different version of Phone.apk so it's best to modify the one that came with your ROM.

    Having said that, the fix is very simple (just changing a 1 to a 0) so you could hex-edit the apk/odex directly... how good is your hex editing skills?

    To make the changes via hex editing, do the following:

    For odex ROMs:
    1. Download the Phone.odex file
    2. Open in hex editor
    3. Search for the bytes: 32 84 2F 00 12 13 (there should be only 1 match)
    4. Change the last byte to 03
    5. Save and upload Phone.odex to /system/app
    6. Reboot

    For dexodex ROMs:
    1. Download the Phone.apk file
    2. Extract the classes.dex file (unzip Phone.apk classes.dex)
    3. Open in hex editor
    4. Search for the bytes: 32 84 2F 00 12 13 (there should be only 1 match)
    5. Change the last byte to 03
    6. Save and add classes.dex back to apk (zip Phone.apk classes.dex)
    7. Upload Phone.apk to /system/app
    8. Reboot

    Otherwise upload your Phone.apk and I'll make the change for u.
    3
    update for ics 4.0.3

    Most ROM have a slightly different version of Phone.apk so it's best to modify the one that came with your ROM.

    Having said that, the fix is very simple (just changing a 1 to a 0) so you could hex-edit the apk/odex directly... how good is your hex editing skills?

    To make the changes via hex editing, do the following:

    For odex ROMs:
    1. Download the Phone.odex file
    2. Open in hex editor
    3. Search for the bytes: 32 84 2F 00 12 13 (there should be only 1 match)
    4. Change the last byte to 03
    5. Save and upload Phone.odex to /system/app
    6. Reboot

    For dexodex ROMs:
    1. Download the Phone.apk file
    2. Extract the classes.dex file (unzip Phone.apk classes.dex)
    3. Open in hex editor
    4. Search for the bytes: 32 84 2F 00 12 13 (there should be only 1 match)
    5. Change the last byte to 03
    6. Save and add classes.dex back to apk (zip Phone.apk classes.dex)
    7. Upload Phone.apk to /system/app
    8. Reboot

    Otherwise upload your Phone.apk and I'll make the change for u.

    for ICS 4.0.3 you will have to search for 10 01 22 00 D6 and replace 10 with 20

    smali :

    .method private onPhoneStateChanged(Landroid/os/AsyncResult;)V
    ...
    invoke-static {v0, v1, v1}, Lcom/android/phone/PhoneUtils;->turnOnNoiseSuppression(Landroid/content/Context;ZZ)V

    second parameter has to be modified to v2:

    invoke-static {v0, v2, v1}, Lcom/android/phone/PhoneUtils;->turnOnNoiseSuppression(Landroid/content/Context;ZZ)V
    3
    Most ROM have a slightly different version of Phone.apk so it's best to modify the one that came with your ROM.

    Having said that, the fix is very simple (just changing a 1 to a 0) so you could hex-edit the apk/odex directly... how good is your hex editing skills?

    To make the changes via hex editing, do the following:

    For odex ROMs:
    1. Download the Phone.odex file
    2. Open in hex editor
    3. Search for the bytes: 32 84 2F 00 12 13 (there should be only 1 match)
    4. Change the last byte to 03
    5. Save and upload Phone.odex to /system/app
    6. Reboot

    For dexodex ROMs:
    1. Download the Phone.apk file
    2. Extract the classes.dex file (unzip Phone.apk classes.dex)
    3. Open in hex editor
    4. Search for the bytes: 32 84 2F 00 12 13 (there should be only 1 match)
    5. Change the last byte to 03
    6. Update checksum (java -jar FixDEXChecksum.jar classes.dex)
    7. Save and add classes.dex back to apk (zip Phone.apk classes.dex)
    8. Upload Phone.apk to /system/app
    9. Reboot

    * thanks to Lula for FixDEXChecksum

    Guys, there's too many versions of Phone.apk for me to fix them all. :)

    I've updated the instructions so that they will work correctly for you now so try to do them yourself. If you don't know how to use Apkmanager or apktool then I'd suggest you need to do some searching. :)
    2
    hello tarobun
    I really appreciate you if you can update your string value for ICS odex roms because after I updated to ICS again suffer from this problem and don't want to use some physical way to open my phone and the code don't exist on official ICS roms

    thank you so much

    The answer has already been provided by firero :)

    for ICS 4.0.3 you will have to search for 10 01 22 00 D6 and replace 10 with 20

    smali :

    .method private onPhoneStateChanged(Landroid/os/AsyncResult; )V
    ...
    invoke-static {v0, v1, v1}, Lcom/android/phone/PhoneUtils;->turnOnNoiseSuppression(Landroid/content/Context;ZZ)V


    second parameter has to be modified to v2:

    invoke-static {v0, v2, v1}, Lcom/android/phone/PhoneUtils;->turnOnNoiseSuppression(Landroid/content/Context;ZZ)V

    But search for just 10 01 22 00 and change first byte from 10 to 20.