Tethering

This commit is contained in:
jens 2022-08-27 02:07:47 +02:00
parent b73a45f4cd
commit eff04037a1

View File

@ -51,6 +51,12 @@ public class TetheringReceiver extends android.content.BroadcastReceiver impleme
{ {
Miscellaneous.logEvent("i", "TetheringReceiver", "Received " + intent.getAction(), 5); Miscellaneous.logEvent("i", "TetheringReceiver", "Received " + intent.getAction(), 5);
/*
DETECT BY DATA DELIVERED IN INTENT
*/
// if(intent.getAction().equals("android.net.conn.TETHER_STATE_CHANGED"))
// {
String searchArray = null; String searchArray = null;
if (Build.VERSION.SDK_INT >= 26) if (Build.VERSION.SDK_INT >= 26)
@ -91,8 +97,13 @@ public class TetheringReceiver extends android.content.BroadcastReceiver impleme
// Miscellaneous.logEvent("i", "Broadcast extra", "Broadcast " + intent.getAction() + " has extra " + key + " and type " + intent.getExtras().get(key).getClass().getName(), 4); // Miscellaneous.logEvent("i", "Broadcast extra", "Broadcast " + intent.getAction() + " has extra " + key + " and type " + intent.getExtras().get(key).getClass().getName(), 4);
} }
// }
try // else if(intent.getAction().equals("android.net.conn.CONNECTIVITY_CHANGE"))
/*
DETECT BY CHECKING ALL NETWORK INTERFACES
*/
// {
/*try
{ {
for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements(); ) for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements(); )
{ {
@ -104,6 +115,14 @@ public class TetheringReceiver extends android.content.BroadcastReceiver impleme
{ {
if (intf.getName().contains("rndis")) if (intf.getName().contains("rndis"))
{ {
Miscellaneous.logEvent("i", "TetheringReceiver", "Tethering on interface " + intf.getName() + " seems to be active.", 4);
lastTetheringTypes.add(ActivityManageTriggerTethering.tetheringTypeUsb);
tetheringActive = true;
}
else if (intf.getName().contains("ndis"))
{
Miscellaneous.logEvent("i", "TetheringReceiver", "Tethering on interface " + intf.getName() + " seems to be active.", 4);
lastTetheringTypes.add(ActivityManageTriggerTethering.tetheringTypeCable);
tetheringActive = true; tetheringActive = true;
} }
} }
@ -113,7 +132,8 @@ public class TetheringReceiver extends android.content.BroadcastReceiver impleme
catch (Exception e) catch (Exception e)
{ {
Miscellaneous.logEvent("e", "TetheringReceiver", Log.getStackTraceString(e), 1); Miscellaneous.logEvent("e", "TetheringReceiver", Log.getStackTraceString(e), 1);
} }*/
// }
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger.Trigger_Enum.tethering); ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger.Trigger_Enum.tethering);
for(int i=0; i<ruleCandidates.size(); i++) for(int i=0; i<ruleCandidates.size(); i++)
@ -137,6 +157,7 @@ public class TetheringReceiver extends android.content.BroadcastReceiver impleme
{ {
intentFilter = new IntentFilter(); intentFilter = new IntentFilter();
intentFilter.addAction("android.net.conn.TETHER_STATE_CHANGED"); intentFilter.addAction("android.net.conn.TETHER_STATE_CHANGED");
// intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE");
} }
try try