Restore 72h DSDS + Wi-Fi standby battery optimizations across all targets

- Fix Combined EPS/IMSI (cs_attach=1) false 4G-only IMS activation in
  ims_qrtr.h, close idle QRTR sockets, bound child/baseband retries, and
  deduplicate state.env writes in bananarchy-imsd.c
- Skip inactive DHCP/connectivity IMS notifications in 40-bananarchy-ims.sh
  and add capped exponential registration backoff (5s-300s) plus
  openCtlSocket() rebind guard in bananarchy-vowifi
- Sync CPU scaling_governor and idempotent screenoff/screenon policy across
  bananarchy-display-power-sync, locker.so, and bananarchy-power-policy.sh
  (standby.mode + rat_timer.pid), and gate noisy change events when dark in
  30-bananarchy-network-status.sh
- Fix bananarchy-dsds --sig-hysteresis QMI NAS wire opcodes to 0x0045
  (1-byte sub bind) and 0x0050 (RSSI/RSCP/RSRP/LTE report threshold config)
- Remove static 200 mA regulator-system-load on PM8909 l11 across all 6
  DTS files and recompile all 5 shipping DTBs
- Extend test-imsd-volte.py, test-standby-power-policy.py, check-rebuild.sh,
  BATTERY-OPTIMIZATION-ANALYSIS.md (Section 24), AGENTS.md, and Unreleased
  CHANGELOG.md notes + rebuilt image SHA-256 checksums (--mkinitfs)
This commit is contained in:
Luxferre committed 2026-11-21 11:05:22 +02:00
1 parent c40ec932de
commit c9eb28b891
42 files changed
+751 -91

No files matched your search

+20 -7
View File
@@ -762,6 +762,7 @@ public:
uint32_t rtpSsrc = 0x42414E01U;
int64_t nextRtpTxMs = 0;
int64_t nextRegRetryMs = 0;
int64_t regBackoffMs = 5000;
uint8_t rpMrCounter = 1;
uint32_t callCounter = 1;
@@ -773,15 +774,19 @@ public:
ims_mkdir_p(stateDir.c_str(), 0755);
ims_config_load(&cfg, nullptr);
ims_state_read(&st);
aka = std::make_unique<ba_vowifi::SimAkaClient>(cfg.ims_sim_slot, stateDir);
simId = aka->readIdentity(st, cfg);
if (!aka) {
aka = std::make_unique<ba_vowifi::SimAkaClient>(cfg.ims_sim_slot, stateDir);
}
if (simId.imsi.empty()) {
simId = aka->readIdentity(st, cfg);
}
if (const char* p = std::getenv("BANANARCHY_PCSCF_PORT")) {
int pv = std::atoi(p);
if (pv > 0 && pv <= 65535) pcscfPort = static_cast<uint16_t>(pv);
}
if (openCtlSocket() != 0) return -1;
if (ctlSrvFd < 0 && openCtlSocket() != 0) return -1;
if (mode == "vowifi") {
std::string eHost = cfg.epdg_server[0] ? std::string(cfg.epdg_server) : defaultEpdgHost();
@@ -789,7 +794,9 @@ public:
ims_str_copy(st.last_error, sizeof(st.last_error), tunnel.lastError.c_str());
ims_str_copy(st.epdg_host, sizeof(st.epdg_host), eHost.c_str());
ims_state_write(&st);
return 0; /* stay alive for retry on RELOAD or timer */
nextRegRetryMs = monotonicMs() + regBackoffMs;
regBackoffMs = std::min<int64_t>(regBackoffMs * 2, 300000);
return 0; /* stay alive for retry on backed-off timer or STOP */
}
localIp = !tunnel.tunIp.empty() ? tunnel.tunIp
: (!tunnel.tunIp6.empty() ? tunnel.tunIp6 : "10.99.0.2");
@@ -852,8 +859,12 @@ public:
}
int timeoutMs = -1;
if (callState == CallState::Active) timeoutMs = 20;
else if (!registered) timeoutMs = 1500;
if (callState == CallState::Active) {
timeoutMs = 20;
} else if (!registered && nextRegRetryMs > 0) {
int64_t rem = nextRegRetryMs - monotonicMs();
timeoutMs = static_cast<int>(std::clamp<int64_t>(rem, 100, 300000));
}
int prc = ::poll(pfds, n, timeoutMs);
if (prc < 0) {
@@ -897,7 +908,8 @@ public:
sendRtpFrame();
nextRtpTxMs = now + 20;
} else if (!registered && nextRegRetryMs > 0 && now >= nextRegRetryMs) {
nextRegRetryMs = now + 10000;
nextRegRetryMs = now + regBackoffMs;
regBackoffMs = std::min<int64_t>(regBackoffMs * 2, 300000);
if (mode == "vowifi" && !tunnel.connected) {
init();
} else {
@@ -1066,6 +1078,7 @@ private:
} else if (sip.statusCode == 200) {
registered = true;
nextRegRetryMs = 0;
regBackoffMs = 5000;
ims_state_read(&st);
if (mode == "vowifi") {
st.vowifi_active = 1;