Project

General

Profile

MigrateContactsDatabase » History » Version 42

Denis 'GNUtoo' Carikli, 06/03/2022 05:22 PM

1 1 Denis 'GNUtoo' Carikli
h1. MigrateContactsDatabase
2 2 Denis 'GNUtoo' Carikli
3 31 Denis 'GNUtoo' Carikli
{{toc}}
4 1 Denis 'GNUtoo' Carikli
5 31 Denis 'GNUtoo' Carikli
h2. Migration overview
6 4 Denis 'GNUtoo' Carikli
7 19 Denis 'GNUtoo' Carikli
Starting with @Replicant 6.0 0004 RC5@, the internal contact database format has changed due to the removal of some nonfree code (the Ambient SDK).
8 1 Denis 'GNUtoo' Carikli
9 19 Denis 'GNUtoo' Carikli
So when upgrading from a Replicant 6.0 image before @Replicant 6.0 0004 RC5@, you will need to follow the migration procedure that is in this wiki page.
10
11
If you follow it, you will have to backup your contact database to a file, then you will erase the internal contact database from within the Replicant recovery.
12
13
When this is done you will be able to install the new Replicant image.
14
15
After that you will be able to restore your contacts database by restoring it from the file you backuped it to.
16
17
h2. Backuping your contacts in a file
18
19 33 Denis 'GNUtoo' Carikli
First, you'll need to make sure Replicant is booted on the device and open the stock contact application. Here's how it looks like after the first start of Replicant 6.0 0003:
20 1 Denis 'GNUtoo' Carikli
21 33 Denis 'GNUtoo' Carikli
!01_launcher.png!
22
23 1 Denis 'GNUtoo' Carikli
Then if it shows a screen with "No contacts." in it, you won't need to backup the contacts to a file since you have no contacts, so you can skip this section (Backuping your contacts in a file), but you will still need to follow the rest of the tutorial in order to erase the internal contact database, otherwise your device may continuously crash after installing a new Replicant version with a different contact database format.
24
25 33 Denis 'GNUtoo' Carikli
If instead it shows some contacts, like in the following image you will then need to backup them to a file:
26
!02_contacts.png!
27 1 Denis 'GNUtoo' Carikli
28 33 Denis 'GNUtoo' Carikli
To do that you will first need to go in the contact application settings. For that click on the menu button (it's on the top right and it consists of 3 vertical dots):
29
!02_contacts.png!
30 1 Denis 'GNUtoo' Carikli
31 42 Denis 'GNUtoo' Carikli
That will display a menu. You will then have to select "Import/export":
32 1 Denis 'GNUtoo' Carikli
!03_menu.png!
33 42 Denis 'GNUtoo' Carikli
34
And then "Export to .vcf file":
35
!04_import-export-menu.png!
36
37 1 Denis 'GNUtoo' Carikli
38 33 Denis 'GNUtoo' Carikli
It will then display a new screen with many contacts. You will need to click a menu button again (it's on the top right and it consists of 3 vertical dots):
39 1 Denis 'GNUtoo' Carikli
40 33 Denis 'GNUtoo' Carikli
!05_contact-list.png!
41 1 Denis 'GNUtoo' Carikli
42 33 Denis 'GNUtoo' Carikli
Then  a new menu with only one option ("All [ ]") will appear:
43
!06_contact-list-menu.png!
44 1 Denis 'GNUtoo' Carikli
45 33 Denis 'GNUtoo' Carikli
You will need to select this option to select all contacts. This will bring to a new screen with all the contacts being checked. You will then need to press the right tick (it looks like a V) that is between the search button and the menu button on the top-right of the screen.
46 7 Denis 'GNUtoo' Carikli
47 33 Denis 'GNUtoo' Carikli
!07_contact-list-menu-checked.png!
48 7 Denis 'GNUtoo' Carikli
49 33 Denis 'GNUtoo' Carikli
Once this is done, it typically brings you to the download application that let you save your contact to a file in the device. As there are no other options you need to select "Download" on the left to save it to the download folder:
50
!08_downloads.png!
51 7 Denis 'GNUtoo' Carikli
52 33 Denis 'GNUtoo' Carikli
It's then strongly advised to copy the resulting file outside of the phone for instance:
53
* To copy it on a microSD and keep the microSD in a safe place where you won't loose it
54
* To copy it on an USB key with the help of a special usb cable
55
* To copy it on your computer with the help of adb
56 4 Denis 'GNUtoo' Carikli
57
h2. Setup ADB
58
59
Follow the instructions for [[ADB|setting up ADB on your computer]] so that you can access a root shell on your device.
60
61
*NOTE*: when prompted on your Replicant device, make sure that you check the box that says *Always allow from this computer* when you grant your computer USB debugging permissions. Otherwise, you will be unable to obtain root shell access on your Replicant device when you reboot it into the recovery OS to actually perform the backup.
62
63
*NOTE*: for security reasons, you may want to [[ADB#Revoking-all-computers-USB-debugging-permissions|revoke these non-expiring permissions]] once the backup is complete.
64
65 12 Denis 'GNUtoo' Carikli
h2. Reboot into the recovery
66
67
To reboot in the recovery, you can follow the instructions in the [[RebootIntoTheRecovery]] wiki page.
68
69 6 Denis 'GNUtoo' Carikli
h2. Mount the data partition
70
71 14 Denis 'GNUtoo' Carikli
You then need to mount the data partition.
72 1 Denis 'GNUtoo' Carikli
73 34 Denis 'GNUtoo' Carikli
For the @Galaxy S III (GT-I9300)@, @Galaxy S III 4G (GT-I9305)@, the @Galaxy Note II (GT-N7100)@ and the @Galaxy Note 8.0 (GT-N51xx)@, you can use the following command:
74 9 Denis 'GNUtoo' Carikli
<pre>
75 13 Denis 'GNUtoo' Carikli
mount /dev/block/platform/*/by-name/USERDATA /data/
76 1 Denis 'GNUtoo' Carikli
</pre>
77 9 Denis 'GNUtoo' Carikli
78 26 Denis 'GNUtoo' Carikli
And for the @Galaxy Nexus (GT-I9250)@, you can use the following command:
79 11 Denis 'GNUtoo' Carikli
<pre>
80 26 Denis 'GNUtoo' Carikli
mount /dev/block/platform/*/*/by-name/userdata /data/
81 25 Denis 'GNUtoo' Carikli
</pre>
82 11 Denis 'GNUtoo' Carikli
83 27 Denis 'GNUtoo' Carikli
For the @Galaxy S II (GT-I9100)@ and the @Galaxy Note (GT-N7000)@, you can use the following command instead:
84 26 Denis 'GNUtoo' Carikli
85 23 Denis 'GNUtoo' Carikli
<pre>
86 26 Denis 'GNUtoo' Carikli
mount /dev/block/platform/*/by-name/DATAFS /data/
87 23 Denis 'GNUtoo' Carikli
</pre>
88
89 24 Denis 'GNUtoo' Carikli
And for the @Galaxy Tab 2 (GT-P31xx, GT-P51xx)@:
90
<pre>
91
mount /dev/block/platform/*/*/by-name/DATAFS /data/
92 21 Denis 'GNUtoo' Carikli
</pre>
93 4 Denis 'GNUtoo' Carikli
94
h2. Erase your contact database
95
96 36 Denis 'GNUtoo' Carikli
Once in the recovery, you will then be able to erase your contact database. 
97 1 Denis 'GNUtoo' Carikli
98 36 Denis 'GNUtoo' Carikli
For that you need to type this command to erase the contact database:
99 2 Denis 'GNUtoo' Carikli
<pre>
100 1 Denis 'GNUtoo' Carikli
rm -rf /data/data/com.android.providers.contacts/databases/
101 36 Denis 'GNUtoo' Carikli
</pre>
102
103
And this one to make the dialer not crash after startup:
104
<pre>
105 22 Denis 'GNUtoo' Carikli
rm -rf /data/data/com.android.dialer/
106 1 Denis 'GNUtoo' Carikli
</pre>
107 4 Denis 'GNUtoo' Carikli
108 15 Denis 'GNUtoo' Carikli
Once this is done you will need to umount the userdata partition. This can be done with the following command:
109
<pre>
110 29 Denis 'GNUtoo' Carikli
umount /data/
111 15 Denis 'GNUtoo' Carikli
</pre>
112 10 Denis 'GNUtoo' Carikli
113 4 Denis 'GNUtoo' Carikli
h2. Install the new Replicant images
114 1 Denis 'GNUtoo' Carikli
115 41 Denis 'GNUtoo' Carikli
Once the backup is done, you can proceed to install the Replicant images that use the new contact database.
116 19 Denis 'GNUtoo' Carikli
117 37 Denis 'GNUtoo' Carikli
h2. Restoring your contacts from a file
118
119
First you need to launch the contact application again:
120
!01_launcher.png!
121
122
Then you end need to click on the "Import contacts" button on the bottom of the middle of the screen:
123
124 38 Denis 'GNUtoo' Carikli
!02_import_contact.png!
125 4 Denis 'GNUtoo' Carikli
126 39 Denis 'GNUtoo' Carikli
You then need to click on the "Import from .vcf file" in the popup in middle of the screen:
127
!03_import-contacts-from-vcf.png!
128
129
You then need to click on the "Local phone account" in the popup in middle of the screen:
130
131
!04_local_phone_account.png!
132
133
You then need to click on the menu button on the top-left of the screen:
134
!05_downloads.png!
135
136
It will bring another menu, you can click on "Downloads":
137
!06_downloads-downloads.png!
138
139
This is to make sure you end up in Downloads as the Downloads application could have remembered other settings, for instance you could be in Recent instead.
140
141
You can then click on the @contact.vcf@ file that you created earlier while backuping the contacts:
142
!07_downloads-select-contact-vcf.png!
143
144
It will then start importing the contacts and show a popup notification:
145
!08_importing-contact-vcf.png!
146
147
If you go to the notification area, it will then show that the importing has finished:
148
!09_check-import-done.png!
149
150
And you will then see all your contacts again:
151
!10_import-done.png!
152
153 4 Denis 'GNUtoo' Carikli
h2. Revoke USB debugging permissions
154
155
If you don't need @USB debugging permissions@ anymore, it might be a good idea to remove them. The [[ADB#Revoking-all-computers-USB-debugging-permissions|Revoking all computer's USB debugging permissions]] section in the ADB wiki page explains how to do that.
156
157 17 Denis 'GNUtoo' Carikli
h2. Finally
158
159 40 Denis 'GNUtoo' Carikli
That's it! Your contacts database is now migrated to the new Replicant release. In addition you should now have a backup of it.
160 17 Denis 'GNUtoo' Carikli
161
h2. Extra information
162
163
The file you backuped your contact in is in the "VCard":https://en.wikipedia.org/wiki/VCard format. That format is a standard, and many other software are compatible with it.