Commit 9d34285
authored
Charging: Detect LineageOS via the system feature, not a denied property (#45)
LineageOS was never detected in the app process, so every LineageOS
device was routed to an OEM adapter. All five ro.lineage.* properties
are SELinux-labelled custom_version_prop, which untrusted_app cannot
read, and SystemProperties.get returns an empty string on denial rather
than throwing — so SystemPropertyReader's runCatching never fired,
nothing was logged, and LineageOsDetector silently returned null. getprop
over adb had always masked this by running as the shell UID.
That made QUALIFIED_CODENAMES dead code (a qualified codename could never
activate), hid the contribution card, and pointed "open battery settings"
at Battery Saver instead of Battery. Detection now uses the app-readable
org.lineageos.android system feature via DeviceInfo.isLineageOs; the
version property is kept as a secondary OR-input for derivatives that
relabel it, and for diagnostics.
Also in the LineageOS contribution path:
- The guided settings-diff wizard is withheld (AdapterSupport
.guidedCaptureUseful). Its capture set excludes the lineagesettings
provider, so a run there always diffs to empty and cannot be delivered
— users were walked into a dead end after entering details and
capturing twice. Both entry points and the destination itself are
gated; the destination waits for adapterResolved so a saved-state
restore cannot flash the wizard on the permissive default.
- The direct report carries a dumpsys lineagehealth probe (new
zero-argument AIDL op; constant binary and argument, read-only, no
write allowlist involved). It is an observation, never a verdict:
provider selection branches on the configured mode before capability,
and Toggle also accepts MODE_LIMIT and enforces the cap itself, so no
value disqualifies a device and none proves enforcement.
- The raw dump is reduced to PROVIDER|mode inside the user service, so
the user's charging schedule (StartTime/TargetTime) and battery level
never cross Binder.
- Withholding the wizard removed these users' only Shizuku grant entry
point, which the probe needs; the card now offers it, branching on
BackendStatus so a stopped server opens Shizuku instead of firing a
request that returns false immediately.
Fixes found alongside: the wizard's bottom bar lacked a navigation-bar
inset and sat under the 3-button nav bar, and the unsupported card
interpolated Build.MANUFACTURER, telling a LineageOS Pixel user that
"Google devices" are unmapped.
Verified on Pixel 6 (oriole) / LineageOS 23.2 / Android 16: adapter
selection is lineageos-lab, the report reads is_lineageos=true,
lineage_cc_provider=DEADLINE, lineage_cc_mode=1,
lineage_cc_limit_mechanism=NOT_OBSERVED, and every field degrades to
unknown with Shizuku stopped. Regression tests drive DeviceInfo.current
against a real PackageManager, the seam the previous unit tests bypassed
by injecting lineageOsVersion directly.1 parent bc55ceb commit 9d34285
32 files changed
Lines changed: 866 additions & 46 deletions
File tree
- .claude
- rules
- skills
- device-qualification
- oem-adapters
- app/src
- main
- aidl/eu/darken/amply/charging/core/access/shizuku
- java/eu/darken/amply
- charging/core
- access
- shizuku
- adapter
- diagnostics/ui
- main
- core
- ui
- dashboard
- setup
- res/values
- test/java/eu/darken/amply
- charging/core
- access
- adapter
- diagnostics/core
- main
- core
- ui/setup
- docs
- plans
- support
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
93 | 93 | | |
94 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
95 | 109 | | |
96 | 110 | | |
97 | 111 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
92 | 117 | | |
93 | 118 | | |
94 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
68 | 73 | | |
69 | 74 | | |
70 | 75 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
12 | 18 | | |
13 | 19 | | |
Lines changed: 13 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
67 | 75 | | |
68 | 76 | | |
69 | 77 | | |
| |||
114 | 122 | | |
115 | 123 | | |
116 | 124 | | |
117 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
118 | 128 | | |
119 | 129 | | |
120 | 130 | | |
| |||
439 | 449 | | |
440 | 450 | | |
441 | 451 | | |
| 452 | + | |
| 453 | + | |
442 | 454 | | |
443 | 455 | | |
444 | 456 | | |
| |||
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
26 | 37 | | |
27 | 38 | | |
28 | 39 | | |
| |||
39 | 50 | | |
40 | 51 | | |
41 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
42 | 60 | | |
43 | 61 | | |
44 | 62 | | |
| |||
69 | 87 | | |
70 | 88 | | |
71 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
72 | 93 | | |
73 | 94 | | |
Lines changed: 12 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
8 | 16 | | |
9 | 17 | | |
10 | 18 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
10 | 17 | | |
11 | 18 | | |
12 | 19 | | |
| |||
0 commit comments