From 14a08a6a3aea01ee2068f91985dda42978c4a29b Mon Sep 17 00:00:00 2001 From: AppDevForAll Date: Fri, 3 Jul 2026 19:06:38 -0600 Subject: [PATCH] ADFA-4552: remove dead VpnService scaffolding The old VpnService tunnel (TProxyService) is gone; only vestigial, never-reached plumbing remained. Removes the dead parts only; the live SOCKS-proxy feature that is merely named 'VPN' is untouched (rename deferred to the rebrand strings audit). - MainActivity: drop unused 'import android.net.VpnService', the vpnPermissionLauncher field + its registerForActivityResult block (registered but never launched), and connectVpn() (a log-only stub reachable only from that launcher). The launcher's battery-optimization call is already covered by batteryOptLauncher + prepareVpn(), so nothing is lost. - ServiceReceiver: drop the commented-out VpnService/TProxyService boot auto-start and now-unused VpnService/Build imports; keep the receiver as a placeholder seam for boot auto-start (ADFA-3340) with a TODO; header -> AppDevForAll. - strings.xml (all 6 locales): remove vpn_permission_granted (used only by the dead connectVpn); the live vpn_starting/vpn_stopping/vpn_description stay. Behaviour-preserving. --- .../org/iiab/controller/MainActivity.java | 16 --------- .../org/iiab/controller/ServiceReceiver.java | 33 +++++++------------ .../app/src/main/res/values-es/strings.xml | 1 - .../app/src/main/res/values-fr/strings.xml | 1 - .../app/src/main/res/values-hi/strings.xml | 1 - .../app/src/main/res/values-pt/strings.xml | 1 - .../src/main/res/values-ru-rRU/strings.xml | 1 - .../app/src/main/res/values/strings.xml | 1 - 8 files changed, 12 insertions(+), 43 deletions(-) diff --git a/controller/app/src/main/java/org/iiab/controller/MainActivity.java b/controller/app/src/main/java/org/iiab/controller/MainActivity.java index ce4cfdcf..d917e7e2 100644 --- a/controller/app/src/main/java/org/iiab/controller/MainActivity.java +++ b/controller/app/src/main/java/org/iiab/controller/MainActivity.java @@ -37,7 +37,6 @@ import android.widget.ImageButton; import android.widget.TextView; import android.widget.Toast; -import android.net.VpnService; import android.os.Build; import android.os.Handler; import android.os.PowerManager; @@ -99,7 +98,6 @@ public void setUsageFragment(UsageFragment fragment) { private String currentTargetUrl = null; private long pulseStartTime = 0; - private ActivityResultLauncher vpnPermissionLauncher; private ActivityResultLauncher requestPermissionsLauncher; private ActivityResultLauncher batteryOptLauncher; @@ -535,16 +533,6 @@ public boolean onTouch(View v, MotionEvent event) { viewPager.setCurrentItem(0, false); // 1. Initialize Result Launchers - vpnPermissionLauncher = registerForActivityResult( - new ActivityResultContracts.StartActivityForResult(), - result -> { - if (result.getResultCode() == RESULT_OK && prefs.getEnable()) { - connectVpn(); - } - BatteryUtils.checkAndPromptOptimizations(MainActivity.this, batteryOptLauncher); - } - ); - batteryOptLauncher = registerForActivityResult( new ActivityResultContracts.StartActivityForResult(), result -> { @@ -747,10 +735,6 @@ public void stopLogSizeUpdates() { sizeUpdateHandler.removeCallbacks(sizeUpdateRunnable); } - private void connectVpn() { - addToLog(getString(R.string.vpn_permission_granted)); - } - @Override protected void onPause() { super.onPause(); diff --git a/controller/app/src/main/java/org/iiab/controller/ServiceReceiver.java b/controller/app/src/main/java/org/iiab/controller/ServiceReceiver.java index f5cead18..061307ba 100644 --- a/controller/app/src/main/java/org/iiab/controller/ServiceReceiver.java +++ b/controller/app/src/main/java/org/iiab/controller/ServiceReceiver.java @@ -1,9 +1,12 @@ /* * ============================================================================ * Name : ServiceReceiver.java - * Author : IIAB Project - * Copyright : Copyright (c) 2026 IIAB Project - * Description : Broadcast receiver for system events + * Author : AppDevForAll + * Copyright : Copyright (c) 2026 AppDevForAll + * Description : Broadcast receiver for system events. Currently a placeholder + * for boot auto-start (ADFA-3340). The old VpnService/TProxyService + * auto-start was removed with the dead VPN tunnel (ADFA-4552); the + * receiver is kept as the seam where the future auto-start will hook. * ============================================================================ */ @@ -12,31 +15,19 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; -import android.net.VpnService; -import android.os.Build; public class ServiceReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { + if (intent.getAction() == null) { + return; + } if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) { Preferences prefs = new Preferences(context); - - /* Auto-start */ if (prefs.getEnable()) { - // Initialize the service automatically on boot - /* - Intent i = VpnService.prepare(context); - if (i != null) { - i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - context.startActivity(i); - } - i = new Intent(context, TProxyService.class); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - context.startForegroundService(i.setAction(TProxyService.ACTION_CONNECT)); - } else { - context.startService(i.setAction(TProxyService.ACTION_CONNECT)); - } - */ + // TODO(ADFA-3340): auto-start K2Go on boot. The previous + // VpnService/TProxyService implementation was removed (ADFA-4552, + // dead tunnel); the replacement start path will hook in here. } } } diff --git a/controller/app/src/main/res/values-es/strings.xml b/controller/app/src/main/res/values-es/strings.xml index 59720240..bdcb74dd 100644 --- a/controller/app/src/main/res/values-es/strings.xml +++ b/controller/app/src/main/res/values-es/strings.xml @@ -117,7 +117,6 @@ Conexión iniciada por el usuario Habilite URLs amigables. Bloquee las amenazas. - Permiso de VPN concedido. Conectando... Iniciando VPN... Deteniendo VPN... diff --git a/controller/app/src/main/res/values-fr/strings.xml b/controller/app/src/main/res/values-fr/strings.xml index d0b6b96b..e9811969 100644 --- a/controller/app/src/main/res/values-fr/strings.xml +++ b/controller/app/src/main/res/values-fr/strings.xml @@ -122,7 +122,6 @@ Connexion initiée par l\'utilisateur Activez des URL conviviales. Bloquez les menaces. - Autorisation VPN accordée. Connexion en cours... Démarrage du VPN... Arrêt du VPN... diff --git a/controller/app/src/main/res/values-hi/strings.xml b/controller/app/src/main/res/values-hi/strings.xml index a59eeac8..b34857e1 100644 --- a/controller/app/src/main/res/values-hi/strings.xml +++ b/controller/app/src/main/res/values-hi/strings.xml @@ -122,7 +122,6 @@ उपयोगकर्ता द्वारा आरंभ किया गया कनेक्शन अनुकूल URL सक्षम करें। खतरों को ब्लॉक करें। - VPN अनुमति दी गई। कनेक्ट हो रहा है... VPN शुरू हो रहा है... VPN बंद हो रहा है... diff --git a/controller/app/src/main/res/values-pt/strings.xml b/controller/app/src/main/res/values-pt/strings.xml index c7b42923..4e1b31cc 100644 --- a/controller/app/src/main/res/values-pt/strings.xml +++ b/controller/app/src/main/res/values-pt/strings.xml @@ -122,7 +122,6 @@ Conexão iniciada pelo usuário Ative URLs amigáveis. Bloqueie as ameaças. - Permissão de VPN concedida. Conectando... Iniciando VPN... Parando VPN... diff --git a/controller/app/src/main/res/values-ru-rRU/strings.xml b/controller/app/src/main/res/values-ru-rRU/strings.xml index 110de620..9adae847 100644 --- a/controller/app/src/main/res/values-ru-rRU/strings.xml +++ b/controller/app/src/main/res/values-ru-rRU/strings.xml @@ -122,7 +122,6 @@ Соединение инициировано пользователем Включить безопасные URL. Блокировать угрозы. - Разрешение VPN получено. Подключение... Запуск VPN... Остановка VPN... diff --git a/controller/app/src/main/res/values/strings.xml b/controller/app/src/main/res/values/strings.xml index e575d922..c2894977 100644 --- a/controller/app/src/main/res/values/strings.xml +++ b/controller/app/src/main/res/values/strings.xml @@ -131,7 +131,6 @@ User initiated connection Enable friendly URLs. Lock out the threats. - VPN Permission Granted. Connecting... VPN Starting... VPN Stopping...