Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,814,032 Members 43,756 Now Online
XDA Developers Android and Mobile Development Forum

[GUIDE] [MOD] How to make Call Log Limit practically Unlimited (more than 500)

Tip us?
 
pollob666
Old
(Last edited by pollob666; 17th September 2014 at 06:50 AM.) Reason: Tested Device Update
#1  
pollob666's Avatar
Member - OP
Thanks Meter 72
Posts: 53
Join Date: Mar 2011
Location: Dhaka

 
DONATE TO ME
Lightbulb [GUIDE] [MOD] How to make Call Log Limit practically Unlimited (more than 500)

Background Story:

I was missing the CyberShot Camera too much and found Google Camera has been ported to JB And I also wanted to try the Moded LifeLog app, which somehow was not working on my Pacman Rom.
These were the reasons I Decided to come back to JB Stock Base. I had a previous Nandroid Backup of Lovin's Z2 ROM for XV. I took all my Call-Log and SMS Backups and also took backup of some apps that I used. Then I restored the NAND Backup today.
after that I started restoring the apps+data. Everything was fine.

After few hours of using, As I always do, I took the periodic backup of my Call Logs again. That's when I noticed, the previous Logs were 700+ and now after making some calls, it came down to 500. after Some test, I found out, this is not problem of Backup software.
A little Google search revealed Android has a default call log limit set to 500 Calls.

I searched for Xposed Mod for this, found TrimNot. But it showed error. Most probably, it is only for KK. Then I thought why not MOD it myself?

That's how it all started...

The research & work procedure:
 

I first thought, OK, I need to find where the Calls are stored. After passing some time with Google, I found, the Logs are stored in a SQlite3 Database, in
Code:
/data/data/com.android.providers.contacts/databases/contacts2.db
There is no limit in this database storage. So, the limit must be in the code.

After another couple of hours, I found that Android checks if the contacts has reached 500 then removes the older. Searching with

Quote:
Call Log Android
in android API reference, where I found some leads on my research.

"public class CallLog" which is under "android.provider.CallLog"

Something told me, to look for this class, in the actual source code. But that's almost 30 GB and I don't have time. from some prior Java knowledge I knew, all class have their own source file, with the same name, So the name would be "CallLog.java"
Now I searched Google, with it and found exactly what I was looking for. The search took me to a Git page android/platform_frameworks_base

And here I found this code.

Code:
Select Code
private static void removeExpiredEntries(Context context) {
            final ContentResolver resolver = context.getContentResolver();
            resolver.delete(CONTENT_URI, "_id IN " +
                    "(SELECT _id FROM calls ORDER BY " + DEFAULT_SORT_ORDER
                    + " LIMIT -1 OFFSET 500)", null);
        }
The file is located in
Code:
Select Code
platform_frameworks_base/core/java/android/provider/CallLog.java
and from the name I guessed, this should be inside framework files. Then I went into action. I first tried to de-compile the framework-res.apk file. I used Advanced APKTool by BDFreak
Using the windows search tool, I searched for "call log". I found nothing. Then I tried to de-compile "framework.jar". For this, I followed guide by Rizal Lovins - [Share Latest Apktool 4.2.2/Guide/Tutorial/] How to Decompile/Compile/Sign Apk/Jar

after the de-compiling was Done, I found there is a "android/provider" folder. Yes, it look similar to "platform_frameworks_base/core/java/android/provider/CallLog.java"
So, here should be the files. And I found Two files

Code:
Select Code
CallLog$Calls.smali
CallLog.smali
I opened both with Notepad++,

CallLog.smali gave me noting.

But after a careful search, I found the exact query inside the ]CallLog$Calls.smali file.
I found this line -
Code:
Select Code
const-string v2, "_id IN (SELECT _id FROM calls ORDER BY date DESC LIMIT -1 OFFSET 500)"
I just changed 500 to 100000 and I knew my task was done.

I then recompiled the framework.jar and took backup of my original framework.jar (took Nandroid backup ), replaced the original with my modified JAR file. Set the permission rw-r-r or 644. Then rebooted my phone.


Testing:
After the phone started, I made a call, then took backup of the Call Log with Call Log Backup Restore it showed 501.

This means my task is done.

Then I thought, why not share the whole experience today in XDA. So I started Writing this Guide.

F.A.Q.
 
  1. Why I need more than 500 Call Log ?
    - Well I work in Billing Department of a GSM Phone Exchange/Gateway. I periodically cross check my phone Call Logs with the Exchange SoftSwitch Data. Except for that, It's just fun to try something new.
  2. Why this guide has no steps or required steps?
    - Because, if anything I missed, those will be added later in the FAQ, from the comments.
  3. Is this tested on any device?
    -Yes,
    My # Xperia V with LOVINS X™ Z2 ROM 9.2.A.2.5
    # Xperia V NeoWave™ ROM
    # Xperia TX OmniRom
    # Xperia TX (unknown ROM )
    # Xperia Z2 (unknown ROM )
    # Xperia P Stock ROM
    #Xperia P JB based Enigma v7.2 ROM
  4. Can this work on my T/TX/TL/Z/Z1 etc. etc.
    - Theoretically it should work on any Device and any ROM. But, practically, I don't know, why don't you try yourself and let me know
  5. I'm newbie, can you provide me more simple guide?
    - Well I'm a Newbie myself Just take a Nandroid Backup and start the process. What can go wrong? At most you'll have to restore the backup.
    Go to every link and read those too. And Don't forget to Thank those people who provided the Tools and Guides.

    Still If you don't understand my guide, read it twice, if it doesn't work read again.

    Ha Ha Ha kidding. Here you go A Simple guide


Update:
I switched to NeoWave™ ROM and just as usual applied my MOD. Restored 800+ Call Log from Backup. Now I find another limitation. It's in the Dialer. In the KitKat Call History, there is a Statistics option. Here it always shows
Quote:
TOTAL: 500 Calls,....
So Now I'm digging the sources again to make the stats go higher.

Update: The issue was caused because, after sometimes (any call), the call history automatically turned to 500. Because the framework.jar was odexed and i guess, odex file had the old value set again. And for the NeoWave I used android MultiTool, it showed one error while compiling, Unsigned Short value exceeds, I didn't notice that. My bad. Now I have done the Mod again with Apktool (Lovins shared one) and removed the odex file and then Everything seems fine. Even the Statistics Shows, TOATAL: 1203 Calls, ....
Attached Images
File Type: jpg Portal-Focus.jpg - [Click for QR Code] (221.0 KB, 34 views)
_______________________________________________
Xperia V with PAC-MAN Nightly LOVINS X™ Z2 ROM NeoWave™
Xperia U
iPhone 3G (Finally got rid of it)
Xperia Arc S (Also Stolen)
Xperia X10 Mini (Stolen)
The Following 7 Users Say Thank You to pollob666 For This Useful Post: [ Click to Expand ]
 
Antiga Prime
Old
#2  
Senior Member
Thanks Meter 545
Posts: 816
Join Date: Sep 2012
Tested on OmniRom and works as expected. I've used an Xposed module before which does the same thing, but it's always nice to find new ways to implement things without having to use Xposed.
MB525 - Bayer Camera - Slim-mb526-4.4.2.beta.2.4-UNOFFICIAL-20140120-1830
Sony Xperia TX LT29i - CARBON-KK-UNOFFICIAL_Hayabusa_build7
The Following User Says Thank You to Antiga Prime For This Useful Post: [ Click to Expand ]
 
pollob666
Old
(Last edited by pollob666; 9th September 2014 at 03:54 AM.)
#3  
pollob666's Avatar
Member - OP
Thanks Meter 72
Posts: 53
Join Date: Mar 2011
Location: Dhaka

 
DONATE TO ME
Quote:
Originally Posted by Antiga Prime View Post
Tested on OmniRom and works as expected. I've used an Xposed module before which does the same thing, but it's always nice to find new ways to implement things without having to use Xposed.
Thanks for the Confirmation. I am updating the Tested Device & ROM. Your device is TX, Right? I guessed from the signeture
_______________________________________________
Xperia V with PAC-MAN Nightly LOVINS X™ Z2 ROM NeoWave™
Xperia U
iPhone 3G (Finally got rid of it)
Xperia Arc S (Also Stolen)
Xperia X10 Mini (Stolen)
 
tianzhisun
Old
#4  
Member
Thanks Meter 10
Posts: 39
Join Date: Apr 2013
Quote:
Originally Posted by Antiga Prime View Post
Tested on OmniRom and works as expected. I've used an Xposed module before which does the same thing, but it's always nice to find new ways to implement things without having to use Xposed.
Would you like to share the Xposed module you used before?
 
Antiga Prime
Old
#5  
Senior Member
Thanks Meter 545
Posts: 816
Join Date: Sep 2012
Quote:
Originally Posted by pollob666 View Post
Thanks for the Confirmation. I am updating the Tasted Device & ROM. Your device is TX, Right? I guessed from the signeture
Yes, I have a TX.

Quote:
Originally Posted by tianzhisun View Post
Would you like to share the Xposed module you used before?
It's the same one linked in the OP, except it's named TrimNot, not TimNot. I thought it might be a different one given that the one linked above didn't work for @pollob666, but I guess it's because I'm on a 4.4 ROM.
MB525 - Bayer Camera - Slim-mb526-4.4.2.beta.2.4-UNOFFICIAL-20140120-1830
Sony Xperia TX LT29i - CARBON-KK-UNOFFICIAL_Hayabusa_build7
 
pollob666
Old
#6  
pollob666's Avatar
Member - OP
Thanks Meter 72
Posts: 53
Join Date: Mar 2011
Location: Dhaka

 
DONATE TO ME
Quote:
It's the same one linked in the OP, except it's named TrimNot, not TimNot. I thought it might be a different one given that the one linked above didn't work for @pollob666, but I guess it's because I'm on a 4.4 ROM.
Oops.. It was a Typo Yes, TrimNot works on KK but not on JB. that is why I needed to modify my Android Framework.
_______________________________________________
Xperia V with PAC-MAN Nightly LOVINS X™ Z2 ROM NeoWave™
Xperia U
iPhone 3G (Finally got rid of it)
Xperia Arc S (Also Stolen)
Xperia X10 Mini (Stolen)
 
acb123
Old
#7  
Member
Thanks Meter 34
Posts: 86
Join Date: Apr 2011
This is great and I will try it out.

But there is also another ridiculous limitation, that is the maximum of 20 alarms you can have in the clock
 
usb2
Old
(Last edited by usb2; 8th September 2014 at 09:12 AM.)
#8  
usb2's Avatar
Member
Thanks Meter 33
Posts: 76
Join Date: May 2010
Location: Italia
Quote:
Originally Posted by acb123 View Post
This is great and I will try it out.

But there is also another ridiculous limitation, that is the maximum of 20 alarms you can have in the clock
for the clock there is this guide http://forum.xda-developers.com/show...01&postcount=6 give it a look
Click the "Thanks" button if I've helped you

My Phone: Xperia U ST25i
ROM: JB 4.1.2 Devswift1 lite v6
Framework: rakz992's Z1 framework
Kernel: experimental v12 (with dual recovery by kontini)
Bootloader: unlocked
The Following User Says Thank You to usb2 For This Useful Post: [ Click to Expand ]
 
pollob666
Old
#9  
pollob666's Avatar
Member - OP
Thanks Meter 72
Posts: 53
Join Date: Mar 2011
Location: Dhaka

 
DONATE TO ME
Quote:
Originally Posted by acb123 View Post
This is great and I will try it out.
After trying, give us the update.

Quote:
But there is also another ridiculous limitation, that is the maximum of 20 alarms you can have in the clock
I didn't notice that. Let's see what we can do about that
_______________________________________________
Xperia V with PAC-MAN Nightly LOVINS X™ Z2 ROM NeoWave™
Xperia U
iPhone 3G (Finally got rid of it)
Xperia Arc S (Also Stolen)
Xperia X10 Mini (Stolen)
The Following User Says Thank You to pollob666 For This Useful Post: [ Click to Expand ]
 
usb2
Old
#10  
usb2's Avatar
Member
Thanks Meter 33
Posts: 76
Join Date: May 2010
Location: Italia
Quote:
Originally Posted by pollob666 View Post

I didn't notice that. Let's see what we can do about that
give a look at the link in the post above yours... it's for z2 but it could work also for other version
Click the "Thanks" button if I've helped you

My Phone: Xperia U ST25i
ROM: JB 4.1.2 Devswift1 lite v6
Framework: rakz992's Z1 framework
Kernel: experimental v12 (with dual recovery by kontini)
Bootloader: unlocked

The Following User Says Thank You to usb2 For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes