Monday, September 12, 2016

cyanogenmod - How to manually restore Call Log from adb backup on OnePlus One? (SMS already restored)


I ran adb backup with all the backup flags on my OnePlus One (which I had gradually upgraded from 44S to 05Q). Then I wiped it, reimaged it with a fresh image of 05Q, and tried to restore my SMS and call logs.


I managed to restore the SMS history by copying back the /data/data/com.android.providers.telephony/databases folder to my new phone and setting the permissions appropriately. But for the life of me I can't figure out how to restore my call logs -- I can't figure out which folder to restore from and I can't figure out where to restore it to. It seems to me that the two might be different because I originally upgraded the phone from a slightly older version of Cyanogenmod whereas the fresh copy is completely new, but either way I can't figure out how to do this. I have a nagging feeling that the call log might not have even been backed up, but that would be strange because the SMS log was...


Any ideas?



Answer



Note: OP already knows the answer but the following info is for those souls who might be troubled with the same issue.





CM11 in OnePlus One (be it 44S or 05Q update) doesn't have any provision to get the Contacts and Call logs get backed up and restored using ADB.


So unfortunately, the answer is simple: your contacts and call logs were not backed up by ADB because the developer(s) of CM11 didn't allow it, and so, you should look for other ways to restore them (hint: Google Contacts Sync).



Also, if it matters:



  • /data/data/com.android.providers.telephony/databases is where you'll find the database for SMS/MMS

  • /data/data/com.android.providers.contacts/databases/ is where you'll see the Contacts and the Call logs


You can now stop reading if you're satiated by the answer, and I recommend to get busy in finding some recovery methods to regain access to Contacts and Call logs.


However, some souls want a reason for an event no matter what, so here we go with one such reason!





Why is that private content such as SMS/MMS were backed up but not the Contacts?



You've to note that since Jelly Bean was launched this has not been a common behavior exhibited in Android Open Source Code (AOSP) and neither by most of the stock ROMs to allow backup of said private content by ADB, i.e. both Telephony Provider (has SMS/MMS database) and Contacts Provider (has Contacts and Call logs) are usually developed to not to participate in backup and restore infrastructure of the Android system. However, CM11 has some changes which allows SMS/MMS to be backed up but leave the Contacts and Call logs in the dirt.


What are those changes?


My finding states that in CM11, a flag named android:allowBackup="false" was eventually removed from Telephony Provider but remained untouched in Contacts Provider. This flag is always introduced under the app's AndroidManifest.xml.


Google here has to say this regarding that flag:



android:allowBackup


Whether to allow the application to participate in the backup and restore infrastructure. If this attribute is set to false, no backup or restore of the application will ever be performed, even by a full-system backup that would otherwise cause all application data to be saved via adb. The default value of this attribute is true.



(Emphasis mine)


However, for some reason, CM12 reverted back this decision and now, both the apps doesn't allow backup from ADB at all.



If you intend to to see the source of the said packages, then take a look at AndroidManifest.xml of Telephony Providers for:



  • CM11 -- no such flag under

  • CM12 -- has that flag under


But for Contacts Provider both CM11 and CM12 has the flag untouched.


You can further verify this information from the AndroidManifest.xml of both the packages that you've in your CM11. You would find that the flag is present in one app and not in the other.


Note that the default behavior as mentioned in original source code of Android is to disallow backup in both apps for Kitkat release.


As for why CM11 developer(s) made such changes, I would advise asking them directly.


Done for now!





You may checkout my similar answer mentioned here for the question: Backup/Restore SMS/MMS via ADB on a non-rooted device?.


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...