Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,811,404 Members 48,195 Now Online
XDA Developers Android and Mobile Development Forum

I'd like to decrease dialer vibration and I need help with that..

Tip us?
 
S0bes
Old
#1  
S0bes's Avatar
Senior Member - OP
Thanks Meter 248
Posts: 266
Join Date: Jan 2012
Location: Tomsk

 
DONATE TO ME
Default I'd like to decrease dialer vibration and I need help with that..

I'm completely noob.
Here are the sources
http://grepcode.com/file/repository....mHapticPattern

Code:
public void init(Context context, boolean enabled) {
     mEnabled = enabled;
       if (enabled) 
          {
          mVibrator = new SystemVibrator(context);
          mHapticPattern = new long[] {0, DURATION, 2 * DURATION, 3 * DURATION};
          mSystemSettings = new Settings.System();
          mContentResolver = context.getContentResolver();
        }
    }
I need to change mHapticPattern array to adjust vibration duration on dialpad.
So, I can use that

Code:
findAndHookMethod("com.android.phone.common.HapticFeedback", lpparam.classLoader, "init", new XC_MethodHook() 
	    {
            @Override
            protected void afterHookedMethod(MethodHookParam param) throws Throwable {
            	// BUT I don't know what I have to write here to get it working :(
// I know that this method will be called after init method and I don't know how I can change mHapticPattern array :(
            
            }
    });
Or I think I can also change value of Duration
Quote:
private static final long DURATION = 10;
But anyway I do not know how...
I will be glad if anyone will try to help me...
The Following User Says Thank You to S0bes For This Useful Post: [ Click to Expand ]
 
GermainZ
Old
#2  
GermainZ's Avatar
Forum Moderator / Recognized Developer
Thanks Meter 6,407
Posts: 5,484
Join Date: Aug 2012
Changing DURATION directly will have no effect. This is because the compiler replaces final static variables with their values (so "10" will be directly used instead of "DURATION").

What you could do is replace the init(Context context, boolean enabled) method entirely. Check out the development tutorial (and other wiki pages) for some hints on where to get started.
The Following User Says Thank You to GermainZ For This Useful Post: [ Click to Expand ]
 
S0bes
Old
#3  
S0bes's Avatar
Senior Member - OP
Thanks Meter 248
Posts: 266
Join Date: Jan 2012
Location: Tomsk

 
DONATE TO ME
Quote:
Originally Posted by GermainZ View Post
Changing DURATION directly will have no effect. This is because the compiler replaces final static variables with their values (so "10" will be directly used instead of "DURATION").

What you could do is replace the init(Context context, boolean enabled) method entirely. Check out the development tutorial (and other wiki pages) for some hints on where to get started.
Thank you for your answer. But I did not see it till now. That's why my respond is so late.
I had one experience with replacing entire method. But it was just a boolean method. I used this example http://forum.xda-developers.com/show...60&postcount=4

And also I've tried to replace whole init method but I have a problem with that string:
Code:
mVibrator = new SystemVibrator(context);
I did
import android.os.SystemVibrator;
but this "android.os.SystemVibrator;" is highlighted with red in eclipse
It says "The import android.os.SystemVibrator cannot be resolved" but the file exists...
I have a code but because of that error I can't test it
Attached Files
File Type: txt code.txt - [Click for QR Code] (3.3 KB, 0 views)
Check out my Moto CheckBox xposed module for Moto G!
 
GermainZ
Old
#4  
GermainZ's Avatar
Forum Moderator / Recognized Developer
Thanks Meter 6,407
Posts: 5,484
Join Date: Aug 2012
Quote:
Originally Posted by S0bes View Post
It says "The import android.os.SystemVibrator cannot be resolved" but the file exists...
It's possible it's not in the SDK. Use XposedHelpers.findClass(...) to get the SystemVibrator class, then XposedHelpers.newInstance(...) to create a new instance.
The Following User Says Thank You to GermainZ For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes