Enhanced import/export support.

1) Allow imports from the stock SMS database at any time.

2) Provide plaintext export support, in a format compatible with
   the "SMS Backup And Restore" app.

3) Fix the DB weirdness on encrypted restore that previously
   required killing the app.
This commit is contained in:
Moxie Marlinspike
2013-06-24 21:02:30 -07:00
parent 903ab92f5f
commit aa25f94291
37 changed files with 1343 additions and 199 deletions

View File

@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffeaeaea"
android:layout_gravity="center_vertical"
android:gravity="center_vertical">
<LinearLayout android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:layout_gravity="center_vertical"
android:padding="8dip"
android:background="#ffeaeaea">
<LinearLayout android:id="@+id/export_encrypted_backup"
android:clickable="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:background="@drawable/clickable_card"
android:orientation="vertical">
<LinearLayout android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingTop="8dip"
android:paddingBottom="8dip"
android:layout_marginLeft="16dip"
android:layout_marginRight="16dip">
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dip"
android:src="@drawable/encrypted_backup"/>
<LinearLayout android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Registration.Description"
android:text="@string/export_fragment__export_encrypted_backup"/>
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/export_fragment__export_an_encrypted_backup_to_the_sd_card"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout android:id="@+id/export_plaintext_backup"
android:clickable="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:background="@drawable/clickable_card"
android:orientation="vertical">
<LinearLayout android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingTop="8dip"
android:paddingBottom="8dip"
android:layout_marginLeft="16dip"
android:layout_marginRight="16dip">
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dip"
android:src="@drawable/plaintext_backup"/>
<LinearLayout android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Registration.Description"
android:text="@string/export_fragment__export_plaintext_backup"/>
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/export_fragment__export_a_plaintext_backup_compatible_with"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/import_export_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />

View File

@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffeaeaea"
android:layout_gravity="center_vertical"
android:gravity="center_vertical">
<LinearLayout android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:layout_gravity="center_vertical"
android:padding="8dip"
android:background="#ffeaeaea">
<LinearLayout android:id="@+id/import_sms"
android:clickable="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/clickable_card"
android:orientation="vertical">
<LinearLayout android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingTop="8dip"
android:paddingBottom="8dip"
android:layout_marginLeft="16dip"
android:layout_marginRight="16dip">
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dip"
android:src="@drawable/stock_sms"/>
<LinearLayout android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Registration.Description"
android:text="@string/import_fragment__import_system_sms_database"/>
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/import_fragment__import_the_database_from_the_default_system"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout android:id="@+id/import_encrypted_backup"
android:clickable="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:background="@drawable/clickable_card"
android:orientation="vertical">
<LinearLayout android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingTop="8dip"
android:paddingBottom="8dip"
android:layout_marginLeft="16dip"
android:layout_marginRight="16dip">
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dip"
android:src="@drawable/encrypted_backup"/>
<LinearLayout android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Registration.Description"
android:text="@string/import_fragment__import_encrypted_backup"/>
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/import_fragment__restore_a_previously_exported_encrypted_textsecure_backup"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout android:id="@+id/import_plaintext_backup"
android:clickable="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:background="@drawable/clickable_card"
android:orientation="vertical">
<LinearLayout android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingTop="8dip"
android:paddingBottom="8dip"
android:layout_marginLeft="16dip"
android:layout_marginRight="16dip">
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dip"
android:src="@drawable/plaintext_backup"/>
<LinearLayout android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Registration.Description"
android:text="@string/import_fragment__import_plaintext_backup"/>
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/import_fragment__import_a_plaintext_backup_file"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>