Shizuku
This commit is contained in:
@@ -82,7 +82,8 @@
|
|||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
|
||||||
<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
|
<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
|
||||||
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
|
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
|
||||||
|
<uses-permission android:name="android.permission.TETHER_PRIVILEGED" />
|
||||||
|
dev.shadoe.delta.action.START_SOFT_AP
|
||||||
<uses-feature
|
<uses-feature
|
||||||
android:name="android.hardware.telephony"
|
android:name="android.hardware.telephony"
|
||||||
android:required="false" />
|
android:required="false" />
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import android.content.Intent;
|
|||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.media.MediaPlayer;
|
import android.media.MediaPlayer;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
|
import android.net.TetheringManager;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.net.wifi.WifiManager;
|
import android.net.wifi.WifiManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@@ -73,6 +74,8 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import javax.net.ssl.SSLContext;
|
import javax.net.ssl.SSLContext;
|
||||||
@@ -541,7 +544,7 @@ public class Actions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if(Build.VERSION.SDK_INT < 36)
|
||||||
{
|
{
|
||||||
MyOnStartTetheringCallback cb = new MyOnStartTetheringCallback()
|
MyOnStartTetheringCallback cb = new MyOnStartTetheringCallback()
|
||||||
{
|
{
|
||||||
@@ -564,6 +567,13 @@ public class Actions
|
|||||||
else
|
else
|
||||||
mowm.stopTethering();
|
mowm.stopTethering();
|
||||||
}
|
}
|
||||||
|
else // from Android 16 onwards
|
||||||
|
{
|
||||||
|
if(desiredState)
|
||||||
|
Actions.WifiTethering.enable(context);
|
||||||
|
else
|
||||||
|
Actions.WifiTethering.disable(context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1098,18 +1108,18 @@ public class Actions
|
|||||||
// {
|
// {
|
||||||
// ssf = new MySSLSocketFactory(ctx);
|
// ssf = new MySSLSocketFactory(ctx);
|
||||||
// ssf.setHostnameVerifier(SSLSocketFactory.STRICT_HOSTNAME_VERIFIER);
|
// ssf.setHostnameVerifier(SSLSocketFactory.STRICT_HOSTNAME_VERIFIER);
|
||||||
//
|
//
|
||||||
// char[] keystorePass="insecure".toCharArray(); //passphrase for keystore
|
// char[] keystorePass="insecure".toCharArray(); //passphrase for keystore
|
||||||
// KeyStore keyStore=KeyStore.getInstance("BKS");
|
// KeyStore keyStore=KeyStore.getInstance("BKS");
|
||||||
//
|
//
|
||||||
//// String tmfAlgorithm = TrustManagerFactory.getDefaultAlgorithm();
|
//// String tmfAlgorithm = TrustManagerFactory.getDefaultAlgorithm();
|
||||||
// TrustManagerFactory tmf = TrustManagerFactory.getInstance("X509");
|
// TrustManagerFactory tmf = TrustManagerFactory.getInstance("X509");
|
||||||
// tmf.init(keyStore);
|
// tmf.init(keyStore);
|
||||||
//
|
//
|
||||||
// Miscellaneous.logEvent("i", "SSL Keystore", context.getCacheDir().toString(), 4);
|
// Miscellaneous.logEvent("i", "SSL Keystore", context.getCacheDir().toString(), 4);
|
||||||
// InputStream is = context.getResources().openRawResource(R.raw.keystore);
|
// InputStream is = context.getResources().openRawResource(R.raw.keystore);
|
||||||
// keyStore.load(is,keystorePass);
|
// keyStore.load(is,keystorePass);
|
||||||
//
|
//
|
||||||
// ctx.init(null, tmf.getTrustManagers(), null);
|
// ctx.init(null, tmf.getTrustManagers(), null);
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
@@ -1222,7 +1232,10 @@ public class Actions
|
|||||||
else if (startupType.equals(ActivityManageActionStartActivity.startByForegroundServiceString) && Build.VERSION.SDK_INT >= 26)
|
else if (startupType.equals(ActivityManageActionStartActivity.startByForegroundServiceString) && Build.VERSION.SDK_INT >= 26)
|
||||||
automationServerRef.startForegroundService(externalApplicationIntent);
|
automationServerRef.startForegroundService(externalApplicationIntent);
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
externalApplicationIntent.addCategory("");
|
||||||
automationServerRef.sendBroadcast(externalApplicationIntent);
|
automationServerRef.sendBroadcast(externalApplicationIntent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -2674,5 +2687,71 @@ public class Actions
|
|||||||
// }
|
// }
|
||||||
android.provider.Settings.Secure.putString(context.getContentResolver(), android.provider.Settings.Secure.LOCATION_MODE, String.valueOf(desiredState));
|
android.provider.Settings.Secure.putString(context.getContentResolver(), android.provider.Settings.Secure.LOCATION_MODE, String.valueOf(desiredState));
|
||||||
}
|
}
|
||||||
|
public static final class WifiTethering
|
||||||
|
{
|
||||||
|
private static final Executor EXECUTOR = Executors.newSingleThreadExecutor();
|
||||||
|
|
||||||
|
private WifiTethering()
|
||||||
|
{
|
||||||
|
// Utility class
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void enable(Context context)
|
||||||
|
{
|
||||||
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.BAKLAVA)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("TetheringManager requires Android 16 / API 36");
|
||||||
|
}
|
||||||
|
|
||||||
|
TetheringManager tetheringManager = context.getSystemService(TetheringManager.class);
|
||||||
|
|
||||||
|
TetheringManager.TetheringRequest request = new TetheringManager.TetheringRequest.Builder(TetheringManager.TETHERING_WIFI).build();
|
||||||
|
|
||||||
|
tetheringManager.startTethering(request, EXECUTOR, new TetheringManager.StartTetheringCallback() {
|
||||||
|
@Override
|
||||||
|
public void onTetheringStarted()
|
||||||
|
{
|
||||||
|
// Wi-Fi hotspot enabled
|
||||||
|
Miscellaneous.logEvent("i", "Tethering start", "Success", 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTetheringFailed(int error)
|
||||||
|
{
|
||||||
|
// Hotspot could not be enabled
|
||||||
|
Miscellaneous.logEvent("i", "Tethering start", "Failure. Error code: " + String.valueOf(error), 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void disable(Context context)
|
||||||
|
{
|
||||||
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.BAKLAVA)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("TetheringManager requires Android 16 / API 36");
|
||||||
|
}
|
||||||
|
|
||||||
|
TetheringManager tetheringManager = context.getSystemService(TetheringManager.class);
|
||||||
|
|
||||||
|
TetheringManager.TetheringRequest request = new TetheringManager.TetheringRequest.Builder(TetheringManager.TETHERING_WIFI).build();
|
||||||
|
// tetheringManager.stopTethering(TetheringManager.TETHERING_WIFI, EXECUTOR, new TetheringManager.StopTetheringCallback() {
|
||||||
|
tetheringManager.stopTethering(request, EXECUTOR, new TetheringManager.StopTetheringCallback() {
|
||||||
|
@Override
|
||||||
|
public void onStopTetheringSucceeded()
|
||||||
|
{
|
||||||
|
TetheringManager.StopTetheringCallback.super.onStopTetheringSucceeded();
|
||||||
|
Miscellaneous.logEvent("i", "Tethering stop", "Success", 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStopTetheringFailed(int error)
|
||||||
|
{
|
||||||
|
// Hotspot could not be disabled
|
||||||
|
Miscellaneous.logEvent("i", "Tethering stop", "Failure. Error code: " + String.valueOf(error), 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user