Unable to reach the secure environment.
" + + "Error: " + error.getDescription() + "
" + + ""; + view.loadData(customErrorHtml, "text/html", "UTF-8"); + isPageLoading = false; + btnReload.setText("↻"); + } + } }); // --- MANUALLY CLOSE BAR LOGIC --- @@ -163,10 +188,10 @@ public class PortalActivity extends AppCompatActivity { int tempPort = prefs.getSocksPort(); if (tempPort <= 0) tempPort = 1080; - // Variable safe to read in lambda + // 3. Restauramos la variable segura para el puerto final int finalProxyPort = tempPort; - // 3. Proxy block (ONLY IF VPN IS ACTIVE) + // 4. Proxy block (ONLY IF VPN IS ACTIVE) if (isVpnActive) { if (WebViewFeature.isFeatureSupported(WebViewFeature.PROXY_OVERRIDE)) { ProxyConfig proxyConfig = new ProxyConfig.Builder() @@ -178,16 +203,16 @@ public class PortalActivity extends AppCompatActivity { ProxyController.getInstance().setProxyOverride(proxyConfig, executor, () -> { Log.d(TAG, "Proxy configured on port: " + finalProxyPort); // Load HTML only when proxy is ready - webView.loadUrl(targetUrl); + webView.loadUrl(finalTargetUrl); }); } else { // Fallback for older devices Log.w(TAG, "Proxy Override not supported"); - webView.loadUrl(targetUrl); + webView.loadUrl(finalTargetUrl); } } else { // VPN is OFF. Do NOT use proxy. Just load localhost directly. - webView.loadUrl(targetUrl); + webView.loadUrl(finalTargetUrl); } } diff --git a/apk/controller/app/src/main/java/org/iiab/controller/WatchdogService.java b/apk/controller/app/src/main/java/org/iiab/controller/WatchdogService.java index 12133e0..38b3eb0 100644 --- a/apk/controller/app/src/main/java/org/iiab/controller/WatchdogService.java +++ b/apk/controller/app/src/main/java/org/iiab/controller/WatchdogService.java @@ -21,7 +21,8 @@ public class WatchdogService extends Service { public static final String ACTION_START = "org.iiab.controller.WATCHDOG_START"; public static final String ACTION_STOP = "org.iiab.controller.WATCHDOG_STOP"; public static final String ACTION_HEARTBEAT = "org.iiab.controller.HEARTBEAT"; - + public static final String ACTION_STATE_STARTED = "org.iiab.controller.WATCHDOG_STARTED"; + public static final String ACTION_STATE_STOPPED = "org.iiab.controller.WATCHDOG_STOPPED"; private static final int HEARTBEAT_INTERVAL_MS = 20 * 1000; @Override @@ -36,12 +37,8 @@ public class WatchdogService extends Service { String action = intent.getAction(); if (ACTION_START.equals(action)) { startWatchdog(); - } else if (ACTION_STOP.equals(action)) { - stopWatchdog(); - return START_NOT_STICKY; } else if (ACTION_HEARTBEAT.equals(action)) { IIABWatchdog.performHeartbeat(this); - // CRITICAL: Reschedule for the next pulse to create an infinite loop scheduleHeartbeat(); } } @@ -58,15 +55,26 @@ public class WatchdogService extends Service { IIABWatchdog.logSessionStart(this); scheduleHeartbeat(); + + Intent startIntent = new Intent(ACTION_STATE_STARTED); + startIntent.setPackage(getPackageName()); + sendBroadcast(startIntent); } - private void stopWatchdog() { + @Override + public void onDestroy() { + // 1. Avisamos inmediatamente a la UI que nos estamos apagando + Intent stopIntent = new Intent(ACTION_STATE_STOPPED); + stopIntent.setPackage(getPackageName()); + sendBroadcast(stopIntent); + + // 2. Limpiamos la basura cancelHeartbeat(); IIABWatchdog.logSessionStop(this); stopForeground(true); - stopSelf(); - } + super.onDestroy(); + } private PendingIntent getHeartbeatPendingIntent() { Intent intent = new Intent(this, WatchdogService.class); intent.setAction(ACTION_HEARTBEAT); @@ -101,12 +109,6 @@ public class WatchdogService extends Service { } } - @Override - public void onDestroy() { - stopWatchdog(); - super.onDestroy(); - } - @Override public IBinder onBind(Intent intent) { return null; diff --git a/apk/controller/app/src/main/res/drawable/led_off.xml b/apk/controller/app/src/main/res/drawable/led_off.xml new file mode 100644 index 0000000..36cf1e9 --- /dev/null +++ b/apk/controller/app/src/main/res/drawable/led_off.xml @@ -0,0 +1,4 @@ + +