fix(android): forceDisable disarms the tamper-lock — protection stayed enforced after cooldown

When the cooldown elapsed and forceDisable() stopped the VPN, the tamper_armed
SharedPref flag was left set → the AccessibilityService kept enforcing protection
(e.g. blocked the user from turning the a11y service off in system Settings) →
the user couldn't actually get out of protection despite the cooldown elapsing.
forceDisable() now calls disarmTamperLock() before disable().

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
chahinebrini 2026-05-11 16:59:58 +02:00
parent 184a601616
commit aac709ec41

View File

@ -129,8 +129,17 @@ export const protection = {
return RebreakProtection.activateFamilyControls();
},
/** Schaltet alle Layer ab. NUR aufrufen wenn JS-Layer Cooldown verifiziert. */
forceDisable() {
/** Schaltet alle Layer ab + disarmed den Tamper-Lock. NUR aufrufen wenn JS-Layer Cooldown verifiziert. */
async forceDisable() {
// Tamper-Lock ZUERST disarmen — sonst setzt der AccessibilityService den Schutz
// nach dem Cooldown weiter durch (blockt z.B. das Ausschalten des a11y-Service in den
// System-Settings) → der User kommt nicht aus dem Schutz raus, obwohl der Cooldown
// abgelaufen ist. (Android-Bug-Fix.)
try {
await RebreakProtection.disarmTamperLock();
} catch (e) {
console.warn("[protection] disarmTamperLock failed:", e);
}
return RebreakProtection.disable();
},