feat(android): keep the onion published through Doze with a foreground service
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
This commit is contained in:
parent
48c06df2cf
commit
e923e06891
11 changed files with 814 additions and 87 deletions
17
android/app/src/main/res/drawable/ic_stat_onion.xml
Normal file
17
android/app/src/main/res/drawable/ic_stat_onion.xml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Status-bar icon for the keep-alive notification. Notification icons are
|
||||
alpha masks, so this is a flat white silhouette: an onion bulb with a sprout.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M12,2.6c-0.7,1.2 -1.1,2.3 -1.1,3.2 0,0.5 0.5,0.9 1.1,0.9s1.1,-0.4 1.1,-0.9c0,-0.9 -0.4,-2 -1.1,-3.2z" />
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M12,6.4c-2.2,2 -3.6,4.6 -3.6,7.3 0,3.9 1.6,7.3 3.6,7.3s3.6,-3.4 3.6,-7.3c0,-2.7 -1.4,-5.3 -3.6,-7.3zM12,8.2c1.1,1.3 2.1,3 2.1,5.5 0,1.5 -0.5,2.9 -1,3.3 -0.6,-0.4 -1.1,-1.8 -1.1,-3.3 0,-2.5 1,-4.2 2.1,-5.5z" />
|
||||
</vector>
|
||||
Loading…
Reference in a new issue