From c1809bd23c48d5302f6b5e5abfb48574b44ed4e2 Mon Sep 17 00:00:00 2001 From: jens Date: Thu, 2 Jun 2022 17:41:41 +0200 Subject: [PATCH] run executable action --- .../automation2/ActivityControlCenter.java | 2 +- .../ActivityManageActionRunExecutable.java | 2 +- .../automation2/ActivityManageActionWifi.java | 2 +- .../jens/automation2/ActivityManageRule.java | 4 +- .../com/jens/automation2/Miscellaneous.java | 38 +++++++++--------- app/src/main/res/drawable/megaphone.png | Bin 0 -> 2198 bytes app/src/main/res/drawable/satellite.png | Bin 2993 -> 0 bytes .../activity_manage_action_run_executable.xml | 5 +++ app/src/main/res/values/strings.xml | 5 ++- 9 files changed, 32 insertions(+), 26 deletions(-) create mode 100644 app/src/main/res/drawable/megaphone.png delete mode 100644 app/src/main/res/drawable/satellite.png diff --git a/app/src/main/java/com/jens/automation2/ActivityControlCenter.java b/app/src/main/java/com/jens/automation2/ActivityControlCenter.java index 06a18339..0a6de714 100644 --- a/app/src/main/java/com/jens/automation2/ActivityControlCenter.java +++ b/app/src/main/java/com/jens/automation2/ActivityControlCenter.java @@ -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); diff --git a/app/src/main/java/com/jens/automation2/ActivityManageActionRunExecutable.java b/app/src/main/java/com/jens/automation2/ActivityManageActionRunExecutable.java index e332ff38..1111e043 100644 --- a/app/src/main/java/com/jens/automation2/ActivityManageActionRunExecutable.java +++ b/app/src/main/java/com/jens/automation2/ActivityManageActionRunExecutable.java @@ -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; diff --git a/app/src/main/java/com/jens/automation2/ActivityManageActionWifi.java b/app/src/main/java/com/jens/automation2/ActivityManageActionWifi.java index 63364aa4..38b948f0 100644 --- a/app/src/main/java/com/jens/automation2/ActivityManageActionWifi.java +++ b/app/src/main/java/com/jens/automation2/ActivityManageActionWifi.java @@ -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); diff --git a/app/src/main/java/com/jens/automation2/ActivityManageRule.java b/app/src/main/java/com/jens/automation2/ActivityManageRule.java index 4c6b5ac3..b3c353df 100644 --- a/app/src/main/java/com/jens/automation2/ActivityManageRule.java +++ b/app/src/main/java/com/jens/automation2/ActivityManageRule.java @@ -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())) diff --git a/app/src/main/java/com/jens/automation2/Miscellaneous.java b/app/src/main/java/com/jens/automation2/Miscellaneous.java index e21bd74b..d32272d8 100644 --- a/app/src/main/java/com/jens/automation2/Miscellaneous.java +++ b/app/src/main/java/com/jens/automation2/Miscellaneous.java @@ -738,8 +738,8 @@ public class Miscellaneous extends Service * * @return true if the device is rooted, false 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; diff --git a/app/src/main/res/drawable/megaphone.png b/app/src/main/res/drawable/megaphone.png new file mode 100644 index 0000000000000000000000000000000000000000..b425f4651198a196bd5dbc90ae3b325ccab79428 GIT binary patch literal 2198 zcmXw4c{~&DAK$)`JC({tNs_DBW>m-Wd=Jg?95Jn!fIeBRIJ^LbLvTboLV%7_90010z5BRlSB!fh(T zJGniwk3!`Rz#uzQLjd*t!3D0d!_xp|0030p660V6xwZ(=%rOW6P~7#W0WF*!|Jmd~ zGIkB<5KZ%;200EvXkpAWw3=Z%v$BKTvy@$yFQZr(U7$(w+e_ac#qx)2C1(4A{v zbH@?<{R#LW4MLzNgvi6V@gR_J_do&!rU8Y}XX>}O95R16&;$=s2sY3iaGrZANyFOM zUj7m%$V4L4Xj}R3;#b=~ zGL0z(iVk2cFF*VA(*N$^<&Txfxif-#k@9c5l#{?#uoNeeJF1ni>C0Ymnpi`DNHKKe zD6HXtwZV%&^HdK`?yrObshyt-A$X8 zVJoa4yo6_#o20Ou3&iIaMlcAS9@o_FQbDl;er=f}wY9b5W3Pj70(P8(b!HsVO{~`& zI1{;f2~-eMz(Vl(OAq`i!A{hLO}f9lm#(U>ua6%tcdP`eB4ROYg)QYKh$WU&552x~ zBFW@0V2}caQ|IUBLlYaObJg+fsr&J3tRXyu=6y_H^@_8z^TM0hZ%pH9mn13duz0I% z;mU@=EUlj>T!5;*i_7H1*jQvpM8wZgouIkXU2oN$U-nd7di|lo`PF-EEv?Mkldppw z>XGKt2K>~n?l}v9>?I`JI_JI?mIk(DzJVfKXER#G%WBLX8(goYQkNj087SS>0zcJ~ zfCzY(UF|zUPpOUix&FGc5*D(_#*zsfIS$Z5Av z^Ub6zn_ci+g(LYkw3Kj=R{abFuNll5w7Zq!Nx?jvmV1}`!1Pu&_yzg*c2#doZPSg< z5$Apx^}68&v#8U(%{sgnG)}Oe6k;m2xva-}bw6`I?J52=NA}Pmb+`$QMr$irlMhXg zl-~EWUxlOEMi%?RSIQtAmny| zU;>QMT?d}FX?5gr3ED~Ol>Yu?aWeq*$g0eyV9BHR{$Rh9eM_Ize>J;sLVd^E59a?&!pqJ%u5IQ`=>4{f5Q#> zP6vLV$bi8s^(x!1faH@cXTU#1t&$|zz}nBnB4qIje&7~{5oOOv9ya6{2hAt5|KaSJ z7^(J%#=Oddd;aJ6;C^vw?e~>33yp@GHPUXW7IUGX!+^$>nKfzVhA#io$nebP!qmhg zeU(gHa${sOq$us?p39j7@^H4P*3>Ke`z(l>s`k}G;F>RnV*pLp9mDY}GfnZ}zC3fA z<(n#aUJmCLh8Hdx9SRk;f*ob$X-Acx?@)bA_Mty2S9+deKl+w(nX<;%35m8E75-xI zFcSW!dK>R&?8rKsyM-K2FoJk@+!N@zm*G?~SR&$FC!l#w3ziKVX&q_V^w{3V7b^X>xX5KfC<5e*gLETeAoQnA>=KT#n)*0k`+*{{hZO60@y zaH_rhG4X!QU+u&Ncb=1v>;{+z+vv&P8+&WoKAeb|DlQS_{}DcE)w)@7rdM`hQ?K_C z#B+}Qe>!{qniSAH1vFW;5uhEl8%2SYLwG!Xo!e2bddM8&M5iWB&&# C*dV6> literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable/satellite.png b/app/src/main/res/drawable/satellite.png deleted file mode 100644 index f44a177aafe0495daf17abfffc82eaa65886d28f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2993 zcmZWrdpwhG8=u1n35{e2{c6t~MvvKPEKBP$~Spd?;s69Z(g1<0qJ`~d)9+Vf+10`BoYR4!~^f|1-0LxSg<9{{e{&*spfQ9@&syhKs#`saxdTazd*{Y7) zs%YO!e(qR+7llIh*Mq@)$ym}~F<(C%%mYio;0Z9eHXIJuhW!^(b%&_xHcwTzAl3iz zQsu~seeGhq%&~#=B?tN8ab6Sv5~&VBU2-Gf-61BvL=2t;F~NG^-7(wDA=@0-6x{u= z?Db`=yDyRGOY&FSra}Irr6+? z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(kAcU2zkA4(WT5&c={8gAY`aI)VTBQcUE0Z80tal@!o;%xF0z@SEBbRf|?UX zQjzM2kh@jo$G}QeRaLf~-plb(nJ3S3as^wFtoDz0f5oMvGCJg1`&~{;-4%>h2_r5i z=KRKS*&L@tpa z{iu0liUzLTLjLn?xv)U;eW|5GAUh+^UqPE1WD4amPF{Ot>b*Fp=)r~fi)YG-pNCo5 z$h%%`XdKU$S?A{3kMNZZ*_w^kq1$1L@kQqcH$Jx9RbmK6KU%E62})M_jJwHc5f2za zKRh#!2d|(Q;zHRI9qsA*HB^I@!bQ!$ZKWF1hq7BvV525qyU}eL*Z|tb-ku&%fyuO65y$U#?p3#3; diff --git a/app/src/main/res/layout/activity_manage_action_run_executable.xml b/app/src/main/res/layout/activity_manage_action_run_executable.xml index 81a05c05..f230ccdd 100644 --- a/app/src/main/res/layout/activity_manage_action_run_executable.xml +++ b/app/src/main/res/layout/activity_manage_action_run_executable.xml @@ -18,6 +18,11 @@ android:layout_marginBottom="@dimen/default_margin" android:text="@string/runExecutable" /> + + Enter a broadcast action. 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. does not contain - Run executable + Run script or executable Path Parameters Choose executable Run as root Select a valid executable file. The file is not executable. - 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. + 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. While airplane mode is activated, wifi can only be toggled from applications when using root permissions for that. using root + 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. \ No newline at end of file