forked from jens/Automation
bugspray
This commit is contained in:
parent
448942e4e8
commit
8563234db3
@ -1445,9 +1445,10 @@ public class ActivityManageRule extends Activity
|
|||||||
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setUsbTethering.toString()))
|
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setUsbTethering.toString()))
|
||||||
{
|
{
|
||||||
newAction.setAction(Action_Enum.setUsbTethering);
|
newAction.setAction(Action_Enum.setUsbTethering);
|
||||||
|
getActionParameter1Dialog(ActivityManageRule.this).show();
|
||||||
|
|
||||||
if(Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1)
|
if(Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1)
|
||||||
Miscellaneous.messageBox(context.getResources().getString(R.string.warning), context.getResources().getString(R.string.usbTetheringFailForAboveGingerbread), context).show();
|
Miscellaneous.messageBox(context.getResources().getString(R.string.warning), context.getResources().getString(R.string.usbTetheringFailForAboveGingerbread), context).show();
|
||||||
getActionParameter1Dialog(ActivityManageRule.this).show();
|
|
||||||
}
|
}
|
||||||
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setWifiTethering.toString()))
|
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setWifiTethering.toString()))
|
||||||
{
|
{
|
||||||
|
@ -499,7 +499,8 @@ public class ActivityPermissions extends Activity
|
|||||||
case setAirplaneMode:
|
case setAirplaneMode:
|
||||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
// https://stackoverflow.com/questions/32185628/connectivitymanager-requestnetwork-in-android-6-0
|
||||||
|
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
/* Permission was not required anymore, even before Android 6: https://su.chainfire.eu/#updates-permission
|
/* Permission was not required anymore, even before Android 6: https://su.chainfire.eu/#updates-permission
|
||||||
addToArrayListUnique(permissionNameSuperuser, requiredPermissions);*/
|
addToArrayListUnique(permissionNameSuperuser, requiredPermissions);*/
|
||||||
break;
|
break;
|
||||||
@ -512,7 +513,8 @@ public class ActivityPermissions extends Activity
|
|||||||
case setDataConnection:
|
case setDataConnection:
|
||||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
// https://stackoverflow.com/questions/32185628/connectivitymanager-requestnetwork-in-android-6-0
|
||||||
|
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.READ_PHONE_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.READ_PHONE_STATE, requiredPermissions);
|
||||||
/* Permission was not required anymore, even before Android 6: https://su.chainfire.eu/#updates-permission
|
/* Permission was not required anymore, even before Android 6: https://su.chainfire.eu/#updates-permission
|
||||||
addToArrayListUnique(permissionNameSuperuser, requiredPermissions);*/
|
addToArrayListUnique(permissionNameSuperuser, requiredPermissions);*/
|
||||||
@ -522,16 +524,19 @@ public class ActivityPermissions extends Activity
|
|||||||
break;
|
break;
|
||||||
case setUsbTethering:
|
case setUsbTethering:
|
||||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
// https://stackoverflow.com/questions/32185628/connectivitymanager-requestnetwork-in-android-6-0
|
||||||
|
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case setWifi:
|
case setWifi:
|
||||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
// https://stackoverflow.com/questions/32185628/connectivitymanager-requestnetwork-in-android-6-0
|
||||||
|
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case setWifiTethering:
|
case setWifiTethering:
|
||||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
// https://stackoverflow.com/questions/32185628/connectivitymanager-requestnetwork-in-android-6-0
|
||||||
|
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -578,30 +583,30 @@ public class ActivityPermissions extends Activity
|
|||||||
break;
|
break;
|
||||||
case turnUsbTetheringOff:
|
case turnUsbTetheringOff:
|
||||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case turnUsbTetheringOn:
|
case turnUsbTetheringOn:
|
||||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case turnWifiOff:
|
case turnWifiOff:
|
||||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case turnWifiOn:
|
case turnWifiOn:
|
||||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case turnWifiTetheringOff:
|
case turnWifiTetheringOff:
|
||||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case turnWifiTetheringOn:
|
case turnWifiTetheringOn:
|
||||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case waitBeforeNextAction:
|
case waitBeforeNextAction:
|
||||||
|
@ -15,6 +15,8 @@ import android.content.Intent;
|
|||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
|
import android.net.ConnectivityManager;
|
||||||
|
import android.net.NetworkInfo;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@ -671,6 +673,24 @@ public class Miscellaneous extends Service
|
|||||||
return alertDialog.create();
|
return alertDialog.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean haveNetworkConnection()
|
||||||
|
{
|
||||||
|
boolean haveConnectedWifi = false;
|
||||||
|
boolean haveConnectedMobile = false;
|
||||||
|
|
||||||
|
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
|
NetworkInfo[] netInfo = cm.getAllNetworkInfo();
|
||||||
|
for (NetworkInfo ni : netInfo) {
|
||||||
|
if (ni.getTypeName().equalsIgnoreCase("WIFI"))
|
||||||
|
if (ni.isConnected())
|
||||||
|
haveConnectedWifi = true;
|
||||||
|
if (ni.getTypeName().equalsIgnoreCase("MOBILE"))
|
||||||
|
if (ni.isConnected())
|
||||||
|
haveConnectedMobile = true;
|
||||||
|
}
|
||||||
|
return haveConnectedWifi || haveConnectedMobile;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the device is rooted.
|
* Checks if the device is rooted.
|
||||||
*
|
*
|
||||||
@ -678,9 +698,13 @@ public class Miscellaneous extends Service
|
|||||||
*/
|
*/
|
||||||
public static boolean isPhoneRooted()
|
public static boolean isPhoneRooted()
|
||||||
{
|
{
|
||||||
|
if(true)
|
||||||
|
return true;
|
||||||
|
|
||||||
// get from build info
|
// get from build info
|
||||||
String buildTags = Build.TAGS;
|
String buildTags = Build.TAGS;
|
||||||
if (buildTags != null && buildTags.contains("test-keys")) {
|
if (buildTags != null && buildTags.contains("test-keys"))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -507,7 +507,7 @@
|
|||||||
<string name="phoneIsNotRooted" translatable="false">Phone is not rooted.</string>
|
<string name="phoneIsNotRooted" translatable="false">Phone is not rooted.</string>
|
||||||
<string name="dataConWithRootSuccess" translatable="false">Data connection was successfully changed using superuser permissions.</string>
|
<string name="dataConWithRootSuccess" translatable="false">Data connection was successfully changed using superuser permissions.</string>
|
||||||
<string name="dataConWithRootFail" translatable="false">Data could not be changed using superuser permissions.</string>
|
<string name="dataConWithRootFail" translatable="false">Data could not be changed using superuser permissions.</string>
|
||||||
<string name="rootExplanation">You need to root your phone for this function to work. Afterwards you needs to \"run the rule manually\" to show up the superuser permission question. When the superuser popups shows up you need to always allow the application to do that. Otherwise the rule cannot function when the phone is unattended.</string>
|
<string name="rootExplanation">You need to root your phone for this function to work. Afterwards you need to \"run the rule manually\" to show up the superuser permission question. When the superuser popups shows up you need to always allow the application to do that. Otherwise the rule cannot function when the phone is unattended.</string>
|
||||||
<string name="errorWritingConfig">Error writing config. Do you have a writable memory?</string>
|
<string name="errorWritingConfig">Error writing config. Do you have a writable memory?</string>
|
||||||
<string name="phoneNrReplacementError">I could not insert the last phone nr in the variable. I don\'t have it.</string>
|
<string name="phoneNrReplacementError">I could not insert the last phone nr in the variable. I don\'t have it.</string>
|
||||||
<string name="username">Username</string>
|
<string name="username">Username</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user