forked from jens/Automation
run executable action
This commit is contained in:
parent
88a3ab8241
commit
c1809bd23c
@ -357,7 +357,7 @@ public class ActivityControlCenter extends Activity
|
||||
systemInfoText.append("Device: " + android.os.Build.DEVICE + Miscellaneous.lineSeparator);
|
||||
systemInfoText.append("Model: " + android.os.Build.MODEL + Miscellaneous.lineSeparator);
|
||||
systemInfoText.append("Product: " + android.os.Build.PRODUCT + Miscellaneous.lineSeparator);
|
||||
systemInfoText.append("Rooted: " + String.valueOf(Miscellaneous.isPhoneRooted()));
|
||||
systemInfoText.append("Rooted: " + String.valueOf(Miscellaneous.isPhoneRooted()) + Miscellaneous.lineSeparator);
|
||||
systemInfoText.append("Country: " + Miscellaneous.getUserCountry(Miscellaneous.getAnyContext()) + Miscellaneous.lineSeparator);
|
||||
systemInfoText.append("OS language: " + Locale.getDefault().getDisplayName() + Miscellaneous.lineSeparator);
|
||||
systemInfoText.append("Logfile written: " + String.valueOf(Settings.writeLogFile) + Miscellaneous.lineSeparator);
|
||||
|
@ -76,7 +76,7 @@ public class ActivityManageActionRunExecutable extends Activity
|
||||
}
|
||||
else
|
||||
{
|
||||
if(false)//!chkRunExecAsRoot.isChecked() && !executableFile.canExecute())
|
||||
if(!chkRunExecAsRoot.isChecked() && !executableFile.canExecute())
|
||||
{
|
||||
Toast.makeText(ActivityManageActionRunExecutable.this, getResources().getString(R.string.fileNotExecutable), Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
|
@ -42,7 +42,7 @@ public class ActivityManageActionWifi extends Activity
|
||||
// if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
||||
// Miscellaneous.messageBox(getResources().getString(R.string.app_name), getResources().getString(R.string.android10WifiToggleNotice), ActivityManageActionWifi.this).show();
|
||||
|
||||
if(BuildConfig.FLAVOR.equals(AutomationService.flavor_name_googleplay))
|
||||
if(getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.Q)
|
||||
tvWifiExplanation1.setVisibility(View.VISIBLE);
|
||||
else
|
||||
tvWifiExplanation1.setVisibility(View.GONE);
|
||||
|
@ -540,7 +540,7 @@ public class ActivityManageRule extends Activity
|
||||
else if(types[i].toString().equals(Trigger_Enum.roaming.toString()))
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.roaming));
|
||||
else if(types[i].toString().equals(Trigger_Enum.broadcastReceived.toString()))
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.satellite));
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.megaphone));
|
||||
else if(types[i].toString().equals(Trigger_Enum.phoneCall.toString()))
|
||||
{
|
||||
if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageRule.this, "android.permission.SEND_SMS"))
|
||||
@ -1836,7 +1836,7 @@ public class ActivityManageRule extends Activity
|
||||
else if(types[i].toString().equals(Action_Enum.closeNotification.toString()))
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.notification));
|
||||
else if(types[i].toString().equals(Action_Enum.sendBroadcast.toString()))
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.satellite));
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.megaphone));
|
||||
else if(types[i].toString().equals(Action_Enum.runExecutable.toString()))
|
||||
items.add(new Item(typesLong[i].toString(), R.drawable.script));
|
||||
else if(types[i].toString().equals(Action_Enum.sendTextMessage.toString()))
|
||||
|
@ -738,8 +738,8 @@ public class Miscellaneous extends Service
|
||||
*
|
||||
* @return <code>true</code> if the device is rooted, <code>false</code> otherwise.
|
||||
*/
|
||||
public static boolean isPhoneRooted()
|
||||
{
|
||||
public static boolean isPhoneRooted()
|
||||
{
|
||||
// if(true)
|
||||
// return true;
|
||||
|
||||
@ -747,30 +747,30 @@ public class Miscellaneous extends Service
|
||||
String buildTags = Build.TAGS;
|
||||
if (buildTags != null && buildTags.contains("test-keys"))
|
||||
{
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
// check if /system/app/Superuser.apk is present
|
||||
try
|
||||
{
|
||||
File file = new File("/system/app/Superuser.apk");
|
||||
if (file.exists())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
try
|
||||
{
|
||||
File file = new File("/system/app/Superuser.apk");
|
||||
if (file.exists())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
// try executing commands
|
||||
return canExecuteCommand("/system/xbin/which su")
|
||||
return canExecuteCommand("/system/xbin/which su")
|
||||
||
|
||||
canExecuteCommand("/system/bin/which su")
|
||||
||
|
||||
canExecuteCommand("which su");
|
||||
}
|
||||
}
|
||||
|
||||
// executes a command on the system
|
||||
private static boolean canExecuteCommand(String command)
|
||||
@ -798,9 +798,9 @@ public class Miscellaneous extends Service
|
||||
* Disables the SSL certificate checking for new instances of {@link HttpsURLConnection} This has been created to
|
||||
* aid testing on a local box, not for use on production.
|
||||
*/
|
||||
private static void disableSSLCertificateChecking()
|
||||
{
|
||||
try
|
||||
private static void disableSSLCertificateChecking()
|
||||
{
|
||||
try
|
||||
{
|
||||
SSLSocketFactory ssf = null;
|
||||
|
||||
|
BIN
app/src/main/res/drawable/megaphone.png
Normal file
BIN
app/src/main/res/drawable/megaphone.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.9 KiB |
@ -18,6 +18,11 @@
|
||||
android:layout_marginBottom="@dimen/default_margin"
|
||||
android:text="@string/runExecutable" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/runExecutableExplanation" />
|
||||
|
||||
<TableLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -820,14 +820,15 @@
|
||||
<string name="enterBroadcast">Enter a broadcast action.</string>
|
||||
<string name="broadcastExplanation">This action allows to send a broadcast across the Android OS messaging system. This is not user-visible, but apps who listen for that specific broadcast can respond to it being sent.</string>
|
||||
<string name="directionStringDoesNotContain">does not contain</string>
|
||||
<string name="runExecutable">Run executable</string>
|
||||
<string name="runExecutable">Run script or executable</string>
|
||||
<string name="path">Path</string>
|
||||
<string name="parameters">Parameters</string>
|
||||
<string name="chooseExecutable">Choose executable</string>
|
||||
<string name="runAsRoot">Run as root</string>
|
||||
<string name="selectValidExecutable">Select a valid executable file.</string>
|
||||
<string name="fileNotExecutable">The file is not executable.</string>
|
||||
<string name="wifiExplanation1">If you downloaded Automation from Google Play Store unfortunately it cannot be turn wifi on or off anymore. Please blame Google for that restriction, not me.\n\nYou can bypass that restriction by rooting your device and activating the checkbox below. Alternatively download this application from F-Droid or my website.</string>
|
||||
<string name="wifiExplanation1">Apps targeting Android Q or higher cannot turn wifi on or off anymore. Please blame Google for this restriction, not me.\n\nYou can bypass this restriction by rooting your device and activating the checkbox below. Alternatively download this application from F-Droid or my website as I am not forced to target the latest API level in those versions.</string>
|
||||
<string name="wifiExplanation2">While airplane mode is activated, wifi can only be toggled from applications when using root permissions for that.</string>
|
||||
<string name="usingRoot">using root</string>
|
||||
<string name="runExecutableExplanation">You can select a script or an executable file here that will be executed as an action.\n\nBut there are some prerequisites which you have to deal with on your own. Google has made it very hard to run anything other than regular Android applications.\n\n1.\nThe file must be marked as executable in the file system. On a regular Android system (without root) this is actually the hard part.\n\n2.\nThat also means Automation must be able to execute the file, not just the owner or the group.\n\n3.\nIf it is a script, a valid shell be specified in the script\'s header.</string>
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user