[Xposed General] pollob666:
Hello,

I was trying to learn working with Xposed and modify the android.provider.CallLog to able able to store More than 500 Numbers in Lollipop.

I am using the code.

Update: I updated to the following code

package com.pollob666.calllogunlimiter;

import android.net.Uri;
import android.content.ContentResolver;
import android.content.Context;
import android.content.ContentValues;

import java.lang.reflect.Method;

import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XC_MethodReplacement;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;

import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
import static de.robv.android.xposed.XposedHelpers.findClass;
import static de.robv.android.xposed.XposedHelpers.findMethodBestMatch;

public class ApplicationTest implements IXposedHookLoadPackage {

[MENTION=439709]override[/MENTION]
public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable {
//XposedBridge.log("CallLogUnlimiter: Loaded Package - " + lpparam.packageName);
if(lpparam.processName.equals("android")) {
XposedBridge.log("CallLogUnlimiter: Loaded Package - " + lpparam.packageName);

Class<?> finder = findClass("android.provider.CallLog", lpparam.classLoader);
XposedBridge.log("CallLogUnlimiter: Loaded Class - " + finder.getName());
Method[] method = finder.getMethods();
for(int i=0; i < method.length; i++) {
XposedBridge.log("CallLogUnlimiter: Got Method - " + method[i].getName());
}

findAndHookMethod(finder.getName(), lpparam.classLoader, "addEntryAndRemoveExpiredEntries", new XC_MethodReplacement() {
[MENTION=439709]override[/MENTION]
protected Uri replaceHookedMethod(MethodHookParam paramet) throws Throwable {
Context context = ((Context) paramet.args[0]);
Uri uri = ((Uri) paramet.args[1]);
ContentValues values = ((ContentValues) paramet.args[2]);
final ContentResolver resolver = context.getContentResolver();
Uri result = resolver.insert(uri, values);

return result;
}
});
}
}
}

I was able to find the Class, But unable to Hook the Method.

This is the Log:

03-09 11:02:54.601 310-310/? D/XposedStartupMarker﹕ Current time: 1425877374, PID: 310
03-09 11:02:54.602 310-310/? I/Xposed﹕ -----------------
03-09 11:02:54.603 310-310/? I/Xposed﹕ Starting Xposed binary version 60, compiled for SDK 21
03-09 11:02:54.603 310-310/? I/Xposed﹕ Phone: Xperia V (Sony), Android version 5.0.2 (SDK 21)
03-09 11:02:54.603 310-310/? I/Xposed﹕ ROM: LRX22G test-keys
03-09 11:02:54.603 310-310/? I/Xposed﹕ Build fingerprint: Sony/LT25i/LT25i:4.3/9.2.A.1.210/Lfv_tg:user/release-keys
03-09 11:02:54.603 310-310/? I/Xposed﹕ Platform: armeabi-v7a, 32-bit binary, system server: yes
03-09 11:02:54.603 310-310/? I/Xposed﹕ SELinux enabled: yes, enforcing: no
03-09 11:02:58.580 310-310/? I/Xposed﹕ -----------------
03-09 11:02:58.594 310-310/? I/Xposed﹕ Added Xposed (/system/framework/XposedBridge.jar) to CLASSPATH
03-09 11:02:59.123 310-310/? I/Xposed﹕ Detected ART runtime
03-09 11:02:59.214 310-310/? I/Xposed﹕ Found Xposed class de/robv/android/xposed/XposedBridge, now initializing
03-09 11:02:59.760 310-310/? I/Xposed﹕ Initializing XposedBridge version 61
03-09 11:03:00.155 310-310/? I/Xposed﹕ Loading modules from /data/app/ccc71.at.free-1/base.apk
03-09 11:03:05.234 310-310/? I/Xposed﹕ Loading class ccc71.at.xposed.at_xposed_enabled
03-09 11:03:05.357 310-310/? I/Xposed﹕ Loading class ccc71.at.xposed.at_remove_battery_icon
03-09 11:03:05.372 310-310/? I/Xposed﹕ Loading class ccc71.at.xposed.at_remove_low_battery_warning
03-09 11:03:05.373 310-310/? I/Xposed﹕ Loading class ccc71.at.xposed.at_apps
03-09 11:03:05.387 310-310/? I/Xposed﹕ Loading class ccc71.at.xposed.at_fix_mnt_asec
03-09 11:03:05.395 310-310/? I/Xposed﹕ Loading modules from /data/app/com.calllogunlimiter.andalib.calllogunlimiter-2/base.apk
03-09 11:03:05.416 310-310/? I/Xposed﹕ Loading class com.pollob666.calllogunlimiter.ApplicationTest
03-09 11:03:05.420 310-310/? I/Xposed﹕ Loading modules from /data/app/com.oasisfeng.greenify-2/base.apk
03-09 11:03:05.510 310-310/? I/Xposed﹕ Loading class com.oasisfeng.greenify.pro.FrameworkPatch
03-09 11:03:05.554 310-310/? I/Xposed﹕ Loading class com.oasisfeng.greenify.pro.SettingsPatch
03-09 11:03:05.556 310-310/? I/Xposed﹕ Loading modules from /data/app/lv.id.dm.pictures2sd-1/base.apk
03-09 11:03:05.576 310-310/? I/Xposed﹕ Loading class lv.id.dm.pictures2sd.XposedModule
03-09 11:03:08.712 858-858/system_process I/XposedModule﹕ Applying patch: .management
03-09 11:03:08.724 858-858/system_process I/XposedModule﹕ Applying patch: boost_mode
03-09 11:03:08.821 858-858/system_process I/XposedModule﹕ Applying patch: timer_coalescing
03-09 11:03:08.832 858-858/system_process I/XposedModule﹕ Applying patch: keep_notifications
03-09 11:03:08.837 858-858/system_process I/XposedModule﹕ Applying patch: block_notification_abuse
03-09 11:03:08.841 858-858/system_process I/XposedModule﹕ Applying patch: telephony_wakeup
03-09 11:03:08.846 858-858/system_process I/Xposed﹕ CallLogUnlimiter: Loaded Package - android
03-09 11:03:08.846 858-858/system_process I/Xposed﹕ CallLogUnlimiter: Loaded Class - android.provider.CallLog
03-09 11:03:08.847 858-858/system_process I/Xposed﹕ CallLogUnlimiter: Got Method - equals
03-09 11:03:08.847 858-858/system_process I/Xposed﹕ CallLogUnlimiter: Got Method - getClass
03-09 11:03:08.847 858-858/system_process I/Xposed﹕ CallLogUnlimiter: Got Method - hashCode
03-09 11:03:08.847 858-858/system_process I/Xposed﹕ CallLogUnlimiter: Got Method - notify
03-09 11:03:08.847 858-858/system_process I/Xposed﹕ CallLogUnlimiter: Got Method - notifyAll
03-09 11:03:08.847 858-858/system_process I/Xposed﹕ CallLogUnlimiter: Got Method - toString
03-09 11:03:08.847 858-858/system_process I/Xposed﹕ CallLogUnlimiter: Got Method - wait
03-09 11:03:08.847 858-858/system_process I/Xposed﹕ CallLogUnlimiter: Got Method - wait
03-09 11:03:08.847 858-858/system_process I/Xposed﹕ CallLogUnlimiter: Got Method - wait
03-09 11:03:08.852 858-858/system_process E/Xposed﹕ java.lang.NoSuchMethodError: android.provider.CallLog#addEntryAndRemoveExpiredEntries()#exact
at de.robv.android.xposed.XposedHelpers.findMethodExact(XposedHelpers.java:179)
at de.robv.android.xposed.XposedHelpers.findAndHookMethod(XposedHelpers.java:129)
at de.robv.android.xposed.XposedHelpers.findAndHookMethod(XposedHelpers.java:136)
at com.pollob666.calllogunlimiter.ApplicationTest.handleLoadPackage(ApplicationTest.java:38)
at de.robv.android.xposed.IXposedHookLoadPackage$Wrapper.handleLoadPackage(IXposedHookLoadPackage.java:20)
at de.robv.android.xposed.callbacks.XC_LoadPackage.call(XC_LoadPackage.java:34)
at de.robv.android.xposed.callbacks.XCallback.callAll(XCallback.java:70)
at de.robv.android.xposed.XposedBridge$3$1.beforeHookedMethod(XposedBridge.java:249)
at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:635)
at com.android.server.SystemServer.startBootstrapServices(Unknown Source)
at com.android.server.SystemServer.run(SystemServer.java:282)
at com.android.server.SystemServer.main(SystemServer.java:185)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:117)
03-09 11:03:08.886 858-858/system_process I/Xposed﹕ Hooking: android from /data/data/ccc71.at.free/xposed/at_crystal_apps
03-09 11:03:08.898 858-858/system_process I/Xposed﹕ Hooking: android from /data/data/ccc71.at.free/xposed/at_sd_apps
03-09 11:03:35.677 858-858/system_process I/Xposed﹕ CallLogUnlimiter: Loaded Package - com.android.providers.settings
03-09 11:03:35.678 858-858/system_process I/Xposed﹕ CallLogUnlimiter: Loaded Class - android.provider.CallLog
03-09 11:03:35.678 858-858/system_process I/Xposed﹕ CallLogUnlimiter: Got Method - equals
03-09 11:03:35.678 858-858/system_process I/Xposed﹕ CallLogUnlimiter: Got Method - getClass
03-09 11:03:35.678 858-858/system_process I/Xposed﹕ CallLogUnlimiter: Got Method - hashCode
03-09 11:03:35.678 858-858/system_process I/Xposed﹕ CallLogUnlimiter: Got Method - notify
03-09 11:03:35.678 858-858/system_process I/Xposed﹕ CallLogUnlimiter: Got Method - notifyAll
03-09 11:03:35.678 858-858/system_process I/Xposed﹕ CallLogUnlimiter: Got Method - toString
03-09 11:03:35.678 858-858/system_process I/Xposed﹕ CallLogUnlimiter: Got Method - wait
03-09 11:03:35.678 858-858/system_process I/Xposed﹕ CallLogUnlimiter: Got Method - wait
03-09 11:03:35.678 858-858/system_process I/Xposed﹕ CallLogUnlimiter: Got Method - wait
03-09 11:03:35.682 858-858/system_process E/Xposed﹕ java.lang.NoSuchMethodError: android.provider.CallLog#addEntryAndRemoveExpiredEntries()#exact
at de.robv.android.xposed.XposedHelpers.findMethodExact(XposedHelpers.java:168)
at de.robv.android.xposed.XposedHelpers.findAndHookMethod(XposedHelpers.java:129)
at de.robv.android.xposed.XposedHelpers.findAndHookMethod(XposedHelpers.java:136)
at com.pollob666.calllogunlimiter.ApplicationTest.handleLoadPackage(ApplicationTest.java:38)
at de.robv.android.xposed.IXposedHookLoadPackage$Wrapper.handleLoadPackage(IXposedHookLoadPackage.java:20)
at de.robv.android.xposed.callbacks.XC_LoadPackage.call(XC_LoadPackage.java:34)
at de.robv.android.xposed.callbacks.XCallback.callAll(XCallback.java:70)
at de.robv.android.xposed.XposedBridge$4.afterHookedMethod(XposedBridge.java:276)
at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:669)
at android.app.LoadedApk.<init>(Unknown Source)
at android.app.ActivityThread.getPackageInfo(ActivityThread.java:1768)
at android.app.ActivityThread.getPackageInfo(ActivityThread.java:1730)
at android.app.ActivityThread.getPackageInfo(ActivityThread.java:1702)
at android.app.ContextImpl.createPackageContextAsUser(ContextImpl.java:2167)
at android.app.ContextImpl.createPackageContext(ContextImpl.java:2148)
at android.content.ContextWrapper.createPackageContext(ContextWrapper.java:658)
at android.app.ActivityThread.installProvider(ActivityThread.java:4972)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4594)
at android.app.ActivityThread.installSystemProviders(ActivityThread.java:5180)
at com.android.server.am.ActivityManagerService.installSystemProviders(ActivityManagerService.java:9973)
at com.android.server.SystemServer.startOtherServices(SystemServer.java:482)
at com.android.server.SystemServer.run(SystemServer.java:284)
at com.android.server.SystemServer.main(SystemServer.java:185)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:117)

But I can't Hook the CallLog or addEntryAndRemoveExpiredEntries

Can anyone please guide me, how can I Hook that Method?