diff --git a/app/src/main/java/com/jens/automation2/Actions.java b/app/src/main/java/com/jens/automation2/Actions.java index bc830e2..1603725 100644 --- a/app/src/main/java/com/jens/automation2/Actions.java +++ b/app/src/main/java/com/jens/automation2/Actions.java @@ -1043,7 +1043,12 @@ public class Actions { Miscellaneous.logEvent("i", "StartOtherActivity", "Starting other Activity...", 4); - String params[] = param.split(";"); + String params[]; + + if(param.contains(Action.actionParameter2Split)) + params = param.split(Action.actionParameter2Split); + else + params = param.split(";"); try { diff --git a/app/src/main/java/com/jens/automation2/ActivityManageActionStartActivity.java b/app/src/main/java/com/jens/automation2/ActivityManageActionStartActivity.java index 0807268..7c179ef 100644 --- a/app/src/main/java/com/jens/automation2/ActivityManageActionStartActivity.java +++ b/app/src/main/java/com/jens/automation2/ActivityManageActionStartActivity.java @@ -58,10 +58,10 @@ public class ActivityManageActionStartActivity extends Activity RadioButton rbStartAppSelectByActivity, rbStartAppSelectByAction, rbStartAppByActivity, rbStartAppByBroadcast, rbStartAppByService, rbStartAppByForegroundService; final String urlShowExamples = "https://server47.de/automation/examples_startProgram.html"; - final static String startByActivityString = "0"; - final static String startByBroadcastString = "1"; - final static String startByServiceString = "2"; - final static String startByForegroundServiceString = "3"; + public final static String startByActivityString = "0"; + public final static String startByBroadcastString = "1"; + public final static String startByServiceString = "2"; + public final static String startByForegroundServiceString = "3"; final static int requestCodeForRequestQueryAllPackagesPermission = 4711; @@ -234,29 +234,29 @@ public class ActivityManageActionStartActivity extends Activity String parameter2 = ""; if (rbStartAppSelectByActivity.isChecked()) - parameter2 += etPackageName.getText().toString() + ";" + etActivityOrActionPath.getText().toString(); + parameter2 += etPackageName.getText().toString() + Action.actionParameter2Split + etActivityOrActionPath.getText().toString(); else { if (etPackageName.getText().toString() != null && etPackageName.getText().toString().length() > 0) - parameter2 += etPackageName.getText().toString() + ";" + etActivityOrActionPath.getText().toString(); + parameter2 += etPackageName.getText().toString() + Action.actionParameter2Split + etActivityOrActionPath.getText().toString(); else - parameter2 += Actions.dummyPackageString + ";" + etActivityOrActionPath.getText().toString(); + parameter2 += Actions.dummyPackageString + Action.actionParameter2Split + etActivityOrActionPath.getText().toString(); // if(etClassName.getText().toString().length() > 0) - parameter2 += ";" + etClassName.getText().toString(); + parameter2 += Action.actionParameter2Split + etClassName.getText().toString(); } if (rbStartAppByActivity.isChecked()) - parameter2 += ";" + startByActivityString; + parameter2 += Action.actionParameter2Split + startByActivityString; else if(rbStartAppByService.isChecked()) - parameter2 += ";" + startByServiceString; + parameter2 += Action.actionParameter2Split + startByServiceString; else if(rbStartAppByForegroundService.isChecked()) - parameter2 += ";" + startByForegroundServiceString; + parameter2 += Action.actionParameter2Split + startByForegroundServiceString; else - parameter2 += ";" + startByBroadcastString; + parameter2 += Action.actionParameter2Split + startByBroadcastString; for (String s : intentPairList) - parameter2 += ";" + s; + parameter2 += Action.actionParameter2Split + s; returnData.putExtra(ActivityManageRule.intentNameActionParameter2, parameter2); @@ -628,7 +628,13 @@ public class ActivityManageActionStartActivity extends Activity rbStartAppSelectByActivity.setChecked(!selectionByAction); rbStartAppSelectByAction.setChecked(selectionByAction); - String[] params = input.getStringExtra(ActivityManageRule.intentNameActionParameter2).split(";"); + String[] params; + String partsString = input.getStringExtra(ActivityManageRule.intentNameActionParameter2); + + if(partsString.contains(Action.actionParameter2Split)) + params = partsString.split(Action.actionParameter2Split); + else + params = partsString.split(";"); if(Miscellaneous.isNumeric(params[2])) // old configuration file { diff --git a/app/src/main/java/com/jens/automation2/ActivityPermissions.java b/app/src/main/java/com/jens/automation2/ActivityPermissions.java index 6bf0f00..f18c223 100644 --- a/app/src/main/java/com/jens/automation2/ActivityPermissions.java +++ b/app/src/main/java/com/jens/automation2/ActivityPermissions.java @@ -650,7 +650,18 @@ public class ActivityPermissions extends Activity // ) // addToArrayListUnique("net.kollnig.missioncontrol.permission.ADMIN", requiredPermissions); if(Build.VERSION.SDK_INT >= 29) - addToArrayListUnique(Manifest.permission.SYSTEM_ALERT_WINDOW, requiredPermissions); + { + String parts[]; + if(action.getParameter2().contains(Action.actionParameter2Split)) + parts = action.getParameter2().split(Action.actionParameter2Split); + else + parts = action.getParameter2().split(";"); + + // Permission only required for starts of activity, not broadcasts or services + + if(parts[2].equals(ActivityManageActionStartActivity.startByActivityString)) + addToArrayListUnique(Manifest.permission.SYSTEM_ALERT_WINDOW, requiredPermissions); + } break; case triggerUrl: addToArrayListUnique(Manifest.permission.INTERNET, requiredPermissions); diff --git a/app/src/main/java/com/jens/automation2/XmlFileInterface.java b/app/src/main/java/com/jens/automation2/XmlFileInterface.java index ca192c9..aa3bddb 100644 --- a/app/src/main/java/com/jens/automation2/XmlFileInterface.java +++ b/app/src/main/java/com/jens/automation2/XmlFileInterface.java @@ -1286,20 +1286,24 @@ public class XmlFileInterface else newTag = tag.replace("/", Action.intentPairSeparator); - String[] newTagPieces = newTag.split(";"); + String[] newTagPieces = new String[0]; + if(newTag.contains(Action.actionParameter2Split)) + newTagPieces = newTag.split(Action.actionParameter2Split); + else + newTag.split(";"); if(newTagPieces.length < 2 || (!newTagPieces[0].contains(Actions.dummyPackageString) && newTagPieces[1].contains(Action.intentPairSeparator))) { - newTag = Actions.dummyPackageString + ";" + newTag; - newTagPieces = newTag.split(";"); + newTag = Actions.dummyPackageString + Action.actionParameter2Split + newTag; + newTagPieces = newTag.split(Action.actionParameter2Split); } if(newTagPieces.length < 3) - newTag += ";" + ActivityManageActionStartActivity.startByActivityString; + newTag += Action.actionParameter2Split + ActivityManageActionStartActivity.startByActivityString; else if(newTagPieces.length >= 3) { if(newTagPieces[2].contains(Action.intentPairSeparator)) - newTag = newTagPieces[0] + ";" + newTagPieces[1] + ";" + ActivityManageActionStartActivity.startByActivityString + ";" + newTagPieces[2]; + newTag = newTagPieces[0] + Action.actionParameter2Split + newTagPieces[1] + Action.actionParameter2Split + ActivityManageActionStartActivity.startByActivityString + Action.actionParameter2Split + newTagPieces[2]; } newAction.setParameter2(newTag); diff --git a/app/src/main/java/com/jens/automation2/receivers/BatteryReceiver.java b/app/src/main/java/com/jens/automation2/receivers/BatteryReceiver.java index d9064e1..6baaeb5 100644 --- a/app/src/main/java/com/jens/automation2/receivers/BatteryReceiver.java +++ b/app/src/main/java/com/jens/automation2/receivers/BatteryReceiver.java @@ -134,7 +134,7 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList { case BatteryManager.BATTERY_STATUS_CHARGING: case BatteryManager.BATTERY_STATUS_FULL: - Miscellaneous.logEvent("i", "BatteryReceiver", "Device has been fully charged.", 5); +// Miscellaneous.logEvent("i", "BatteryReceiver", "Device has been fully charged.", 5); this.actionCharging(context); break; case BatteryManager.BATTERY_STATUS_DISCHARGING: diff --git a/fastlane/metadata/android/en-US/changelogs/138.txt b/fastlane/metadata/android/en-US/changelogs/138.txt new file mode 100644 index 0000000..5bed413 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/138.txt @@ -0,0 +1 @@ +* Fixed: Overlay permission for start other program action only required if startByActivity() is selected \ No newline at end of file