[Atrix 4G Android Development] maledyris:
I thought I'd offer my solution to disabling the hard key vibrations on the Atrix since other people might find this useful. This method differs from the other solutions in that it doesn't tamper with your Silent Mode vibrations (like StreakVibrations does) and it's code based, so it shouldn't tamper with any themes you have installed (like the framework-res.apk method). It is firmware dependent though since it's a code modification.

You'll need an android.policy.jar modified for your firmware.

What I'm doing is I'm modifying the method called performHapticFeedbackLw, and telling it to skip triggering the vibrate pattern for all effects (there are 5) except for keyboard taps. Long press vibe, virtual key vibe, safe mode disabled vibe, and safe mode enabled vibe will no longer trigger... Incidentally, does anyone know what safe mode on this phone refers to?

To use the file, you need to be on Bell, Telstra, GingerBlur, Gladiatrix or stock ATT 1.8.3 firmware, and be deodexed. Can you copy the file to your phone without being deodexed? I don't know. I'm a programmer, but an Android newbie so just to be safe it's best if you're deodexed.

Before you try anything, obviously make sure you are backed up. At least copy your existing android.policy.jar so that you can restore it if necessary.

All you need to do is either:

a) Run the novibes.bat script packaged in the zip. There are a couple prerequisites:

1. Make sure to set your USB connection to "None" on your phone.

2. On your phone, go to Settings > Applications > Development and make sure USB debugging is turned on.

3. Plug your phone into your PC and let it install any necessary drivers.

4. Then you can run novibes.bat.

or

b) Follow the steps outlined below to do it manually:

1. Replace /system/framework/android.policy.jar with the one that I've attached.

2. Make sure the permissions of the file are set to rw-r--r-- (thanks for reminding me, Meloy and for correcting, natboy!). The easiest way is to use Root Explorer, long press the file, choose permissions, and set owner: read/write, group:read, others:read. Otherwise, use Terminal and type "chmod 644 /system/framework/android.policy.jar" without the quotations.

3. Reboot.

For those not on stock Bell, I'd be willing to modify your android.policy.jar and post it here if you provide somewhere for me to download it, and specify what firmware it comes from. It's quite quick to do once you're set up so I don't mind. Alternatively, make the change yourself:

1. Download baksmali and smali (both .jars and scripts, total 4 files).

2. Copy /system/framework/ from your phone to your computer.

3. Copy all the files from step 1 to the framework directory from step 2 on your computer.

4. Unzip android.policy.jar and copy its classes.dex file to the framework directory on your computer.

5. From the command line, navigate to the framework directory and run "./baksmali classes.dex". It will create a directory named "out".

6. Open "out/com/android/internal/policy/impl/PhoneWindowManager.smali" in a text editor.

7. Search for a method called "performHapticFeedbackLw". Go to near the bottom of that method, and you will see the Dalvik bytecode representation of a switch statement:

.sparse-switch
0x0 -> :sswitch_27	#This is for long press vibe
0x1 -> :sswitch_35	#This is for virtual key vibe
0x3 -> :sswitch_38	#This is for keyboard tap vibe
0x2710 -> :sswitch_3b	#This is for safemode disabled vibe
0x2711 -> :sswitch_3e	#This is for safemode enabled vibe
.end sparse-switch

8. Here's an example of how you might want it to change. Basically you want to replace the original goto labels with one that causes the method to step out without triggering a vibe, and that notifies the calling method there was no vibe by returning false. The label to use is called ":cond_1d":

.sparse-switch
0x0 -> :cond_1d	#This is for long press vibe
0x1 -> :cond_1d	#This is for virtual key vibe
0x3 -> :sswitch_38	#This is for keyboard tap vibe
0x2710 -> :cond_1d	#This is for safemode disabled vibe
0x2711 -> :cond_1d	#This is for safemode enabled vibe
.end sparse-switch

9. From the command line in the framework directory, run "./smali -o classes.dex out". You now have a new classes.dex that has your modification.

10. Zip up the classes.dex with the META-INF directory from your original android.policy.jar. Rename the zip to android.policy.jar.

11. Copy the new file to your phone and reboot.

12. At this point you should be done.