1. Declare the module in AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.xpomodfc"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data
android:name="xposedmodule"
android:value="true" />
<meta-data
android:name="xposeddescription"
android:value="List APP Modules and hook Some funtions"
/>
<meta-data
android:name="xposedminversion"
android:value="30" />
</application>
</manifest>
2. Create a text file called xposed_init (without .txt) in your assets folder with your main class as the content.
alt.com.TweakFC
& also create a directory named "lib" inside your project and add XPosedBridgeAPI.jar in it.
3. Inject package loading process using handleLoadPackage() method
public void handleLoadPackage(final
LoadPackageParam lpparam) throws Throwable {
if (!lpparam.packageName.equals("com.android.systemui"))
return;
XposedBridge.log("we are in SystemUI!");
}
4. Hook and replace your methods of choice. Don't forget to static import this method:
import static
de.robv.android.xposed.XposedHelpers.findAndHookMethod;
Run your code before/after a method. You can determine the returned result of the method using theMethodHookParam.
findAndHookMethod("com.example.android
", lpparam.classLoader, "isThisTheMethodToBeHooked", new
XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws
Throwable {
// this will be called before the original method is executed
if (somethingHappens) {
// modify the result of the
original method
param.setResult(false);
}
}
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable
{
// this will be called after
}
}
You can also replace the method completely. If the function has some params, make sure you include them in the findAndHookMethod function call.
You can also replace the method completely. If the function has some params, make sure you include them in the findAndHookMethod function call.
findAndHookMethod("com.example.SomeClass",
loadPackageParam.classLoader, "getAudioEnabled", Context.class,
String.class, new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam param) throws
Throwable {
return true;
}
});
Comments
Post a Comment