Legacy: Add Auto-Launch feature to Potato Build
This commit is contained in:
@@ -10,12 +10,12 @@ android {
|
||||
applicationId "com.cbcren.vpn"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 33
|
||||
versionCode 1
|
||||
versionName "1.0-legacy"
|
||||
versionCode 5
|
||||
versionName "2.1-legacy-auto"
|
||||
|
||||
multiDexEnabled true
|
||||
|
||||
// Forzar 32 bits (ARMv7)
|
||||
// Forzar 32 bits (ARMv7) para TV Boxes viejas
|
||||
ndk {
|
||||
abiFilters 'armeabi-v7a'
|
||||
}
|
||||
@@ -38,6 +38,9 @@ dependencies {
|
||||
implementation 'com.google.android.material:material:1.5.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
|
||||
|
||||
// MultiDex (Crucial para que no crashee al inicio en Android 7)
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
|
||||
// WireGuard (Versión 2021, probada en Android 5+)
|
||||
implementation 'com.wireguard.android:tunnel:1.0.20211029'
|
||||
}
|
||||
|
||||
@@ -7,6 +7,6 @@ public final class BuildConfig {
|
||||
public static final boolean DEBUG = Boolean.parseBoolean("true");
|
||||
public static final String APPLICATION_ID = "com.cbcren.vpn";
|
||||
public static final String BUILD_TYPE = "debug";
|
||||
public static final int VERSION_CODE = 1;
|
||||
public static final String VERSION_NAME = "1.0-legacy";
|
||||
public static final int VERSION_CODE = 5;
|
||||
public static final String VERSION_NAME = "2.1-legacy-auto";
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,2 +1,2 @@
|
||||
#Mon Feb 09 23:46:22 CET 2026
|
||||
#Tue Feb 10 14:25:52 CET 2026
|
||||
com.cbcren.vpn.app-main-27\:/layout/activity_main.xml=/home/ren/androidtv/app/build/intermediates/merged_res/debug/layout_activity_main.xml.flat
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.cbcren.vpn"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0-legacy" >
|
||||
android:versionCode="5"
|
||||
android:versionName="2.1-legacy-auto" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="21"
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
|
||||
|
||||
<!-- Soporte TV -->
|
||||
<uses-feature
|
||||
android:name="android.software.leanback"
|
||||
android:required="false" />
|
||||
@@ -20,9 +20,10 @@
|
||||
android:required="false" />
|
||||
|
||||
<application
|
||||
android:name="androidx.multidex.MultiDexApplication"
|
||||
android:appComponentFactory="androidx.core.app.CoreComponentFactory"
|
||||
android:debuggable="true"
|
||||
android:label="Xuper VPN Legacy"
|
||||
android:label="Xuper VPN Auto (Legacy)"
|
||||
android:theme="@style/Theme.AppCompat.Light.NoActionBar" >
|
||||
<activity
|
||||
android:name="com.cbcren.vpn.MainActivity"
|
||||
@@ -35,7 +36,6 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- Parche para servicio VPN en Android 12+ -->
|
||||
<service
|
||||
android:name="com.wireguard.android.backend.GoBackend$VpnService"
|
||||
android:exported="true"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.cbcren.vpn"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0-legacy" >
|
||||
android:versionCode="5"
|
||||
android:versionName="2.1-legacy-auto" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="21"
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
|
||||
|
||||
<!-- Soporte TV -->
|
||||
<uses-feature
|
||||
android:name="android.software.leanback"
|
||||
android:required="false" />
|
||||
@@ -20,9 +20,10 @@
|
||||
android:required="false" />
|
||||
|
||||
<application
|
||||
android:name="androidx.multidex.MultiDexApplication"
|
||||
android:appComponentFactory="androidx.core.app.CoreComponentFactory"
|
||||
android:debuggable="true"
|
||||
android:label="Xuper VPN Legacy"
|
||||
android:label="Xuper VPN Auto (Legacy)"
|
||||
android:theme="@style/Theme.AppCompat.Light.NoActionBar" >
|
||||
<activity
|
||||
android:name="com.cbcren.vpn.MainActivity"
|
||||
@@ -35,7 +36,6 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- Parche para servicio VPN en Android 12+ -->
|
||||
<service
|
||||
android:name="com.wireguard.android.backend.GoBackend$VpnService"
|
||||
android:exported="true"
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 1,
|
||||
"versionName": "1.0-legacy",
|
||||
"versionCode": 5,
|
||||
"versionName": "2.1-legacy-auto",
|
||||
"outputFile": "AndroidManifest.xml"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.cbcren.vpn"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0-legacy" >
|
||||
android:versionCode="5"
|
||||
android:versionName="2.1-legacy-auto" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="21"
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
|
||||
|
||||
<!-- Soporte TV -->
|
||||
<uses-feature
|
||||
android:name="android.software.leanback"
|
||||
android:required="false" />
|
||||
@@ -20,9 +20,10 @@
|
||||
android:required="false" />
|
||||
|
||||
<application
|
||||
android:name="androidx.multidex.MultiDexApplication"
|
||||
android:appComponentFactory="androidx.core.app.CoreComponentFactory"
|
||||
android:debuggable="true"
|
||||
android:label="Xuper VPN Legacy"
|
||||
android:label="Xuper VPN Auto (Legacy)"
|
||||
android:theme="@style/Theme.AppCompat.Light.NoActionBar" >
|
||||
<activity
|
||||
android:name="com.cbcren.vpn.MainActivity"
|
||||
@@ -35,7 +36,6 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- Parche para servicio VPN en Android 12+ -->
|
||||
<service
|
||||
android:name="com.wireguard.android.backend.GoBackend$VpnService"
|
||||
android:exported="true"
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 1,
|
||||
"versionName": "1.0-legacy",
|
||||
"versionCode": 5,
|
||||
"versionName": "2.1-legacy-auto",
|
||||
"outputFile": "AndroidManifest.xml"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 1,
|
||||
"versionName": "1.0-legacy",
|
||||
"versionCode": 5,
|
||||
"versionName": "2.1-legacy-auto",
|
||||
"outputFile": "resources-debug.ap_"
|
||||
}
|
||||
],
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -11,8 +11,8 @@
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 1,
|
||||
"versionName": "1.0-legacy",
|
||||
"versionCode": 5,
|
||||
"versionName": "2.1-legacy-auto",
|
||||
"outputFile": "app-debug.apk"
|
||||
}
|
||||
],
|
||||
|
||||
Binary file not shown.
@@ -4,13 +4,14 @@
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" tools:ignore="QueryAllPackagesPermission" />
|
||||
|
||||
<!-- Soporte TV -->
|
||||
<uses-feature android:name="android.software.leanback" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
|
||||
|
||||
<application
|
||||
android:label="Xuper VPN Legacy"
|
||||
android:label="Xuper VPN Auto (Legacy)"
|
||||
android:name="androidx.multidex.MultiDexApplication"
|
||||
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
|
||||
|
||||
<activity android:name=".MainActivity"
|
||||
@@ -22,7 +23,6 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- Parche para servicio VPN en Android 12+ -->
|
||||
<service android:name="com.wireguard.android.backend.GoBackend$VpnService"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.BIND_VPN_SERVICE"
|
||||
|
||||
@@ -2,8 +2,10 @@ package com.cbcren.vpn;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.os.Handler;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
@@ -15,8 +17,6 @@ import com.wireguard.android.backend.Tunnel;
|
||||
import com.wireguard.config.Config;
|
||||
import com.wireguard.config.Interface;
|
||||
import com.wireguard.config.Peer;
|
||||
import com.wireguard.config.InetEndpoint;
|
||||
import com.wireguard.config.InetNetwork;
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
|
||||
@@ -25,6 +25,9 @@ public class MainActivity extends Activity {
|
||||
private static final String SERVER_PUB_KEY = "44dNaTOCc/nY6vkqy3fJ+L1RqWDqFqEaEq1IBL/InRM=";
|
||||
private static final String SERVER_ENDPOINT = "194.163.191.200:51820";
|
||||
private static final String CLIENT_IP = "10.66.66.2/32";
|
||||
|
||||
// Auto-Launch Target
|
||||
private static final String TARGET_PACKAGE = "com.android.mgstv"; // XuperTV
|
||||
// ---------------------
|
||||
|
||||
private Backend backend;
|
||||
@@ -51,6 +54,11 @@ public class MainActivity extends Activity {
|
||||
statusText.setText("Error Backend: " + e.getMessage());
|
||||
}
|
||||
|
||||
// Verificar XuperTV
|
||||
if (!isPackageInstalled(TARGET_PACKAGE)) {
|
||||
Toast.makeText(this, "Aviso: XuperTV no detectada", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
actionButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -96,16 +104,21 @@ public class MainActivity extends Activity {
|
||||
|
||||
private void connectTunnel() {
|
||||
try {
|
||||
// Asegurar desconexión previa
|
||||
try { backend.setState(tunnel, Tunnel.State.DOWN, null); } catch (Exception e) {}
|
||||
|
||||
// Conectar
|
||||
backend.setState(tunnel, Tunnel.State.UP, config);
|
||||
|
||||
// Iniciar temporizador
|
||||
statusText.setText("CONECTADO - 60s");
|
||||
statusText.setText("CONECTADO.\nLanzando TV...");
|
||||
actionButton.setEnabled(false);
|
||||
|
||||
// Auto-Launch con delay
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
launchTargetApp();
|
||||
}
|
||||
}, 2000);
|
||||
|
||||
timer = new CountDownTimer(60000, 1000) {
|
||||
public void onTick(long millisUntilFinished) {
|
||||
statusText.setText("VPN ACTIVA: " + millisUntilFinished / 1000 + "s");
|
||||
@@ -124,7 +137,7 @@ public class MainActivity extends Activity {
|
||||
private void disconnectTunnel() {
|
||||
try {
|
||||
backend.setState(tunnel, Tunnel.State.DOWN, null);
|
||||
statusText.setText("DESCONECTADO. Abre XuperTV.");
|
||||
statusText.setText("DESCONECTADO.\nListo.");
|
||||
actionButton.setEnabled(true);
|
||||
actionButton.setText("RECONECTAR");
|
||||
} catch (Exception e) {
|
||||
@@ -132,7 +145,27 @@ public class MainActivity extends Activity {
|
||||
}
|
||||
}
|
||||
|
||||
// Implementación mínima de Tunnel
|
||||
private boolean isPackageInstalled(String packageName) {
|
||||
try {
|
||||
getPackageManager().getPackageInfo(packageName, 0);
|
||||
return true;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void launchTargetApp() {
|
||||
try {
|
||||
Intent launchIntent = getPackageManager().getLaunchIntentForPackage(TARGET_PACKAGE);
|
||||
if (launchIntent != null) {
|
||||
startActivity(launchIntent);
|
||||
Toast.makeText(this, "Abriendo XuperTV...", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// Ignorar
|
||||
}
|
||||
}
|
||||
|
||||
private static class SimpleTunnel implements Tunnel {
|
||||
private final String name;
|
||||
SimpleTunnel(String name) { this.name = name; }
|
||||
|
||||
Reference in New Issue
Block a user