Compare commits
5 Commits
master
...
developmen
Author | SHA1 | Date |
---|---|---|
|
6b23bd6733 | |
|
1a60c88f35 | |
|
3312d99177 | |
|
ea01806915 | |
|
36173f2fcb |
|
@ -11,8 +11,8 @@ android {
|
|||
compileSdkVersion 31
|
||||
buildToolsVersion '29.0.2'
|
||||
useLibrary 'org.apache.http.legacy'
|
||||
versionCode 133
|
||||
versionName "1.7.17"
|
||||
versionCode 135
|
||||
versionName "1.7.18"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ android {
|
|||
{
|
||||
dimension "version"
|
||||
versionNameSuffix "-googlePlay"
|
||||
targetSdkVersion 31
|
||||
targetSdkVersion 32
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
<application
|
||||
android:allowBackup="true"
|
||||
android:allowClearUserData="true"
|
||||
android:icon="@drawable/gears"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme"
|
||||
android:networkSecurityConfig="@xml/network_security_config">
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
<application
|
||||
android:allowBackup="true"
|
||||
android:allowClearUserData="true"
|
||||
android:icon="@drawable/gears"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme"
|
||||
android:networkSecurityConfig="@xml/network_security_config">
|
||||
|
|
|
@ -65,12 +65,11 @@
|
|||
<uses-permission android:name="com.wireguard.android.permission.CONTROL_TUNNELS"/>
|
||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||
<uses-permission android:name="android.permission.READ_CALL_LOG" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:allowClearUserData="true"
|
||||
android:icon="@drawable/gears"
|
||||
android:icon="@drawable/crane"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme"
|
||||
android:networkSecurityConfig="@xml/network_security_config">
|
||||
|
|
|
@ -706,6 +706,7 @@ public class ActivityPermissions extends Activity
|
|||
case startPhoneCall:
|
||||
addToArrayListUnique(Manifest.permission.CALL_PHONE, requiredPermissions);
|
||||
// addToArrayListUnique(Manifest.permission.SYSTEM_ALERT_WINDOW, requiredPermissions);
|
||||
addToArrayListUnique(Manifest.permission.SYSTEM_ALERT_WINDOW, requiredPermissions);
|
||||
break;
|
||||
case stopPhoneCall:
|
||||
addToArrayListUnique(Manifest.permission.ANSWER_PHONE_CALLS, requiredPermissions);
|
||||
|
@ -909,6 +910,8 @@ public class ActivityPermissions extends Activity
|
|||
case Manifest.permission.SYSTEM_ALERT_WINDOW:
|
||||
for(String ruleName : getRulesUsing(Action.Action_Enum.startOtherActivity))
|
||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||
for(String ruleName : getRulesUsing(Action.Action_Enum.startPhoneCall))
|
||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||
break;
|
||||
case Manifest.permission.ANSWER_PHONE_CALLS:
|
||||
for(String ruleName : getRulesUsing(Action.Action_Enum.stopPhoneCall))
|
||||
|
|
|
@ -518,7 +518,12 @@ public class AutomationService extends Service implements OnInitListener
|
|||
builder.setContentTitle("Automation");
|
||||
|
||||
if(Settings.showIconWhenServiceIsRunning)
|
||||
builder.setSmallIcon(R.drawable.ic_launcher);
|
||||
{
|
||||
if(BuildConfig.FLAVOR.equalsIgnoreCase(AutomationService.flavor_name_googleplay))
|
||||
builder.setSmallIcon(R.drawable.crane);
|
||||
else
|
||||
builder.setSmallIcon(R.drawable.ic_launcher);
|
||||
}
|
||||
|
||||
builder.setCategory(Notification.CATEGORY_SERVICE);
|
||||
builder.setWhen(System.currentTimeMillis());
|
||||
|
@ -526,7 +531,7 @@ public class AutomationService extends Service implements OnInitListener
|
|||
|
||||
Notification defaultNotification = builder.build();
|
||||
|
||||
defaultNotification.icon = R.drawable.ic_launcher;
|
||||
defaultNotification.icon = R.drawable.crane;
|
||||
defaultNotification.when = System.currentTimeMillis();
|
||||
|
||||
// defaultNotification.defaults |= Notification.DEFAULT_VIBRATE;
|
||||
|
@ -573,7 +578,7 @@ public class AutomationService extends Service implements OnInitListener
|
|||
builder.setOnlyAlertOnce(true);
|
||||
|
||||
if(Settings.showIconWhenServiceIsRunning)
|
||||
builder.setSmallIcon(R.drawable.ic_launcher);
|
||||
builder.setSmallIcon(R.drawable.crane);
|
||||
|
||||
// builder.setContentText(textToDisplay);
|
||||
// builder.setSmallIcon(icon);
|
||||
|
|
|
@ -1164,7 +1164,7 @@ public class Miscellaneous extends Service
|
|||
builder.setOnlyAlertOnce(true);
|
||||
|
||||
if(Settings.showIconWhenServiceIsRunning && notificationChannelId.equals(AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE))
|
||||
builder.setSmallIcon(R.drawable.ic_launcher);
|
||||
builder.setSmallIcon(R.drawable.crane);
|
||||
else if(!notificationChannelId.equals(AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE))
|
||||
builder.setSmallIcon(R.drawable.info);
|
||||
|
||||
|
|
|
@ -32,21 +32,21 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
|||
if(!batteryReceiverActive)
|
||||
{
|
||||
BatteryReceiver.automationServiceRef = automationServiceRef;
|
||||
|
||||
|
||||
if(batteryInfoReceiverInstance == null)
|
||||
batteryInfoReceiverInstance = new BatteryReceiver();
|
||||
|
||||
|
||||
if(batteryIntentFilter == null)
|
||||
{
|
||||
batteryIntentFilter = new IntentFilter();
|
||||
batteryIntentFilter.addAction(Intent.ACTION_BATTERY_CHANGED);
|
||||
batteryIntentFilter.addAction(Intent.ACTION_BATTERY_LOW);
|
||||
// batteryIntentFilter.addAction(Intent.ACTION_POWER_CONNECTED);
|
||||
// batteryIntentFilter.addAction(Intent.ACTION_POWER_DISCONNECTED);
|
||||
// batteryIntentFilter.addAction(Intent.ACTION_POWER_CONNECTED);
|
||||
// batteryIntentFilter.addAction(Intent.ACTION_POWER_DISCONNECTED);
|
||||
}
|
||||
|
||||
|
||||
batteryStatus = automationServiceRef.registerReceiver(batteryInfoReceiverInstance, batteryIntentFilter);
|
||||
|
||||
|
||||
batteryReceiverActive = true;
|
||||
}
|
||||
}
|
||||
|
@ -59,16 +59,16 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
|||
automationServiceRef.unregisterReceiver(batteryInfoReceiverInstance);
|
||||
batteryInfoReceiverInstance = null;
|
||||
}
|
||||
|
||||
|
||||
batteryReceiverActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static boolean isBatteryReceiverActive()
|
||||
{
|
||||
return batteryReceiverActive;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isUsbHostConnected()
|
||||
{
|
||||
return usbHostConnected;
|
||||
|
@ -80,7 +80,7 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
|||
}
|
||||
|
||||
private static int currentChargingState = 0; //0=unknown, 1=no, 2=yes
|
||||
|
||||
|
||||
public static int getCurrentChargingState()
|
||||
{
|
||||
return currentChargingState;
|
||||
|
@ -90,11 +90,11 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
|||
public void onReceive(Context context, Intent intent)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "BatteryReceiver", "Received event " + intent.getAction(), 5);
|
||||
|
||||
|
||||
if (intent == null)
|
||||
return;
|
||||
if (context == null)
|
||||
return;
|
||||
return;
|
||||
|
||||
if(intent.getAction().equals(Intent.ACTION_BATTERY_LOW))
|
||||
{
|
||||
|
@ -105,12 +105,12 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
|||
try
|
||||
{
|
||||
batteryLevel = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
|
||||
// int scale = -1;
|
||||
// int voltage = -1;
|
||||
// int temp = -1;
|
||||
// scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1);
|
||||
// temp = intent.getIntExtra(BatteryManager.EXTRA_TEMPERATURE, -1);
|
||||
// voltage = intent.getIntExtra(BatteryManager.EXTRA_VOLTAGE, -1);
|
||||
// int scale = -1;
|
||||
// int voltage = -1;
|
||||
// int temp = -1;
|
||||
// scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1);
|
||||
// temp = intent.getIntExtra(BatteryManager.EXTRA_TEMPERATURE, -1);
|
||||
// voltage = intent.getIntExtra(BatteryManager.EXTRA_VOLTAGE, -1);
|
||||
Log.i("Battery", "Level: " + String.valueOf(batteryLevel));
|
||||
this.actionBatteryLevel(context);
|
||||
|
||||
|
@ -121,7 +121,7 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
|||
switch(statusPlugged)
|
||||
{
|
||||
case BatteryManager.BATTERY_PLUGGED_AC:
|
||||
// Toast.makeText(context, "Regular charging", Toast.LENGTH_LONG).show();
|
||||
// Toast.makeText(context, "Regular charging", Toast.LENGTH_LONG).show();
|
||||
Miscellaneous.logEvent("i", "BatteryReceiver", "Regular charging.", 5);
|
||||
this.actionCharging(context);
|
||||
break;
|
||||
|
@ -138,6 +138,7 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
|||
this.actionCharging(context);
|
||||
break;
|
||||
case BatteryManager.BATTERY_STATUS_DISCHARGING:
|
||||
case BatteryManager.BATTERY_STATUS_NOT_CHARGING:
|
||||
this.actionDischarging(context);
|
||||
break;
|
||||
}
|
||||
|
@ -148,7 +149,7 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static int isDeviceCharging(Context context)
|
||||
{
|
||||
switch(currentChargingState)
|
||||
|
@ -163,10 +164,10 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
|||
Miscellaneous.logEvent("i", "ChargingInfo", "Status of device charging was requested. Device is charging.", 3);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return currentChargingState;
|
||||
}
|
||||
|
||||
|
||||
private void actionCharging(Context context)
|
||||
{
|
||||
if(currentChargingState != BatteryManager.BATTERY_STATUS_CHARGING) // Avoid flooding the log. This event will occur on a regular basis even though charging state wasn't changed.
|
||||
|
@ -183,7 +184,7 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void actionBatteryLevel(Context context)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "BatteryReceiver", "Battery level has changed.", 3);
|
||||
|
@ -195,7 +196,7 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
|||
ruleCandidates.get(i).activate(automationServiceRef, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void actionDischarging(Context context)
|
||||
{
|
||||
if(currentChargingState != BatteryManager.BATTERY_STATUS_UNKNOWN) // Avoid flooding the log. This event will occur on a regular basis even though charging state wasn't changed.
|
||||
|
@ -210,17 +211,17 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
|||
if(ruleCandidates.get(i).getsGreenLight(context))
|
||||
ruleCandidates.get(i).activate(automationServiceRef, false);
|
||||
}
|
||||
|
||||
|
||||
this.actionUsbDisconnected(context);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void actionUsbConnected(Context context)
|
||||
{
|
||||
// Event usbConnected
|
||||
|
||||
|
||||
// Miscellaneous.logEvent("i", "BatteryReceiver", "BATTERY_PLUGGED_USB");
|
||||
|
||||
|
||||
if(!usbHostConnected)
|
||||
{
|
||||
usbHostConnected = true;
|
||||
|
@ -234,15 +235,15 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
|||
if(oneRule.getsGreenLight(context))
|
||||
oneRule.activate(automationServiceRef, false);
|
||||
}
|
||||
|
||||
|
||||
this.actionCharging(context);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void actionUsbDisconnected(Context context)
|
||||
{
|
||||
// Event usbDisConnected
|
||||
|
||||
|
||||
if(usbHostConnected)
|
||||
{
|
||||
usbHostConnected = false;
|
||||
|
|
After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
@ -882,8 +882,8 @@
|
|||
<string name="wifiMonitoringAlsoRequiresThis">This permission is also required if the trigger is using the current wifi connection.</string>
|
||||
<string name="copyTextToClipboard">Copy text to clipboard</string>
|
||||
<string name="textToCopy">Text to copy</string>
|
||||
<string name="android.permission.SYSTEM_ALERT_WINDOW">Draw over other apps</string>
|
||||
<string name="overlayPermissionHint">After clicking OK you\'ll be sent to a system dialog. Please select Automation there and allow "draw over other apps".</string>
|
||||
<string name="android.permission.SYSTEM_ALERT_WINDOW">Display over other apps</string>
|
||||
<string name="overlayPermissionHint">After clicking OK you\'ll be sent to a system dialog. Please select Automation there and allow "Display over other apps".</string>
|
||||
<string name="variablesOnlyForTypes">Variables are only available for parameter types String and URI</string>
|
||||
<string name="intentParametersHint">If you want to specify a parameter you also have to click \"Add intent pair\". Otherwise your changes will not be saved.</string>
|
||||
</resources>
|
|
@ -0,0 +1,4 @@
|
|||
* Fixed: Added overlay permission for start-phone-call action
|
||||
* Change: Icon changed in Play store version
|
||||
* Fixed: Trigger "battery is charging" would only fire once and not after disconnecting and connecting charger
|
||||
* Change: Was forced to raise targetSdk to 32 for Google Play version. If that should break something, consider switching to the F-Droid or APK version.
|