WireViewModel owned the single Wire node and called shutdown() from onCleared(), so a backgrounded node died with the UI. Node lifetime is now arbitrated by a pure policy (NodeLifetime) with two anchors — UI and keep-alive — and one process-wide owner (NodeHost) that is the only caller of flush()/shutdown() in the app. KeepAliveService holds the process in the foreground behind an ongoing notification from the "keep-alive" channel, started on unlock and stopped by Lock or the notification action, so peers can still reach the device while the screen is off. - foregroundServiceType="specialUse": dataSync is documented as a finite transfer (upload/download/backup) and this is an always-on node - POST_NOTIFICATIONS requested when the node becomes reachable; denial keeps the service running with no visible notice instead of failing - re-unlock with a node the service kept alive adopts it rather than reopening the store the live node still holds - 9 device-free unit tests for the start/stop/re-unlock state machine
73 lines
3.5 KiB
XML
73 lines
3.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
|
|
<!--
|
|
INTERNET is the only permission requested at first launch.
|
|
No camera (invites are typed/pasted, not scanned), no contacts, no
|
|
storage.
|
|
|
|
Tor runs in-process, and the node is kept published across Doze and
|
|
backgrounding by KeepAliveService: a foreground service with an ongoing
|
|
notification, started on unlock, stopped by Lock or by the notification's
|
|
Stop action. Its anchors and the node's lifetime are arbitrated in
|
|
NodeHost/NodeLifetime; the service never owns the node itself.
|
|
-->
|
|
<uses-permission android:name="android.permission.INTERNET" />
|
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
|
|
|
<!--
|
|
specialUse, not dataSync. dataSync is documented as "data transfer
|
|
operations" (upload/download, backup/restore, import/export) and the
|
|
official alternatives guide points at WorkManager or a user-initiated
|
|
transfer job — all of which assume a transfer with an end. A node holding
|
|
an inbound onion service open and draining a retry queue has no end and no
|
|
progress to report, so specialUse ("valid foreground service use cases
|
|
that aren't covered by the other types") is the honest declaration. It
|
|
costs a Play Console justification; dataSync would cost a lie.
|
|
-->
|
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
|
|
|
|
<!-- API 33+. Without it the keep-alive still runs, but its notification is
|
|
hidden from the drawer (the user sees the service in the Task Manager
|
|
instead). Denial is handled, not fatal: see WireViewModel.keepAliveNote. -->
|
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
|
|
|
<application
|
|
android:allowBackup="false"
|
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
|
android:fullBackupContent="false"
|
|
android:icon="@mipmap/ic_launcher"
|
|
android:label="@string/app_name"
|
|
android:roundIcon="@mipmap/ic_launcher"
|
|
android:supportsRtl="true"
|
|
android:theme="@style/Theme.OnionWire">
|
|
|
|
<activity
|
|
android:name=".MainActivity"
|
|
android:exported="true"
|
|
android:label="@string/app_name"
|
|
android:windowSoftInputMode="adjustResize">
|
|
<intent-filter>
|
|
<action android:name="android.intent.action.MAIN" />
|
|
<category android:name="android.intent.category.LAUNCHER" />
|
|
</intent-filter>
|
|
</activity>
|
|
|
|
<!--
|
|
Not exported: only this app starts it, from a user-visible unlock.
|
|
stopWithTask is left at its default (false) on purpose — swiping the
|
|
task away must not take the onion offline; the activity is destroyed,
|
|
NodeHost flushes the outbox, and the onion stays published.
|
|
-->
|
|
<service
|
|
android:name=".keepalive.KeepAliveService"
|
|
android:exported="false"
|
|
android:foregroundServiceType="specialUse">
|
|
<property
|
|
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
|
|
android:value="peer-to-peer messaging node: keeps an inbound onion service published and an outbox retry queue running so peers can deliver messages while the app is backgrounded; there is no user-initiated transfer to bound the work" />
|
|
</service>
|
|
|
|
</application>
|
|
|
|
</manifest>
|