4

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?

8
  • /data/data/com.android.providers.contacts/databases/contacts2.db (in the table calls) I confirmed it on my Oneplus One running CM12. But I don't think ADB could've backed up that location. Please confirm if ADB did take a backup since I would have to revise my linked answer. // Oh, and it seems that you've root access, so why did you not use some good backup tool like Titanium Backup, or something? Just asking. :)
    – Firelord
    Jul 16, 2015 at 21:42
  • @Firelord: CM12 doesn't help here (I already have the fresh 05Q which is CM11, it's easy enough for me to check that myself). The problem is that the folder names seem to have changed after the original upgrade to 05Q; in fact, in my backup, the subfolder isn't even called databases/, but rather db/. This is why I'm asking the question here. In this particular case, I see com.android.contacts -- which I did try to restore (but which has no database subfolder) -- but not com.android.providers.contacts. But com.android.providers.telephony was backed up, and did seem to restore SMSs.
    – user541686
    Jul 16, 2015 at 22:12
  • @Firelord: As for why I didn't use Titanium Backup: well it's because I was stupid and thought Google's tools would do the right thing. It never occurred to me that what I wanted was so unreasonable that even the gazillion flags I passed to adb would be insufficient.
    – user541686
    Jul 16, 2015 at 22:13
  • It's not that folder names has changed from databases to db but ADB uses those short forms as conventions in just any backup. It's not related to CM11 or CM12 at all.
    – Firelord
    Jul 16, 2015 at 22:17
  • @Firelord: Oh... I see. Well, yeah I don't see that folder. Why would it back up SMS but not call logs, though? That doesn't make sense...
    – user541686
    Jul 16, 2015 at 22:18

1 Answer 1

8

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


Disappointment!

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 SMS/MMS were backed up and not the Contacts?

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 <application ..
  • CM12 -- has that flag under <application ..

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?.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .