Skip to content

Open-source Android PDF and document toolkit with PDF tools, Office viewing, XLSX editing, scanning, and image editing. Built with Kotlin and Jetpack Compose.

Document flavors, Office engine licensing (MPL-2.0) and foss-only network use

Chethan61665e62e1872f9
diff --git a/PRIVACY.md b/PRIVACY.md
index 5c58ac4..f3af5c0 100644
--- a/PRIVACY.md
+++ b/PRIVACY.md
@@ -8,7 +8,24 @@ ClearPDF is designed to be an offline-first PDF utility for Android.
- It does not show ads.
- It does not include analytics, telemetry, or crash-reporting services.
- It does not intentionally upload PDFs or extracted content to a server.
-- The app does not request Android's `INTERNET` permission.
+- The Google Play build does not request Android's `INTERNET` permission.
+
+## Build flavors and the optional Office engine
+
+ClearPDF ships in two flavors:
+
+- **play** (Google Play): no `INTERNET` permission. The optional Office engine (powered by
+ LibreOffice) is delivered by Google Play itself as an on-demand module, only when you tap
+ *Download* in Settings.
+- **foss** (GitHub / sideload builds): declares `INTERNET` for exactly one purpose — downloading that
+ same optional engine when you ask for it. The download goes to a fixed GitHub release URL, sends no
+ document or personal data, and is installed only if its size and SHA-256 checksum match values
+ pinned in the app. Nothing is downloaded unless you start it, and you can delete the engine at any
+ time in Settings.
+
+In both flavors your documents never leave the device: conversion runs locally in an isolated app
+process, and the app's WebViews (used to lay out .docx and HTML) block all network requests and opt
+out of Safe Browsing lookups and WebView metrics.
## Files and permissions
diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md
index 456d2d0..4a663db 100644
--- a/THIRD_PARTY_NOTICES.md
+++ b/THIRD_PARTY_NOTICES.md
@@ -49,7 +49,7 @@ ClearPDF uses open-source components and keeps their notices with the project. R
- License: Apache License 2.0
- Use: informed ClearPDF's on-device tool set (e.g. PDF-to-Images export). ClearPDF's implementations are original code written against the app's own architecture and `backdrop` UI; no source was copied. This acknowledgement is provided in good faith for the shared feature direction.
-The app does not add GPL or LGPL components for document rendering. If a future dependency changes that, its license and redistribution obligations must be reviewed before release.
+The app does not bundle GPL or LGPL components for document rendering. If a future dependency changes that, its license and redistribution obligations must be reviewed before release. (The optional LibreOffice engine below is not bundled in the APK; it is installed only on request.)
## docx-preview (docxjs)
@@ -70,3 +70,25 @@ The app does not add GPL or LGPL components for document rendering. If a future
- Use: required by docx-preview to read the .docx zip container in the browser context.
- Notice practice: the upstream banner (including its pako attribution) is preserved verbatim at the
top of the vendored file, and the library is credited in Settings → Licenses.
+
+## LibreOffice (optional Office engine)
+
+- What: "Office engine (powered by LibreOffice)" — a prebuilt LibreOfficeKit bundle for Android
+ (`liblo-native-code.so`, `libc++_shared.so` and the LibreOffice runtime tree). It is **not in the
+ APK**. It is installed only when the user asks for it in Settings: the `play` flavor gets it through
+ the on-demand Play Feature Delivery module `:office_engine`, and the `foss` flavor downloads it from
+ a pinned release, accepting it only if its size and SHA-256 match `OfficeEngineManifest.kt`.
+- Binary source: https://github.com/vasuki-re/LibreOffice-Lite (release v2.0), a build of
+ LibreOffice core (https://git.libreoffice.org/core, mirror https://github.com/LibreOffice/core).
+- License: Mozilla Public License 2.0 for LibreOffice itself; some bundled parts (fonts such as
+ Liberation, Carlito, Caladea and Gentium Basic, and other third-party libraries compiled into
+ LibreOffice) carry their own licences, listed at https://www.libreoffice.org/about-us/licenses/.
+- Source availability (MPL-2.0 §3.2): the corresponding LibreOffice source is available from the
+ URLs above. Anyone redistributing a build that bundles or rehosts the engine must keep that source
+ available and should prefer a self-built bundle whose build recipe is published.
+- ClearPDF's Kotlin JNI binding (`app/src/main/java/org/libreoffice/kit/`) is original code; only
+ its package, class and method names follow LibreOffice's Android binding, because the native
+ library resolves them by name.
+- Trademark: "LibreOffice" is a trademark of The Document Foundation; ClearPDF uses it only to say
+ the optional engine is powered by LibreOffice and is not affiliated with or endorsed by TDF.
+- Credited in Settings → Licenses and Settings → Office engine.
diff --git a/readme.md b/readme.md
index d42ead7..61b40d2 100644
--- a/readme.md
+++ b/readme.md
@@ -110,9 +110,20 @@ Open the project in Android Studio and run:
The project uses JDK 17 or newer and Android SDK 36. Build the release variant locally with:
```bash
-./gradlew assembleRelease
+./gradlew assembleFossRelease # GitHub/sideload APKs (per-ABI + universal)
+./gradlew bundlePlayRelease # Google Play bundle
```
+There are two product flavors (dimension `distribution`, same `applicationId`):
+
+- `play` — Google Play. No `INTERNET` permission; the optional Office engine (powered by
+ LibreOffice) is the on-demand dynamic feature `:office_engine`. Its ~46 MB binaries are not in git:
+ `bundlePlay*` downloads the pinned archives, verifies their SHA-256 and unpacks them
+ (`:office_engine:prepareOfficeEngineBinaries`). Other tasks never need the network.
+- `foss` — the engine is downloaded on request in Settings, SHA-256 verified.
+
+Debug equivalents: `assemblePlayDebug`, `assembleFossDebug`, `installFossDebug`.
+
The release build is intentionally unsigned for contributors unless local signing credentials are configured. Never commit `key.properties`, keystores, APKs, or private documents.
---