Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f1a4923437 |
@@ -9,15 +9,12 @@ android {
|
||||
defaultConfig {
|
||||
applicationId "com.cbcren.vpn"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 34 // Compatible con Android 14/15/16
|
||||
versionCode 8
|
||||
versionName "4.0-universal-embedded"
|
||||
|
||||
targetSdkVersion 33
|
||||
versionCode 5
|
||||
versionName "2.0-auto"
|
||||
multiDexEnabled true
|
||||
|
||||
// ¡IMPORTANTE! Habilitar ambas arquitecturas
|
||||
ndk {
|
||||
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
||||
abiFilters 'armeabi-v7a'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +28,5 @@ dependencies {
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'com.google.android.material:material:1.2.1'
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
|
||||
// Motor WireGuard Embebido (Versión estable 2021)
|
||||
implementation 'com.wireguard.android:tunnel:1.0.20211029'
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
#Tue Feb 10 00:24:44 CET 2026
|
||||
#Tue Feb 10 00:08:21 CET 2026
|
||||
com.cbcren.vpn.app-main-15\:/mipmap-anydpi-v26/ic_launcher.xml=/home/ren/androidtv/app/build/intermediates/merged_res/debug/mipmap-anydpi-v26_ic_launcher.xml.flat
|
||||
com.cbcren.vpn.app-main-15\:/layout/activity_main.xml=/home/ren/androidtv/app/build/intermediates/merged_res/debug/layout_activity_main.xml.flat
|
||||
com.cbcren.vpn.app-main-15\:/drawable/ic_launcher_foreground.xml=/home/ren/androidtv/app/build/intermediates/merged_res/debug/drawable_ic_launcher_foreground.xml.flat
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#Tue Feb 10 00:24:45 CET 2026
|
||||
#Tue Feb 10 00:08:21 CET 2026
|
||||
com.cbcren.vpn.app-main-5\:/drawable/ic_launcher_foreground.xml=/home/ren/androidtv/app/build/intermediates/packaged_res/debug/drawable/ic_launcher_foreground.xml
|
||||
com.cbcren.vpn.app-main-5\:/layout/activity_main.xml=/home/ren/androidtv/app/build/intermediates/packaged_res/debug/layout/activity_main.xml
|
||||
com.cbcren.vpn.app-main-5\:/mipmap-anydpi-v26/ic_launcher.xml=/home/ren/androidtv/app/build/intermediates/packaged_res/debug/mipmap-anydpi-v26/ic_launcher.xml
|
||||
|
||||
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,15 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.cbcren.vpn"
|
||||
android:versionCode="8"
|
||||
android:versionName="4.0-universal-embedded" >
|
||||
android:versionCode="5"
|
||||
android:versionName="2.0-auto" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="21"
|
||||
android:targetSdkVersion="34" />
|
||||
android:targetSdkVersion="33" />
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<!-- Permiso para saber si la app está instalada -->
|
||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
|
||||
|
||||
<uses-feature
|
||||
@@ -23,7 +23,7 @@
|
||||
android:name="androidx.multidex.MultiDexApplication"
|
||||
android:appComponentFactory="androidx.core.app.CoreComponentFactory"
|
||||
android:debuggable="true"
|
||||
android:label="Xuper VPN Universal"
|
||||
android:label="Xuper VPN Auto"
|
||||
android:theme="@style/Theme.MaterialComponents.Light.NoActionBar" >
|
||||
<activity
|
||||
android:name="com.cbcren.vpn.MainActivity"
|
||||
@@ -36,7 +36,6 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- Servicio VPN Embebido (Parcheado para Android 12+) -->
|
||||
<service
|
||||
android:name="com.wireguard.android.backend.GoBackend$VpnService"
|
||||
android:exported="true"
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.cbcren.vpn"
|
||||
android:versionCode="8"
|
||||
android:versionName="4.0-universal-embedded" >
|
||||
android:versionCode="5"
|
||||
android:versionName="2.0-auto" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="21"
|
||||
android:targetSdkVersion="34" />
|
||||
android:targetSdkVersion="33" />
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<!-- Permiso para saber si la app está instalada -->
|
||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
|
||||
|
||||
<uses-feature
|
||||
@@ -23,7 +23,7 @@
|
||||
android:name="androidx.multidex.MultiDexApplication"
|
||||
android:appComponentFactory="androidx.core.app.CoreComponentFactory"
|
||||
android:debuggable="true"
|
||||
android:label="Xuper VPN Universal"
|
||||
android:label="Xuper VPN Auto"
|
||||
android:theme="@style/Theme.MaterialComponents.Light.NoActionBar" >
|
||||
<activity
|
||||
android:name="com.cbcren.vpn.MainActivity"
|
||||
@@ -36,7 +36,6 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- Servicio VPN Embebido (Parcheado para Android 12+) -->
|
||||
<service
|
||||
android:name="com.wireguard.android.backend.GoBackend$VpnService"
|
||||
android:exported="true"
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 8,
|
||||
"versionName": "4.0-universal-embedded",
|
||||
"versionCode": 5,
|
||||
"versionName": "2.0-auto",
|
||||
"outputFile": "AndroidManifest.xml"
|
||||
}
|
||||
],
|
||||
|
||||
Binary file not shown.
@@ -1,15 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.cbcren.vpn"
|
||||
android:versionCode="8"
|
||||
android:versionName="4.0-universal-embedded" >
|
||||
android:versionCode="5"
|
||||
android:versionName="2.0-auto" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="21"
|
||||
android:targetSdkVersion="34" />
|
||||
android:targetSdkVersion="33" />
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<!-- Permiso para saber si la app está instalada -->
|
||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
|
||||
|
||||
<uses-feature
|
||||
@@ -23,7 +23,7 @@
|
||||
android:name="androidx.multidex.MultiDexApplication"
|
||||
android:appComponentFactory="androidx.core.app.CoreComponentFactory"
|
||||
android:debuggable="true"
|
||||
android:label="Xuper VPN Universal"
|
||||
android:label="Xuper VPN Auto"
|
||||
android:theme="@style/Theme.MaterialComponents.Light.NoActionBar" >
|
||||
<activity
|
||||
android:name="com.cbcren.vpn.MainActivity"
|
||||
@@ -36,7 +36,6 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- Servicio VPN Embebido (Parcheado para Android 12+) -->
|
||||
<service
|
||||
android:name="com.wireguard.android.backend.GoBackend$VpnService"
|
||||
android:exported="true"
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 8,
|
||||
"versionName": "4.0-universal-embedded",
|
||||
"versionCode": 5,
|
||||
"versionName": "2.0-auto",
|
||||
"outputFile": "AndroidManifest.xml"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -11,17 +11,17 @@
|
||||
android:id="@+id/statusText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="XUPER VPN UNIVERSAL"
|
||||
android:text="VPN + XUPER TV"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginBottom="32dp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/connectBtn"
|
||||
android:id="@+id/actionButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="INICIAR"
|
||||
android:text="ACTIVAR Y ABRIR TV"
|
||||
android:padding="20dp"
|
||||
android:textSize="18sp"/>
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 8,
|
||||
"versionName": "4.0-universal-embedded",
|
||||
"versionCode": 5,
|
||||
"versionName": "2.0-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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -11,8 +11,8 @@
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 8,
|
||||
"versionName": "4.0-universal-embedded",
|
||||
"versionCode": 5,
|
||||
"versionName": "2.0-auto",
|
||||
"outputFile": "app-debug.apk"
|
||||
}
|
||||
],
|
||||
|
||||
Binary file not shown.
@@ -3,14 +3,14 @@
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<!-- Permiso para saber si la app está instalada -->
|
||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" tools:ignore="QueryAllPackagesPermission" />
|
||||
|
||||
<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 Universal"
|
||||
android:label="Xuper VPN Auto"
|
||||
android:name="androidx.multidex.MultiDexApplication"
|
||||
android:theme="@style/Theme.MaterialComponents.Light.NoActionBar">
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- Servicio VPN Embebido (Parcheado para Android 12+) -->
|
||||
<service android:name="com.wireguard.android.backend.GoBackend$VpnService"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.BIND_VPN_SERVICE"
|
||||
|
||||
@@ -5,39 +5,36 @@ 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;
|
||||
import android.view.View;
|
||||
import android.os.Handler;
|
||||
|
||||
// Imports del Motor Embebido
|
||||
import com.wireguard.android.backend.Backend;
|
||||
import com.wireguard.android.backend.GoBackend;
|
||||
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 {
|
||||
|
||||
// --- CONFIGURACIÓN WIREGUARD ---
|
||||
// --- CONFIGURACIÓN ---
|
||||
private static final String CLIENT_PRIV_KEY = "ULfX2KspqzSv9cgfvYxGjbL/3FkOS27iCVCyL+LWGmE=";
|
||||
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";
|
||||
|
||||
// --- CONFIGURACIÓN APP OBJETIVO ---
|
||||
private static final String TARGET_PACKAGE = "com.android.mgstv"; // XuperTV
|
||||
// ----------------------------------
|
||||
// App a lanzar
|
||||
private static final String TARGET_PACKAGE = "com.android.mgstv";
|
||||
// ---------------------
|
||||
|
||||
private Backend backend;
|
||||
private Tunnel tunnel;
|
||||
private Config config;
|
||||
private TextView statusText;
|
||||
private Button connectBtn;
|
||||
private Button actionButton;
|
||||
private CountDownTimer timer;
|
||||
|
||||
@Override
|
||||
@@ -46,33 +43,53 @@ public class MainActivity extends Activity {
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
statusText = findViewById(R.id.statusText);
|
||||
connectBtn = findViewById(R.id.connectBtn);
|
||||
connectBtn.setText("ACTIVAR Y ABRIR TV");
|
||||
actionButton = findViewById(R.id.actionButton);
|
||||
|
||||
// 1. Inicializar Motor VPN
|
||||
// Inicializar Backend
|
||||
try {
|
||||
backend = new GoBackend(getApplicationContext());
|
||||
tunnel = new SimpleTunnel("XuperVPN");
|
||||
config = createConfig();
|
||||
} catch (Exception e) {
|
||||
statusText.setText("Error Motor VPN: " + e.getMessage());
|
||||
connectBtn.setEnabled(false);
|
||||
return;
|
||||
statusText.setText("Error Backend: " + e.getMessage());
|
||||
}
|
||||
|
||||
// 2. Verificar XuperTV
|
||||
// Verificar si XuperTV está instalada
|
||||
if (!isPackageInstalled(TARGET_PACKAGE)) {
|
||||
Toast.makeText(this, "Aviso: XuperTV no detectada", Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(this, "Aviso: XuperTV no encontrada (" + TARGET_PACKAGE + ")", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
connectBtn.setOnClickListener(new View.OnClickListener() {
|
||||
actionButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startVpnSequence();
|
||||
startVpn();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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, "Lanzando XuperTV...", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(this, "Instala XuperTV para auto-inicio", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// Ignorar
|
||||
}
|
||||
}
|
||||
|
||||
private Config createConfig() throws Exception {
|
||||
Interface.Builder interfaceBuilder = new Interface.Builder();
|
||||
interfaceBuilder.parsePrivateKey(CLIENT_PRIV_KEY);
|
||||
@@ -90,8 +107,7 @@ public class MainActivity extends Activity {
|
||||
.build();
|
||||
}
|
||||
|
||||
private void startVpnSequence() {
|
||||
// Pedir permiso de VPN al sistema (Android dialog)
|
||||
private void startVpn() {
|
||||
Intent intent = GoBackend.VpnService.prepare(this);
|
||||
if (intent != null) {
|
||||
startActivityForResult(intent, 0);
|
||||
@@ -105,30 +121,29 @@ public class MainActivity extends Activity {
|
||||
if (resultCode == RESULT_OK) {
|
||||
connectTunnel();
|
||||
} else {
|
||||
statusText.setText("Permiso de VPN denegado");
|
||||
statusText.setText("Permiso denegado");
|
||||
}
|
||||
}
|
||||
|
||||
private void connectTunnel() {
|
||||
try {
|
||||
// Asegurar limpieza
|
||||
try { backend.setState(tunnel, Tunnel.State.DOWN, null); } catch (Exception e) {}
|
||||
|
||||
// CONECTAR
|
||||
// Conectar
|
||||
backend.setState(tunnel, Tunnel.State.UP, config);
|
||||
|
||||
statusText.setText("CONECTADO.\nLanzando TV en 2s...");
|
||||
connectBtn.setEnabled(false);
|
||||
statusText.setText("CONECTADO - LANZANDO TV...");
|
||||
actionButton.setEnabled(false);
|
||||
|
||||
// Auto-Launch XuperTV
|
||||
// Lanzar la app con un pequeño retraso para asegurar que el túnel esté listo
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
launchTargetApp();
|
||||
}
|
||||
}, 2000);
|
||||
}, 2000); // 2 segundos de espera
|
||||
|
||||
// Temporizador 60s
|
||||
// Iniciar temporizador
|
||||
timer = new CountDownTimer(60000, 1000) {
|
||||
public void onTick(long millisUntilFinished) {
|
||||
statusText.setText("VPN ACTIVA: " + millisUntilFinished / 1000 + "s");
|
||||
@@ -140,42 +155,18 @@ public class MainActivity extends Activity {
|
||||
}.start();
|
||||
|
||||
} catch (Exception e) {
|
||||
statusText.setText("Error Conexión: " + e.getMessage());
|
||||
connectBtn.setEnabled(true);
|
||||
statusText.setText("Error al conectar: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void disconnectTunnel() {
|
||||
try {
|
||||
if (backend != null) {
|
||||
backend.setState(tunnel, Tunnel.State.DOWN, null);
|
||||
}
|
||||
statusText.setText("DESCONECTADO.\nListo.");
|
||||
connectBtn.setEnabled(true);
|
||||
connectBtn.setText("REINICIAR");
|
||||
backend.setState(tunnel, Tunnel.State.DOWN, null);
|
||||
statusText.setText("DESCONECTADO. Disfruta!");
|
||||
actionButton.setEnabled(true);
|
||||
actionButton.setText("RECONECTAR");
|
||||
} catch (Exception e) {
|
||||
// Ignorar
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
statusText.setText("Error desconexión: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,17 +11,17 @@
|
||||
android:id="@+id/statusText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="XUPER VPN UNIVERSAL"
|
||||
android:text="VPN + XUPER TV"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginBottom="32dp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/connectBtn"
|
||||
android:id="@+id/actionButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="INICIAR"
|
||||
android:text="ACTIVAR Y ABRIR TV"
|
||||
android:padding="20dp"
|
||||
android:textSize="18sp"/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user