Skip to content

Commit

Permalink
Changed "CCTG Mode (root)" to "CCTG Import", user now needs to select…
Browse files Browse the repository at this point in the history
… a file.

This file can be copied e.g. by doing `adb shell su -c cp /data/data/de.corona.tracing/databases/exposure.db /storage/emulated/0/Download/`.
This file can also be copied from another device, if desired. --> Closes #161 and #107 and several feature requests received by e-mail.
This will also ensure that the original CCTG database is not touched and can therefore not be corrupted.
  • Loading branch information
mh- committed Apr 3, 2022
1 parent e276e74 commit 5db7b75
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 140 deletions.
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The `release` build variant will probably build out-of-the box only on macOS bec
After a lot of user feedback and many iterations, the app meanwhile has several modes.
The best user experience is available if the device is rooted and the app gets root permissions: With root permissions, the app can directly access the database _from a framework_ where the recorded Rolling Proximity IDs (RPIs) are stored.

However, since many users cannot or do not wish to root their device, two other options (RaMBLE and CCTG) are also available, where _another app_ can export their recorded RPIs, so that this app can read them without root rights, and work with them.
However, since many users cannot or do not wish to root their device, other options (RaMBLE and CCTG) are also available, where _another app_ can export their recorded RPIs, so that this app can read them without root rights, and work with them.

The currently available modes are:

Expand All @@ -40,25 +40,27 @@ The currently available modes are:
### Normal mode (root):
This app reads RPIs from the Google Exposure Notifications service / framework. Works together with the official [Corona-Warn-App](https://www.coronawarn.app/de/).

### CCTG mode (root):
This app reads RPIs from the [Corona Contact Tracing Germany app](https://bubu1.eu/cctg/) (which brings its own microG framework that stores the RPIs in its own location). Works if you have installed CCTG, and give root access to this app.
***NOTE: Better use the CCTG export (as explained below) instead***

### microG mode (root):
This app reads RPIs from the [microG ENF framework](https://microg.org). Works if you have installed microG and an app that activates microG ENF RPI recording, and give root access to this app.

## Modes that work without root:

### RaMBLE mode:
### RaMBLE Import:
You need to record with the [RaMBLE app](https://apkpure.com/de/ramble-bluetooth-le-mapper/com.contextis.android.BLEScanner) (to record, tap the "▶" button), and then on the next day, export the database (tap the "⋮" button in the top right corner, select "Export Database"). Then set this app to RaMBLE Mode (tap the "⋮" menu button in the top right corner, select "RaMBLE Mode"). *You then need to select the newest "RaMBLE_..." file from the "Downloads" directory*, where RaMBLE has stored its exported database.

Note that the next time you want to use this app, you need to follow the same steps again (export from RaMBLE, select the file in this app).

### CCTG export (not a special mode within this app):
This requires the installation of the [Corona Contact Tracing Germany app](https://bubu1.eu/cctg/). On the next day, export the tracing information from CCTG and share with this app as described in the [CCTG FAQ](https://codeberg.org/corona-contact-tracing-germany/cwa-android#how-do-i-access-the-microg-exposure-notitifaction-settings-in-the-standalone-app). If you tap "export" on the microG ENF screen, and select to share with this app (tap on the Friendly Dog icon), this app is called and automatically reads the data, and also automatically selects "microG mode" in the process.
### CCTG Export (not a special mode within this app):
This requires the installation of the [Corona Contact Tracing Germany app](https://bubu1.eu/cctg/). On the next day, export the tracing information from CCTG and share with this app as described in the [CCTG FAQ](https://codeberg.org/corona-contact-tracing-germany/cwa-android#how-do-i-access-the-microg-exposure-notitifaction-settings-in-the-standalone-app). If you tap "export" on the microG ENF screen, and select to *share* with this app (tap on the Friendly Dog icon), this app is called and automatically reads the data, and also automatically selects "microG mode" in the process.

Note that the next time you want to use this app, you need to follow the same steps again (export and share from CCTG / microG ENF).

### CCTG Import:
*NOTE: It's easier to use the CCTG Export (as explained above) instead*
This app can read RPIs from a file created by the [Corona Contact Tracing Germany app](https://bubu1.eu/cctg/) (which brings its own microG framework that stores the RPIs in its own location: /data/data/de.corona.tracing/databases/exposure.db). Works if you have installed CCTG, can copy the database file to a location where you can select it from within this app - e.g. by doing `adb shell su -c cp /data/data/de.corona.tracing/databases/exposure.db /storage/emulated/0/Download/`.
One thing you can also do using this mode: Use a **copy of a database file** that was copied from a slow device, where analysis takes very long, on another more capable device, where analysis runs faster.


---
(BTW, if you wonder why this explanation is not part of the Play Store text: This is because of the Play Store requirements for COVID-19 apps; this is not a category 1 or 2 app and must therefore not use COVID-19 related terms in its Play Store listing.)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public class MainActivity extends AppCompatActivity {
public static final String EXTRA_MESSAGE_DAY = "org.tosl.coronawarncompanion.DAY_MESSAGE";
public static final String EXTRA_MESSAGE_COUNT = "org.tosl.coronawarncompanion.COUNT_MESSAGE";
public static final int INTENT_PICK_RAMBLE_FILE = 1;
public static final int INTENT_PICK_CCTG_FILE = 2;
static boolean mainActivityShouldBeRecreated = false;
private static CWCApplication.AppModeOptions desiredAppMode;
private RpiList rpiList = null;
Expand Down Expand Up @@ -441,9 +442,10 @@ protected void onCreate(Bundle savedInstanceState) {
rpiList = microGDbOnDisk.getRpisFromContactDB(this, databaseFile);
continueWhenRpisAreAvailable();
} else if (CWCApplication.appMode == CCTG_MODE) {
CctgDbOnDisk cctgDbOnDisk = new CctgDbOnDisk(this);
rpiList = cctgDbOnDisk.getRpisFromContactDB(this);
continueWhenRpisAreAvailable();
intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("application/octet-stream"); // this is the MIME type of a CCTG SQLITE database
startActivityForResult(intent, INTENT_PICK_CCTG_FILE);
} else {
throw new IllegalStateException();
}
Expand Down Expand Up @@ -549,6 +551,7 @@ public void onActivityResult(int requestCode, int resultCode,
super.onActivityResult(requestCode, resultCode, resultData);
if (requestCode == INTENT_PICK_RAMBLE_FILE
&& resultCode == Activity.RESULT_OK) {
// Import the RaMBLE file:
// The result data contains a URI for the document or directory that
// the user selected.
Uri uri;
Expand All @@ -561,6 +564,19 @@ public void onActivityResult(int requestCode, int resultCode,
getDaysFromMillis(System.currentTimeMillis()) - 14);
continueWhenRpisAreAvailable();
}
} else if (requestCode == INTENT_PICK_CCTG_FILE
&& resultCode == Activity.RESULT_OK) {
// Import the CCTG file:
// The result data contains a URI for the document or directory that
// the user selected.
Uri uri;
if (resultData != null) {
uri = resultData.getData();
// Perform operations on the document using its URI.
CctgDbOnDisk cctgDbOnDisk = new CctgDbOnDisk(this, uri);
rpiList = cctgDbOnDisk.getRpisFromContactDB();
continueWhenRpisAreAvailable();
}
}
}

Expand Down
Loading

0 comments on commit 5db7b75

Please sign in to comment.