Forum added to contact options

This commit is contained in:
2025-10-19 23:32:34 +02:00
parent 7972a335c3
commit a6e10d09c3
17 changed files with 2060 additions and 2042 deletions

View File

@@ -79,7 +79,7 @@
<!--android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.USE_EXACT_ALARM" />-->
<uses-permission android:name="com.termux.permission.RUN_COMMAND" />
<uses-permission android:name="com.termux.permission.FOREGROUND_SERVICE_TYPE_SPECIAL_USE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<uses-feature
android:name="android.hardware.telephony"

View File

@@ -77,7 +77,7 @@
<!--android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.USE_EXACT_ALARM" />-->
<uses-permission android:name="com.termux.permission.RUN_COMMAND" />
<uses-permission android:name="com.termux.permission.FOREGROUND_SERVICE_TYPE_SPECIAL_USE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<uses-feature
android:name="android.hardware.telephony"

View File

@@ -74,7 +74,7 @@
<!--android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.USE_EXACT_ALARM" />-->
<uses-permission android:name="com.termux.permission.RUN_COMMAND" />
<uses-permission android:name="com.termux.permission.FOREGROUND_SERVICE_TYPE_SPECIAL_USE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<application
android:allowBackup="true"

View File

@@ -97,7 +97,7 @@ public class Actions
Miscellaneous.logEvent("w", "createNotification", "Creating notification with title " + elements[0] + " and text " + elements[1], 3);
// Create a new notification ID each time
int notificationId = Math.round(Calendar.getInstance().getTimeInMillis()/1000);
int notificationId = Math.round(Calendar.getInstance().getTimeInMillis() / 1000);
try
{
@@ -128,17 +128,17 @@ public class Actions
String requiredText = "";
String method = ActivityManageActionCloseNotification.dismissRegularString;
if(params.length >= 5)
if (params.length >= 5)
requiredText = params[4];
if(params.length >= 6 && !params[5].equals(ActivityManageActionCloseNotification.dismissRegularString))
if (params.length >= 6 && !params[5].equals(ActivityManageActionCloseNotification.dismissRegularString))
method = params[5];
for (StatusBarNotification sbn : NotificationListener.getInstance().getActiveNotifications())
{
NotificationListener.SimpleNotification sn = NotificationListener.convertNotificationToSimpleNotification(true, sbn);
Miscellaneous.logEvent("i", "NotificationCloseCheck", "Checking if this notification should be closed in the context of rule " + action.getParentRule().getName() + ": "+ sn.toString(), 5);
Miscellaneous.logEvent("i", "NotificationCloseCheck", "Checking if this notification should be closed in the context of rule " + action.getParentRule().getName() + ": " + sn.toString(), 5);
if (!myApp.equals(Trigger.anyAppString))
{
@@ -153,7 +153,7 @@ public class Actions
/*
Notifications from Automation are disregarded to avoid infinite loops.
*/
if(myApp.equals(BuildConfig.APPLICATION_ID))
if (myApp.equals(BuildConfig.APPLICATION_ID))
{
continue;
}
@@ -185,9 +185,9 @@ public class Actions
}
Miscellaneous.logEvent("i", "NotificationCloseCheck", "All criteria matches. Closing notification: " + sbn.getNotification().toString(), 3);
if(NotificationListener.getInstance() != null)
if (NotificationListener.getInstance() != null)
{
if(method == ActivityManageActionCloseNotification.dismissRegularString)
if (method == ActivityManageActionCloseNotification.dismissRegularString)
NotificationListener.getInstance().dismissNotification(sbn);
else
NotificationListener.getInstance().clickNotificationButton(sbn, method);
@@ -204,7 +204,7 @@ public class Actions
Miscellaneous.logEvent("i", "sendBroadcast", "Sending broadcast with action " + action, 5);
Intent broadcastIntent = new Intent();
if(action.contains(Action.actionParameter2Split))
if (action.contains(Action.actionParameter2Split))
{
String[] parts = action.split(Action.actionParameter2Split);
broadcastIntent.setAction(parts[0]);
@@ -222,11 +222,11 @@ public class Actions
{
String[] parts = parameter2.split(Action.actionParameter2Split);
if(AutomationService.isMyServiceRunning(Miscellaneous.getAnyContext()))
if (AutomationService.isMyServiceRunning(Miscellaneous.getAnyContext()))
{
Map<String,String> map = AutomationService.getInstance().getVariableMap();
Map<String, String> map = AutomationService.getInstance().getVariableMap();
if(parts.length > 1)
if (parts.length > 1)
{
try
{
@@ -243,9 +243,9 @@ public class Actions
Miscellaneous.logEvent("i", "Variable", "Checking for applicable rules after variable has been set or deleted.", 2);
List<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger.Trigger_Enum.checkVariable);
for(int i=0; i<ruleCandidates.size(); i++)
for (int i = 0; i < ruleCandidates.size(); i++)
{
if(ruleCandidates.get(i).haveEnoughPermissions() && ruleCandidates.get(i).getsGreenLight(AutomationService.getInstance()))
if (ruleCandidates.get(i).haveEnoughPermissions() && ruleCandidates.get(i).getsGreenLight(AutomationService.getInstance()))
{
Miscellaneous.logEvent("i", "Variable", "Rule " + ruleCandidates.get(i).getName() + " applies after variable has been set or deleted.", 2);
ruleCandidates.get(i).activate(AutomationService.getInstance(), false);
@@ -265,12 +265,12 @@ public class Actions
{
forceUseRoot = Boolean.parseBoolean(parameter2);
}
catch(Exception e)
catch (Exception e)
{
}
if(context.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.Q || forceUseRoot)
if (context.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.Q || forceUseRoot)
return setWifiWithRoot(context, desiredState, toggleActionIfPossible);
else
return setWifiOldFashioned(context, desiredState, toggleActionIfPossible);
@@ -283,7 +283,7 @@ public class Actions
String command = null;
String desiredStateString;
if(desiredState)
if (desiredState)
desiredStateString = "enable";
else
desiredStateString = "disable";
@@ -310,7 +310,7 @@ public class Actions
if (desiredState && Settings.useWifiForPositioning)
WifiBroadcastReceiver.startWifiReceiver(automationServerRef.getLocationProvider());
}
catch(Exception e)
catch (Exception e)
{
Miscellaneous.logEvent("w", "setWifiOldFashioned()", Log.getStackTraceString(e), 4);
}
@@ -584,7 +584,7 @@ public class Actions
{
Miscellaneous.logEvent("e", "Bluetooth Tethering", Log.getStackTraceString(e), 1);
}
catch(InvocationTargetException e)
catch (InvocationTargetException e)
{
/*
Exact error message: "Bluetooth binder is null"
@@ -842,7 +842,7 @@ public class Actions
public static void setDoNotDisturb(Context context, int desiredDndMode)
{
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
{
/*
if (!notificationManager.isNotificationPolicyAccessGranted())
@@ -850,7 +850,7 @@ public class Actions
*/
Miscellaneous.logEvent("i", context.getResources().getString(R.string.soundSettings), "Changing DND to " + String.valueOf(desiredDndMode), 4);
NotificationManager mNotificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.setInterruptionFilter(desiredDndMode);
}
else
@@ -965,9 +965,9 @@ public class Actions
String vibrateDurations[] = parameter2.split(Action.vibrateSeparator);
int counter = 1;
for(String vibrate : vibrateDurations)
for (String vibrate : vibrateDurations)
{
if(counter % 2 != 0)
if (counter % 2 != 0)
{
Vibrator vibrator = (Vibrator) Miscellaneous.getAnyContext().getSystemService(Context.VIBRATOR_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
@@ -1055,7 +1055,7 @@ public class Actions
String[] params;
if(param.contains(Action.actionParameter2Split))
if (param.contains(Action.actionParameter2Split))
params = param.split(Action.actionParameter2Split, -1);
else
params = param.split(";", -1);
@@ -1079,7 +1079,7 @@ public class Actions
externalApplicationIntent = new Intent(Intent.ACTION_MAIN);
externalApplicationIntent.addCategory(Intent.CATEGORY_LAUNCHER);
if(packageName.equals("dummyPkg") || packageName.length() == 0)
if (packageName.equals("dummyPkg") || packageName.length() == 0)
externalApplicationIntent.setAction(className);
externalApplicationIntent.setPackage(packageName);
@@ -1098,7 +1098,7 @@ public class Actions
if (!packageName.equals(dummyPackageString))
{
externalApplicationIntent.setPackage(packageName);
if(!StringUtils.isEmpty(className))
if (!StringUtils.isEmpty(className))
externalApplicationIntent.setClassName(packageName, className);
}
@@ -1111,11 +1111,12 @@ public class Actions
}
externalApplicationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// externalApplicationIntent.setType(android.intent.extra.)
// Pack intents
if(params.length >= 5)
if (params.length >= 5)
{
if(Miscellaneous.isNumeric(startupType))
if (Miscellaneous.isNumeric(startupType))
externalApplicationIntent = packParametersIntoIntent(externalApplicationIntent, params, 4);
else
externalApplicationIntent = packParametersIntoIntent(externalApplicationIntent, params, 3);
@@ -1279,18 +1280,18 @@ public class Actions
phoneNumber = parametersArray[0];
message = parametersArray[1];
if(parametersArray.length > 2)
if (parametersArray.length > 2)
{
messageType = parametersArray[2];
if(parametersArray.length > 3)
if (parametersArray.length > 3)
filePath = parametersArray[3];
}
try
{
String textToSend = Miscellaneous.replaceVariablesInText(message, context);
if(messageType.equals("sms"))
if (messageType.equals("sms"))
sendSmsMessage(phoneNumber, textToSend);
else
sendMmsMessage(phoneNumber, textToSend, filePath);
@@ -1365,7 +1366,7 @@ public class Actions
wakeLock.release();
}
catch(Exception e)
catch (Exception e)
{
Miscellaneous.logEvent("e", "Wakeup device action", "Error while waking up device: " + Log.getStackTraceString(e), 1);
}
@@ -1410,7 +1411,7 @@ public class Actions
// Works, but requires Manifest.permission.BIND_DEVICE_ADMIN
// https://stackoverflow.com/questions/23898406/java-lang-securityexception-no-active-admin-owned-by-uid-10047-for-policy-4-on
DevicePolicyManager deviceManager = (DevicePolicyManager)Miscellaneous.getAnyContext().getSystemService(Context.DEVICE_POLICY_SERVICE);
DevicePolicyManager deviceManager = (DevicePolicyManager) Miscellaneous.getAnyContext().getSystemService(Context.DEVICE_POLICY_SERVICE);
deviceManager.lockNow();
}
@@ -1618,7 +1619,7 @@ public class Actions
public static boolean controlMediaPlayback(Context context, int command)
{
int keyCode = -1;
switch(command)
switch (command)
{
case 0:
keyCode = KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE;
@@ -1764,9 +1765,9 @@ public class Actions
{
try
{
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)
{
if(MobileDataStuff.setMobileNetworkFromAndroid9(desiredState, automationServerRef))
if (MobileDataStuff.setMobileNetworkFromAndroid9(desiredState, automationServerRef))
{
Miscellaneous.logEvent("i", "setDataConnectionWithRoot()", Miscellaneous.getAnyContext().getResources().getString(R.string.dataConWithRootSuccess), 2);
return true;
@@ -1826,7 +1827,7 @@ public class Actions
try
{
int desiredStateString;
if(desiredState)
if (desiredState)
desiredStateString = 1;
else
desiredStateString = 0;
@@ -1869,7 +1870,7 @@ public class Actions
try
{
int desiredStateString;
if(desiredState)
if (desiredState)
desiredStateString = 1;
else
desiredStateString = 0;
@@ -1902,7 +1903,7 @@ public class Actions
String command = null;
String desiredStateString;
if(desiredState)
if (desiredState)
desiredStateString = "enable";
else
desiredStateString = "disable";
@@ -2022,7 +2023,7 @@ public class Actions
suResult = Shell.Pool.SU.run(commands);
if(Miscellaneous.getCallingMethodName().equals("runExecutable"))
if (Miscellaneous.getCallingMethodName().equals("runExecutable"))
{
Actions.setVariable("last_run_executable_exit_code" + Action.actionParameter2Split + String.valueOf(suResult));
// Actions.setVariable("last_run_executable_output" + Action.actionParameter2Split + (String) result[1]);
@@ -2030,7 +2031,7 @@ public class Actions
Miscellaneous.logEvent("i", "executeCommandViaSu()", "RC=" + String.valueOf(suResult), 3);
if(suResult == 0)
if (suResult == 0)
success = true;
}
else
@@ -2078,7 +2079,7 @@ public class Actions
static int getBrightnessSetting(int percentage)
{
if(percentage == 0)
if (percentage == 0)
return 1; // seems to be the minimum, 0 isn't working
/*
@@ -2090,7 +2091,7 @@ public class Actions
Map<Integer, Integer> percentageSettingValueMap = new HashMap<>();
if(Build.VERSION.SDK_INT < 34)
if (Build.VERSION.SDK_INT < 34)
{
// Noted from Android 10
percentageSettingValueMap.put(11, 10);
@@ -2167,87 +2168,87 @@ public class Actions
else
{
// Noted from Android 14
percentageSettingValueMap.put(11,1);
percentageSettingValueMap.put(15,2);
percentageSettingValueMap.put(19,3);
percentageSettingValueMap.put(22,4);
percentageSettingValueMap.put(24,5);
percentageSettingValueMap.put(27,6);
percentageSettingValueMap.put(29,7);
percentageSettingValueMap.put(31,8);
percentageSettingValueMap.put(33,9);
percentageSettingValueMap.put(34,10);
percentageSettingValueMap.put(36,11);
percentageSettingValueMap.put(38,12);
percentageSettingValueMap.put(39,13);
percentageSettingValueMap.put(41,14);
percentageSettingValueMap.put(42,15);
percentageSettingValueMap.put(43,16);
percentageSettingValueMap.put(45,17);
percentageSettingValueMap.put(46,18);
percentageSettingValueMap.put(47,47);
percentageSettingValueMap.put(48,49);
percentageSettingValueMap.put(50,21);
percentageSettingValueMap.put(51,22);
percentageSettingValueMap.put(52,23);
percentageSettingValueMap.put(53,24);
percentageSettingValueMap.put(54,25);
percentageSettingValueMap.put(55,26);
percentageSettingValueMap.put(56,27);
percentageSettingValueMap.put(57,28);
percentageSettingValueMap.put(58,30);
percentageSettingValueMap.put(59,31);
percentageSettingValueMap.put(60,32);
percentageSettingValueMap.put(61,34);
percentageSettingValueMap.put(62,35);
percentageSettingValueMap.put(63,37);
percentageSettingValueMap.put(64,39);
percentageSettingValueMap.put(65,41);
percentageSettingValueMap.put(66,43);
percentageSettingValueMap.put(67,45);
percentageSettingValueMap.put(68,47);
percentageSettingValueMap.put(69,49);
percentageSettingValueMap.put(70,52);
percentageSettingValueMap.put(71,54);
percentageSettingValueMap.put(72,57);
percentageSettingValueMap.put(73,60);
percentageSettingValueMap.put(74,63);
percentageSettingValueMap.put(75,66);
percentageSettingValueMap.put(76,70);
percentageSettingValueMap.put(77,73);
percentageSettingValueMap.put(78,77);
percentageSettingValueMap.put(79,81);
percentageSettingValueMap.put(80,85);
percentageSettingValueMap.put(81,90);
percentageSettingValueMap.put(82,95);
percentageSettingValueMap.put(83,100);
percentageSettingValueMap.put(84,105);
percentageSettingValueMap.put(85,111);
percentageSettingValueMap.put(86,117);
percentageSettingValueMap.put(87,124);
percentageSettingValueMap.put(88,130);
percentageSettingValueMap.put(89,137);
percentageSettingValueMap.put(90,144);
percentageSettingValueMap.put(91,152);
percentageSettingValueMap.put(92,161);
percentageSettingValueMap.put(93,170);
percentageSettingValueMap.put(94,179);
percentageSettingValueMap.put(95,189);
percentageSettingValueMap.put(96,199);
percentageSettingValueMap.put(97,210);
percentageSettingValueMap.put(98,223);
percentageSettingValueMap.put(99,235);
percentageSettingValueMap.put(100,248);
percentageSettingValueMap.put(11, 1);
percentageSettingValueMap.put(15, 2);
percentageSettingValueMap.put(19, 3);
percentageSettingValueMap.put(22, 4);
percentageSettingValueMap.put(24, 5);
percentageSettingValueMap.put(27, 6);
percentageSettingValueMap.put(29, 7);
percentageSettingValueMap.put(31, 8);
percentageSettingValueMap.put(33, 9);
percentageSettingValueMap.put(34, 10);
percentageSettingValueMap.put(36, 11);
percentageSettingValueMap.put(38, 12);
percentageSettingValueMap.put(39, 13);
percentageSettingValueMap.put(41, 14);
percentageSettingValueMap.put(42, 15);
percentageSettingValueMap.put(43, 16);
percentageSettingValueMap.put(45, 17);
percentageSettingValueMap.put(46, 18);
percentageSettingValueMap.put(47, 47);
percentageSettingValueMap.put(48, 49);
percentageSettingValueMap.put(50, 21);
percentageSettingValueMap.put(51, 22);
percentageSettingValueMap.put(52, 23);
percentageSettingValueMap.put(53, 24);
percentageSettingValueMap.put(54, 25);
percentageSettingValueMap.put(55, 26);
percentageSettingValueMap.put(56, 27);
percentageSettingValueMap.put(57, 28);
percentageSettingValueMap.put(58, 30);
percentageSettingValueMap.put(59, 31);
percentageSettingValueMap.put(60, 32);
percentageSettingValueMap.put(61, 34);
percentageSettingValueMap.put(62, 35);
percentageSettingValueMap.put(63, 37);
percentageSettingValueMap.put(64, 39);
percentageSettingValueMap.put(65, 41);
percentageSettingValueMap.put(66, 43);
percentageSettingValueMap.put(67, 45);
percentageSettingValueMap.put(68, 47);
percentageSettingValueMap.put(69, 49);
percentageSettingValueMap.put(70, 52);
percentageSettingValueMap.put(71, 54);
percentageSettingValueMap.put(72, 57);
percentageSettingValueMap.put(73, 60);
percentageSettingValueMap.put(74, 63);
percentageSettingValueMap.put(75, 66);
percentageSettingValueMap.put(76, 70);
percentageSettingValueMap.put(77, 73);
percentageSettingValueMap.put(78, 77);
percentageSettingValueMap.put(79, 81);
percentageSettingValueMap.put(80, 85);
percentageSettingValueMap.put(81, 90);
percentageSettingValueMap.put(82, 95);
percentageSettingValueMap.put(83, 100);
percentageSettingValueMap.put(84, 105);
percentageSettingValueMap.put(85, 111);
percentageSettingValueMap.put(86, 117);
percentageSettingValueMap.put(87, 124);
percentageSettingValueMap.put(88, 130);
percentageSettingValueMap.put(89, 137);
percentageSettingValueMap.put(90, 144);
percentageSettingValueMap.put(91, 152);
percentageSettingValueMap.put(92, 161);
percentageSettingValueMap.put(93, 170);
percentageSettingValueMap.put(94, 179);
percentageSettingValueMap.put(95, 189);
percentageSettingValueMap.put(96, 199);
percentageSettingValueMap.put(97, 210);
percentageSettingValueMap.put(98, 223);
percentageSettingValueMap.put(99, 235);
percentageSettingValueMap.put(100, 248);
}
if(percentageSettingValueMap.containsKey(percentage))
if (percentageSettingValueMap.containsKey(percentage))
return percentageSettingValueMap.get(percentage);
else
{
// Find next best value
for(int i = percentage; i <= 100; i++)
for (int i = percentage; i <= 100; i++)
{
if(percentageSettingValueMap.containsKey(i))
if (percentageSettingValueMap.containsKey(i))
return percentageSettingValueMap.get(i);
}
}
@@ -2269,12 +2270,12 @@ public class Actions
public static boolean runExecutable(Context context, boolean runAsRoot, String path, String parameters)
{
if(runAsRoot)
if (runAsRoot)
{
if(!StringUtils.isEmpty(parameters))
return executeCommandViaSu(new String[] { path + " " + parameters });
if (!StringUtils.isEmpty(parameters))
return executeCommandViaSu(new String[]{path + " " + parameters});
else
return executeCommandViaSu(new String[] { path });
return executeCommandViaSu(new String[]{path});
}
else
{
@@ -2283,7 +2284,7 @@ public class Actions
File executable = new File(path);
File workingDir = new File(executable.getParent());
if(!StringUtils.isEmpty(parameters))
if (!StringUtils.isEmpty(parameters))
result = runExternalApplication(path, 0, workingDir, parameters);
else
result = runExternalApplication(path, 0, workingDir, null);
@@ -2298,7 +2299,6 @@ public class Actions
}
/**
*
* @param commandToExecute
* @param timeout
* @param params
@@ -2312,7 +2312,7 @@ public class Actions
String fullCommand;
if(!StringUtils.isEmpty(params))
if (!StringUtils.isEmpty(params))
fullCommand = commandToExecute + " " + params;
else
fullCommand = commandToExecute;
@@ -2331,30 +2331,30 @@ public class Actions
{
Process process = null;
if(workingDirectory != null)
if (workingDirectory != null)
process = Runtime.getRuntime().exec(fullCommand, null, workingDirectory);
else
process = Runtime.getRuntime().exec(fullCommand);
stdin = process.getOutputStream ();
stderr = process.getErrorStream ();
stdout = process.getInputStream ();
stdin = process.getOutputStream();
stderr = process.getErrorStream();
stdout = process.getInputStream();
stdin.close();
// clean up if any output in stdout
BufferedReader brCleanUp = new BufferedReader (new InputStreamReader (stdout));
while ((line = brCleanUp.readLine ()) != null)
BufferedReader brCleanUp = new BufferedReader(new InputStreamReader(stdout));
while ((line = brCleanUp.readLine()) != null)
{
Miscellaneous.logEvent ("i", "Running executable", "[Stdout] " + line, 4);
Miscellaneous.logEvent("i", "Running executable", "[Stdout] " + line, 4);
output.append(line);
}
brCleanUp.close();
// clean up if any output in stderr
brCleanUp = new BufferedReader (new InputStreamReader(stderr));
while ((line = brCleanUp.readLine ()) != null)
brCleanUp = new BufferedReader(new InputStreamReader(stderr));
while ((line = brCleanUp.readLine()) != null)
{
Miscellaneous.logEvent ("i", "Running executable", "[Stderr] " + line, 4);
Miscellaneous.logEvent("i", "Running executable", "[Stderr] " + line, 4);
output.append(line);
}
brCleanUp.close();
@@ -2362,17 +2362,17 @@ public class Actions
try
{
// Wait for the process to exit, we want the return code
if(timeout > 0 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
if (timeout > 0 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
{
try
{
if(!process.waitFor(timeout, TimeUnit.MILLISECONDS))
if (!process.waitFor(timeout, TimeUnit.MILLISECONDS))
{
Miscellaneous.logEvent("i", "Running executable", "Timeout of " + String.valueOf(timeout) + " ms reached. Killing check attempt.", 3);
process.destroyForcibly();
}
}
catch(NoSuchMethodError e)
catch (NoSuchMethodError e)
{
process.waitFor();
}
@@ -2386,7 +2386,7 @@ public class Actions
Miscellaneous.logEvent("i", "Running executable", Log.getStackTraceString(e), 1);
}
if(process.exitValue() == 0)
if (process.exitValue() == 0)
Miscellaneous.logEvent("i", "Running executable", "ReturnCode: " + String.valueOf(process.exitValue()), 4);
else
Miscellaneous.logEvent("i", "Running executable", "External execution (RC=" + String.valueOf(process.exitValue()) + ") returned error: " + output.toString(), 3);
@@ -2410,17 +2410,17 @@ public class Actions
{
try
{
for(Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();)
for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements(); )
{
NetworkInterface intf = en.nextElement();
for(Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();)
for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements(); )
{
InetAddress inetAddress = enumIpAddr.nextElement();
if(!intf.isLoopback())
if (!intf.isLoopback())
{
if(intf.getName().contains("rndis"))
if (intf.getName().contains("rndis"))
{
return true;
}
@@ -2428,7 +2428,7 @@ public class Actions
}
}
}
catch(Exception e)
catch (Exception e)
{
Miscellaneous.logEvent("e", "isTetheringActive()", Log.getStackTraceString(e), 3);
}
@@ -2438,6 +2438,7 @@ public class Actions
public final static int wakeLockTimeoutDisabled = -1;
static boolean wakeLockStopRequested = false;
public static void wakeLockStart(Context context, long duration)
{
Thread lockThread = new Thread(new Runnable()
@@ -2468,13 +2469,13 @@ public class Actions
e.printStackTrace();
}
if(duration > 0)
if (duration > 0)
waited += step;
if(wakeLockStopRequested) //stop requested
if (wakeLockStopRequested) //stop requested
Miscellaneous.logEvent("i", "WakeLockStart", "Stop requested.", 4);
}
while(!wakeLockStopRequested && (duration < 0 || waited <= duration));
while (!wakeLockStopRequested && (duration < 0 || waited <= duration));
fullWakeLock.release();
}
@@ -2502,7 +2503,7 @@ public class Actions
More precisely it's required for codes containing the # character.
*/
if(Build.VERSION.SDK_INT >= 34)
if (Build.VERSION.SDK_INT >= 34)
intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + Uri.encode("\"" + phoneNumber + "\"")));
else
intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + Uri.encode(phoneNumber)));
@@ -2515,7 +2516,7 @@ public class Actions
public static void endPhoneCall(Context context)
{
if(Build.VERSION.SDK_INT < 21)
if (Build.VERSION.SDK_INT < 21)
{
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
try
@@ -2547,7 +2548,7 @@ public class Actions
{
Miscellaneous.logEvent("i", "Clipboard", "Copying data to clipboard: " + text, 4);
if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB)
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB)
{
android.text.ClipboardManager clipboard = (android.text.ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setText(text);
@@ -2564,7 +2565,7 @@ public class Actions
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)
{
if(!BuildConfig.FLAVOR.equals(AutomationService.flavor_name_googleplay))
if (!BuildConfig.FLAVOR.equals(AutomationService.flavor_name_googleplay))
MyAccessibilityService.getInstance().performGlobalAction(AccessibilityService.GLOBAL_ACTION_TAKE_SCREENSHOT);
}
}

View File

@@ -11,6 +11,7 @@ import android.content.res.Resources;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.MotionEvent;
@@ -46,7 +47,7 @@ public class ActivityMainScreen extends ActivityGeneric
ToggleButton toggleService, tbLockSound;
Button bShowHelp, bPrivacy, bAddSoundLockTIme, bDonate, bControlCenter;
TextView tvActivePoi, tvClosestPoi, tvLastRule, tvLastProfile, tvMainScreenNotePermissions, tvMainScreenNoteFeaturesFromOtherFlavor, tvMainScreenNoteLocationImpossibleBlameGoogle, tvMainScreenNoteNews, tvLockSoundDuration;
TextView tvActivePoi, tvClosestPoi, tvLastRule, tvLastProfile, tvMainScreenNotePermissions, tvMainScreenNoteFeaturesFromOtherFlavor, tvMainScreenNoteLocationImpossibleBlameGoogle, tvMainScreenNoteNews, tvLockSoundDuration, tvContactNotice;
ListView lvRuleHistory;
ArrayAdapter<Rule> ruleHistoryListViewAdapter;
@@ -83,10 +84,14 @@ public class ActivityMainScreen extends ActivityGeneric
tbLockSound = (ToggleButton) findViewById(R.id.tbLockSound);
toggleService = (ToggleButton) findViewById(R.id.tbArmMastListener);
bDonate = (Button)findViewById(R.id.bDonate);
tvContactNotice = (TextView) findViewById(R.id.tvContactNotice);
if(!BuildConfig.FLAVOR.equalsIgnoreCase(AutomationService.flavor_name_googleplay))
bDonate.setVisibility(View.VISIBLE);
// Make links clickable
tvContactNotice.setMovementMethod(LinkMovementMethod.getInstance());
toggleService.setChecked(AutomationService.isMyServiceRunning(this));
toggleService.setOnCheckedChangeListener(new OnCheckedChangeListener()
{

View File

@@ -157,6 +157,15 @@ public class AutomationService extends Service implements OnInitListener
ActivityPermissions.requestSpecificPermission(Manifest.permission.FOREGROUND_SERVICE);
return false;
}
else
{
if(Miscellaneous.getTargetSDK(Miscellaneous.getAnyContext()) >= 34 && !ActivityPermissions.havePermission(Manifest.permission.FOREGROUND_SERVICE_SPECIAL_USE, context))
{
Toast.makeText(context, context.getResources().getString(R.string.permissionForegroundServiceTypeSpecialUseRequired), Toast.LENGTH_LONG).show();
Miscellaneous.logEvent("e", "Permission", "Don't have permission FOREGROUND_SERVICE_SPECIAL_USE. Will request it now.", 4);
return false;
}
}
}
if (
@@ -510,6 +519,7 @@ public class AutomationService extends Service implements OnInitListener
{
Intent myServiceIntent = new Intent(context, AutomationService.class);
myServiceIntent.putExtra("startAtBoot", startAtBoot);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
context.startForegroundService(myServiceIntent);
else
@@ -661,9 +671,9 @@ public class AutomationService extends Service implements OnInitListener
myNotification.flags |= Notification.FLAG_NO_CLEAR;
// notificationManager.notify(notificationId, myNotification);
if(Miscellaneous.getTargetSDK(Miscellaneous.getAnyContext()) >= 34)
instance.startForeground(notificationId, myNotification, ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE);
else
// if(Miscellaneous.getTargetSDK(Miscellaneous.getAnyContext()) >= 34)
// instance.startForeground(notificationId, myNotification, ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE);
// else
instance.startForeground(notificationId, myNotification);
}
}

View File

@@ -370,11 +370,12 @@
android:text="@string/donate" />
<TextView
android:id="@+id/tvContactNotice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/default_margin"
android:gravity="center_horizontal"
android:text="@string/emailContactNotice" />
android:text="@string/contactNotice" />
</LinearLayout>

View File

@@ -698,7 +698,7 @@
<string name="screenIs">Bildschirm ist %1$s</string>
<string name="sendEmailToDev">Email an Entwickler schicken</string>
<string name="controlCenter">Steuerungszentrale</string>
<string name="emailContactNotice">Email ist mein bevorzugtes Kommunikationsmittel, um Fehler zu melden, Fragen zu stellen or Vorschläge zu machen. Bitte gehen Sie für weitere Infos in die Steuerungszentrale.\nViele Fragen können nicht einfach gleich beantwortet werden, sondern erfordern eine technische Prüfung. Haben Sie also bitte etwas Geduld.</string>
<string name="contactNotice">Email ist mein bevorzugtes Kommunikationsmittel, um Fehler zu melden, Fragen zu stellen or Vorschläge zu machen. Bitte gehen Sie für weitere Infos in die Steuerungszentrale.\nViele Fragen können nicht einfach gleich beantwortet werden, sondern erfordern eine technische Prüfung. Haben Sie also bitte etwas Geduld.\n\nAlternativ können Sie Ihre Frage im <a href="https://forum.server47.de">Forum</a> stellen.</string>
<string name="featureCeasedToWorkLastWorkingAndroidVersion">Aufgrund Google\'s unendlicher Weisheit, ist die letzte Android Version, mit der diese Funktion noch funktioniert, die Version %1$s. Sie können es hier einrichten, aber vermutlich wird es keine Auswirkung haben.</string>
<string name="musicPlaying">Musik läuft</string>
<string name="selectParameters">Wählen Sie die Parameter</string>

View File

@@ -697,7 +697,7 @@
<string name="screenIs">pantalla esta %1$s</string>
<string name="sendEmailToDev">Enviar email al desrollador</string>
<string name="featureCeasedToWorkLastWorkingAndroidVersion">Debido a la infinita sabiduría de Google, la última versión de Android en la que se sabe que funciona esta función es %1$s. Puede configurarlo, pero probablemente no tendrá ningún efecto.</string>
<string name="emailContactNotice">El correo electrónico es mi método preferido de contacto para informar errores, hacer preguntas o hacer propuestas. Vaya al centro de control para obtener más información.\nMuchas preguntas no se pueden responder de inmediato, pero requieren cierta investigación técnica. Así que, por favor, tengan un poco de paciencia.</string>
<string name="contactNotice">El correo electrónico es mi método preferido de contacto para informar errores, hacer preguntas o hacer propuestas. Vaya al centro de control para obtener más información.\nMuchas preguntas no se pueden responder de inmediato, pero requieren cierta investigación técnica. Así que, por favor, tengan un poco de paciencia. \n\nAlternativamente, tiene la opción de hacer sus preguntas en el <a href="https://forum.server47.de">foro</a>.</string>
<string name="actionMediaControlNotice">Ten en cuenta que esta acción puede no funcionar con TODOS los jugadores. E incluso si lo hace, no todos los botones funcionan necesariamente.</string>
<string name="musicPlaying">Musica esta reproduciendo</string>
<string name="selectParameters">Elije parametros</string>

View File

@@ -679,7 +679,7 @@
<string name="comparisonCaseInsensitive">La coparaisonn est sensible à la casse du texte</string>
<string name="profileWarning">Les paramètres que vous pouvez régler ici affectent les évènements audio sur votre télephone. Ils peuvent même annuler votre alarme de réveil. Donc, quoi que vous fassiez, il est fortement recommandé de le tester, même après les mises à jour dAndroid.</string>
<string name="ifString">si</string>
<string name="emailContactNotice">Le-mail est mon moyen de contact préféré pour signaler les bogues, poser des questions ou faire des propositions. Rendez-vous sur le centre de contrôle pour en savoir plus. Des questions multiples peuvent ne pas recevoir de réponse immédiate, mais nécessitent des recherches techniques. Veuillez donc faire preuve de patience.</string>
<string name="contactNotice">Le-mail est mon moyen de contact préféré pour signaler les bogues, poser des questions ou faire des propositions. Rendez-vous sur le centre de contrôle pour en savoir plus. Des questions multiples peuvent ne pas recevoir de réponse immédiate, mais nécessitent des recherches techniques. Veuillez donc faire preuve de patience. \n\nSinon, vous avez la possibilité de poser vos questions dans le <a href="https://forum.server47.de">forum</a>.</string>
<string name="controlCenter">Centre de contrôle</string>
<string name="sendEmailToDev">Envoyer un email au développeur</string>
<string name="screenIs">lécran est %1$s</string>

View File

@@ -699,7 +699,7 @@
<string name="screenIs">lo schermo è %1$s</string>
<string name="sendEmailToDev">Invia email allo sviluppatore</string>
<string name="controlCenter">Centro di controllo</string>
<string name="emailContactNotice">L\'e-mail è il mio metodo di contatto preferito per segnalare bug, porre domande o fare proposte. Vai al centro di controllo per saperne di più.\nMolte domande non possono essere risolte immediatamente, ma richiedono alcune ricerche tecniche. Quindi, per favore, abbiate un po\' di pazienza.</string>
<string name="contactNotice">L\'e-mail è il mio metodo di contatto preferito per segnalare bug, porre domande o fare proposte. Vai al centro di controllo per saperne di più.\nMolte domande non possono essere risolte immediatamente, ma richiedono alcune ricerche tecniche. Quindi, per favore, abbiate un po\' di pazienza. \n\nIn alternativa hai la possibilità di porre le tue domande nel <a href="https://forum.server47.de">forum</a>.</string>
<string name="musicPlaying">La musica è in riproduzione</string>
<string name="musicIsPlaying">la musica è in riproduzione</string>
<string name="musicIsNotPlaying">la musica non viene riprodotta</string>

View File

@@ -677,7 +677,7 @@
<string name="comparisonCaseInsensitive">Vergelijkingen worden gedaan case-INsensitief</string>
<string name="profileWarning">De instellingen die je hier maakt kunnen ervoor zorgen dat je bepaalde dingen niet meer van je telefoon merkt. Ze kunnen zelfs je wekker dempen. Dus wat je ook doet - het wordt aanbevolen om het te testen - ook na Android upgrades.</string>
<string name="ifString">als</string>
<string name="emailContactNotice">E-mail is mijn favoriete contactmethode om bugs te melden, vragen te stellen of voorstellen te doen. Ga naar het controlecentrum voor meer informatie.\nVeel vragen kunnen niet meteen worden beantwoord, maar vereisen wel wat technisch onderzoek. Dus heb alsjeblieft wat geduld.</string>
<string name="contactNotice">E-mail is mijn favoriete contactmethode om bugs te melden, vragen te stellen of voorstellen te doen. Ga naar het controlecentrum voor meer informatie.\nVeel vragen kunnen niet meteen worden beantwoord, maar vereisen wel wat technisch onderzoek. Dus heb alsjeblieft wat geduld. \n\nJe hebt ook de mogelijkheid om je vragen te stellen in het <a href="https://forum.server47.de">forum</a>.</string>
<string name="controlCenter">Controlecentrum</string>
<string name="sendEmailToDev">Stuur een e-mail naar de ontwikkelaar</string>
<string name="screenIs">scherm is %1$s</string>

View File

@@ -769,7 +769,7 @@
<string name="comparisonCaseInsensitive">Porównania nie uwzględniają wielkości liter</string>
<string name="profileWarning">Ustawienia, które możesz tutaj dostosować, mogą sprawić, że nie będziesz już zauważać pewnych rzeczy w swoim telefonie. Mogą nawet wyciszyć budzik. Więc cokolwiek robisz - zdecydowanie zalecamy przetestowanie tego - także po aktualizacjach Androida.</string>
<string name="ifString">jeśli</string>
<string name="emailContactNotice">E-mail to moja preferowana metoda kontaktu w celu zgłaszania błędów, zadawania pytań lub składania propozycji. Przejdź do centrum sterowania, aby dowiedzieć się więcej.\nNa wiele pytań nie można odpowiedzieć od razu, ale wymagają one pewnych działań technicznych. Prosimy więc o odrobinę cierpliwości.</string>
<string name="contactNotice">E-mail to moja preferowana metoda kontaktu w celu zgłaszania błędów, zadawania pytań lub składania propozycji. Przejdź do centrum sterowania, aby dowiedzieć się więcej.\nNa wiele pytań nie można odpowiedzieć od razu, ale wymagają one pewnych działań technicznych. Prosimy więc o odrobinę cierpliwości. \n\nAlternatywnie masz możliwość zadawania pytań na <a href="https://forum.server47.de">forum</a>.</string>
<string name="controlCenter">Centrum kontroli</string>
<string name="sendEmailToDev">Wyślij wiadomość e-mail do programisty</string>
<string name="screenIs">ekran to %1$s</string>

View File

@@ -736,7 +736,7 @@
<string name="comparisonCaseInsensitive">Сравнения проводятся без учета регистра</string>
<string name="profileWarning">Настройки, которые вы можете изменить здесь, могут привести к тому, что вы больше не заметите определенных вещей с вашего телефона. Они могут даже отключить будильник. Так что что бы вы ни делали - рекомендуется это проверять.</string>
<string name="ifString">если</string>
<string name="emailContactNotice">Электронная почта - мой предпочтительный способ связи, для сообщений об ошибках, вопросов или предложений. Перейдите в центр управления, чтобы узнать больше.\nМногие вопросы не могут быть решены сразу, но требуют некоторых технических исследований. Поэтому, пожалуйста, наберитесь терпения.</string>
<string name="contactNotice">Электронная почта - мой предпочтительный способ связи, для сообщений об ошибках, вопросов или предложений. Перейдите в центр управления, чтобы узнать больше.\nМногие вопросы не могут быть решены сразу, но требуют некоторых технических исследований. Поэтому, пожалуйста, наберитесь терпения. \n\nВ качестве альтернативы у вас есть возможность задать свои вопросы на <a href="https://forum.server47.de">форуме</a>.</string>
<string name="controlCenter">Центр управления</string>
<string name="sendEmailToDev">Отправить электронное письмо разработчику</string>
<string name="screenIs">экран %1$s</string>

View File

@@ -671,7 +671,7 @@
<string name="comparisonCaseInsensitive">比较不区分大小写</string>
<string name="profileWarning">此处的设置可能会导致您无法再注意到手机中的某些内容,甚至可以让您的起床闹钟静音。所以无论怎样设置——强烈建议测试,在 Android 更新之后也要再测试。</string>
<string name="ifString">如果</string>
<string name="emailContactNotice">电子邮件是向我报告错误、提出问题或建议的首选联系方式。前往控制中心了解更多信息。\n许多问题无法立即解答需要进行一些技术研究。所以请耐心等待。</string>
<string name="contactNotice">电子邮件是向我报告错误、提出问题或建议的首选联系方式。前往控制中心了解更多信息。\n许多问题无法立即解答需要进行一些技术研究。所以请耐心等待。 \n\n或者您可以选择在 <a href="https://forum.server47.de">论坛</a>中提问 。</string>
<string name="controlCenter">控制中心</string>
<string name="sendEmailToDev">向开发者发送电子邮件</string>
<string name="screenIs">屏幕 %1$s</string>

View File

@@ -770,7 +770,7 @@
<string name="comparisonCaseInsensitive">Comparisons are done case-INsensitive</string>
<string name="profileWarning">The settings you can adjust here, can cause that you don\'t notice certain things from your phone anymore. They may even silence your wakeup alarm. So whatever you do - it is highly recommended that you test it - also after Android updates.</string>
<string name="ifString">if</string>
<string name="emailContactNotice">Email is my preferred method of contact to report bugs, ask questions or make proposals. Go to control center to learn more.\nMany questions cannot be answered straight away, but require some technical research. So please have some patience.</string>
<string name="contactNotice">Email is my preferred method of contact to report bugs, ask questions or make proposals. Go to control center to learn more.\nMany questions cannot be answered straight away, but require some technical research. So please have some patience.\n\nAlternatively you have the option of asking your questions in the <a href="https://forum.server47.de">forum</a>.</string>
<string name="controlCenter">Control center</string>
<string name="sendEmailToDev">Send email to developer</string>
<string name="screenIs">screen is %1$s</string>

View File

@@ -0,0 +1 @@
* Fixed: Crash in Play Store version when starting the service