Project

General

Profile

MigrateContactsDatabase » History » Version 32

Denis 'GNUtoo' Carikli, 06/02/2022 02:32 PM
Add screen capture to backup the contacts as it seems to have been done with dark design patterns

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. Warnings
6
7
Improvements to this article are welcome:
8 2 Denis 'GNUtoo' Carikli
* This article is a work in progress
9
* It hasn't been tested yet and might contain mistakes
10 4 Denis 'GNUtoo' Carikli
* It needs to be more clear for less technical users
11 1 Denis 'GNUtoo' Carikli
12 31 Denis 'GNUtoo' Carikli
h2. Migration overview
13 4 Denis 'GNUtoo' Carikli
14 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).
15 1 Denis 'GNUtoo' Carikli
16 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.
17
18
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.
19
20
When this is done you will be able to install the new Replicant image.
21
22
After that you will be able to restore your contacts database by restoring it from the file you backuped it to.
23
24
h2. Backuping your contacts in a file
25
26 7 Denis 'GNUtoo' Carikli
First, you'll need to make sure Replicant is booted on the device and open the stock contact application.
27
28 20 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.
29 7 Denis 'GNUtoo' Carikli
30 20 Denis 'GNUtoo' Carikli
If instead it shows some contacts, you will then need to backup them to a file.
31 7 Denis 'GNUtoo' Carikli
32
To do that you will first need to go in the contact application settings. 
33
34
To do that, once you are in the contact application, you can press the settings button in the application or press the settings button (On the Galaxy SIII, it's the button on the left of the home button).
35
36
That will display a menu. You will then have to select "Import/export" and then "Export to .vcf file".
37
38
It will then display a new screen with many contacts.
39
40
You will need to again press the settings button and a new menu with only one option ("All [ ]") will appear. 
41
42
You will need to select this option to select all contacts.
43
44
Once this is done, a new Tick button will appear in the screen. You will need to press it.
45
46
Once this is done you can save your contact to a file in the device, and copy that file somewhere safe (like on your laptop). 
47
48
This way if you end up having to erase your data somehow, you will still be able to easily restore your contacts.
49 4 Denis 'GNUtoo' Carikli
50
h2. Setup ADB
51
52
Follow the instructions for [[ADB|setting up ADB on your computer]] so that you can access a root shell on your device.
53
54
*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.
55
56
*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.
57
58 12 Denis 'GNUtoo' Carikli
h2. Reboot into the recovery
59
60
To reboot in the recovery, you can follow the instructions in the [[RebootIntoTheRecovery]] wiki page.
61
62 6 Denis 'GNUtoo' Carikli
h2. Mount the data partition
63
64 14 Denis 'GNUtoo' Carikli
You then need to mount the data partition.
65 1 Denis 'GNUtoo' Carikli
66 28 Denis 'GNUtoo' Carikli
For the @Galaxy S III (GT-I9300)@, the @Galaxy Note II (GT-N7100)@ and the @Galaxy Note 8.0 (GT-N51xx)@, you can use the following command:
67 9 Denis 'GNUtoo' Carikli
<pre>
68 13 Denis 'GNUtoo' Carikli
mount /dev/block/platform/*/by-name/USERDATA /data/
69 1 Denis 'GNUtoo' Carikli
</pre>
70 9 Denis 'GNUtoo' Carikli
71 26 Denis 'GNUtoo' Carikli
And for the @Galaxy Nexus (GT-I9250)@, you can use the following command:
72 11 Denis 'GNUtoo' Carikli
<pre>
73 26 Denis 'GNUtoo' Carikli
mount /dev/block/platform/*/*/by-name/userdata /data/
74 25 Denis 'GNUtoo' Carikli
</pre>
75 11 Denis 'GNUtoo' Carikli
76 27 Denis 'GNUtoo' Carikli
For the @Galaxy S II (GT-I9100)@ and the @Galaxy Note (GT-N7000)@, you can use the following command instead:
77 26 Denis 'GNUtoo' Carikli
78 23 Denis 'GNUtoo' Carikli
<pre>
79 26 Denis 'GNUtoo' Carikli
mount /dev/block/platform/*/by-name/DATAFS /data/
80 23 Denis 'GNUtoo' Carikli
</pre>
81
82 24 Denis 'GNUtoo' Carikli
And for the @Galaxy Tab 2 (GT-P31xx, GT-P51xx)@:
83
<pre>
84
mount /dev/block/platform/*/*/by-name/DATAFS /data/
85 21 Denis 'GNUtoo' Carikli
</pre>
86 4 Denis 'GNUtoo' Carikli
87
h2. Erase your contact database
88
89
Once in the recovery, you will then be able to erase your contact database:
90
91 2 Denis 'GNUtoo' Carikli
<pre>
92 1 Denis 'GNUtoo' Carikli
rm -rf /data/data/com.android.providers.contacts/databases/
93 22 Denis 'GNUtoo' Carikli
rm -rf /data/data/com.android.dialer/
94 1 Denis 'GNUtoo' Carikli
</pre>
95 4 Denis 'GNUtoo' Carikli
96 15 Denis 'GNUtoo' Carikli
Once this is done you will need to umount the userdata partition. This can be done with the following command:
97
<pre>
98 29 Denis 'GNUtoo' Carikli
umount /data/
99 15 Denis 'GNUtoo' Carikli
</pre>
100 10 Denis 'GNUtoo' Carikli
101 4 Denis 'GNUtoo' Carikli
h2. Install the new Replicant images
102 1 Denis 'GNUtoo' Carikli
103
Once the backup is done, you can proceed to install the Replicant images that have the contact database format to migrate to.
104 19 Denis 'GNUtoo' Carikli
105
h2. Restoring your contacts from a file
106
107
TODO
108 4 Denis 'GNUtoo' Carikli
109
h2. Revoke USB debugging permissions
110
111
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.
112
113 17 Denis 'GNUtoo' Carikli
h2. Finally
114
115 16 Denis 'GNUtoo' Carikli
That's it! Your contacts database is now backed up.
116 17 Denis 'GNUtoo' Carikli
117
h2. Extra information
118
119
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.