Compare commits
No commits in common. "074f75ed2026b469c3462e0e08151bce5866305c" and "cb430b957f6ef7e98d35bff9fce9ed1775f6403c" have entirely different histories.
074f75ed20
...
cb430b957f
2
.idea/deploymentTargetDropDown.xml
generated
2
.idea/deploymentTargetDropDown.xml
generated
@ -12,6 +12,6 @@
|
|||||||
</deviceKey>
|
</deviceKey>
|
||||||
</Target>
|
</Target>
|
||||||
</targetSelectedWithDropDown>
|
</targetSelectedWithDropDown>
|
||||||
<timeTargetWasSelectedWithDropDown value="2021-09-24T23:07:53.935197300Z" />
|
<timeTargetWasSelectedWithDropDown value="2021-08-14T11:41:28.444891400Z" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@ -11,8 +11,8 @@ android {
|
|||||||
compileSdkVersion 29
|
compileSdkVersion 29
|
||||||
buildToolsVersion '29.0.2'
|
buildToolsVersion '29.0.2'
|
||||||
useLibrary 'org.apache.http.legacy'
|
useLibrary 'org.apache.http.legacy'
|
||||||
versionCode 113
|
versionCode 112
|
||||||
versionName "1.6.43"
|
versionName "1.6.42"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
@ -36,27 +36,27 @@ android {
|
|||||||
flavorDimensions "version"
|
flavorDimensions "version"
|
||||||
|
|
||||||
productFlavors
|
productFlavors
|
||||||
{
|
{
|
||||||
googlePlayFlavor
|
googlePlayFlavor
|
||||||
{
|
{
|
||||||
dimension "version"
|
dimension "version"
|
||||||
versionNameSuffix "-googlePlay"
|
versionNameSuffix "-googlePlay"
|
||||||
targetSdkVersion 30
|
targetSdkVersion 29
|
||||||
}
|
}
|
||||||
|
|
||||||
fdroidFlavor
|
fdroidFlavor
|
||||||
{
|
{
|
||||||
dimension "version"
|
dimension "version"
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
}
|
}
|
||||||
|
|
||||||
apkFlavor
|
apkFlavor
|
||||||
{
|
{
|
||||||
dimension "version"
|
dimension "version"
|
||||||
versionNameSuffix "-apk"
|
versionNameSuffix "-apk"
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
"type": "SINGLE",
|
"type": "SINGLE",
|
||||||
"filters": [],
|
"filters": [],
|
||||||
"attributes": [],
|
"attributes": [],
|
||||||
"versionCode": 113,
|
"versionCode": 112,
|
||||||
"versionName": "1.6.43-googlePlay",
|
"versionName": "1.6.42-googlePlay",
|
||||||
"outputFile": "app-googlePlayFlavor-release.apk"
|
"outputFile": "app-googlePlayFlavor-release.apk"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -365,7 +365,7 @@ public class Action
|
|||||||
Actions.setUsbTethering(context, getParameter1(), toggleActionIfPossible);
|
Actions.setUsbTethering(context, getParameter1(), toggleActionIfPossible);
|
||||||
break;
|
break;
|
||||||
case setWifi:
|
case setWifi:
|
||||||
Actions.WifiStuff.setWifi(context, getParameter1(), toggleActionIfPossible);
|
Actions.setWifi(context, getParameter1(), toggleActionIfPossible);
|
||||||
break;
|
break;
|
||||||
case setWifiTethering:
|
case setWifiTethering:
|
||||||
Actions.setWifiTethering(context, getParameter1(), toggleActionIfPossible);
|
Actions.setWifiTethering(context, getParameter1(), toggleActionIfPossible);
|
||||||
@ -381,7 +381,7 @@ public class Action
|
|||||||
break;
|
break;
|
||||||
case wakeupDevice:
|
case wakeupDevice:
|
||||||
Actions.wakeupDevice(Long.parseLong(this.getParameter2()));
|
Actions.wakeupDevice(Long.parseLong(this.getParameter2()));
|
||||||
// wakeupDevice() will create a separate thread. That'll take some time, we wait 100ms.
|
// wakeupDevice() will create a seperate thread. That'll take some time, we wait 100ms.
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
|
@ -3,7 +3,6 @@ package com.jens.automation2;
|
|||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.app.NotificationManager;
|
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.bluetooth.BluetoothAdapter;
|
import android.bluetooth.BluetoothAdapter;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
@ -24,11 +23,10 @@ import android.telephony.SmsManager;
|
|||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.RequiresApi;
|
|
||||||
|
|
||||||
import com.jens.automation2.actions.wifi_router.MyOnStartTetheringCallback;
|
import com.jens.automation2.actions.wifi_router.MyOnStartTetheringCallback;
|
||||||
import com.jens.automation2.actions.wifi_router.MyOreoWifiManager;
|
import com.jens.automation2.actions.wifi_router.MyOreoWifiManager;
|
||||||
import com.jens.automation2.location.WifiBroadcastReceiver;
|
import com.jens.automation2.location.WifiBroadcastReceiver;
|
||||||
@ -72,85 +70,48 @@ public class Actions
|
|||||||
public static final String wireguard_tunnel_down = "com.wireguard.android.action.SET_TUNNEL_DOWN";
|
public static final String wireguard_tunnel_down = "com.wireguard.android.action.SET_TUNNEL_DOWN";
|
||||||
public static final String wireguard_tunnel_refresh = "com.wireguard.android.action.REFRESH_TUNNEL_STATES";
|
public static final String wireguard_tunnel_refresh = "com.wireguard.android.action.REFRESH_TUNNEL_STATES";
|
||||||
|
|
||||||
public static class WifiStuff
|
public static Boolean setWifi(Context context, Boolean desiredState, boolean toggleActionIfPossible)
|
||||||
{
|
{
|
||||||
public static Boolean setWifi(Context context, Boolean desiredState, boolean toggleActionIfPossible)
|
Miscellaneous.logEvent("i", "Wifi", "Changing Wifi to " + String.valueOf(desiredState), 4);
|
||||||
|
|
||||||
|
if (desiredState && Settings.useWifiForPositioning)
|
||||||
|
WifiBroadcastReceiver.startWifiReceiver(autoMationServerRef.getLocationProvider());
|
||||||
|
|
||||||
|
WifiManager myWifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
|
||||||
|
|
||||||
|
// toggle
|
||||||
|
if (toggleActionIfPossible)
|
||||||
{
|
{
|
||||||
if(context.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.Q)
|
Toast.makeText(context, context.getResources().getString(R.string.toggling) + " " + context.getResources().getString(R.string.wifi), Toast.LENGTH_LONG).show();
|
||||||
return setWifiWithRoot(context, desiredState, toggleActionIfPossible);
|
desiredState = !myWifi.isWifiEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only perform action if necessary
|
||||||
|
if ((!myWifi.isWifiEnabled() && desiredState) | (myWifi.isWifiEnabled() && !desiredState))
|
||||||
|
{
|
||||||
|
String wifiString = "";
|
||||||
|
|
||||||
|
if (desiredState)
|
||||||
|
{
|
||||||
|
wifiString = context.getResources().getString(R.string.activating) + " " + context.getResources().getString(R.string.wifi);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return setWifiOldFashioned(context, desiredState, toggleActionIfPossible);
|
{
|
||||||
}
|
wifiString = context.getResources().getString(R.string.deactivating) + " " + context.getResources().getString(R.string.wifi);
|
||||||
|
}
|
||||||
|
|
||||||
public static Boolean setWifiWithRoot(Context context, Boolean desiredState, boolean toggleActionIfPossible)
|
Toast.makeText(context, wifiString, Toast.LENGTH_LONG).show();
|
||||||
{
|
|
||||||
Miscellaneous.logEvent("i", "Wifi", "Changing wifi to " + String.valueOf(desiredState) + ", but with root permissions.", 4);
|
|
||||||
|
|
||||||
String command = null;
|
boolean returnValue = myWifi.setWifiEnabled(desiredState);
|
||||||
int state = 0;
|
if (!returnValue)
|
||||||
|
Miscellaneous.logEvent("i", "Wifi", "Error changing Wifi to " + String.valueOf(desiredState), 2);
|
||||||
String desiredStateString;
|
|
||||||
if(desiredState)
|
|
||||||
desiredStateString = "enable";
|
|
||||||
else
|
else
|
||||||
desiredStateString = "disable";
|
Miscellaneous.logEvent("i", "Wifi", "Wifi changed to " + String.valueOf(desiredState), 2);
|
||||||
|
|
||||||
try
|
return returnValue;
|
||||||
{
|
|
||||||
command = "svc wifi " + desiredStateString;
|
|
||||||
Miscellaneous.logEvent("i", "setWifiWithRoot()", "Running command as root: " + command.toString(), 5);
|
|
||||||
return executeCommandViaSu(new String[]{command});
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
// Oops! Something went wrong, so we throw the exception here.
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean setWifiOldFashioned(Context context, Boolean desiredState, boolean toggleActionIfPossible)
|
return true;
|
||||||
{
|
|
||||||
Miscellaneous.logEvent("i", "Wifi", "Changing wifi to " + String.valueOf(desiredState), 4);
|
|
||||||
|
|
||||||
if (desiredState && Settings.useWifiForPositioning)
|
|
||||||
WifiBroadcastReceiver.startWifiReceiver(autoMationServerRef.getLocationProvider());
|
|
||||||
|
|
||||||
WifiManager myWifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
|
|
||||||
|
|
||||||
// toggle
|
|
||||||
if (toggleActionIfPossible)
|
|
||||||
{
|
|
||||||
Toast.makeText(context, context.getResources().getString(R.string.toggling) + " " + context.getResources().getString(R.string.wifi), Toast.LENGTH_LONG).show();
|
|
||||||
desiredState = !myWifi.isWifiEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only perform action if necessary
|
|
||||||
if ((!myWifi.isWifiEnabled() && desiredState) | (myWifi.isWifiEnabled() && !desiredState))
|
|
||||||
{
|
|
||||||
String wifiString = "";
|
|
||||||
|
|
||||||
if (desiredState)
|
|
||||||
{
|
|
||||||
wifiString = context.getResources().getString(R.string.activating) + " " + context.getResources().getString(R.string.wifi);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wifiString = context.getResources().getString(R.string.deactivating) + " " + context.getResources().getString(R.string.wifi);
|
|
||||||
}
|
|
||||||
|
|
||||||
Toast.makeText(context, wifiString, Toast.LENGTH_LONG).show();
|
|
||||||
|
|
||||||
boolean returnValue = myWifi.setWifiEnabled(desiredState);
|
|
||||||
if (!returnValue)
|
|
||||||
Miscellaneous.logEvent("i", "Wifi", "Error changing Wifi to " + String.valueOf(desiredState), 2);
|
|
||||||
else
|
|
||||||
Miscellaneous.logEvent("i", "Wifi", "Wifi changed to " + String.valueOf(desiredState), 2);
|
|
||||||
|
|
||||||
return returnValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setDisplayRotation(Context myContext, Boolean desiredState, boolean toggleActionIfPossible)
|
public static void setDisplayRotation(Context myContext, Boolean desiredState, boolean toggleActionIfPossible)
|
||||||
@ -498,53 +459,12 @@ public class Actions
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.M)
|
public static void setSound(Context context, int soundSetting)
|
||||||
public static void setDoNotDisturb(Context context, int desiredSetting)
|
|
||||||
{
|
{
|
||||||
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
Miscellaneous.logEvent("i", context.getResources().getString(R.string.soundSettings), "Changing sound to " + String.valueOf(soundSetting), 4);
|
||||||
|
|
||||||
// Check if the notification policy access has been granted for the app.
|
|
||||||
/* if (!notificationManager.isNotificationPolicyAccessGranted())
|
|
||||||
{
|
|
||||||
Intent intent = new Intent(android.provider.Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS);
|
|
||||||
startActivity(intent);
|
|
||||||
return;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
notificationManager.setInterruptionFilter(desiredSetting);
|
|
||||||
|
|
||||||
/*if (notificationManager.getCurrentInterruptionFilter() == NotificationManager.INTERRUPTION_FILTER_ALL)
|
|
||||||
{
|
|
||||||
notificationManager.setInterruptionFilter(NotificationManager.INTERRUPTION_FILTER_NONE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
notificationManager.setInterruptionFilter(NotificationManager.INTERRUPTION_FILTER_ALL);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.M)
|
|
||||||
public static boolean isDoNotDisturbActive(Context context)
|
|
||||||
{
|
|
||||||
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
|
||||||
int result = notificationManager.getCurrentInterruptionFilter();
|
|
||||||
return (notificationManager.getCurrentInterruptionFilter() != NotificationManager.INTERRUPTION_FILTER_ALL);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setSound(Context context, int desiredSoundSetting)
|
|
||||||
{
|
|
||||||
Miscellaneous.logEvent("i", context.getResources().getString(R.string.soundSettings), "Changing sound to " + String.valueOf(desiredSoundSetting), 4);
|
|
||||||
|
|
||||||
AudioManager myAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
|
AudioManager myAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
|
||||||
|
myAudioManager.setRingerMode(soundSetting);
|
||||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && desiredSoundSetting == AudioManager.RINGER_MODE_SILENT)
|
|
||||||
{
|
|
||||||
AudioManager am = (AudioManager) Miscellaneous.getAnyContext().getSystemService(Context.AUDIO_SERVICE);
|
|
||||||
am.setStreamVolume(AudioManager.STREAM_NOTIFICATION, 0, AudioManager.FLAG_PLAY_SOUND);
|
|
||||||
am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_OFF);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
myAudioManager.setRingerMode(desiredSoundSetting);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getIPAddressUsb(final boolean useIPv4)
|
private static String getIPAddressUsb(final boolean useIPv4)
|
||||||
@ -657,19 +577,7 @@ public class Actions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setDND(Context context, int desiredDndMode)
|
public void useDownloadedWebpage(String result)
|
||||||
{
|
|
||||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
|
|
||||||
{
|
|
||||||
Miscellaneous.logEvent("i", context.getResources().getString(R.string.soundSettings), "Changing DND to " + String.valueOf(desiredDndMode), 4);
|
|
||||||
NotificationManager mNotificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
|
|
||||||
mNotificationManager.setInterruptionFilter(desiredDndMode);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Miscellaneous.logEvent("w", context.getResources().getString(R.string.soundSettings), "Cannot change DND to " + String.valueOf(desiredDndMode) + ". This Android version is too and doesn\'t have that feature, yet.", 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void useDownloadedWebpage(String result)
|
|
||||||
{
|
{
|
||||||
// Toast.makeText(context, "Result: " + result, Toast.LENGTH_LONG).show();
|
// Toast.makeText(context, "Result: " + result, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
@ -1235,7 +1143,7 @@ public class Actions
|
|||||||
desiredState = !isEnabled;
|
desiredState = !isEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT_WATCH)
|
if (Build.VERSION.SDK_INT <= 20)
|
||||||
{
|
{
|
||||||
for (Method m : iConnectivityManagerClass.getDeclaredMethods())
|
for (Method m : iConnectivityManagerClass.getDeclaredMethods())
|
||||||
{
|
{
|
||||||
@ -1261,48 +1169,23 @@ public class Actions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static boolean setDataConnectionWithRoot(boolean desiredState)
|
protected static boolean setDataConnectionWithRoot(boolean enable)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if(Build.VERSION.SDK_INT > Build.VERSION_CODES.O_MR1)
|
int desiredState = 0;
|
||||||
|
if (enable)
|
||||||
|
desiredState = 1;
|
||||||
|
|
||||||
|
if (MobileDataStuff.setMobileNetworkFromLollipop(desiredState, autoMationServerRef))
|
||||||
{
|
{
|
||||||
if(MobileDataStuff.setMobileNetworkFromAndroid9(desiredState, autoMationServerRef))
|
Miscellaneous.logEvent("i", "setDataConnectionWithRoot()", Miscellaneous.getAnyContext().getResources().getString(R.string.dataConWithRootSuccess), 2);
|
||||||
{
|
return true;
|
||||||
Miscellaneous.logEvent("i", "setDataConnectionWithRoot()", Miscellaneous.getAnyContext().getResources().getString(R.string.dataConWithRootSuccess), 2);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Miscellaneous.logEvent("e", "setDataConnectionWithRoot()", Miscellaneous.getAnyContext().getResources().getString(R.string.dataConWithRootFail), 2);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
{
|
|
||||||
if (MobileDataStuff.setMobileNetworkTillAndroid5(desiredState, autoMationServerRef))
|
|
||||||
{
|
|
||||||
Miscellaneous.logEvent("i", "setDataConnectionWithRoot()", Miscellaneous.getAnyContext().getResources().getString(R.string.dataConWithRootSuccess), 2);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Miscellaneous.logEvent("e", "setDataConnectionWithRoot()", Miscellaneous.getAnyContext().getResources().getString(R.string.dataConWithRootFail), 2);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (MobileDataStuff.setMobileNetworkAndroid6Till8(desiredState, autoMationServerRef))
|
Miscellaneous.logEvent("e", "setDataConnectionWithRoot()", Miscellaneous.getAnyContext().getResources().getString(R.string.dataConWithRootFail), 2);
|
||||||
{
|
return false;
|
||||||
Miscellaneous.logEvent("i", "setDataConnectionWithRoot()", Miscellaneous.getAnyContext().getResources().getString(R.string.dataConWithRootSuccess), 2);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Miscellaneous.logEvent("e", "setDataConnectionWithRoot()", Miscellaneous.getAnyContext().getResources().getString(R.string.dataConWithRootFail), 2);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@ -1319,35 +1202,43 @@ public class Actions
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
public static boolean setMobileNetworkAndroid6Till8(boolean desiredState, Context context) throws Exception
|
public static boolean setMobileNetworkFromLollipop(int desiredState, Context context) throws Exception
|
||||||
{
|
{
|
||||||
String command = null;
|
String command = null;
|
||||||
|
int state = 0;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int desiredStateString;
|
|
||||||
if(desiredState)
|
|
||||||
desiredStateString = 1;
|
|
||||||
else
|
|
||||||
desiredStateString = 0;
|
|
||||||
|
|
||||||
// Get the current state of the mobile network.
|
// Get the current state of the mobile network.
|
||||||
// boolean state = isMobileDataEnabled() ? 0 : 1;
|
state = isMobileDataEnabled() ? 0 : 1;
|
||||||
// Get the value of the "TRANSACTION_setDataEnabled" field.
|
// Get the value of the "TRANSACTION_setDataEnabled" field.
|
||||||
String transactionCode = getTransactionCode(context);
|
String transactionCode = getTransactionCode(context);
|
||||||
// Android 5.1+ (API 22) and later.
|
// Android 5.1+ (API 22) and later.
|
||||||
SubscriptionManager mSubscriptionManager = (SubscriptionManager) context.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP)
|
||||||
// Loop through the subscription list i.e. SIM list.
|
|
||||||
for (int i = 0; i < mSubscriptionManager.getActiveSubscriptionInfoCountMax(); i++)
|
|
||||||
{
|
{
|
||||||
|
SubscriptionManager mSubscriptionManager = (SubscriptionManager) context.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
|
||||||
|
// Loop through the subscription list i.e. SIM list.
|
||||||
|
for (int i = 0; i < mSubscriptionManager.getActiveSubscriptionInfoCountMax(); i++)
|
||||||
|
{
|
||||||
|
if (transactionCode != null && transactionCode.length() > 0)
|
||||||
|
{
|
||||||
|
// Get the active subscription ID for a given SIM card.
|
||||||
|
int subscriptionId = mSubscriptionManager.getActiveSubscriptionInfoList().get(i).getSubscriptionId();
|
||||||
|
// Execute the command via `su` to turn off
|
||||||
|
// mobile network for a subscription service.
|
||||||
|
command = "service call phone " + transactionCode + " i32 " + subscriptionId + " i32 " + desiredState;
|
||||||
|
Miscellaneous.logEvent("i", "setDataConnectionWithRoot()", "Running command: " + command.toString(), 5);
|
||||||
|
return executeCommandViaSu(new String[]{command});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP)
|
||||||
|
{
|
||||||
|
// Android 5.0 (API 21) only.
|
||||||
if (transactionCode != null && transactionCode.length() > 0)
|
if (transactionCode != null && transactionCode.length() > 0)
|
||||||
{
|
{
|
||||||
// Get the active subscription ID for a given SIM card.
|
// Execute the command via `su` to turn off mobile network.
|
||||||
int subscriptionId = mSubscriptionManager.getActiveSubscriptionInfoList().get(i).getSubscriptionId();
|
command = "service call phone " + transactionCode + " i32 " + desiredState;
|
||||||
// Execute the command via `su` to turn off
|
|
||||||
// mobile network for a subscription service.
|
|
||||||
command = "service call phone " + transactionCode + " i32 " + subscriptionId + " i32 " + desiredStateString;
|
|
||||||
Miscellaneous.logEvent("i", "setMobileNetworkAndroid6Till8()", "Running command: " + command.toString(), 5);
|
|
||||||
return executeCommandViaSu(new String[]{command});
|
return executeCommandViaSu(new String[]{command});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1361,75 +1252,6 @@ public class Actions
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
|
||||||
public static boolean setMobileNetworkTillAndroid5(boolean desiredState, Context context) throws Exception
|
|
||||||
{
|
|
||||||
String command = null;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int desiredStateString;
|
|
||||||
if(desiredState)
|
|
||||||
desiredStateString = 1;
|
|
||||||
else
|
|
||||||
desiredStateString = 0;
|
|
||||||
|
|
||||||
// Get the current state of the mobile network.
|
|
||||||
// int currentState = isMobileDataEnabled() ? 0 : 1;
|
|
||||||
// Get the value of the "TRANSACTION_setDataEnabled" field.
|
|
||||||
String transactionCode = getTransactionCode(context);
|
|
||||||
// Android 5.0 (API 21) only.
|
|
||||||
if (transactionCode != null && transactionCode.length() > 0)
|
|
||||||
{
|
|
||||||
// Execute the command via `su` to turn off mobile network.
|
|
||||||
command = "service call phone " + transactionCode + " i32 " + desiredStateString;
|
|
||||||
Miscellaneous.logEvent("i", "setMobileNetworkTillAndroid5()", "Running command: " + command.toString(), 5);
|
|
||||||
return executeCommandViaSu(new String[]{command});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
// Oops! Something went wrong, so we throw the exception here.
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
|
||||||
public static boolean setMobileNetworkFromAndroid9(boolean desiredState, Context context) throws Exception
|
|
||||||
{
|
|
||||||
String command = null;
|
|
||||||
|
|
||||||
String desiredStateString;
|
|
||||||
if(desiredState)
|
|
||||||
desiredStateString = "enable";
|
|
||||||
else
|
|
||||||
desiredStateString = "disable";
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
Android 8.1 is the last version on which the transaction code can be determined
|
|
||||||
with the below method. From 9.0 on the field TRANSACTION_setDataEnabled does not
|
|
||||||
exist anymore. Usually it was 83 and we'll just try this number hardcoded.
|
|
||||||
Alternatively the bottom of this might be an approach:
|
|
||||||
https://stackoverflow.com/questions/26539445/the-setmobiledataenabled-method-is-no-longer-callable-as-of-android-l-and-later
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Execute the command via `su` to turn off
|
|
||||||
// mobile network for a subscription service.
|
|
||||||
command = "svc data " + desiredStateString;
|
|
||||||
Miscellaneous.logEvent("i", "setMobileNetworkFromAndroid9()", "Running command: " + command.toString(), 5);
|
|
||||||
return executeCommandViaSu(new String[]{command});
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
// Oops! Something went wrong, so we throw the exception here.
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
public static boolean isMobileDataEnabled()
|
public static boolean isMobileDataEnabled()
|
||||||
{
|
{
|
||||||
|
@ -29,7 +29,6 @@ import androidx.core.text.HtmlCompat;
|
|||||||
|
|
||||||
import com.jens.automation2.AutomationService.serviceCommands;
|
import com.jens.automation2.AutomationService.serviceCommands;
|
||||||
import com.jens.automation2.Trigger.Trigger_Enum;
|
import com.jens.automation2.Trigger.Trigger_Enum;
|
||||||
import com.jens.automation2.location.CellLocationChangedReceiver;
|
|
||||||
import com.jens.automation2.location.LocationProvider;
|
import com.jens.automation2.location.LocationProvider;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -22,8 +22,6 @@ import android.widget.EditText;
|
|||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.jens.automation2.receivers.ConnectivityReceiver;
|
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
@ -165,7 +163,7 @@ public class ActivityManagePoi extends Activity
|
|||||||
locationSearchStart = Calendar.getInstance();
|
locationSearchStart = Calendar.getInstance();
|
||||||
startTimeout();
|
startTimeout();
|
||||||
|
|
||||||
if(!Settings.privacyLocationing || !ConnectivityReceiver.isDataConnectionAvailable(AutomationService.getInstance()))
|
if(!Settings.privacyLocationing)
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", "POI Manager", getResources().getString(R.string.logGettingPositionWithProvider) + " " + provider1, 3);
|
Miscellaneous.logEvent("i", "POI Manager", getResources().getString(R.string.logGettingPositionWithProvider) + " " + provider1, 3);
|
||||||
myLocationManager.requestLocationUpdates(provider1, 500, Settings.satisfactoryAccuracyNetwork, myLocationListenerNetwork);
|
myLocationManager.requestLocationUpdates(provider1, 500, Settings.satisfactoryAccuracyNetwork, myLocationListenerNetwork);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.jens.automation2;
|
package com.jens.automation2;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.NotificationManager;
|
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -38,8 +37,8 @@ public class ActivityManageProfile extends Activity
|
|||||||
final static int intentCodeRingtonePickerNotificationsFile = 9020;
|
final static int intentCodeRingtonePickerNotificationsFile = 9020;
|
||||||
final static int intentCodeRingtonePickerNotificationsRingtone = 9021;
|
final static int intentCodeRingtonePickerNotificationsRingtone = 9021;
|
||||||
|
|
||||||
CheckBox checkBoxChangeSoundMode, checkBoxChangeVolumeMusicVideoGameMedia, checkBoxChangeVolumeNotifications, checkBoxChangeVolumeAlarms, checkBoxChangeIncomingCallsRingtone, checkBoxChangeNotificationRingtone, checkBoxChangeAudibleSelection, checkBoxChangeScreenLockUnlockSound, checkBoxChangeHapticFeedback, checkBoxChangeVibrateWhenRinging, checkBoxVibrateWhenRinging, checkBoxAudibleSelection, checkBoxScreenLockUnlockSound, checkBoxHapticFeedback, checkBoxChangeDnd;
|
CheckBox checkBoxChangeSoundMode, checkBoxChangeVolumeMusicVideoGameMedia, checkBoxChangeVolumeNotifications, checkBoxChangeVolumeAlarms, checkBoxChangeIncomingCallsRingtone, checkBoxChangeNotificationRingtone, checkBoxChangeAudibleSelection, checkBoxChangeScreenLockUnlockSound, checkBoxChangeHapticFeedback, checkBoxChangeVibrateWhenRinging, checkBoxVibrateWhenRinging, checkBoxAudibleSelection, checkBoxScreenLockUnlockSound, checkBoxHapticFeedback;
|
||||||
Spinner spinnerSoundMode, spinnerDndMode;
|
Spinner spinnerSoundMode;
|
||||||
SeekBar seekBarVolumeMusic, seekBarVolumeNotifications, seekBarVolumeAlarms;
|
SeekBar seekBarVolumeMusic, seekBarVolumeNotifications, seekBarVolumeAlarms;
|
||||||
Button bChangeSoundIncomingCalls, bChangeSoundNotifications, bSaveProfile;
|
Button bChangeSoundIncomingCalls, bChangeSoundNotifications, bSaveProfile;
|
||||||
TextView tvIncomingCallsRingtone, tvNotificationsRingtone;
|
TextView tvIncomingCallsRingtone, tvNotificationsRingtone;
|
||||||
@ -48,7 +47,6 @@ public class ActivityManageProfile extends Activity
|
|||||||
File incomingCallsRingtone = null, notificationsRingtone = null;
|
File incomingCallsRingtone = null, notificationsRingtone = null;
|
||||||
|
|
||||||
ArrayAdapter<String> soundModeAdapter;
|
ArrayAdapter<String> soundModeAdapter;
|
||||||
ArrayAdapter<String> dndModeAdapter;
|
|
||||||
|
|
||||||
public void setIncomingCallsRingtone(File incomingCallsRingtone)
|
public void setIncomingCallsRingtone(File incomingCallsRingtone)
|
||||||
{
|
{
|
||||||
@ -87,7 +85,6 @@ public class ActivityManageProfile extends Activity
|
|||||||
this.setContentView(R.layout.activity_manage_specific_profile);
|
this.setContentView(R.layout.activity_manage_specific_profile);
|
||||||
|
|
||||||
checkBoxChangeSoundMode = (CheckBox)findViewById(R.id.checkBoxChangeSoundMode);
|
checkBoxChangeSoundMode = (CheckBox)findViewById(R.id.checkBoxChangeSoundMode);
|
||||||
checkBoxChangeDnd = (CheckBox)findViewById(R.id.checkBoxChangeDnd);
|
|
||||||
checkBoxChangeVolumeMusicVideoGameMedia = (CheckBox)findViewById(R.id.checkBoxChangeVolumeMusicVideoGameMedia);
|
checkBoxChangeVolumeMusicVideoGameMedia = (CheckBox)findViewById(R.id.checkBoxChangeVolumeMusicVideoGameMedia);
|
||||||
checkBoxChangeVolumeNotifications = (CheckBox)findViewById(R.id.checkBoxChangeVolumeNotifications);
|
checkBoxChangeVolumeNotifications = (CheckBox)findViewById(R.id.checkBoxChangeVolumeNotifications);
|
||||||
checkBoxChangeVolumeAlarms = (CheckBox)findViewById(R.id.checkBoxChangeVolumeAlarms);
|
checkBoxChangeVolumeAlarms = (CheckBox)findViewById(R.id.checkBoxChangeVolumeAlarms);
|
||||||
@ -102,7 +99,6 @@ public class ActivityManageProfile extends Activity
|
|||||||
checkBoxHapticFeedback = (CheckBox)findViewById(R.id.checkBoxHapticFeedback);
|
checkBoxHapticFeedback = (CheckBox)findViewById(R.id.checkBoxHapticFeedback);
|
||||||
checkBoxVibrateWhenRinging = (CheckBox)findViewById(R.id.checkBoxVibrateWhenRinging);
|
checkBoxVibrateWhenRinging = (CheckBox)findViewById(R.id.checkBoxVibrateWhenRinging);
|
||||||
spinnerSoundMode = (Spinner)findViewById(R.id.spinnerSoundMode);
|
spinnerSoundMode = (Spinner)findViewById(R.id.spinnerSoundMode);
|
||||||
spinnerDndMode = (Spinner)findViewById(R.id.spinnerDndMode);
|
|
||||||
seekBarVolumeMusic = (SeekBar)findViewById(R.id.seekBarVolumeMusic);
|
seekBarVolumeMusic = (SeekBar)findViewById(R.id.seekBarVolumeMusic);
|
||||||
seekBarVolumeNotifications = (SeekBar)findViewById(R.id.seekBarVolumeNotifications);
|
seekBarVolumeNotifications = (SeekBar)findViewById(R.id.seekBarVolumeNotifications);
|
||||||
seekBarVolumeAlarms = (SeekBar)findViewById(R.id.seekBarVolumeAlarms);
|
seekBarVolumeAlarms = (SeekBar)findViewById(R.id.seekBarVolumeAlarms);
|
||||||
@ -118,7 +114,6 @@ public class ActivityManageProfile extends Activity
|
|||||||
checkBoxScreenLockUnlockSound.setEnabled(false);
|
checkBoxScreenLockUnlockSound.setEnabled(false);
|
||||||
checkBoxHapticFeedback.setEnabled(false);
|
checkBoxHapticFeedback.setEnabled(false);
|
||||||
spinnerSoundMode.setEnabled(false);
|
spinnerSoundMode.setEnabled(false);
|
||||||
spinnerDndMode.setEnabled(false);
|
|
||||||
seekBarVolumeMusic.setEnabled(false);
|
seekBarVolumeMusic.setEnabled(false);
|
||||||
seekBarVolumeNotifications.setEnabled(false);
|
seekBarVolumeNotifications.setEnabled(false);
|
||||||
seekBarVolumeAlarms.setEnabled(false);
|
seekBarVolumeAlarms.setEnabled(false);
|
||||||
@ -126,14 +121,6 @@ public class ActivityManageProfile extends Activity
|
|||||||
bChangeSoundNotifications.setEnabled(false);
|
bChangeSoundNotifications.setEnabled(false);
|
||||||
|
|
||||||
spinnerSoundMode.setSelection(0);
|
spinnerSoundMode.setSelection(0);
|
||||||
spinnerDndMode.setSelection(0);
|
|
||||||
|
|
||||||
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
|
|
||||||
{
|
|
||||||
// Disable DND controls
|
|
||||||
checkBoxChangeDnd.setEnabled(false);
|
|
||||||
spinnerDndMode.setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Scale SeekBars to the system's maximum volume values
|
// Scale SeekBars to the system's maximum volume values
|
||||||
AudioManager am = (AudioManager) Miscellaneous.getAnyContext().getSystemService(Context.AUDIO_SERVICE);
|
AudioManager am = (AudioManager) Miscellaneous.getAnyContext().getSystemService(Context.AUDIO_SERVICE);
|
||||||
@ -141,31 +128,9 @@ public class ActivityManageProfile extends Activity
|
|||||||
seekBarVolumeNotifications.setMax(am.getStreamMaxVolume(AudioManager.STREAM_NOTIFICATION));
|
seekBarVolumeNotifications.setMax(am.getStreamMaxVolume(AudioManager.STREAM_NOTIFICATION));
|
||||||
seekBarVolumeAlarms.setMax(am.getStreamMaxVolume(AudioManager.STREAM_ALARM));
|
seekBarVolumeAlarms.setMax(am.getStreamMaxVolume(AudioManager.STREAM_ALARM));
|
||||||
|
|
||||||
soundModeAdapter = new ArrayAdapter<String>(this, R.layout.text_view_for_poi_listview_mediumtextsize, new String[]
|
soundModeAdapter = new ArrayAdapter<String>(this, R.layout.text_view_for_poi_listview_mediumtextsize, new String[] { getResources().getString(R.string.soundModeSilent), getResources().getString(R.string.soundModeVibrate), getResources().getString(R.string.soundModeNormal) });
|
||||||
{
|
|
||||||
getResources().getString(R.string.soundModeSilent),
|
|
||||||
getResources().getString(R.string.soundModeVibrate),
|
|
||||||
getResources().getString(R.string.soundModeNormal)
|
|
||||||
});
|
|
||||||
spinnerSoundMode.setAdapter(soundModeAdapter);
|
spinnerSoundMode.setAdapter(soundModeAdapter);
|
||||||
|
|
||||||
dndModeAdapter = new ArrayAdapter<String>(this, R.layout.text_view_for_poi_listview_mediumtextsize, new String[]
|
|
||||||
{
|
|
||||||
getResources().getString(R.string.dndOff),
|
|
||||||
getResources().getString(R.string.dndPriority),
|
|
||||||
getResources().getString(R.string.dndNothing),
|
|
||||||
getResources().getString(R.string.dndAlarms)
|
|
||||||
});
|
|
||||||
spinnerDndMode.setAdapter(dndModeAdapter);
|
|
||||||
/*
|
|
||||||
Order in spinner: 1, 2, 4, 3
|
|
||||||
NotificationManager.INTERRUPTION_FILTER_UNKNOWN -> Returned when the value is unavailable for any reason.
|
|
||||||
NotificationManager.INTERRUPTION_FILTER_ALL -> 1 -> Normal interruption filter - no notifications are suppressed. -> essentially turn off DND
|
|
||||||
NotificationManager.INTERRUPTION_FILTER_PRIORITY -> 2 -> Priority interruption filter - all notifications are suppressed except those that match the priority criteria.
|
|
||||||
NotificationManager.INTERRUPTION_FILTER_ALARMS -> 4 -> Alarms only interruption filter - all notifications except those of category
|
|
||||||
NotificationManager.INTERRUPTION_FILTER_NONE -> 3 -> No interruptions filter - all notifications are suppressed and all audio streams (except those used for phone calls) and vibrations are muted.
|
|
||||||
*/
|
|
||||||
|
|
||||||
checkBoxChangeSoundMode.setOnCheckedChangeListener(new OnCheckedChangeListener()
|
checkBoxChangeSoundMode.setOnCheckedChangeListener(new OnCheckedChangeListener()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -174,14 +139,6 @@ public class ActivityManageProfile extends Activity
|
|||||||
spinnerSoundMode.setEnabled(isChecked);
|
spinnerSoundMode.setEnabled(isChecked);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
checkBoxChangeDnd.setOnCheckedChangeListener(new OnCheckedChangeListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
|
|
||||||
{
|
|
||||||
spinnerDndMode.setEnabled(isChecked);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
checkBoxChangeVolumeMusicVideoGameMedia.setOnCheckedChangeListener(new OnCheckedChangeListener()
|
checkBoxChangeVolumeMusicVideoGameMedia.setOnCheckedChangeListener(new OnCheckedChangeListener()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -370,7 +327,6 @@ public class ActivityManageProfile extends Activity
|
|||||||
{
|
{
|
||||||
etName.setText(ActivityMainProfiles.profileToEdit.getName());
|
etName.setText(ActivityMainProfiles.profileToEdit.getName());
|
||||||
checkBoxChangeSoundMode.setChecked(ActivityMainProfiles.profileToEdit.getChangeSoundMode());
|
checkBoxChangeSoundMode.setChecked(ActivityMainProfiles.profileToEdit.getChangeSoundMode());
|
||||||
checkBoxChangeDnd.setChecked(ActivityMainProfiles.profileToEdit.getChangeDndMode());
|
|
||||||
checkBoxChangeVolumeMusicVideoGameMedia.setChecked(ActivityMainProfiles.profileToEdit.getChangeVolumeMusicVideoGameMedia());
|
checkBoxChangeVolumeMusicVideoGameMedia.setChecked(ActivityMainProfiles.profileToEdit.getChangeVolumeMusicVideoGameMedia());
|
||||||
checkBoxChangeVolumeNotifications.setChecked(ActivityMainProfiles.profileToEdit.getChangeVolumeNotifications());
|
checkBoxChangeVolumeNotifications.setChecked(ActivityMainProfiles.profileToEdit.getChangeVolumeNotifications());
|
||||||
checkBoxChangeVolumeAlarms.setChecked(ActivityMainProfiles.profileToEdit.getChangeVolumeAlarms());
|
checkBoxChangeVolumeAlarms.setChecked(ActivityMainProfiles.profileToEdit.getChangeVolumeAlarms());
|
||||||
@ -382,7 +338,6 @@ public class ActivityManageProfile extends Activity
|
|||||||
checkBoxChangeVibrateWhenRinging.setChecked(ActivityMainProfiles.profileToEdit.getChangeVibrateWhenRinging());
|
checkBoxChangeVibrateWhenRinging.setChecked(ActivityMainProfiles.profileToEdit.getChangeVibrateWhenRinging());
|
||||||
|
|
||||||
spinnerSoundMode.setSelection(ActivityMainProfiles.profileToEdit.getSoundMode());
|
spinnerSoundMode.setSelection(ActivityMainProfiles.profileToEdit.getSoundMode());
|
||||||
spinnerDndMode.setSelection(ActivityMainProfiles.profileToEdit.getDndMode()-1);
|
|
||||||
seekBarVolumeMusic.setProgress(ActivityMainProfiles.profileToEdit.getVolumeMusic());
|
seekBarVolumeMusic.setProgress(ActivityMainProfiles.profileToEdit.getVolumeMusic());
|
||||||
seekBarVolumeNotifications.setProgress(ActivityMainProfiles.profileToEdit.getVolumeNotifications());
|
seekBarVolumeNotifications.setProgress(ActivityMainProfiles.profileToEdit.getVolumeNotifications());
|
||||||
seekBarVolumeAlarms.setProgress(ActivityMainProfiles.profileToEdit.getVolumeAlarms());
|
seekBarVolumeAlarms.setProgress(ActivityMainProfiles.profileToEdit.getVolumeAlarms());
|
||||||
@ -404,7 +359,6 @@ public class ActivityManageProfile extends Activity
|
|||||||
|
|
||||||
ActivityMainProfiles.profileToEdit.setName(etName.getText().toString());
|
ActivityMainProfiles.profileToEdit.setName(etName.getText().toString());
|
||||||
ActivityMainProfiles.profileToEdit.setChangeSoundMode(checkBoxChangeSoundMode.isChecked());
|
ActivityMainProfiles.profileToEdit.setChangeSoundMode(checkBoxChangeSoundMode.isChecked());
|
||||||
ActivityMainProfiles.profileToEdit.setChangeDndMode(checkBoxChangeDnd.isChecked());
|
|
||||||
ActivityMainProfiles.profileToEdit.setChangeVolumeMusicVideoGameMedia(checkBoxChangeVolumeMusicVideoGameMedia.isChecked());
|
ActivityMainProfiles.profileToEdit.setChangeVolumeMusicVideoGameMedia(checkBoxChangeVolumeMusicVideoGameMedia.isChecked());
|
||||||
ActivityMainProfiles.profileToEdit.setChangeVolumeNotifications(checkBoxChangeVolumeNotifications.isChecked());
|
ActivityMainProfiles.profileToEdit.setChangeVolumeNotifications(checkBoxChangeVolumeNotifications.isChecked());
|
||||||
ActivityMainProfiles.profileToEdit.setChangeVolumeAlarms(checkBoxChangeVolumeAlarms.isChecked());
|
ActivityMainProfiles.profileToEdit.setChangeVolumeAlarms(checkBoxChangeVolumeAlarms.isChecked());
|
||||||
@ -420,7 +374,6 @@ public class ActivityManageProfile extends Activity
|
|||||||
ActivityMainProfiles.profileToEdit.setHapticFeedback(checkBoxHapticFeedback.isChecked());
|
ActivityMainProfiles.profileToEdit.setHapticFeedback(checkBoxHapticFeedback.isChecked());
|
||||||
ActivityMainProfiles.profileToEdit.setVibrateWhenRinging(checkBoxVibrateWhenRinging.isChecked());
|
ActivityMainProfiles.profileToEdit.setVibrateWhenRinging(checkBoxVibrateWhenRinging.isChecked());
|
||||||
ActivityMainProfiles.profileToEdit.setSoundMode(spinnerSoundMode.getSelectedItemPosition());
|
ActivityMainProfiles.profileToEdit.setSoundMode(spinnerSoundMode.getSelectedItemPosition());
|
||||||
ActivityMainProfiles.profileToEdit.setDndMode(spinnerDndMode.getSelectedItemPosition()+1);
|
|
||||||
ActivityMainProfiles.profileToEdit.setVolumeMusic(seekBarVolumeMusic.getProgress());
|
ActivityMainProfiles.profileToEdit.setVolumeMusic(seekBarVolumeMusic.getProgress());
|
||||||
ActivityMainProfiles.profileToEdit.setVolumeNotifications(seekBarVolumeNotifications.getProgress());
|
ActivityMainProfiles.profileToEdit.setVolumeNotifications(seekBarVolumeNotifications.getProgress());
|
||||||
ActivityMainProfiles.profileToEdit.setVolumeAlarms(seekBarVolumeAlarms.getProgress());
|
ActivityMainProfiles.profileToEdit.setVolumeAlarms(seekBarVolumeAlarms.getProgress());
|
||||||
@ -448,23 +401,21 @@ public class ActivityManageProfile extends Activity
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!checkBoxChangeSoundMode.isChecked()
|
if(!checkBoxChangeSoundMode.isChecked()
|
||||||
&&
|
&
|
||||||
!checkBoxChangeDnd.isChecked()
|
|
||||||
&&
|
|
||||||
!checkBoxChangeVolumeMusicVideoGameMedia.isChecked()
|
!checkBoxChangeVolumeMusicVideoGameMedia.isChecked()
|
||||||
&&
|
&
|
||||||
!checkBoxChangeVolumeNotifications.isChecked()
|
!checkBoxChangeVolumeNotifications.isChecked()
|
||||||
&&
|
&
|
||||||
!checkBoxChangeVolumeAlarms.isChecked()
|
!checkBoxChangeVolumeAlarms.isChecked()
|
||||||
&&
|
&
|
||||||
!checkBoxChangeIncomingCallsRingtone.isChecked()
|
!checkBoxChangeIncomingCallsRingtone.isChecked()
|
||||||
&&
|
&
|
||||||
!checkBoxChangeNotificationRingtone.isChecked()
|
!checkBoxChangeNotificationRingtone.isChecked()
|
||||||
&&
|
&
|
||||||
!checkBoxChangeAudibleSelection.isChecked()
|
!checkBoxChangeAudibleSelection.isChecked()
|
||||||
&&
|
&
|
||||||
!checkBoxChangeScreenLockUnlockSound.isChecked()
|
!checkBoxChangeScreenLockUnlockSound.isChecked()
|
||||||
&&
|
&
|
||||||
!checkBoxChangeHapticFeedback.isChecked()
|
!checkBoxChangeHapticFeedback.isChecked()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.jens.automation2;
|
package com.jens.automation2;
|
||||||
|
|
||||||
import android.Manifest;
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
@ -121,7 +120,7 @@ public class ActivityManageRule extends Activity
|
|||||||
{
|
{
|
||||||
context = this;
|
context = this;
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_manage_specific_rule);
|
setContentView(R.layout.manage_specific_rule);
|
||||||
|
|
||||||
instance = this;
|
instance = this;
|
||||||
|
|
||||||
@ -614,16 +613,16 @@ public class ActivityManageRule extends Activity
|
|||||||
if(triggerType == Trigger_Enum.nfcTag)
|
if(triggerType == Trigger_Enum.nfcTag)
|
||||||
{
|
{
|
||||||
if (NfcReceiver.checkNfcRequirements(ActivityManageRule.this, true))
|
if (NfcReceiver.checkNfcRequirements(ActivityManageRule.this, true))
|
||||||
getTriggerParameterDialog(context, booleanChoices).show();
|
getTriggerParamterDialog(context, booleanChoices).show();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
getTriggerParameterDialog(context, booleanChoices).show();
|
getTriggerParamterDialog(context, booleanChoices).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return builder.create();
|
return builder.create();
|
||||||
}
|
}
|
||||||
private AlertDialog getTriggerParameterDialog(final Context myContext, final String[] choices)
|
private AlertDialog getTriggerParamterDialog(final Context myContext, final String[] choices)
|
||||||
{
|
{
|
||||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
|
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
|
||||||
alertDialogBuilder.setTitle(getResources().getString(R.string.selectTypeOfTrigger));
|
alertDialogBuilder.setTitle(getResources().getString(R.string.selectTypeOfTrigger));
|
||||||
@ -1177,7 +1176,6 @@ public class ActivityManageRule extends Activity
|
|||||||
{
|
{
|
||||||
ruleToEdit.getTriggerSet().add(newTrigger);
|
ruleToEdit.getTriggerSet().add(newTrigger);
|
||||||
|
|
||||||
newTrigger.setTriggerParameter(data.getBooleanExtra("direction", false));
|
|
||||||
newTrigger.setTriggerParameter2(
|
newTrigger.setTriggerParameter2(
|
||||||
data.getStringExtra("app") + Trigger.triggerParameter2Split +
|
data.getStringExtra("app") + Trigger.triggerParameter2Split +
|
||||||
data.getStringExtra("titleDir") + Trigger.triggerParameter2Split +
|
data.getStringExtra("titleDir") + Trigger.triggerParameter2Split +
|
||||||
@ -1384,7 +1382,7 @@ public class ActivityManageRule extends Activity
|
|||||||
else if(types[i].toString().equals(Action_Enum.sendTextMessage.toString()))
|
else if(types[i].toString().equals(Action_Enum.sendTextMessage.toString()))
|
||||||
{
|
{
|
||||||
// if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageSpecificRule.this, "android.permission.SEND_SMS") && !Miscellaneous.isGooglePlayInstalled(ActivityManageSpecificRule.this))
|
// if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageSpecificRule.this, "android.permission.SEND_SMS") && !Miscellaneous.isGooglePlayInstalled(ActivityManageSpecificRule.this))
|
||||||
if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageRule.this, Manifest.permission.SEND_SMS))
|
if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageRule.this, "android.permission.SEND_SMS"))
|
||||||
items.add(new Item(typesLong[i].toString(), R.drawable.message));
|
items.add(new Item(typesLong[i].toString(), R.drawable.message));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1425,15 +1423,14 @@ public class ActivityManageRule extends Activity
|
|||||||
newAction.setAction(Action_Enum.triggerUrl);
|
newAction.setAction(Action_Enum.triggerUrl);
|
||||||
ActivityManageActionTriggerUrl.resultingAction = null;
|
ActivityManageActionTriggerUrl.resultingAction = null;
|
||||||
Intent editTriggerIntent = new Intent(context, ActivityManageActionTriggerUrl.class);
|
Intent editTriggerIntent = new Intent(context, ActivityManageActionTriggerUrl.class);
|
||||||
startActivityForResult(editTriggerIntent, requestCodeActionTriggerUrlAdd);
|
startActivityForResult(editTriggerIntent, 1000);
|
||||||
}
|
}
|
||||||
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setWifi.toString()))
|
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setWifi.toString()))
|
||||||
{
|
{
|
||||||
newAction.setAction(Action_Enum.setWifi);
|
newAction.setAction(Action_Enum.setWifi);
|
||||||
getActionParameter1Dialog(ActivityManageRule.this).show();
|
|
||||||
|
|
||||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
||||||
Miscellaneous.messageBox(context.getResources().getString(R.string.app_name), context.getResources().getString(R.string.android10WifiToggleNotice), context).show();
|
Toast.makeText(context, context.getResources().getString(R.string.android10WifiToggleNotice), Toast.LENGTH_LONG).show();
|
||||||
|
getActionParameter1Dialog(ActivityManageRule.this).show();
|
||||||
}
|
}
|
||||||
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setBluetooth.toString()))
|
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setBluetooth.toString()))
|
||||||
{
|
{
|
||||||
@ -1445,10 +1442,9 @@ public class ActivityManageRule extends Activity
|
|||||||
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setUsbTethering.toString()))
|
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setUsbTethering.toString()))
|
||||||
{
|
{
|
||||||
newAction.setAction(Action_Enum.setUsbTethering);
|
newAction.setAction(Action_Enum.setUsbTethering);
|
||||||
getActionParameter1Dialog(ActivityManageRule.this).show();
|
|
||||||
|
|
||||||
if(Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1)
|
if(Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1)
|
||||||
Miscellaneous.messageBox(context.getResources().getString(R.string.warning), context.getResources().getString(R.string.usbTetheringFailForAboveGingerbread), context).show();
|
Miscellaneous.messageBox(context.getResources().getString(R.string.warning), context.getResources().getString(R.string.usbTetheringFailForAboveGingerbread), context).show();
|
||||||
|
getActionParameter1Dialog(ActivityManageRule.this).show();
|
||||||
}
|
}
|
||||||
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setWifiTethering.toString()))
|
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setWifiTethering.toString()))
|
||||||
{
|
{
|
||||||
@ -1474,7 +1470,7 @@ public class ActivityManageRule extends Activity
|
|||||||
{
|
{
|
||||||
newAction.setAction(Action_Enum.startOtherActivity);
|
newAction.setAction(Action_Enum.startOtherActivity);
|
||||||
Intent intent = new Intent(ActivityManageRule.this, ActivityManageActionStartActivity.class);
|
Intent intent = new Intent(ActivityManageRule.this, ActivityManageActionStartActivity.class);
|
||||||
startActivityForResult(intent, requestCodeActionStartActivityAdd);
|
startActivityForResult(intent, 3000);
|
||||||
}
|
}
|
||||||
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.waitBeforeNextAction.toString()))
|
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.waitBeforeNextAction.toString()))
|
||||||
{
|
{
|
||||||
@ -1508,7 +1504,7 @@ public class ActivityManageRule extends Activity
|
|||||||
newAction.setAction(Action_Enum.speakText);
|
newAction.setAction(Action_Enum.speakText);
|
||||||
ActivityManageActionSpeakText.resultingAction = null;
|
ActivityManageActionSpeakText.resultingAction = null;
|
||||||
Intent editTriggerIntent = new Intent(context, ActivityManageActionSpeakText.class);
|
Intent editTriggerIntent = new Intent(context, ActivityManageActionSpeakText.class);
|
||||||
startActivityForResult(editTriggerIntent, requestCodeActionSpeakTextAdd);
|
startActivityForResult(editTriggerIntent, 5000);
|
||||||
}
|
}
|
||||||
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.sendTextMessage.toString()))
|
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.sendTextMessage.toString()))
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@ package com.jens.automation2;
|
|||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Notification;
|
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -20,9 +19,6 @@ import android.util.Log;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import androidx.core.app.NotificationManagerCompat;
|
|
||||||
|
|
||||||
import com.jens.automation2.receivers.NotificationListener;
|
import com.jens.automation2.receivers.NotificationListener;
|
||||||
|
|
||||||
@ -415,11 +411,11 @@ public class ActivityPermissions extends Activity
|
|||||||
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case charging:
|
case charging:
|
||||||
// addToArrayListUnique(Manifest.permission.READ_PHONE_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.READ_PHONE_STATE, requiredPermissions);
|
||||||
// addToArrayListUnique("android.permission.BATTERY_STATS", requiredPermissions);
|
// addToArrayListUnique("android.permission.BATTERY_STATS", requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case headsetPlugged:
|
case headsetPlugged:
|
||||||
// addToArrayListUnique(Manifest.permission.READ_PHONE_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.READ_PHONE_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case nfcTag:
|
case nfcTag:
|
||||||
addToArrayListUnique(Manifest.permission.NFC, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.NFC, requiredPermissions);
|
||||||
@ -498,13 +494,12 @@ public class ActivityPermissions extends Activity
|
|||||||
break;
|
break;
|
||||||
case sendTextMessage:
|
case sendTextMessage:
|
||||||
addToArrayListUnique(Manifest.permission.SEND_SMS, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.SEND_SMS, requiredPermissions);
|
||||||
checkPermissionsInVariableUse(action.getParameter2(), requiredPermissions);
|
checkPermissionsInVariableUse(action.getParameter2(), requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case setAirplaneMode:
|
case setAirplaneMode:
|
||||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
// https://stackoverflow.com/questions/32185628/connectivitymanager-requestnetwork-in-android-6-0
|
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
|
||||||
/* Permission was not required anymore, even before Android 6: https://su.chainfire.eu/#updates-permission
|
/* Permission was not required anymore, even before Android 6: https://su.chainfire.eu/#updates-permission
|
||||||
addToArrayListUnique(permissionNameSuperuser, requiredPermissions);*/
|
addToArrayListUnique(permissionNameSuperuser, requiredPermissions);*/
|
||||||
break;
|
break;
|
||||||
@ -517,8 +512,7 @@ public class ActivityPermissions extends Activity
|
|||||||
case setDataConnection:
|
case setDataConnection:
|
||||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
// https://stackoverflow.com/questions/32185628/connectivitymanager-requestnetwork-in-android-6-0
|
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
|
||||||
addToArrayListUnique(Manifest.permission.READ_PHONE_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.READ_PHONE_STATE, requiredPermissions);
|
||||||
/* Permission was not required anymore, even before Android 6: https://su.chainfire.eu/#updates-permission
|
/* Permission was not required anymore, even before Android 6: https://su.chainfire.eu/#updates-permission
|
||||||
addToArrayListUnique(permissionNameSuperuser, requiredPermissions);*/
|
addToArrayListUnique(permissionNameSuperuser, requiredPermissions);*/
|
||||||
@ -528,19 +522,16 @@ public class ActivityPermissions extends Activity
|
|||||||
break;
|
break;
|
||||||
case setUsbTethering:
|
case setUsbTethering:
|
||||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
// https://stackoverflow.com/questions/32185628/connectivitymanager-requestnetwork-in-android-6-0
|
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
|
||||||
break;
|
break;
|
||||||
case setWifi:
|
case setWifi:
|
||||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
// https://stackoverflow.com/questions/32185628/connectivitymanager-requestnetwork-in-android-6-0
|
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
|
||||||
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case setWifiTethering:
|
case setWifiTethering:
|
||||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
// https://stackoverflow.com/questions/32185628/connectivitymanager-requestnetwork-in-android-6-0
|
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
|
||||||
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -587,30 +578,30 @@ public class ActivityPermissions extends Activity
|
|||||||
break;
|
break;
|
||||||
case turnUsbTetheringOff:
|
case turnUsbTetheringOff:
|
||||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case turnUsbTetheringOn:
|
case turnUsbTetheringOn:
|
||||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case turnWifiOff:
|
case turnWifiOff:
|
||||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case turnWifiOn:
|
case turnWifiOn:
|
||||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case turnWifiTetheringOff:
|
case turnWifiTetheringOff:
|
||||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case turnWifiTetheringOn:
|
case turnWifiTetheringOn:
|
||||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case waitBeforeNextAction:
|
case waitBeforeNextAction:
|
||||||
@ -618,9 +609,6 @@ public class ActivityPermissions extends Activity
|
|||||||
case wakeupDevice:
|
case wakeupDevice:
|
||||||
addToArrayListUnique(Manifest.permission.WAKE_LOCK, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WAKE_LOCK, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case playSound:
|
|
||||||
addToArrayListUnique(Manifest.permission.READ_EXTERNAL_STORAGE, requiredPermissions);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -659,7 +647,7 @@ public class ActivityPermissions extends Activity
|
|||||||
{
|
{
|
||||||
for (Action action : rule.getActionSet())
|
for (Action action : rule.getActionSet())
|
||||||
{
|
{
|
||||||
if(action.getAction().equals(actionType))
|
if(action.equals(actionType))
|
||||||
addToArrayListUnique(rule.getName(), returnList);
|
addToArrayListUnique(rule.getName(), returnList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -686,14 +674,17 @@ public class ActivityPermissions extends Activity
|
|||||||
case Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE:
|
case Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE:
|
||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.notification))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.notification))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case permissionNameGoogleActivityDetection:
|
case permissionNameGoogleActivityDetection:
|
||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.activityDetection))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.activityDetection))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Manifest.permission.ACTIVITY_RECOGNITION:
|
case Manifest.permission.ACTIVITY_RECOGNITION:
|
||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.activityDetection))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.activityDetection))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Manifest.permission.ACCESS_COARSE_LOCATION:
|
case Manifest.permission.ACCESS_COARSE_LOCATION:
|
||||||
// usingElements.add(getResources().getString(R.string.android_permission_ACCESS_COARSE_LOCATION));
|
// usingElements.add(getResources().getString(R.string.android_permission_ACCESS_COARSE_LOCATION));
|
||||||
@ -830,10 +821,6 @@ public class ActivityPermissions extends Activity
|
|||||||
case Manifest.permission.FOREGROUND_SERVICE:
|
case Manifest.permission.FOREGROUND_SERVICE:
|
||||||
usingElements.add(getResources().getString(R.string.startAutomationAsService));
|
usingElements.add(getResources().getString(R.string.startAutomationAsService));
|
||||||
break;
|
break;
|
||||||
case Manifest.permission.READ_EXTERNAL_STORAGE:
|
|
||||||
for(String ruleName : getRulesUsing(Action.Action_Enum.playSound))
|
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return usingElements;
|
return usingElements;
|
||||||
@ -978,8 +965,8 @@ public class ActivityPermissions extends Activity
|
|||||||
if(requiredPermissions.contains(Manifest.permission.SEND_SMS))
|
if(requiredPermissions.contains(Manifest.permission.SEND_SMS))
|
||||||
{
|
{
|
||||||
if(!ActivityPermissions.isPermissionDeclaratedInManifest(Miscellaneous.getAnyContext(), Manifest.permission.SEND_SMS)
|
if(!ActivityPermissions.isPermissionDeclaratedInManifest(Miscellaneous.getAnyContext(), Manifest.permission.SEND_SMS)
|
||||||
// &&
|
&&
|
||||||
// Miscellaneous.isGooglePlayInstalled(Miscellaneous.getAnyContext())
|
Miscellaneous.isGooglePlayInstalled(Miscellaneous.getAnyContext())
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
requiredPermissions.remove(Manifest.permission.SEND_SMS);
|
requiredPermissions.remove(Manifest.permission.SEND_SMS);
|
||||||
@ -997,10 +984,7 @@ public class ActivityPermissions extends Activity
|
|||||||
Miscellaneous.logEvent("i", "Permissions", "Requesting permissions: " + permissions, 2);
|
Miscellaneous.logEvent("i", "Permissions", "Requesting permissions: " + permissions, 2);
|
||||||
|
|
||||||
// Toast.makeText(ActivityPermissions.this, "Requesting permissions. Amount: " + String.valueOf(requiredPermissions.size()), Toast.LENGTH_LONG).show();
|
// Toast.makeText(ActivityPermissions.this, "Requesting permissions. Amount: " + String.valueOf(requiredPermissions.size()), Toast.LENGTH_LONG).show();
|
||||||
if(requiredPermissions.size() > 0)
|
requestPermissions(requiredPermissions.toArray(new String[requiredPermissions.size()]), requestCodeForPermissions);
|
||||||
requestPermissions(requiredPermissions.toArray(new String[requiredPermissions.size()]), requestCodeForPermissions);
|
|
||||||
// else
|
|
||||||
// Miscellaneous.messageBox(getResources().getString(R.string.warning), getResources().getString(R.string.permissionsRequiredNotAvailable), ActivityPermissions.this).show();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
setHaveAllPermissions();
|
setHaveAllPermissions();
|
||||||
@ -1168,6 +1152,10 @@ public class ActivityPermissions extends Activity
|
|||||||
private void setHaveAllPermissions()
|
private void setHaveAllPermissions()
|
||||||
{
|
{
|
||||||
setResult(RESULT_OK);
|
setResult(RESULT_OK);
|
||||||
|
// All permissions have been granted.
|
||||||
|
NotificationManager mNotificationManager = (NotificationManager) Miscellaneous.getAnyContext().getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
|
mNotificationManager.cancel(notificationIdPermissions);
|
||||||
|
ActivityMainScreen.updateMainScreen();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -1178,14 +1166,6 @@ public class ActivityPermissions extends Activity
|
|||||||
// Activity may not have been loaded, yet.
|
// Activity may not have been loaded, yet.
|
||||||
}
|
}
|
||||||
|
|
||||||
// All permissions have been granted.
|
|
||||||
NotificationManager mNotificationManager = (NotificationManager) Miscellaneous.getAnyContext().getSystemService(Context.NOTIFICATION_SERVICE);
|
|
||||||
mNotificationManager.cancel(notificationIdPermissions);
|
|
||||||
if(AutomationService.getInstance() != null)
|
|
||||||
AutomationService.getInstance().cancelNotification();
|
|
||||||
|
|
||||||
ActivityMainScreen.updateMainScreen();
|
|
||||||
|
|
||||||
this.finish();
|
this.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1342,7 +1322,6 @@ public class ActivityPermissions extends Activity
|
|||||||
mapActionPermissions.put("turnWifiTetheringOn", Manifest.permission.WRITE_SETTINGS);
|
mapActionPermissions.put("turnWifiTetheringOn", Manifest.permission.WRITE_SETTINGS);
|
||||||
mapActionPermissions.put("turnWifiTetheringOn", Manifest.permission.CHANGE_NETWORK_STATE);
|
mapActionPermissions.put("turnWifiTetheringOn", Manifest.permission.CHANGE_NETWORK_STATE);
|
||||||
mapActionPermissions.put("turnWifiTetheringOn", Manifest.permission.ACCESS_NETWORK_STATE);
|
mapActionPermissions.put("turnWifiTetheringOn", Manifest.permission.ACCESS_NETWORK_STATE);
|
||||||
mapActionPermissions.put("playSound", Manifest.permission.READ_EXTERNAL_STORAGE);
|
|
||||||
// mapActionPermissions.put("waitBeforeNextAction", "");
|
// mapActionPermissions.put("waitBeforeNextAction", "");
|
||||||
mapActionPermissions.put("wakeupDevice", Manifest.permission.WAKE_LOCK);
|
mapActionPermissions.put("wakeupDevice", Manifest.permission.WAKE_LOCK);
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ import android.util.Log;
|
|||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.core.app.NotificationCompat;
|
import androidx.core.app.NotificationCompat;
|
||||||
import androidx.core.app.NotificationManagerCompat;
|
|
||||||
|
|
||||||
import com.jens.automation2.Trigger.Trigger_Enum;
|
import com.jens.automation2.Trigger.Trigger_Enum;
|
||||||
import com.jens.automation2.location.LocationProvider;
|
import com.jens.automation2.location.LocationProvider;
|
||||||
@ -334,7 +333,7 @@ public class AutomationService extends Service implements OnInitListener
|
|||||||
|
|
||||||
protected void startLocationProvider()
|
protected void startLocationProvider()
|
||||||
{
|
{
|
||||||
if(ActivityPermissions.havePermission(Manifest.permission.ACCESS_COARSE_LOCATION, AutomationService.this))
|
if(ActivityPermissions.havePermission("android.permission.ACCESS_COARSE_LOCATION", AutomationService.this))
|
||||||
myLocationProvider = new LocationProvider(this); //autostart with this (only) constructor
|
myLocationProvider = new LocationProvider(this); //autostart with this (only) constructor
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -408,14 +407,6 @@ public class AutomationService extends Service implements OnInitListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cancelNotification()
|
|
||||||
{
|
|
||||||
// stopForeground(false);
|
|
||||||
NotificationManagerCompat.from(AutomationService.this).cancelAll();
|
|
||||||
// NotificationManagerCompat.from(AutomationService.this).cancel(ActivityPermissions.notificationIdPermissions);
|
|
||||||
// NotificationManagerCompat.from(AutomationService.this).cancel(AutomationService.notificationIdRestrictions);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void checkForMissingBackgroundLocationPermission()
|
protected void checkForMissingBackgroundLocationPermission()
|
||||||
{
|
{
|
||||||
if(Miscellaneous.googleToBlameForLocation(true))
|
if(Miscellaneous.googleToBlameForLocation(true))
|
||||||
@ -430,6 +421,23 @@ public class AutomationService extends Service implements OnInitListener
|
|||||||
else
|
else
|
||||||
Miscellaneous.createDismissableNotification(getResources().getString(R.string.featuresDisabled), notificationIdLocationRestriction, pi);
|
Miscellaneous.createDismissableNotification(getResources().getString(R.string.featuresDisabled), notificationIdLocationRestriction, pi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
||||||
|
{
|
||||||
|
if (BuildConfig.FLAVOR.equalsIgnoreCase("googlePlayFlavor"))
|
||||||
|
{
|
||||||
|
if (Rule.isAnyRuleUsing(Trigger_Enum.pointOfInterest))
|
||||||
|
{
|
||||||
|
Intent intent = new Intent(AutomationService.this, ActivityMainTabLayout.class);
|
||||||
|
PendingIntent pi = PendingIntent.getActivity(AutomationService.this, 0, intent, 0);
|
||||||
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1)
|
||||||
|
Miscellaneous.createDismissableNotificationWithDelay(2200, getResources().getString(R.string.featuresDisabled), notificationIdLocationRestriction, pi);
|
||||||
|
else
|
||||||
|
Miscellaneous.createDismissableNotification(getResources().getString(R.string.featuresDisabled), notificationIdLocationRestriction, pi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void startAutomationService(Context context, boolean startAtBoot)
|
public static void startAutomationService(Context context, boolean startAtBoot)
|
||||||
@ -624,9 +632,6 @@ public class AutomationService extends Service implements OnInitListener
|
|||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
if(notificationBuilder == null)
|
|
||||||
notificationBuilder = createDefaultNotificationBuilder();
|
|
||||||
|
|
||||||
notificationBuilder.setContentText(textToDisplay);
|
notificationBuilder.setContentText(textToDisplay);
|
||||||
notificationBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(textToDisplay));
|
notificationBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(textToDisplay));
|
||||||
|
|
||||||
|
@ -15,8 +15,6 @@ import android.content.Intent;
|
|||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.net.ConnectivityManager;
|
|
||||||
import android.net.NetworkInfo;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@ -609,10 +607,7 @@ public class Miscellaneous extends Service
|
|||||||
if(notificationTitle != null && notificationTitle.length() > 0)
|
if(notificationTitle != null && notificationTitle.length() > 0)
|
||||||
source = source.replace("[notificationTitle]", notificationTitle);
|
source = source.replace("[notificationTitle]", notificationTitle);
|
||||||
else
|
else
|
||||||
{
|
|
||||||
source = source.replace("notificationTitle unknown", notificationTitle);
|
|
||||||
Miscellaneous.logEvent("w", "Variable replacement", "notificationTitle was empty.", 3);
|
Miscellaneous.logEvent("w", "Variable replacement", "notificationTitle was empty.", 3);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(source.contains("[notificationText]"))
|
if(source.contains("[notificationText]"))
|
||||||
@ -622,10 +617,7 @@ public class Miscellaneous extends Service
|
|||||||
if(notificationText != null && notificationText.length() > 0)
|
if(notificationText != null && notificationText.length() > 0)
|
||||||
source = source.replace("[notificationText]", notificationText);
|
source = source.replace("[notificationText]", notificationText);
|
||||||
else
|
else
|
||||||
{
|
|
||||||
source = source.replace("notificationText unknown", notificationText);
|
|
||||||
Miscellaneous.logEvent("w", "Variable replacement", "notificationText was empty.", 3);
|
Miscellaneous.logEvent("w", "Variable replacement", "notificationText was empty.", 3);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Miscellaneous.logEvent("i", "URL after replace", source);
|
// Miscellaneous.logEvent("i", "URL after replace", source);
|
||||||
@ -673,24 +665,6 @@ public class Miscellaneous extends Service
|
|||||||
return alertDialog.create();
|
return alertDialog.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean haveNetworkConnection()
|
|
||||||
{
|
|
||||||
boolean haveConnectedWifi = false;
|
|
||||||
boolean haveConnectedMobile = false;
|
|
||||||
|
|
||||||
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
|
||||||
NetworkInfo[] netInfo = cm.getAllNetworkInfo();
|
|
||||||
for (NetworkInfo ni : netInfo) {
|
|
||||||
if (ni.getTypeName().equalsIgnoreCase("WIFI"))
|
|
||||||
if (ni.isConnected())
|
|
||||||
haveConnectedWifi = true;
|
|
||||||
if (ni.getTypeName().equalsIgnoreCase("MOBILE"))
|
|
||||||
if (ni.isConnected())
|
|
||||||
haveConnectedMobile = true;
|
|
||||||
}
|
|
||||||
return haveConnectedWifi || haveConnectedMobile;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the device is rooted.
|
* Checks if the device is rooted.
|
||||||
*
|
*
|
||||||
@ -698,13 +672,9 @@ public class Miscellaneous extends Service
|
|||||||
*/
|
*/
|
||||||
public static boolean isPhoneRooted()
|
public static boolean isPhoneRooted()
|
||||||
{
|
{
|
||||||
// if(true)
|
|
||||||
// return true;
|
|
||||||
|
|
||||||
// get from build info
|
// get from build info
|
||||||
String buildTags = Build.TAGS;
|
String buildTags = Build.TAGS;
|
||||||
if (buildTags != null && buildTags.contains("test-keys"))
|
if (buildTags != null && buildTags.contains("test-keys")) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -911,7 +881,6 @@ public class Miscellaneous extends Service
|
|||||||
dismissableNotificationBuilder.setContentText(textToDisplay);
|
dismissableNotificationBuilder.setContentText(textToDisplay);
|
||||||
dismissableNotificationBuilder.setContentIntent(pendingIntent);
|
dismissableNotificationBuilder.setContentIntent(pendingIntent);
|
||||||
dismissableNotificationBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(textToDisplay));
|
dismissableNotificationBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(textToDisplay));
|
||||||
dismissableNotificationBuilder.setAutoCancel(true);
|
|
||||||
|
|
||||||
Notification dismissableNotification = dismissableNotificationBuilder.build();
|
Notification dismissableNotification = dismissableNotificationBuilder.build();
|
||||||
|
|
||||||
@ -1013,7 +982,6 @@ public class Miscellaneous extends Service
|
|||||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
|
||||||
builder.setCategory(Notification.CATEGORY_SERVICE);
|
builder.setCategory(Notification.CATEGORY_SERVICE);
|
||||||
|
|
||||||
builder.setAutoCancel(true);
|
|
||||||
builder.setWhen(System.currentTimeMillis());
|
builder.setWhen(System.currentTimeMillis());
|
||||||
builder.setContentIntent(myPendingIntent);
|
builder.setContentIntent(myPendingIntent);
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ import android.content.Context;
|
|||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.media.RingtoneManager;
|
import android.media.RingtoneManager;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@ -25,9 +24,6 @@ public class Profile implements Comparable<Profile>
|
|||||||
protected boolean changeSoundMode;
|
protected boolean changeSoundMode;
|
||||||
protected int soundMode;
|
protected int soundMode;
|
||||||
|
|
||||||
protected boolean changeDndMode;
|
|
||||||
protected int dndMode;
|
|
||||||
|
|
||||||
boolean changeVolumeMusicVideoGameMedia;
|
boolean changeVolumeMusicVideoGameMedia;
|
||||||
protected int volumeMusic;
|
protected int volumeMusic;
|
||||||
|
|
||||||
@ -85,26 +81,6 @@ public class Profile implements Comparable<Profile>
|
|||||||
return soundMode;
|
return soundMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getChangeDndMode()
|
|
||||||
{
|
|
||||||
return changeDndMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setChangeDndMode(boolean changeDndMode)
|
|
||||||
{
|
|
||||||
this.changeDndMode = changeDndMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDndMode()
|
|
||||||
{
|
|
||||||
return dndMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDndMode(int dndMode)
|
|
||||||
{
|
|
||||||
this.dndMode = dndMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setChangeVolumeMusicVideoGameMedia(boolean changeVolumeMusicVideoGameMedia)
|
public void setChangeVolumeMusicVideoGameMedia(boolean changeVolumeMusicVideoGameMedia)
|
||||||
{
|
{
|
||||||
this.changeVolumeMusicVideoGameMedia = changeVolumeMusicVideoGameMedia;
|
this.changeVolumeMusicVideoGameMedia = changeVolumeMusicVideoGameMedia;
|
||||||
@ -474,9 +450,6 @@ public class Profile implements Comparable<Profile>
|
|||||||
if(changeSoundMode)
|
if(changeSoundMode)
|
||||||
Actions.setSound(context, soundMode);
|
Actions.setSound(context, soundMode);
|
||||||
|
|
||||||
if(changeDndMode)
|
|
||||||
Actions.setDND(context, dndMode);
|
|
||||||
|
|
||||||
if(changeVolumeMusicVideoGameMedia)
|
if(changeVolumeMusicVideoGameMedia)
|
||||||
am.setStreamVolume(AudioManager.STREAM_MUSIC, volumeMusic, AudioManager.FLAG_PLAY_SOUND);
|
am.setStreamVolume(AudioManager.STREAM_MUSIC, volumeMusic, AudioManager.FLAG_PLAY_SOUND);
|
||||||
|
|
||||||
@ -491,19 +464,10 @@ public class Profile implements Comparable<Profile>
|
|||||||
applyRingTone(incomingCallsRingtone, RingtoneManager.TYPE_RINGTONE, context);
|
applyRingTone(incomingCallsRingtone, RingtoneManager.TYPE_RINGTONE, context);
|
||||||
|
|
||||||
if(changeVibrateWhenRinging)
|
if(changeVibrateWhenRinging)
|
||||||
{
|
if(vibrateWhenRinging)
|
||||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
|
am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ON);
|
||||||
{
|
else
|
||||||
android.provider.Settings.System.putInt(context.getContentResolver(), "vibrate_when_ringing", vibrateWhenRinging?1:0);
|
am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_OFF);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (vibrateWhenRinging)
|
|
||||||
am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ON);
|
|
||||||
else
|
|
||||||
am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_OFF);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(changeNotificationRingtone)
|
if(changeNotificationRingtone)
|
||||||
if(notificationRingtone != null)
|
if(notificationRingtone != null)
|
||||||
|
@ -144,14 +144,14 @@ public class ReceiverCoordinator
|
|||||||
ConnectivityReceiver.startConnectivityReceiver(AutomationService.getInstance());
|
ConnectivityReceiver.startConnectivityReceiver(AutomationService.getInstance());
|
||||||
|
|
||||||
// startCellLocationChangedReceiver
|
// startCellLocationChangedReceiver
|
||||||
if(!ConnectivityReceiver.isAirplaneMode(AutomationService.getInstance()) && WifiBroadcastReceiver.mayCellLocationReceiverBeActivated() && (Rule.isAnyRuleUsing(Trigger.Trigger_Enum.pointOfInterest) || Rule.isAnyRuleUsing(Trigger.Trigger_Enum.speed)))
|
if(!ConnectivityReceiver.isAirplaneMode(AutomationService.getInstance()) && WifiBroadcastReceiver.mayCellLocationReceiverBeActivated() && (Rule.isAnyRuleUsing(Trigger.Trigger_Enum.pointOfInterest) | Rule.isAnyRuleUsing(Trigger.Trigger_Enum.speed)))
|
||||||
{
|
{
|
||||||
if(!Miscellaneous.googleToBlameForLocation(true))
|
if(!Miscellaneous.googleToBlameForLocation(true))
|
||||||
CellLocationChangedReceiver.startCellLocationChangedReceiver();
|
CellLocationChangedReceiver.startCellLocationChangedReceiver();
|
||||||
}
|
}
|
||||||
|
|
||||||
// startBatteryReceiver
|
// startBatteryReceiver
|
||||||
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.charging) || Rule.isAnyRuleUsing(Trigger.Trigger_Enum.usb_host_connection) || Rule.isAnyRuleUsing(Trigger.Trigger_Enum.batteryLevel))
|
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.charging) | Rule.isAnyRuleUsing(Trigger.Trigger_Enum.usb_host_connection) | Rule.isAnyRuleUsing(Trigger.Trigger_Enum.batteryLevel))
|
||||||
BatteryReceiver.startBatteryReceiver(AutomationService.getInstance());
|
BatteryReceiver.startBatteryReceiver(AutomationService.getInstance());
|
||||||
|
|
||||||
// startAlarmListener
|
// startAlarmListener
|
||||||
|
@ -170,9 +170,9 @@ public class XmlFileInterface
|
|||||||
serializer.startTag(null, "changeVibrateWhenRinging");
|
serializer.startTag(null, "changeVibrateWhenRinging");
|
||||||
serializer.text(String.valueOf(Profile.getProfileCollection().get(i).getChangeVibrateWhenRinging()));
|
serializer.text(String.valueOf(Profile.getProfileCollection().get(i).getChangeVibrateWhenRinging()));
|
||||||
serializer.endTag(null, "changeVibrateWhenRinging");//
|
serializer.endTag(null, "changeVibrateWhenRinging");//
|
||||||
serializer.startTag(null, "vibrateWhenRinging");
|
serializer.startTag(null, "changeVibrateWhenRinging");
|
||||||
serializer.text(String.valueOf(Profile.getProfileCollection().get(i).getVibrateWhenRinging()));
|
serializer.text(String.valueOf(Profile.getProfileCollection().get(i).getVibrateWhenRinging()));
|
||||||
serializer.endTag(null, "vibrateWhenRinging");
|
serializer.endTag(null, "changeVibrateWhenRinging");
|
||||||
|
|
||||||
serializer.startTag(null, "changeNotificationRingtone");
|
serializer.startTag(null, "changeNotificationRingtone");
|
||||||
serializer.text(String.valueOf(Profile.getProfileCollection().get(i).getChangeNotificationRingtone()));
|
serializer.text(String.valueOf(Profile.getProfileCollection().get(i).getChangeNotificationRingtone()));
|
||||||
@ -206,18 +206,12 @@ public class XmlFileInterface
|
|||||||
serializer.text(String.valueOf(Profile.getProfileCollection().get(i).getHapticFeedback()));
|
serializer.text(String.valueOf(Profile.getProfileCollection().get(i).getHapticFeedback()));
|
||||||
serializer.endTag(null, "hapticFeedback");
|
serializer.endTag(null, "hapticFeedback");
|
||||||
|
|
||||||
serializer.startTag(null, "changeDndMode");
|
|
||||||
serializer.text(String.valueOf(Profile.getProfileCollection().get(i).getChangeDndMode()));
|
|
||||||
serializer.endTag(null, "changeDndMode");//
|
|
||||||
serializer.startTag(null, "dndMode");
|
|
||||||
serializer.text(String.valueOf(Profile.getProfileCollection().get(i).getDndMode()));
|
|
||||||
serializer.endTag(null, "dndMode");
|
|
||||||
|
|
||||||
serializer.endTag(null, "Profile");
|
serializer.endTag(null, "Profile");
|
||||||
}
|
}
|
||||||
serializer.endTag(null, "ProfileCollection");
|
serializer.endTag(null, "ProfileCollection");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
serializer.startTag(null, "RuleCollection");
|
serializer.startTag(null, "RuleCollection");
|
||||||
for(int i=0; i<Rule.getRuleCollection().size(); i++)
|
for(int i=0; i<Rule.getRuleCollection().size(); i++)
|
||||||
{
|
{
|
||||||
@ -613,10 +607,6 @@ public class XmlFileInterface
|
|||||||
newProfile.setChangeSoundMode(Boolean.parseBoolean(readTag(parser, "changeSoundMode")));
|
newProfile.setChangeSoundMode(Boolean.parseBoolean(readTag(parser, "changeSoundMode")));
|
||||||
else if (name.equals("soundMode"))
|
else if (name.equals("soundMode"))
|
||||||
newProfile.setSoundMode(Integer.parseInt(readTag(parser, "soundMode")));
|
newProfile.setSoundMode(Integer.parseInt(readTag(parser, "soundMode")));
|
||||||
else if (name.equals("changeDndMode"))
|
|
||||||
newProfile.setChangeDndMode(Boolean.parseBoolean(readTag(parser, "changeDndMode")));
|
|
||||||
else if (name.equals("dndMode"))
|
|
||||||
newProfile.setDndMode(Integer.parseInt(readTag(parser, "dndMode")));
|
|
||||||
else if (name.equals("changeVolumeMusicVideoGameMedia"))
|
else if (name.equals("changeVolumeMusicVideoGameMedia"))
|
||||||
newProfile.setChangeVolumeMusicVideoGameMedia(Boolean.parseBoolean(readTag(parser, "changeVolumeMusicVideoGameMedia")));
|
newProfile.setChangeVolumeMusicVideoGameMedia(Boolean.parseBoolean(readTag(parser, "changeVolumeMusicVideoGameMedia")));
|
||||||
else if (name.equals("volumeMusic"))
|
else if (name.equals("volumeMusic"))
|
||||||
@ -651,8 +641,6 @@ public class XmlFileInterface
|
|||||||
else
|
else
|
||||||
newProfile.setNotificationRingtone(null);
|
newProfile.setNotificationRingtone(null);
|
||||||
}
|
}
|
||||||
else if (name.equals("vibrateWhenRinging"))
|
|
||||||
newProfile.setVibrateWhenRinging(Boolean.parseBoolean(readTag(parser, "vibrateWhenRinging")));
|
|
||||||
else if (name.equals("changeAudibleSelection"))
|
else if (name.equals("changeAudibleSelection"))
|
||||||
newProfile.setChangeAudibleSelection(Boolean.parseBoolean(readTag(parser, "changeAudibleSelection")));
|
newProfile.setChangeAudibleSelection(Boolean.parseBoolean(readTag(parser, "changeAudibleSelection")));
|
||||||
else if (name.equals("audibleSelection"))
|
else if (name.equals("audibleSelection"))
|
||||||
|
@ -130,21 +130,6 @@ public class CellLocationChangedReceiver extends PhoneStateListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isCellLocationChangedReceiverPossible()
|
|
||||||
{
|
|
||||||
if(telephonyManager == null)
|
|
||||||
telephonyManager = (TelephonyManager) AutomationService.getInstance().getSystemService(Context.TELEPHONY_SERVICE);
|
|
||||||
|
|
||||||
if(
|
|
||||||
ConnectivityReceiver.isAirplaneMode(AutomationService.getInstance())
|
|
||||||
||
|
|
||||||
telephonyManager.getSimState() != TelephonyManager.SIM_STATE_READY
|
|
||||||
)
|
|
||||||
return false;
|
|
||||||
else
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Location getLocation(String accuracy)
|
public Location getLocation(String accuracy)
|
||||||
{
|
{
|
||||||
Criteria crit = new Criteria();
|
Criteria crit = new Criteria();
|
||||||
@ -152,7 +137,7 @@ public class CellLocationChangedReceiver extends PhoneStateListener
|
|||||||
String myProviderName;
|
String myProviderName;
|
||||||
|
|
||||||
// If privacy mode or no data connection available
|
// If privacy mode or no data connection available
|
||||||
if(Settings.privacyLocationing || !ConnectivityReceiver.isDataConnectionAvailable(AutomationService.getInstance()))
|
if(Settings.privacyLocationing | !ConnectivityReceiver.isDataConnectionAvailable(AutomationService.getInstance()))
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", "CellLocation", Miscellaneous.getAnyContext().getResources().getString(R.string.enforcingGps), 4);
|
Miscellaneous.logEvent("i", "CellLocation", Miscellaneous.getAnyContext().getResources().getString(R.string.enforcingGps), 4);
|
||||||
myProviderName = LocationManager.GPS_PROVIDER;
|
myProviderName = LocationManager.GPS_PROVIDER;
|
||||||
@ -190,9 +175,6 @@ public class CellLocationChangedReceiver extends PhoneStateListener
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(myLocationManager == null)
|
|
||||||
myLocationManager = (LocationManager) AutomationService.getInstance().getSystemService(Context.LOCATION_SERVICE);
|
|
||||||
|
|
||||||
if(!myLocationManager.isProviderEnabled(myProviderName))
|
if(!myLocationManager.isProviderEnabled(myProviderName))
|
||||||
{
|
{
|
||||||
if(myProviderName.equals(LocationManager.NETWORK_PROVIDER))
|
if(myProviderName.equals(LocationManager.NETWORK_PROVIDER))
|
||||||
@ -244,11 +226,13 @@ public class CellLocationChangedReceiver extends PhoneStateListener
|
|||||||
return currentLocation;
|
return currentLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setCurrentLocation(Location currentLocation)
|
public void setCurrentLocation(Location currentLocation)
|
||||||
{
|
{
|
||||||
this.currentLocation = currentLocation;
|
this.currentLocation = currentLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class MyLocationListener implements LocationListener
|
public class MyLocationListener implements LocationListener
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -343,7 +327,7 @@ public class CellLocationChangedReceiver extends PhoneStateListener
|
|||||||
{
|
{
|
||||||
if(!cellLocationListenerActive)
|
if(!cellLocationListenerActive)
|
||||||
{
|
{
|
||||||
if(!ConnectivityReceiver.isAirplaneMode(AutomationService.getInstance()) && telephonyManager.getSimState() == TelephonyManager.SIM_STATE_READY)
|
if(!ConnectivityReceiver.isAirplaneMode(AutomationService.getInstance()))
|
||||||
{
|
{
|
||||||
if(WifiBroadcastReceiver.mayCellLocationReceiverBeActivated())
|
if(WifiBroadcastReceiver.mayCellLocationReceiverBeActivated())
|
||||||
{
|
{
|
||||||
@ -372,7 +356,7 @@ public class CellLocationChangedReceiver extends PhoneStateListener
|
|||||||
Miscellaneous.logEvent("w", "cellReceiver", "Wanted to activate CellLocationChangedReceiver, but Wifi-Receiver says not to.", 4);
|
Miscellaneous.logEvent("w", "cellReceiver", "Wanted to activate CellLocationChangedReceiver, but Wifi-Receiver says not to.", 4);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Miscellaneous.logEvent("i", "cellReceiver", "Not starting cellLocationListener because Airplane mode is active or SIM_STATE is not ready.", 4);
|
Miscellaneous.logEvent("i", "cellReceiver", "Not starting cellLocationListener because Airplane mode is active.", 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
@ -426,3 +410,4 @@ public class CellLocationChangedReceiver extends PhoneStateListener
|
|||||||
ActivityPermissions.havePermission("android.permission.ACCESS_WIFI_STATE", Miscellaneous.getAnyContext());
|
ActivityPermissions.havePermission("android.permission.ACCESS_WIFI_STATE", Miscellaneous.getAnyContext());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ import android.location.LocationManager;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.telephony.TelephonyManager;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.jens.automation2.ActivityMainScreen;
|
import com.jens.automation2.ActivityMainScreen;
|
||||||
@ -27,9 +26,13 @@ import java.util.Calendar;
|
|||||||
|
|
||||||
public class LocationProvider
|
public class LocationProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
protected static boolean passiveLocationListenerActive = false;
|
protected static boolean passiveLocationListenerActive = false;
|
||||||
|
|
||||||
protected static LocationListener passiveLocationListener;
|
protected static LocationListener passiveLocationListener;
|
||||||
|
|
||||||
protected static LocationProvider locationProviderInstance = null;
|
protected static LocationProvider locationProviderInstance = null;
|
||||||
|
|
||||||
protected AutomationService parentService;
|
protected AutomationService parentService;
|
||||||
public AutomationService getParentService()
|
public AutomationService getParentService()
|
||||||
{
|
{
|
||||||
@ -106,128 +109,123 @@ public class LocationProvider
|
|||||||
|
|
||||||
public void setCurrentLocation(Location newLocation, boolean skipVerification)
|
public void setCurrentLocation(Location newLocation, boolean skipVerification)
|
||||||
{
|
{
|
||||||
if(newLocation != null)
|
Miscellaneous.logEvent("i", "Location", "Setting location.", 4);
|
||||||
|
|
||||||
|
currentLocation = newLocation;
|
||||||
|
currentLocationStaticCopy = newLocation;
|
||||||
|
|
||||||
|
Miscellaneous.logEvent("i", "LocationListener", "Giving update to POI class", 4);
|
||||||
|
PointOfInterest.positionUpdate(newLocation, parentService, false, skipVerification);
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", "Location", "Setting location.", 4);
|
if(
|
||||||
|
locationList.size() >= 1
|
||||||
currentLocation = newLocation;
|
&&
|
||||||
currentLocationStaticCopy = newLocation;
|
locationList.get(locationList.size()-1).getTime() == newLocation.getTime()
|
||||||
|
&&
|
||||||
Miscellaneous.logEvent("i", "LocationListener", "Giving update to POI class", 4);
|
locationList.get(locationList.size()-1).getProvider().equals(newLocation.getProvider())
|
||||||
PointOfInterest.positionUpdate(newLocation, parentService, false, skipVerification);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (
|
|
||||||
locationList.size() >= 1
|
|
||||||
&&
|
|
||||||
locationList.get(locationList.size() - 1).getTime() == newLocation.getTime()
|
|
||||||
&&
|
|
||||||
locationList.get(locationList.size() - 1).getProvider().equals(newLocation.getProvider())
|
|
||||||
)
|
)
|
||||||
|
{
|
||||||
|
// This is a duplicate update, do not store it
|
||||||
|
Miscellaneous.logEvent("i", "LocationListener", "Duplicate location, ignoring.", 4);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Miscellaneous.logEvent("i", "Speed", "Commencing speed calculation.", 4);
|
||||||
|
// This part keeps the last two location entries to determine the current speed.
|
||||||
|
|
||||||
|
locationList.add(newLocation);
|
||||||
|
|
||||||
|
if(newLocation.hasSpeed())
|
||||||
{
|
{
|
||||||
// This is a duplicate update, do not store it
|
Miscellaneous.logEvent("i", "Speed", "Location has speed, taking that: " + String.valueOf(newLocation.getSpeed()) + " km/h", 4);
|
||||||
Miscellaneous.logEvent("i", "LocationListener", "Duplicate location, ignoring.", 4);
|
setSpeed(newLocation.getSpeed()); // Take the value that came with the location, that should be more precise
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", "Speed", "Commencing speed calculation.", 4);
|
speedCalculation:
|
||||||
// This part keeps the last two location entries to determine the current speed.
|
if (locationList.size() >= 2)
|
||||||
|
|
||||||
locationList.add(newLocation);
|
|
||||||
|
|
||||||
if (newLocation.hasSpeed())
|
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", "Speed", "Location has speed, taking that: " + String.valueOf(newLocation.getSpeed()) + " km/h", 4);
|
while (locationList.size() > 2)
|
||||||
setSpeed(newLocation.getSpeed()); // Take the value that came with the location, that should be more precise
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
speedCalculation:
|
|
||||||
if (locationList.size() >= 2)
|
|
||||||
{
|
{
|
||||||
while (locationList.size() > 2)
|
// Remove all entries except for the last 2
|
||||||
{
|
Miscellaneous.logEvent("i", "Speed", "About to delete oldest position record until only 2 left. Currently have " + String.valueOf(locationList.size()) + " records.", 4);
|
||||||
// Remove all entries except for the last 2
|
locationList.remove(0);
|
||||||
Miscellaneous.logEvent("i", "Speed", "About to delete oldest position record until only 2 left. Currently have " + String.valueOf(locationList.size()) + " records.", 4);
|
}
|
||||||
locationList.remove(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The two most recent locations in the list must have a usable accuracy.
|
The two most recent locations in the list must have a usable accuracy.
|
||||||
*/
|
*/
|
||||||
for (int i = 0; i < 2; i++)
|
for(int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
(locationList.get(i).getProvider().equals(LocationManager.GPS_PROVIDER) && locationList.get(i).getAccuracy() > Settings.satisfactoryAccuracyGps)
|
(locationList.get(i).getProvider().equals(LocationManager.GPS_PROVIDER) && locationList.get(i).getAccuracy() > Settings.satisfactoryAccuracyGps)
|
||||||
||
|
||
|
||||||
(locationList.get(i).getProvider().equals(LocationManager.NETWORK_PROVIDER) && locationList.get(i).getAccuracy() > Settings.satisfactoryAccuracyNetwork)
|
(locationList.get(i).getProvider().equals(LocationManager.NETWORK_PROVIDER) && locationList.get(i).getAccuracy() > Settings.satisfactoryAccuracyNetwork)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", "Speed", "Not using 2 most recent locations for speed calculation because at least one does not have a satisfactory accuracy: " + locationList.get(i).toString(), 4);
|
Miscellaneous.logEvent("i", "Speed", "Not using 2 most recent locations for speed calculation because at least one does not have a satisfactory accuracy: " + locationList.get(i).toString(), 4);
|
||||||
break speedCalculation;
|
break speedCalculation;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Miscellaneous.logEvent("i", "Speed", "Trying to calculate speed based on the last locations.", 4);
|
||||||
|
|
||||||
|
double currentSpeed;
|
||||||
|
long timeDifferenceInSeconds = (Math.abs(locationList.get(locationList.size() - 2).getTime() - locationList.get(locationList.size() - 1).getTime())) / 1000; //milliseconds
|
||||||
|
if (timeDifferenceInSeconds <= Settings.speedMaximumTimeBetweenLocations * 60)
|
||||||
|
{
|
||||||
|
double distanceTraveled = locationList.get(locationList.size() - 2).distanceTo(locationList.get(locationList.size() - 1)); //results in meters
|
||||||
|
|
||||||
|
if (timeDifferenceInSeconds == 0)
|
||||||
|
{
|
||||||
|
Miscellaneous.logEvent("w", "Speed", "No time passed since last position. Can't calculate speed here.", 4);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Miscellaneous.logEvent("i", "Speed", "Trying to calculate speed based on the last locations.", 4);
|
currentSpeed = distanceTraveled / timeDifferenceInSeconds * 3.6; // convert m/s --> km/h
|
||||||
|
|
||||||
double currentSpeed;
|
|
||||||
long timeDifferenceInSeconds = (Math.abs(locationList.get(locationList.size() - 2).getTime() - locationList.get(locationList.size() - 1).getTime())) / 1000; //milliseconds
|
|
||||||
if (timeDifferenceInSeconds <= Settings.speedMaximumTimeBetweenLocations * 60)
|
|
||||||
{
|
|
||||||
double distanceTraveled = locationList.get(locationList.size() - 2).distanceTo(locationList.get(locationList.size() - 1)); //results in meters
|
|
||||||
|
|
||||||
if (timeDifferenceInSeconds == 0)
|
|
||||||
{
|
|
||||||
Miscellaneous.logEvent("w", "Speed", "No time passed since last position. Can't calculate speed here.", 4);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
currentSpeed = distanceTraveled / timeDifferenceInSeconds * 3.6; // convert m/s --> km/h
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Due to strange factors the time difference might be 0 resulting in mathematical error.
|
Due to strange factors the time difference might be 0 resulting in mathematical error.
|
||||||
*/
|
*/
|
||||||
if (Double.isInfinite(currentSpeed) | Double.isNaN(currentSpeed))
|
if (Double.isInfinite(currentSpeed) | Double.isNaN(currentSpeed))
|
||||||
Miscellaneous.logEvent("i", "Speed", "Error while calculating speed.", 4);
|
Miscellaneous.logEvent("i", "Speed", "Error while calculating speed.", 4);
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
Miscellaneous.logEvent("i", "Speed", "Current speed: " + String.valueOf(currentSpeed) + " km/h", 2);
|
||||||
|
|
||||||
|
setSpeed(currentSpeed);
|
||||||
|
|
||||||
|
// execute matching rules containing speed
|
||||||
|
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesBySpeed();
|
||||||
|
for (Rule oneRule : ruleCandidates)
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", "Speed", "Current speed: " + String.valueOf(currentSpeed) + " km/h", 2);
|
if (oneRule.applies(this.getParentService()))
|
||||||
|
oneRule.activate(getParentService(), false);
|
||||||
setSpeed(currentSpeed);
|
|
||||||
|
|
||||||
// execute matching rules containing speed
|
|
||||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesBySpeed();
|
|
||||||
for (Rule oneRule : ruleCandidates)
|
|
||||||
{
|
|
||||||
if (oneRule.applies(this.getParentService()))
|
|
||||||
oneRule.activate(getParentService(), false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
Miscellaneous.logEvent("i", "Speed", "Last two locations are too far apart in terms of time. Cannot use them for speed calculation.", 4);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
Miscellaneous.logEvent("i", "Speed", "Last two locations are too far apart in terms of time. Cannot use them for speed calculation.", 4);
|
||||||
Miscellaneous.logEvent("w", "Speed", "Don't have enough values for speed calculation, yet.", 3);
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
Miscellaneous.logEvent("w", "Speed", "Don't have enough values for speed calculation, yet.", 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Miscellaneous.logEvent("e", "Speed", "Error during speed calculation: " + Log.getStackTraceString(e), 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
AutomationService.updateNotification();
|
|
||||||
|
|
||||||
if (AutomationService.isMainActivityRunning(parentService))
|
|
||||||
ActivityMainScreen.updateMainScreen();
|
|
||||||
}
|
}
|
||||||
else
|
catch(Exception e)
|
||||||
Miscellaneous.logEvent("w", "Location", "New location given is null. Ignoring.", 5);
|
{
|
||||||
|
Miscellaneous.logEvent("e", "Speed", "Error during speed calculation: " + Log.getStackTraceString(e), 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
AutomationService.updateNotification();
|
||||||
|
|
||||||
|
if(AutomationService.isMainActivityRunning(parentService))
|
||||||
|
ActivityMainScreen.updateMainScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startLocationService()
|
public void startLocationService()
|
||||||
@ -246,37 +244,13 @@ public class LocationProvider
|
|||||||
|
|
||||||
if(Settings.positioningEngine == 0)
|
if(Settings.positioningEngine == 0)
|
||||||
{
|
{
|
||||||
|
// startCellLocationChangedReceiver
|
||||||
|
if (!ConnectivityReceiver.isAirplaneMode(this.parentService) && WifiBroadcastReceiver.mayCellLocationReceiverBeActivated() && (Rule.isAnyRuleUsing(Trigger_Enum.pointOfInterest) | Rule.isAnyRuleUsing(Trigger_Enum.speed)))
|
||||||
|
CellLocationChangedReceiver.startCellLocationChangedReceiver();
|
||||||
|
|
||||||
|
// startPassiveLocationListener
|
||||||
if(Rule.isAnyRuleUsing(Trigger_Enum.pointOfInterest) | Rule.isAnyRuleUsing(Trigger_Enum.speed))
|
if(Rule.isAnyRuleUsing(Trigger_Enum.pointOfInterest) | Rule.isAnyRuleUsing(Trigger_Enum.speed))
|
||||||
{
|
|
||||||
// TelephonyManager telephonyManager = (TelephonyManager) AutomationService.getInstance().getSystemService(Context.TELEPHONY_SERVICE);
|
|
||||||
|
|
||||||
// startCellLocationChangedReceiver
|
|
||||||
if (CellLocationChangedReceiver.isCellLocationChangedReceiverPossible())
|
|
||||||
{
|
|
||||||
if (WifiBroadcastReceiver.mayCellLocationReceiverBeActivated())
|
|
||||||
CellLocationChangedReceiver.startCellLocationChangedReceiver();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
Reasons why we may end up here:
|
|
||||||
- Airplane mode is active
|
|
||||||
- No phone module present (pure wifi device)
|
|
||||||
- No SIM card is inserted or it's not unlocked
|
|
||||||
|
|
||||||
We'd have to try GPS now to get an initial position.
|
|
||||||
For permanent use there is no way we could know when it
|
|
||||||
would make sense to check the position again.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Trigger a one-time-position-search
|
|
||||||
Location loc = CellLocationChangedReceiver.getInstance().getLocation("fine");
|
|
||||||
LocationProvider.getInstance().setCurrentLocation(loc, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// startPassiveLocationListener
|
|
||||||
startPassiveLocationListener();
|
startPassiveLocationListener();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -9,13 +9,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/smsDialogNotice"
|
|
||||||
android:textColor="#ea131b"
|
|
||||||
android:layout_marginBottom="@dimen/default_margin" />
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/bImportNumberFromContacts"
|
android:id="@+id/bImportNumberFromContacts"
|
||||||
android:drawableLeft="@drawable/contacts"
|
android:drawableLeft="@drawable/contacts"
|
||||||
|
@ -45,19 +45,6 @@
|
|||||||
<requestFocus />
|
<requestFocus />
|
||||||
</EditText>
|
</EditText>
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1dp"
|
|
||||||
android:layout_margin="10dp"
|
|
||||||
android:layout_marginVertical="@dimen/default_margin"
|
|
||||||
android:background="#aa000000" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/general"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/checkBoxChangeSoundMode"
|
android:id="@+id/checkBoxChangeSoundMode"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@ -76,54 +63,13 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="40dp" />
|
android:layout_marginLeft="40dp" />
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="40dp"
|
|
||||||
android:text="@string/silentTriggersDnd" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1dp"
|
|
||||||
android:layout_margin="10dp"
|
|
||||||
android:layout_marginVertical="@dimen/default_margin"
|
|
||||||
android:background="#aa000000" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/dnd"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
|
||||||
|
|
||||||
<CheckBox
|
|
||||||
android:id="@+id/checkBoxChangeDnd"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/change" />
|
|
||||||
|
|
||||||
<Spinner
|
|
||||||
android:id="@+id/spinnerDndMode"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="40dp" />
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="40dp"
|
|
||||||
android:text="@string/dndRemarks" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1dp"
|
|
||||||
android:layout_margin="10dp"
|
|
||||||
android:layout_marginVertical="@dimen/default_margin"
|
|
||||||
android:background="#aa000000" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/volumes"
|
android:text="@string/volumes"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
|
android:layout_marginLeft="40dp" />
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/checkBoxChangeVolumeMusicVideoGameMedia"
|
android:id="@+id/checkBoxChangeVolumeMusicVideoGameMedia"
|
||||||
@ -176,19 +122,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="40dp" />
|
android:layout_marginLeft="40dp" />
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1dp"
|
|
||||||
android:layout_margin="10dp"
|
|
||||||
android:layout_marginVertical="@dimen/default_margin"
|
|
||||||
android:background="#aa000000" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/tones"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/checkBoxChangeIncomingCallsRingtone"
|
android:id="@+id/checkBoxChangeIncomingCallsRingtone"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@ -267,19 +200,6 @@
|
|||||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1dp"
|
|
||||||
android:layout_margin="10dp"
|
|
||||||
android:layout_marginVertical="@dimen/default_margin"
|
|
||||||
android:background="#aa000000" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/miscellaneous"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/checkBoxChangeAudibleSelection"
|
android:id="@+id/checkBoxChangeAudibleSelection"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@ -320,7 +240,6 @@
|
|||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/bSaveProfile"
|
android:id="@+id/bSaveProfile"
|
||||||
android:layout_marginTop="@dimen/default_margin"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/save" />
|
android:text="@string/save" />
|
||||||
|
@ -475,14 +475,14 @@
|
|||||||
<string name="textMessageAnnotations">Sie können direkt eine Telefonnummer eingeben. Alternativ können Sie eine aus Ihren Kontakten auswählen. Aber: Es wird immer die Nummer gespeichert, nicht der Kontakt referenziert. D.h., wenn Sie einmal die Nummer eines Kontaktes ändern, müssen Sie diese Regel aktualisieren.</string>
|
<string name="textMessageAnnotations">Sie können direkt eine Telefonnummer eingeben. Alternativ können Sie eine aus Ihren Kontakten auswählen. Aber: Es wird immer die Nummer gespeichert, nicht der Kontakt referenziert. D.h., wenn Sie einmal die Nummer eines Kontaktes ändern, müssen Sie diese Regel aktualisieren.</string>
|
||||||
<string name="importNumberFromContacts">Von Kontakten importieren</string>
|
<string name="importNumberFromContacts">Von Kontakten importieren</string>
|
||||||
<string name="android9RecordAudioNotice">Falls Sie die Umgebungslautstärke als Auslöser benutzen: Leider hat sich Google entschlossen ab Android Version 9 (Pie) Hintergrundanwendungen den Zugriff auf das Mikrofon zu verweigern. Das bedeutet, dass dieser Auslöser keinen Effekt mehr hat und keine Regeln auslösen wird.</string>
|
<string name="android9RecordAudioNotice">Falls Sie die Umgebungslautstärke als Auslöser benutzen: Leider hat sich Google entschlossen ab Android Version 9 (Pie) Hintergrundanwendungen den Zugriff auf das Mikrofon zu verweigern. Das bedeutet, dass dieser Auslöser keinen Effekt mehr hat und keine Regeln auslösen wird.</string>
|
||||||
<string name="android10WifiToggleNotice">Leider hat Google in Android 10 die Möglichkeit entfernt, daß normale Anwendungen WLAN an- oder ausschalten können. Nur, wenn Ihr Gerät gerootet ist, sollte es weiterhin funktionieren. Wenn nicht, wird diese Aktion leider keinen Effekt mehr auf Ihrem Gerät haben.</string>
|
<string name="android10WifiToggleNotice">Leider hat Google in Android 10 die Möglichkeit entfernt, daß normale Anwendungen WLAN an- oder ausschalten können. Diese Aktion wird also keinen Effekt auf Ihrem Gerät haben.</string>
|
||||||
<string name="messageNotShownAgain">Diese Nachricht wird nicht wieder angezeigt.</string>
|
<string name="messageNotShownAgain">Diese Nachricht wird nicht wieder angezeigt.</string>
|
||||||
<string name="chooseActivityHint">In diesem letzten Auswahlfeld müssen Sie eine bestimmte \"Activity\" auswählen. Vereinfacht ist das ein bestimmtes Fenster der ausgewählten Anwendung. Wenn Sie nicht wissen, welche Sie auswählen sollen, ist es normalerweise eine gute Idee zunächst welche auszuprobieren, die \"main\" oder \"launcher\" im Namen haben.</string>
|
<string name="chooseActivityHint">In diesem letzten Auswahlfeld müssen Sie eine bestimmte \"Activity\" auswählen. Vereinfacht ist das ein bestimmtes Fenster der ausgewählten Anwendung. Wenn Sie nicht wissen, welche Sie auswählen sollen, ist es normalerweise eine gute Idee zunächst welche auszuprobieren, die \"main\" oder \"launcher\" im Namen haben.</string>
|
||||||
<string name="edit">Bearbeiten</string>
|
<string name="edit">Bearbeiten</string>
|
||||||
<string name="clickAndHoldForOptions">Klicken und halten Sie ein Objekt für Optionen.</string>
|
<string name="clickAndHoldForOptions">Klicken und halten Sie ein Objekt für Optionen.</string>
|
||||||
<string name="startAutomationAsService">Automation als Dienst starten</string>
|
<string name="startAutomationAsService">Automation als Dienst starten</string>
|
||||||
<string name="setScreenBrightness">Bildschirmhelligkeit einstellen</string>
|
<string name="setScreenBrightness">Set screen brightness</string>
|
||||||
<string name="setScreenBrightnessEnterValue">Geben Sie den gewünschten Helligkeitswert ein (von 0 bis 100).</string>
|
<string name="setScreenBrightnessEnterValue">Enter the desired brightness (from 0 to 100).</string>
|
||||||
<string name="autoBrightness">Automatische Helligkeitseinstellung verwenden</string>
|
<string name="autoBrightness">Automatische Helligkeitseinstellung verwenden</string>
|
||||||
<string name="apply">übernehmen</string>
|
<string name="apply">übernehmen</string>
|
||||||
<string name="brightnessAuto">automatische Helligkeit</string>
|
<string name="brightnessAuto">automatische Helligkeit</string>
|
||||||
@ -594,5 +594,4 @@
|
|||||||
<string name="top">Oben</string>
|
<string name="top">Oben</string>
|
||||||
<string name="bottom">Unten</string>
|
<string name="bottom">Unten</string>
|
||||||
<string name="tabsPlacementSummary">Wol soll die Taskleiste angezeigt werden?</string>
|
<string name="tabsPlacementSummary">Wol soll die Taskleiste angezeigt werden?</string>
|
||||||
<string name="tones">Klingeltöne</string>
|
|
||||||
</resources>
|
</resources>
|
@ -556,7 +556,7 @@
|
|||||||
<string name="logFileMaxSizeTitle">Maximo tamaño del archivo log [Mb]</string>
|
<string name="logFileMaxSizeTitle">Maximo tamaño del archivo log [Mb]</string>
|
||||||
<string name="theseAreThePermissionsRequired">Esos son los permisos necesarios.</string>
|
<string name="theseAreThePermissionsRequired">Esos son los permisos necesarios.</string>
|
||||||
<string name="android9RecordAudioNotice">Si usa la condición nivel del ruido fondo: Desafortunadamente iniciando con Android 9 (Pie) Google decidió prohibir aplicaciones de fondo usando el micrófono. Por eso esta condición no tendrá un efecto y no iniciará algo.</string>
|
<string name="android9RecordAudioNotice">Si usa la condición nivel del ruido fondo: Desafortunadamente iniciando con Android 9 (Pie) Google decidió prohibir aplicaciones de fondo usando el micrófono. Por eso esta condición no tendrá un efecto y no iniciará algo.</string>
|
||||||
<string name="android10WifiToggleNotice">Desafortunadamente Google dedició remover esta función en Android 10. Applicaciones regulares ya no pueden activar o desactivar wifi. Solo si su dispositivo esta rooted debe funcionar adelante. Si no este ación no va a continuar de funcionar.</string>
|
<string name="android10WifiToggleNotice">Si usa la condición nivel del ruido fondo: Desafortunadamente iniciando con Android 9 (Pie) Google decidió prohibir aplicaciones de fondo usando el micrófono. Por eso esta condición no tendrá un efecto y no iniciará algo.</string>
|
||||||
<string name="messageNotShownAgain">Esta nota no aparecerá otra vez.</string>
|
<string name="messageNotShownAgain">Esta nota no aparecerá otra vez.</string>
|
||||||
<string name="noLocationCouldBeFound">No pude encontrar una posición despues de un limite de %1$s segundos..</string>
|
<string name="noLocationCouldBeFound">No pude encontrar una posición despues de un limite de %1$s segundos..</string>
|
||||||
<string name="pleaseGiveBgLocation">En la proxima pantalla por favor vaya a permisos, luego a posición. Ahi elija \"Siempre permitir\" para permitir Automation determinar la posición en el fondo.</string>
|
<string name="pleaseGiveBgLocation">En la proxima pantalla por favor vaya a permisos, luego a posición. Ahi elija \"Siempre permitir\" para permitir Automation determinar la posición en el fondo.</string>
|
||||||
@ -593,5 +593,4 @@
|
|||||||
<string name="intentDataComment">Si su parametro es de tipo Uri y especifica \"IntentData\" como nombre (minúscula/mayáscula no es importante), el parametro no está añadido como un parametro normal con puExtra(), pero estará añadido al intent con setData().</string>
|
<string name="intentDataComment">Si su parametro es de tipo Uri y especifica \"IntentData\" como nombre (minúscula/mayáscula no es importante), el parametro no está añadido como un parametro normal con puExtra(), pero estará añadido al intent con setData().</string>
|
||||||
<string name="locationEngineDisabledLong">Desafortunadamente su posición todavia no puede ser determinada. Gratitud va para Google por su sabiduria y amabilidad infinita.\n\nDejenme explicarselo mas. Comenzando con Android 10 un nuevo permiso se introdujo que es necesario para determinar la posición en el fondo (que es necesario para una app como esta). Aunque lo considero una buena idea, conlleva a una chicana para desarolladores.\n\nCuando se esta desarrollando una app se puede intentar calificar para este permiso mientras se sigue un catalogo de condiciones. Desafortunadamente nuevas versiones de mi app fueron rechazadas por un periodo de trés meses. Cumplé todas las condiciones, pero Google\'s mierda servicio para desarolladores afirmó que no. Despues de presentar pruebas, que cumplí con todo, recibí una respuesta de \"No puedo ayudarte mas.\". En algun momento me rendí.\n\nComo consecuencia la version Google Play todavia no sabe usar la locación como una condición. Mi única alternativa fue remover la applicación de Google Play.\n\nLo siento mucho, pero hicé todo lo posible para discutir con un support que no sabe aprobar la prueba de Turing repetidamente.\n\nLa noticia positiva: Usted todavia puede tener todo!\n\nAutomation ahora es open source y se puede encontrar en F-Droid. Es un app store que se preocupa por su privacidad - en vez de solo simular eso. Simplemente guarde su configuración, desinstale la app, instale la de F-Droid, restaure su configuración - terminado.\n\nCliquee aqui para averiguar más:</string>
|
<string name="locationEngineDisabledLong">Desafortunadamente su posición todavia no puede ser determinada. Gratitud va para Google por su sabiduria y amabilidad infinita.\n\nDejenme explicarselo mas. Comenzando con Android 10 un nuevo permiso se introdujo que es necesario para determinar la posición en el fondo (que es necesario para una app como esta). Aunque lo considero una buena idea, conlleva a una chicana para desarolladores.\n\nCuando se esta desarrollando una app se puede intentar calificar para este permiso mientras se sigue un catalogo de condiciones. Desafortunadamente nuevas versiones de mi app fueron rechazadas por un periodo de trés meses. Cumplé todas las condiciones, pero Google\'s mierda servicio para desarolladores afirmó que no. Despues de presentar pruebas, que cumplí con todo, recibí una respuesta de \"No puedo ayudarte mas.\". En algun momento me rendí.\n\nComo consecuencia la version Google Play todavia no sabe usar la locación como una condición. Mi única alternativa fue remover la applicación de Google Play.\n\nLo siento mucho, pero hicé todo lo posible para discutir con un support que no sabe aprobar la prueba de Turing repetidamente.\n\nLa noticia positiva: Usted todavia puede tener todo!\n\nAutomation ahora es open source y se puede encontrar en F-Droid. Es un app store que se preocupa por su privacidad - en vez de solo simular eso. Simplemente guarde su configuración, desinstale la app, instale la de F-Droid, restaure su configuración - terminado.\n\nCliquee aqui para averiguar más:</string>
|
||||||
<string name="startAppChoiceNote">Aqui tiene 2 opciones generales:\\n\\n1. Puede encender un programa seleccionando un activity. Imagine eso como preseleccionar una pantalla/ventana especifica de una aplicación. Tenga en cuenta que no siempre funcionará. Eso es porque las ventanas de una app pueden interactuar entre ellas, por ejemplo dar parametros. Si se abre una ventana especifica directamente esta interacción todavia no ha ocurrido y la ventana se podría cerrar al instante (por lo tanto nunca será presentada). Pruebe esto sin embargo! Puede introducir una trayectoria de una activity manualmente, pero es recomendable usar el boton \"Elegir\". Si decide introducir la trayectoria de la app manualmente en la casilla de arriba y la trayectoria completa de una activity en la de abajo.\\n\\n2.Elección con action\\nContrariamente a elegir una ventana especifica, tambien puede encender una app con un action. Es similar a llamar \"Queria xyz\" y si hay una app que le puede ayudar a usted sera encendida. Un ejemplo bueno seria \"abrir browser\" - podria tener multiples (una normalemente es el valor predeterminado). Usted necesita introducirlo manualmente, PackageName es opcional aqui. Tenga en cuenta las variables no seran resueltas. Si por ejemplo quiere encender la camara usando \"MediaStore.ACTION_IMAGE_CAPTURE\" no va a funcionar. Tiene que mirar en la documentación de Android y usar el valor real de esta variable que - en este ejemplo - seria \"android.media.action.IMAGE_CAPTURE\".</string>
|
<string name="startAppChoiceNote">Aqui tiene 2 opciones generales:\\n\\n1. Puede encender un programa seleccionando un activity. Imagine eso como preseleccionar una pantalla/ventana especifica de una aplicación. Tenga en cuenta que no siempre funcionará. Eso es porque las ventanas de una app pueden interactuar entre ellas, por ejemplo dar parametros. Si se abre una ventana especifica directamente esta interacción todavia no ha ocurrido y la ventana se podría cerrar al instante (por lo tanto nunca será presentada). Pruebe esto sin embargo! Puede introducir una trayectoria de una activity manualmente, pero es recomendable usar el boton \"Elegir\". Si decide introducir la trayectoria de la app manualmente en la casilla de arriba y la trayectoria completa de una activity en la de abajo.\\n\\n2.Elección con action\\nContrariamente a elegir una ventana especifica, tambien puede encender una app con un action. Es similar a llamar \"Queria xyz\" y si hay una app que le puede ayudar a usted sera encendida. Un ejemplo bueno seria \"abrir browser\" - podria tener multiples (una normalemente es el valor predeterminado). Usted necesita introducirlo manualmente, PackageName es opcional aqui. Tenga en cuenta las variables no seran resueltas. Si por ejemplo quiere encender la camara usando \"MediaStore.ACTION_IMAGE_CAPTURE\" no va a funcionar. Tiene que mirar en la documentación de Android y usar el valor real de esta variable que - en este ejemplo - seria \"android.media.action.IMAGE_CAPTURE\".</string>
|
||||||
<string name="tones">Sonidos</string>
|
|
||||||
</resources>
|
</resources>
|
@ -586,5 +586,4 @@
|
|||||||
<string name="locationFoundInaccurate">È stato possibile solo trovare una ubicazione con una precisione limitata. Potrebbe non funzionare in maniera affidabile. Il raggio minimo per le ubicazioni è di %1$d m.</string>
|
<string name="locationFoundInaccurate">È stato possibile solo trovare una ubicazione con una precisione limitata. Potrebbe non funzionare in maniera affidabile. Il raggio minimo per le ubicazioni è di %1$d m.</string>
|
||||||
<string name="noLocationCouldBeFound">Nessuna posizione è stata trovata dopo un tempo di attesa di %1$s seconds.</string>
|
<string name="noLocationCouldBeFound">Nessuna posizione è stata trovata dopo un tempo di attesa di %1$s seconds.</string>
|
||||||
<string name="pleaseGiveBgLocation">Nella schermata successiva vai su permessi, poi posizione. Lì seleziona \"Consenti sempre\" per permettere ad Automation di determinare la tua posizione in secondo piano.</string>
|
<string name="pleaseGiveBgLocation">Nella schermata successiva vai su permessi, poi posizione. Lì seleziona \"Consenti sempre\" per permettere ad Automation di determinare la tua posizione in secondo piano.</string>
|
||||||
<string name="tones">Suonerias</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -507,7 +507,7 @@
|
|||||||
<string name="phoneIsNotRooted" translatable="false">Phone is not rooted.</string>
|
<string name="phoneIsNotRooted" translatable="false">Phone is not rooted.</string>
|
||||||
<string name="dataConWithRootSuccess" translatable="false">Data connection was successfully changed using superuser permissions.</string>
|
<string name="dataConWithRootSuccess" translatable="false">Data connection was successfully changed using superuser permissions.</string>
|
||||||
<string name="dataConWithRootFail" translatable="false">Data could not be changed using superuser permissions.</string>
|
<string name="dataConWithRootFail" translatable="false">Data could not be changed using superuser permissions.</string>
|
||||||
<string name="rootExplanation">You need to root your phone for this function to work. Afterwards you need to \"run the rule manually\" to show up the superuser permission question. When the superuser popups shows up you need to always allow the application to do that. Otherwise the rule cannot function when the phone is unattended.</string>
|
<string name="rootExplanation">You need to root your phone for this function to work. Afterwards you needs to \"run the rule manually\" to show up the superuser permission question. When the superuser popups shows up you need to always allow the application to do that. Otherwise the rule cannot function when the phone is unattended.</string>
|
||||||
<string name="errorWritingConfig">Error writing config. Do you have a writable memory?</string>
|
<string name="errorWritingConfig">Error writing config. Do you have a writable memory?</string>
|
||||||
<string name="phoneNrReplacementError">I could not insert the last phone nr in the variable. I don\'t have it.</string>
|
<string name="phoneNrReplacementError">I could not insert the last phone nr in the variable. I don\'t have it.</string>
|
||||||
<string name="username">Username</string>
|
<string name="username">Username</string>
|
||||||
@ -570,7 +570,7 @@
|
|||||||
<string name="textMessageAnnotations">You can directly enter a phone number. Alternatively use the contacts option to pick one. But keep in mind: The number will be stored here, not the contact. If you change the phone number of a selected contact you\'ll need to update this rule. It doesn\'t do that by itself.</string>
|
<string name="textMessageAnnotations">You can directly enter a phone number. Alternatively use the contacts option to pick one. But keep in mind: The number will be stored here, not the contact. If you change the phone number of a selected contact you\'ll need to update this rule. It doesn\'t do that by itself.</string>
|
||||||
<string name="importNumberFromContacts">Import number from contacts</string>
|
<string name="importNumberFromContacts">Import number from contacts</string>
|
||||||
<string name="android9RecordAudioNotice">If you\'re using the noise level trigger: Unfortunately beginning with Android 9 (Pie) Google decided to disallow background applications to use the microphone. So this trigger has no effect anymore and won\'t trigger anything.</string>
|
<string name="android9RecordAudioNotice">If you\'re using the noise level trigger: Unfortunately beginning with Android 9 (Pie) Google decided to disallow background applications to use the microphone. So this trigger has no effect anymore and won\'t trigger anything.</string>
|
||||||
<string name="android10WifiToggleNotice">Unfortunately Google decided to remove this feature in Android 10. Regular apps are not allowed anymore to turn wifi on or off. Only if your device is rooted it should continue to work. If not, then I\'m afraid this won\'t have an effect anymore.</string>
|
<string name="android10WifiToggleNotice">Unfortunately Google decided to remove this feature in Android 10. Regular apps are not allowed anymore to turn wifi on or off. This means this action will have no effect on your device.</string>
|
||||||
<string name="messageNotShownAgain">This message won\'t be shown again.</string>
|
<string name="messageNotShownAgain">This message won\'t be shown again.</string>
|
||||||
<string name="chooseActivityHint">In this final selection popup you need to select a specific activity. Simplified this is like a window of the desired application. If you do not know which one it is generally a good idea to pick one that has \"main\" or \"launcher\" in its name.</string>
|
<string name="chooseActivityHint">In this final selection popup you need to select a specific activity. Simplified this is like a window of the desired application. If you do not know which one it is generally a good idea to pick one that has \"main\" or \"launcher\" in its name.</string>
|
||||||
<string name="edit">Edit</string>
|
<string name="edit">Edit</string>
|
||||||
@ -691,15 +691,4 @@
|
|||||||
<string name="tabsPlacement">Position of tab bar</string>
|
<string name="tabsPlacement">Position of tab bar</string>
|
||||||
<string name="tabsPlacementSummary">Choose where the tabs bar should be placed.</string>
|
<string name="tabsPlacementSummary">Choose where the tabs bar should be placed.</string>
|
||||||
<string name="wifiApi30">Because Google screwd up yet another part of Android, starting with API 30 only the currently visible wifis can be displayed. Not all the ones your device knows.</string>
|
<string name="wifiApi30">Because Google screwd up yet another part of Android, starting with API 30 only the currently visible wifis can be displayed. Not all the ones your device knows.</string>
|
||||||
<string name="smsDialogNotice">If you have not used a send-sms action in this program before, Android may show an additional confirmation dialog, asking you to allow sending messages. You need to select the \"always allow\" checkbox and confirm if you want this action to work in the background. It\'s advised to run this rule manually once.</string>
|
|
||||||
<string name="silentTriggersDnd">REMARK: The silent mode often triggers Do-Not-Disturb on newer devices. If that happens on your device, I recommend using the normal mode instead and lowering all volumes to zero.</string>
|
|
||||||
<string name="tones">Tones</string>
|
|
||||||
<string name="miscellaneous">Miscellaneous</string>
|
|
||||||
<string name="dnd">Do not disturb</string>
|
|
||||||
<string name="dndOff">DND off</string>
|
|
||||||
<string name="dndPriority">Let priority notifications through</string>
|
|
||||||
<string name="dndAlarms">Let alarms through</string>
|
|
||||||
<string name="dndNothing">Let nothing through</string>
|
|
||||||
<string name="dndRemarks">Fine tuning (like allowing phone calls, picking specific numbers, etc.) can only be done from the system\'s settings.</string>
|
|
||||||
<string name="permissionsRequiredNotAvailable">Your rules required permissions which cannot be requested from this installed flavor of Automation.</string>
|
|
||||||
</resources>
|
</resources>
|
@ -5,7 +5,7 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.0.3'
|
classpath 'com.android.tools.build:gradle:7.0.2'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
Loading…
Reference in New Issue
Block a user