Compare commits

..

No commits in common. "development" and "master" have entirely different histories.

22 changed files with 446 additions and 321 deletions

View File

@ -11,8 +11,8 @@ android {
compileSdkVersion 33
buildToolsVersion '29.0.2'
useLibrary 'org.apache.http.legacy'
versionCode 143
versionName "1.8.2"
versionCode 142
versionName "1.8.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View File

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

View File

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

View File

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

View File

@ -33,9 +33,13 @@ public class Action
setWifiTethering,
setBluetoothTethering,
setDisplayRotation,
turnWifiOn,turnWifiOff,
turnBluetoothOn,turnBluetoothOff,
triggerUrl,
changeSoundProfile,
turnUsbTetheringOn,turnUsbTetheringOff,
turnWifiTetheringOn,turnWifiTetheringOff,
enableScreenRotation,disableScreenRotation,
startOtherActivity,
waitBeforeNextAction,
turnScreenOnOrOff,
@ -56,9 +60,9 @@ public class Action
startPhoneCall,
stopPhoneCall,
copyToClipboard,
takeScreenshot,
setLocationService,
sendTextMessage,
takeScreenshot;
sendTextMessage;
public String getFullName(Context context)
{
@ -76,6 +80,14 @@ public class Action
return context.getResources().getString(R.string.actionSetUsbTethering);
case setDisplayRotation:
return context.getResources().getString(R.string.actionSetDisplayRotation);
case turnWifiOn:
return context.getResources().getString(R.string.actionTurnWifiOn);
case turnWifiOff:
return context.getResources().getString(R.string.actionTurnWifiOff);
case turnBluetoothOn:
return context.getResources().getString(R.string.actionTurnBluetoothOn);
case turnBluetoothOff:
return context.getResources().getString(R.string.actionTurnBluetoothOff);
case triggerUrl:
return context.getResources().getString(R.string.actionTriggerUrl);
case changeSoundProfile:
@ -84,6 +96,14 @@ public class Action
return context.getResources().getString(R.string.actionTurnUsbTetheringOn);
case turnUsbTetheringOff:
return context.getResources().getString(R.string.actionTurnUsbTetheringOff);
case turnWifiTetheringOn:
return context.getResources().getString(R.string.actionTurnWifiTetheringOn);
case turnWifiTetheringOff:
return context.getResources().getString(R.string.actionTurnWifiTetheringOff);
case enableScreenRotation:
return context.getResources().getString(R.string.actionEnableScreenRotation);
case disableScreenRotation:
return context.getResources().getString(R.string.actionDisableScreenRotation);
case startOtherActivity:
return context.getResources().getString(R.string.startOtherActivity);
case waitBeforeNextAction:
@ -473,9 +493,25 @@ public class Action
for(Action_Enum action : Action_Enum.values())
{
if( // exclusion for deprecated types
!action.toString().equals("turnWifiOn")
&&
!action.toString().equals("turnWifiOff")
&&
!action.toString().equals("turnBluetoothOn")
&&
!action.toString().equals("turnBluetoothOff")
&&
!action.toString().equals("turnUsbTetheringOn")
&&
!action.toString().equals("turnUsbTetheringOff")
&&
!action.toString().equals("turnWifiTetheringOn")
&&
!action.toString().equals("turnWifiTetheringOff")
&&
!action.toString().equals("enableScreenRotation")
&&
!action.toString().equals("disableScreenRotation")
) // exclusion for deprecated types
actionTypesList.add(action.toString());
}
@ -489,9 +525,25 @@ public class Action
for(Action_Enum action : Action_Enum.values())
{
if( // exclusion for deprecated types
!action.toString().equals("turnWifiOn")
&&
!action.toString().equals("turnWifiOff")
&&
!action.toString().equals("turnBluetoothOn")
&&
!action.toString().equals("turnBluetoothOff")
&&
!action.toString().equals("turnUsbTetheringOn")
&&
!action.toString().equals("turnUsbTetheringOff")
&&
!action.toString().equals("turnWifiTetheringOn")
&&
!action.toString().equals("turnWifiTetheringOff")
&&
!action.toString().equals("enableScreenRotation")
&&
!action.toString().equals("disableScreenRotation")
) // exclusion for deprecated types
actionTypesList.add(action.getFullName(context));
}

View File

@ -208,8 +208,8 @@ public class Actions
String[] parts = action.split(Action.actionParameter2Split);
broadcastIntent.setAction(parts[0]);
String[] intentParts = parts[1].split(";");
broadcastIntent = packParametersIntoIntent(broadcastIntent, intentParts, 0);
String[] intentparts = parts[1].split(";");
broadcastIntent = packParametersIntoIntent(broadcastIntent, intentparts, 0);
}
else
broadcastIntent.setAction(action);
@ -1056,57 +1056,51 @@ public class Actions
String params[];
if(param.contains(Action.actionParameter2Split))
params = param.split(Action.actionParameter2Split, -1);
params = param.split(Action.actionParameter2Split);
else
params = param.split(";", -1);
params = param.split(";");
try
{
Intent externalApplicationIntent;
String packageName, className, activityOrAction, startupType;
if (!startByAction)
{
// selected by activity
String packageName, className;
packageName = params[0];
className = params[1];
activityOrAction = params[2];
startupType = params[3];
if (!startByAction)
{
// start by activity
Miscellaneous.logEvent("i", "StartOtherApp", "Starting app by activity: " + packageName + " " + className, 3);
externalApplicationIntent = new Intent(Intent.ACTION_MAIN);
externalApplicationIntent.addCategory(Intent.CATEGORY_LAUNCHER);
if(packageName.equals("dummyPkg") || packageName.length() == 0)
if(packageName.equals("dummyPkg"))
externalApplicationIntent.setAction(className);
externalApplicationIntent.setPackage(packageName);
externalApplicationIntent.setClassName(packageName, activityOrAction);
externalApplicationIntent.setClassName(packageName, className);
if (!Miscellaneous.doesActivityExist(externalApplicationIntent, Miscellaneous.getAnyContext()))
Miscellaneous.logEvent("w", "StartOtherApp", "Activity not found: " + className, 2);
}
else
{
// start by action
// selected by action
Miscellaneous.logEvent("i", "StartOtherApp", "Starting app by action: " + param, 3);
externalApplicationIntent = new Intent();
if (!packageName.equals(dummyPackageString))
{
externalApplicationIntent.setPackage(packageName);
if(!StringUtils.isEmpty(className))
externalApplicationIntent.setClassName(packageName, className);
}
if (!params[0].equals(dummyPackageString))
externalApplicationIntent.setPackage(params[0]);
externalApplicationIntent.setAction(activityOrAction);
externalApplicationIntent.setAction(params[1]);
if (startupType.equals(ActivityManageActionStartActivity.startByServiceString) || startupType.equals(ActivityManageActionStartActivity.startByForegroundServiceString))
if (params[2].equals(ActivityManageActionStartActivity.startByServiceString) || params[2].equals(ActivityManageActionStartActivity.startByForegroundServiceString))
{
externalApplicationIntent.setComponent(new ComponentName(packageName, className));
externalApplicationIntent.setComponent(new ComponentName(params[0], params[2]));
}
}
@ -1115,17 +1109,17 @@ public class Actions
// Pack intents
if(params.length >= 4)
{
if(Miscellaneous.isNumeric(startupType))
if(Miscellaneous.isNumeric(params[3]))
externalApplicationIntent = packParametersIntoIntent(externalApplicationIntent, params, 4);
else
externalApplicationIntent = packParametersIntoIntent(externalApplicationIntent, params, 3);
}
if (startupType.equals(ActivityManageActionStartActivity.startByActivityString))
if (params[2].equals(ActivityManageActionStartActivity.startByActivityString))
automationServerRef.startActivity(externalApplicationIntent);
else if (startupType.equals(ActivityManageActionStartActivity.startByServiceString))
else if (params[2].equals(ActivityManageActionStartActivity.startByServiceString))
automationServerRef.startService(externalApplicationIntent);
else if (startupType.equals(ActivityManageActionStartActivity.startByForegroundServiceString) && Build.VERSION.SDK_INT >= 26)
else if (params[2].equals(ActivityManageActionStartActivity.startByForegroundServiceString) && Build.VERSION.SDK_INT >= 26)
automationServerRef.startForegroundService(externalApplicationIntent);
else
automationServerRef.sendBroadcast(externalApplicationIntent);

View File

@ -8,7 +8,6 @@ import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
@ -98,20 +97,11 @@ public class ActivityControlCenter extends Activity
{
@Override
public void onClick(View v)
{
AlertDialog dialog = Miscellaneous.messageBox(getResources().getString(R.string.info), getResources().getString(R.string.importChooseFolderNotice), ActivityControlCenter.this);
dialog.setOnDismissListener(new DialogInterface.OnDismissListener()
{
@Override
public void onDismiss(DialogInterface dialogInterface)
{
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
startActivityForResult(intent, requestCodeImport);
}
});
dialog.show();
}
});
bExportConfiguration = (Button) findViewById(R.id.bExportConfiguration);
bExportConfiguration.setOnClickListener(new View.OnClickListener()

View File

@ -590,7 +590,7 @@ public class ActivityMainScreen extends ActivityGeneric
Miscellaneous.messageBox(getResources().getString(R.string.app_name), getResources().getString(R.string.android9RecordAudioNotice) + " " + getResources().getString(R.string.messageNotShownAgain), ActivityMainScreen.this).show();
}
if(Miscellaneous.getTargetSDK(ActivityMainScreen.this) >= 29 && !Settings.noticeAndroid10WifiShown && Rule.isAnyRuleUsing(Action.Action_Enum.setWifi))
if(Build.VERSION.SDK_INT >= 29 && !Settings.noticeAndroid10WifiShown && Rule.isAnyRuleUsing(Action.Action_Enum.setWifi))
{
Settings.noticeAndroid10WifiShown = true;
Settings.writeSettings(ActivityMainScreen.this);

View File

@ -53,7 +53,7 @@ public class ActivityManageActionStartActivity extends Activity
Button bSelectApp, bAddIntentPair, bSaveActionStartOtherActivity, showStartProgramExamples;
Spinner spinnerParameterType;
RadioGroup rgAppStartupType;
// boolean edit = false;
boolean edit = false;
ProgressDialog progressDialog = null;
RadioButton rbStartAppSelectByActivity, rbStartAppSelectByAction, rbStartAppByActivity, rbStartAppByBroadcast, rbStartAppByService, rbStartAppByForegroundService;
@ -95,7 +95,7 @@ public class ActivityManageActionStartActivity extends Activity
spinnerParameterType.setAdapter(intentTypeSpinnerAdapter);
intentTypeSpinnerAdapter.notifyDataSetChanged();
// etClassName.setEnabled(false);
etClassName.setEnabled(false);
intentPairAdapter = new ArrayAdapter<String>(this, R.layout.text_view_for_poi_listview_mediumtextsize, intentPairList);
bSelectApp.setOnClickListener(new OnClickListener()
@ -233,29 +233,26 @@ public class ActivityManageActionStartActivity extends Activity
String parameter2 = "";
/*
0 = packageName
1 = className
2 = activityName/actionName
3 = startType
4 = parameters
*/
if (rbStartAppSelectByActivity.isChecked())
parameter2 += etPackageName.getText().toString() + Action.actionParameter2Split + etActivityOrActionPath.getText().toString();
else
{
if (etPackageName.getText().toString() != null && etPackageName.getText().toString().length() > 0)
parameter2 += etPackageName.getText().toString() + Action.actionParameter2Split + etActivityOrActionPath.getText().toString();
else
parameter2 += Actions.dummyPackageString + Action.actionParameter2Split + etActivityOrActionPath.getText().toString();
parameter2 += etPackageName.getText().toString()
+ Action.actionParameter2Split
+ etClassName.getText().toString()
+ Action.actionParameter2Split
+ etActivityOrActionPath.getText().toString()
+ Action.actionParameter2Split;
parameter2 += Action.actionParameter2Split + etClassName.getText().toString();
}
if (rbStartAppByActivity.isChecked())
parameter2 += startByActivityString;
parameter2 += Action.actionParameter2Split + startByActivityString;
else if(rbStartAppByService.isChecked())
parameter2 += startByServiceString;
parameter2 += Action.actionParameter2Split + startByServiceString;
else if(rbStartAppByForegroundService.isChecked())
parameter2 += startByForegroundServiceString;
parameter2 += Action.actionParameter2Split + startByForegroundServiceString;
else
parameter2 += startByBroadcastString;
parameter2 += Action.actionParameter2Split + startByBroadcastString;
for (String s : intentPairList)
parameter2 += Action.actionParameter2Split + s;
@ -319,6 +316,23 @@ public class ActivityManageActionStartActivity extends Activity
}
});
rgAppStartupType.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener()
{
@Override
public void onCheckedChanged(RadioGroup radioGroup, int i)
{
if(rbStartAppByActivity.isChecked())
etClassName.setEnabled(false);
else if (rbStartAppByBroadcast.isChecked())
etClassName.setEnabled(false);
else if(rbStartAppByService.isChecked())
etClassName.setEnabled(true);
else if(rbStartAppByForegroundService.isChecked())
etClassName.setEnabled(true);
}
});
Intent i = getIntent();
if(i.hasExtra(ActivityManageRule.intentNameActionParameter1))
loadValuesIntoGui(i);
@ -611,36 +625,52 @@ public class ActivityManageActionStartActivity extends Activity
rbStartAppSelectByActivity.setChecked(!selectionByAction);
rbStartAppSelectByAction.setChecked(selectionByAction);
/*
0 = packageName
1 = className
2 = activityName/actionName
3 = startType
4 = parameters
*/
try
{
String[] params;
String partsString = input.getStringExtra(ActivityManageRule.intentNameActionParameter2);
if(partsString.contains(Action.actionParameter2Split))
params = partsString.split(Action.actionParameter2Split, -1);
params = partsString.split(Action.actionParameter2Split);
else
params = partsString.split(";", -1);
etPackageName.setText(params[0]);
etClassName.setText(params[1]);
etActivityOrActionPath.setText(params[2]);
params = partsString.split(";");
if(Miscellaneous.isNumeric(params[2])) // old configuration file
{
rbStartAppByActivity.setChecked(params[2].equals(startByActivityString));
rbStartAppByBroadcast.setChecked(params[2].equals(startByBroadcastString));
rbStartAppByService.setChecked(params[2].equals(startByServiceString));
}
else
{
rbStartAppByActivity.setChecked(params[3].equals(startByActivityString));
rbStartAppByBroadcast.setChecked(params[3].equals(startByBroadcastString));
rbStartAppByService.setChecked(params[3].equals(startByServiceString));
rbStartAppByForegroundService.setChecked(params[3].equals(startByForegroundServiceString));
}
int startIndex = -1;
if(!selectionByAction)
{
etPackageName.setText(params[0]);
etActivityOrActionPath.setText(params[1]);
}
else
{
if(!params[0].contains(Actions.dummyPackageString))
etPackageName.setText(params[0]);
etActivityOrActionPath.setText(params[1]);
etClassName.setText(params[2]);
}
if (params.length >= 4)
startIndex = 4;
if(startIndex > -1 && params.length > startIndex)
{
intentPairList.clear();
for(int i=4; i<params.length; i++)
for(int i=startIndex; i<params.length; i++)
{
if(lvIntentPairs.getVisibility() != View.VISIBLE)
lvIntentPairs.setVisibility(View.VISIBLE);
@ -650,10 +680,6 @@ public class ActivityManageActionStartActivity extends Activity
updateIntentPairList();
}
catch(Exception e)
{
Toast.makeText(ActivityManageActionStartActivity.this, getResources().getString(R.string.errorLoadingValues), Toast.LENGTH_LONG).show();
}
}
private void updateIntentPairList()

View File

@ -622,7 +622,7 @@ public class ActivityManageRule extends Activity
items.add(new Item(typesLong[i].toString(), R.drawable.megaphone));
else if(types[i].toString().equals(Trigger_Enum.phoneCall.toString()))
{
if(ActivityPermissions.isPermissionDeclaredInManifest(ActivityManageRule.this, Manifest.permission.SEND_SMS))
if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageRule.this, Manifest.permission.SEND_SMS))
items.add(new Item(typesLong[i].toString(), R.drawable.phone));
}
else if(types[i].toString().equals(Trigger_Enum.nfcTag.toString()))
@ -655,7 +655,7 @@ public class ActivityManageRule extends Activity
items.add(new Item(typesLong[i].toString(), R.drawable.variable));
else if(types[i].toString().equals(Trigger_Enum.calendarEvent.toString()))
{
if(ActivityPermissions.isPermissionDeclaredInManifest(ActivityManageRule.this, Manifest.permission.READ_CALENDAR))
if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageRule.this, Manifest.permission.READ_CALENDAR))
items.add(new Item(typesLong[i].toString(), R.drawable.calendar));
}
else
@ -2238,17 +2238,17 @@ public class ActivityManageRule extends Activity
items.add(new Item(typesLong[i].toString(), R.drawable.script));
else if(types[i].toString().equals(Action_Enum.startPhoneCall.toString()))
{
if(ActivityPermissions.isPermissionDeclaredInManifest(ActivityManageRule.this, Manifest.permission.CALL_PHONE))
if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageRule.this, Manifest.permission.CALL_PHONE))
items.add(new Item(typesLong[i].toString(), R.drawable.phone));
}
else if(types[i].toString().equals(Action_Enum.stopPhoneCall.toString()))
{
if(ActivityPermissions.isPermissionDeclaredInManifest(ActivityManageRule.this, Manifest.permission.ANSWER_PHONE_CALLS))
if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageRule.this, Manifest.permission.ANSWER_PHONE_CALLS))
items.add(new Item(typesLong[i].toString(), R.drawable.phone));
}
else if(types[i].toString().equals(Action_Enum.sendTextMessage.toString()))
{
if(ActivityPermissions.isPermissionDeclaredInManifest(ActivityManageRule.this, Manifest.permission.SEND_SMS))
if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageRule.this, Manifest.permission.SEND_SMS))
items.add(new Item(typesLong[i].toString(), R.drawable.message));
}
else if(types[i].toString().equals(Action_Enum.copyToClipboard.toString()))
@ -2259,7 +2259,7 @@ public class ActivityManageRule extends Activity
items.add(new Item(typesLong[i].toString(), R.drawable.compass_small));
else if(types[i].toString().equals(Action_Enum.takeScreenshot.toString()))
{
if(ActivityPermissions.isServiceAvailable(Miscellaneous.getAnyContext(), "MyAccessibilityService"))
if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageRule.this, Manifest.permission.BIND_ACCESSIBILITY_SERVICE))
items.add(new Item(typesLong[i].toString(), R.drawable.copier));
}
else
@ -2294,28 +2294,28 @@ public class ActivityManageRule extends Activity
{
newAction = new Action();
CharSequence[] actionTypes = Action.getActionTypesAsArray();
if(actionTypes[which].toString().equals(Action_Enum.triggerUrl.toString()))
if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.triggerUrl.toString()))
{
//launch other activity to enter a url and parameters;
newAction.setAction(Action_Enum.triggerUrl);
// ActivityManageActionTriggerUrl.resultingAction = null;
Intent editTriggerIntent = new Intent(context, ActivityManageActionTriggerUrl.class);
startActivityForResult(editTriggerIntent, requestCodeActionTriggerUrlAdd);
}
else if(actionTypes[which].toString().equals(Action_Enum.setWifi.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setWifi.toString()))
{
newAction.setAction(Action_Enum.setWifi);
Intent editSetWifiIntent = new Intent(context, ActivityManageActionWifi.class);
startActivityForResult(editSetWifiIntent, requestCodeActionSetWifiAdd);
}
else if(actionTypes[which].toString().equals(Action_Enum.setBluetooth.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setBluetooth.toString()))
{
if(!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH))
Miscellaneous.messageBox("Bluetooth", getResources().getString(R.string.deviceDoesNotHaveBluetooth), ActivityManageRule.this).show();;
newAction.setAction(Action_Enum.setBluetooth);
getActionParameter1Dialog(ActivityManageRule.this).show();
}
else if(actionTypes[which].toString().equals(Action_Enum.setUsbTethering.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setUsbTethering.toString()))
{
newAction.setAction(Action_Enum.setUsbTethering);
getActionParameter1Dialog(ActivityManageRule.this).show();
@ -2323,12 +2323,12 @@ public class ActivityManageRule extends Activity
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();
}
else if(actionTypes[which].toString().equals(Action_Enum.setWifiTethering.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setWifiTethering.toString()))
{
newAction.setAction(Action_Enum.setWifiTethering);
getActionParameter1Dialog(ActivityManageRule.this).show();
}
else if(actionTypes[which].toString().equals(Action_Enum.setBluetoothTethering.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setBluetoothTethering.toString()))
{
newAction.setAction(Action_Enum.setBluetoothTethering);
getActionParameter1Dialog(ActivityManageRule.this).show();
@ -2339,12 +2339,12 @@ public class ActivityManageRule extends Activity
if(Build.VERSION.SDK_INT > Build.VERSION_CODES.O)
Miscellaneous.messageBox(context.getResources().getString(R.string.notice), context.getResources().getString(R.string.btTetheringNotice), context).show();
}
else if(actionTypes[which].toString().equals(Action_Enum.setDisplayRotation.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setDisplayRotation.toString()))
{
newAction.setAction(Action_Enum.setDisplayRotation);
getActionParameter1Dialog(ActivityManageRule.this).show();
}
else if(actionTypes[which].toString().equals(Action_Enum.changeSoundProfile.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.changeSoundProfile.toString()))
{
if(Profile.getProfileCollection().size() > 0)
{
@ -2354,23 +2354,23 @@ public class ActivityManageRule extends Activity
else
Toast.makeText(context, getResources().getString(R.string.noProfilesCreateOneFirst), Toast.LENGTH_LONG).show();
}
else if(actionTypes[which].toString().equals(Action_Enum.startOtherActivity.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.startOtherActivity.toString()))
{
newAction.setAction(Action_Enum.startOtherActivity);
Intent intent = new Intent(ActivityManageRule.this, ActivityManageActionStartActivity.class);
startActivityForResult(intent, requestCodeActionStartActivityAdd);
}
else if(actionTypes[which].toString().equals(Action_Enum.waitBeforeNextAction.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.waitBeforeNextAction.toString()))
{
newAction.setAction(Action_Enum.waitBeforeNextAction);
getActionWaitBeforeNextActionDialog(ActivityManageRule.this).show();
}
else if(actionTypes[which].toString().equals(Action_Enum.turnScreenOnOrOff.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.turnScreenOnOrOff.toString()))
{
newAction.setAction(Action_Enum.turnScreenOnOrOff);
getActionParameter1Dialog(ActivityManageRule.this).show();
}
else if(actionTypes[which].toString().equals(Action_Enum.setAirplaneMode.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setAirplaneMode.toString()))
{
newAction.setAction(Action_Enum.setAirplaneMode);
getActionParameter1Dialog(ActivityManageRule.this).show();
@ -2379,13 +2379,13 @@ public class ActivityManageRule extends Activity
Miscellaneous.messageBox(getResources().getString(R.string.airplaneMode), getResources().getString(R.string.rootExplanation), ActivityManageRule.this).show();
}
}
else if(actionTypes[which].toString().equals(Action_Enum.setDataConnection.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setDataConnection.toString()))
{
newAction.setAction(Action_Enum.setDataConnection);
getActionParameter1Dialog(ActivityManageRule.this).show();
Miscellaneous.messageBox(getResources().getString(R.string.actionDataConnection), getResources().getString(R.string.rootExplanation), ActivityManageRule.this).show();
}
else if(actionTypes[which].toString().equals(Action_Enum.speakText.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.speakText.toString()))
{
//launch other activity to enter a url and parameters;
newAction.setAction(Action_Enum.speakText);
@ -2393,9 +2393,9 @@ public class ActivityManageRule extends Activity
Intent editTriggerIntent = new Intent(context, ActivityManageActionSpeakText.class);
startActivityForResult(editTriggerIntent, requestCodeActionSpeakTextAdd);
}
else if(actionTypes[which].toString().equals(Action_Enum.sendTextMessage.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.sendTextMessage.toString()))
{
if(ActivityPermissions.isPermissionDeclaredInManifest(ActivityManageRule.this, Manifest.permission.SEND_SMS))
if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageRule.this, Manifest.permission.SEND_SMS))
{
//launch other activity to enter parameters;
newAction.setAction(Action_Enum.sendTextMessage);
@ -2404,97 +2404,97 @@ public class ActivityManageRule extends Activity
startActivityForResult(editTriggerIntent, requestCodeActionSendTextMessageAdd);
}
}
else if(actionTypes[which].toString().equals(Action_Enum.playMusic.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.playMusic.toString()))
{
newAction.setAction(Action_Enum.playMusic);
ruleToEdit.getActionSet().add(newAction);
refreshActionList();
}
else if(actionTypes[which].toString().equals(Action_Enum.vibrate.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.vibrate.toString()))
{
newAction.setAction(Action_Enum.vibrate);
Intent intent = new Intent(ActivityManageRule.this, ActivityManageActionVibrate.class);
startActivityForResult(intent, requestCodeActionVibrateAdd);
}
else if(actionTypes[which].toString().equals(Action_Enum.sendBroadcast.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.sendBroadcast.toString()))
{
newAction.setAction(Action_Enum.sendBroadcast);
Intent intent = new Intent(ActivityManageRule.this, ActivityManageActionSendBroadcast.class);
startActivityForResult(intent, requestCodeActionSendBroadcastAdd);
}
else if(actionTypes[which].toString().equals(Action_Enum.runExecutable.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.runExecutable.toString()))
{
newAction.setAction(Action_Enum.runExecutable);
Intent intent = new Intent(ActivityManageRule.this, ActivityManageActionRunExecutable.class);
startActivityForResult(intent, requestCodeActionRunExecutableAdd);
}
else if(actionTypes[which].toString().equals(Action_Enum.startPhoneCall.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.startPhoneCall.toString()))
{
newAction.setAction(Action_Enum.startPhoneCall);
Intent intent = new Intent(ActivityManageRule.this, ActivityManageActionMakePhoneCall.class);
startActivityForResult(intent, requestCodeActionMakePhoneCallAdd);
}
else if(actionTypes[which].toString().equals(Action_Enum.setVariable.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setVariable.toString()))
{
newAction.setAction(Action_Enum.setVariable);
Intent intent = new Intent(ActivityManageRule.this, ActivityManageActionSetVariable.class);
startActivityForResult(intent, requestCodeActionSetVariableAdd);
}
else if(actionTypes[which].toString().equals(Action_Enum.stopPhoneCall.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.stopPhoneCall.toString()))
{
newAction.setAction(Action_Enum.stopPhoneCall);
ruleToEdit.getActionSet().add(newAction);
refreshActionList();
}
else if(actionTypes[which].toString().equals(Action_Enum.wakelock.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.wakelock.toString()))
{
newAction.setAction(Action_Enum.wakelock);
Intent intent = new Intent(ActivityManageRule.this, ActivityManageActionWakeLock.class);
startActivityForResult(intent, requestCodeActionWakeLockAdd);
}
else if(actionTypes[which].toString().equals(Action_Enum.controlMediaPlayback.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.controlMediaPlayback.toString()))
{
newAction.setAction(Action_Enum.controlMediaPlayback);
Intent intent = new Intent(ActivityManageRule.this, ActivityManageActionControlMedia.class);
startActivityForResult(intent, requestCodeActionControlMediaAdd);
}
else if(actionTypes[which].toString().equals(Action_Enum.createNotification.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.createNotification.toString()))
{
newAction.setAction(Action_Enum.createNotification);
Intent intent = new Intent(ActivityManageRule.this, ActivityManageActionCreateNotification.class);
startActivityForResult(intent, requestCodeActionCreateNotificationAdd);
}
else if(actionTypes[which].toString().equals(Action_Enum.closeNotification.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.closeNotification.toString()))
{
newAction.setAction(Action_Enum.closeNotification);
Intent intent = new Intent(ActivityManageRule.this, ActivityManageActionCloseNotification.class);
startActivityForResult(intent, requestCodeActionCloseNotificationAdd);
}
else if(actionTypes[which].toString().equals(Action_Enum.setScreenBrightness.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setScreenBrightness.toString()))
{
newAction.setAction(Action_Enum.setScreenBrightness);
Intent actionScreenBrightnessIntent = new Intent(context, ActivityManageActionBrightnessSetting.class);
startActivityForResult(actionScreenBrightnessIntent, requestCodeActionScreenBrightnessAdd);
}
else if(actionTypes[which].toString().equals(Action_Enum.playSound.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.playSound.toString()))
{
newAction.setAction(Action_Enum.playSound);
Intent actionPlaySoundIntent = new Intent(context, ActivityManageActionPlaySound.class);
startActivityForResult(actionPlaySoundIntent, requestCodeActionPlaySoundAdd);
}
else if(actionTypes[which].toString().equals(Action_Enum.copyToClipboard.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.copyToClipboard.toString()))
{
newAction.setAction(Action_Enum.copyToClipboard);
Intent intent = new Intent(ActivityManageRule.this, ActivityManageActionCopyToClipboard.class);
startActivityForResult(intent, requestCodeActionCopyTextToClipboardAdd);
}
else if(actionTypes[which].toString().equals(Action_Enum.takeScreenshot.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.takeScreenshot.toString()))
{
newAction.setAction(Action_Enum.takeScreenshot);
ruleToEdit.getActionSet().add(newAction);
refreshActionList();
}
else if(actionTypes[which].toString().equals(Action_Enum.setLocationService.toString()))
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.setLocationService.toString()))
{
newAction.setAction(Action_Enum.setLocationService);
Intent intent = new Intent(ActivityManageRule.this, ActivityManageActionLocationService.class);

View File

@ -15,6 +15,7 @@ import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
@ -73,7 +74,7 @@ public class ActivityManageTriggerWifi extends Activity
if(
Miscellaneous.getTargetSDK(Miscellaneous.getAnyContext()) >= 29
&&
!ActivityPermissions.isPermissionDeclaredInManifest(Miscellaneous.getAnyContext(), Manifest.permission.ACCESS_BACKGROUND_LOCATION)
!ActivityPermissions.isPermissionDeclaratedInManifest(Miscellaneous.getAnyContext(), Manifest.permission.ACCESS_BACKGROUND_LOCATION)
)
tvWifiTriggerNameLocationNotice.setVisibility(View.VISIBLE);

View File

@ -11,8 +11,6 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PermissionInfo;
import android.content.pm.ServiceInfo;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Build;
@ -29,6 +27,8 @@ import android.widget.TextView;
import com.jens.automation2.receivers.NotificationListener;
import org.w3c.dom.DOMImplementationSource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@ -579,7 +579,7 @@ public class ActivityPermissions extends Activity
(
Miscellaneous.getTargetSDK(Miscellaneous.getAnyContext()) >= 29
&&
isPermissionDeclaredInManifest(Miscellaneous.getAnyContext(), Manifest.permission.ACCESS_BACKGROUND_LOCATION)
isPermissionDeclaratedInManifest(Miscellaneous.getAnyContext(), Manifest.permission.ACCESS_BACKGROUND_LOCATION)
)
||
Build.VERSION.SDK_INT >= 33
@ -611,6 +611,12 @@ public class ActivityPermissions extends Activity
if(targetProfile.changeIncomingCallsRingtone || targetProfile.changeNotificationRingtone)
addToArrayListUnique(Manifest.permission.READ_EXTERNAL_STORAGE, requiredPermissions);
break;
case disableScreenRotation:
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
break;
case enableScreenRotation:
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
break;
case playMusic:
break;
case controlMediaPlayback:
@ -713,12 +719,40 @@ public class ActivityPermissions extends Activity
addToArrayListUnique(Manifest.permission.INTERNET, requiredPermissions);
getPermissionsForVariablesInUse(action.getParameter2(), requiredPermissions);
break;
case turnBluetoothOff:
addToArrayListUnique(Manifest.permission.BLUETOOTH_ADMIN, requiredPermissions);
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
addToArrayListUnique(Manifest.permission.BLUETOOTH, requiredPermissions);
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
break;
case turnBluetoothOn:
addToArrayListUnique(Manifest.permission.BLUETOOTH_ADMIN, requiredPermissions);
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
addToArrayListUnique(Manifest.permission.BLUETOOTH, requiredPermissions);
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
break;
case turnUsbTetheringOff:
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
break;
case turnUsbTetheringOn:
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
break;
case turnWifiOff:
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
break;
case turnWifiOn:
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
break;
case turnWifiTetheringOff:
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
break;
case turnWifiTetheringOn:
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
break;
case waitBeforeNextAction:
break;
case playSound:
@ -864,6 +898,18 @@ public class ActivityPermissions extends Activity
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
for(String ruleName : getRulesUsing(Action.Action_Enum.setWifiTethering))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
for(String ruleName : getRulesUsing(Action.Action_Enum.turnBluetoothOff))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
for(String ruleName : getRulesUsing(Action.Action_Enum.turnBluetoothOn))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
for(String ruleName : getRulesUsing(Action.Action_Enum.turnWifiOff))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
for(String ruleName : getRulesUsing(Action.Action_Enum.turnWifiOn))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
for(String ruleName : getRulesUsing(Action.Action_Enum.turnWifiTetheringOff))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
for(String ruleName : getRulesUsing(Action.Action_Enum.turnWifiTetheringOn))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
break;
case Manifest.permission.ACCESS_WIFI_STATE:
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.pointOfInterest))
@ -876,12 +922,20 @@ public class ActivityPermissions extends Activity
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
for(String ruleName : getRulesUsing(Action.Action_Enum.setBluetooth))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
for(String ruleName : getRulesUsing(Action.Action_Enum.turnBluetoothOff))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
for(String ruleName : getRulesUsing(Action.Action_Enum.turnBluetoothOn))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
break;
case Manifest.permission.BLUETOOTH:
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.bluetoothConnection))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
for(String ruleName : getRulesUsing(Action.Action_Enum.setBluetooth))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
for(String ruleName : getRulesUsing(Action.Action_Enum.turnBluetoothOff))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
for(String ruleName : getRulesUsing(Action.Action_Enum.turnBluetoothOn))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
break;
case Manifest.permission.GET_TASKS:
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.process_started_stopped))
@ -1075,14 +1129,14 @@ public class ActivityPermissions extends Activity
{
if(permissionNames.equals(Manifest.permission.PROCESS_OUTGOING_CALLS))
{
if(ActivityPermissions.isPermissionDeclaredInManifest(Miscellaneous.getAnyContext(), Manifest.permission.PROCESS_OUTGOING_CALLS) && !Miscellaneous.isGooglePlayInstalled(Miscellaneous.getAnyContext()))
if(ActivityPermissions.isPermissionDeclaratedInManifest(Miscellaneous.getAnyContext(), Manifest.permission.PROCESS_OUTGOING_CALLS) && !Miscellaneous.isGooglePlayInstalled(Miscellaneous.getAnyContext()))
{
permissionList.add(permission);
}
}
else if(permissionNames.equals(Manifest.permission.SEND_SMS))
{
if(ActivityPermissions.isPermissionDeclaredInManifest(Miscellaneous.getAnyContext(), Manifest.permission.SEND_SMS) && !Miscellaneous.isGooglePlayInstalled(Miscellaneous.getAnyContext()))
if(ActivityPermissions.isPermissionDeclaratedInManifest(Miscellaneous.getAnyContext(), Manifest.permission.SEND_SMS) && !Miscellaneous.isGooglePlayInstalled(Miscellaneous.getAnyContext()))
{
permissionList.add(permission);
}
@ -1251,7 +1305,7 @@ public class ActivityPermissions extends Activity
{
if(requiredPermissions.contains(Manifest.permission.PROCESS_OUTGOING_CALLS))
{
if(!ActivityPermissions.isPermissionDeclaredInManifest(Miscellaneous.getAnyContext(), Manifest.permission.SEND_SMS)
if(!ActivityPermissions.isPermissionDeclaratedInManifest(Miscellaneous.getAnyContext(), Manifest.permission.SEND_SMS)
&&
Miscellaneous.isGooglePlayInstalled(Miscellaneous.getAnyContext())
)
@ -1262,7 +1316,7 @@ public class ActivityPermissions extends Activity
}
if(requiredPermissions.contains(Manifest.permission.SEND_SMS))
{
if(!ActivityPermissions.isPermissionDeclaredInManifest(Miscellaneous.getAnyContext(), Manifest.permission.SEND_SMS)
if(!ActivityPermissions.isPermissionDeclaratedInManifest(Miscellaneous.getAnyContext(), Manifest.permission.SEND_SMS)
)
{
requiredPermissions.remove(Manifest.permission.SEND_SMS);
@ -1632,53 +1686,12 @@ public class ActivityPermissions extends Activity
mapActionPermissions.put("wakeupDevice", Manifest.permission.WAKE_LOCK);
}
public static boolean isServiceAvailable(Context context, String serviceName)
{
/*int flags = PackageManager.GET_ACTIVITIES
| PackageManager.GET_CONFIGURATIONS
| PackageManager.GET_DISABLED_COMPONENTS
| PackageManager.GET_GIDS | PackageManager.GET_INSTRUMENTATION
| PackageManager.GET_INTENT_FILTERS
| PackageManager.GET_PERMISSIONS | PackageManager.GET_PROVIDERS
| PackageManager.GET_RECEIVERS | PackageManager.GET_SERVICES
| PackageManager.GET_SIGNATURES;
PackageManager packageManager = getPackageManager();
List<PackageInfo> installedPackages = packageManager.getInstalledPackages(flags);
for (PackageInfo packageInfo : installedPackages)
{
ServiceInfo[] services = packageInfo.services;
PermissionInfo[] permissions = packageInfo.permissions;
}*/
StringBuffer buffer = new StringBuffer();
try
{
PackageManager packageManager = context.getPackageManager();
PackageInfo packageInfo = packageManager.getPackageInfo("com.jens.automation2", PackageManager.GET_SERVICES);
ServiceInfo[] services = packageInfo.services;
for (ServiceInfo serviceInfo : services)
{
if(serviceInfo.name.endsWith(serviceName))
return true;
}
PermissionInfo[] permissions = packageInfo.permissions;
}
catch (PackageManager.NameNotFoundException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
return false;
}
public static boolean isPermissionDeclaredInManifest(Context context, String permission)
public static boolean isPermissionDeclaratedInManifest(Context context, String permission)
{
PackageManager pm = context.getPackageManager();
try
{
PackageInfo packageInfo = pm.getPackageInfo(context.getPackageName(), PackageManager.GET_PERMISSIONS);
String[] requestedPermissions = null;
if (packageInfo != null)
{

View File

@ -322,7 +322,7 @@ public class AutomationService extends Service implements OnInitListener
DateTimeListener.setOrResetAlarms();
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.calendarEvent) && ActivityPermissions.isPermissionDeclaredInManifest(AutomationService.getInstance(), Manifest.permission.READ_CALENDAR) && ActivityPermissions.havePermission(Manifest.permission.READ_CALENDAR, AutomationService.getInstance()))
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.calendarEvent) && ActivityPermissions.isPermissionDeclaratedInManifest(AutomationService.getInstance(), Manifest.permission.READ_CALENDAR) && ActivityPermissions.havePermission(Manifest.permission.READ_CALENDAR, AutomationService.getInstance()))
CalendarReceiver.armOrRearmTimer();
}
@ -392,20 +392,6 @@ public class AutomationService extends Service implements OnInitListener
r.activate(AutomationService.this, false);
}
if(!Settings.hasBeenDone(Settings.constVersion143StartOtherProgramConfigEditHint))
{
if(Rule.isAnyRuleUsing(Action.Action_Enum.startOtherActivity))
{
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1)
Miscellaneous.createDismissibleNotificationWithDelay(1010, null, getResources().getString(R.string.version143StartOtherActivityHint), 9123, AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE, null);
else
Miscellaneous.createDismissibleNotification(null, getResources().getString(R.string.version143StartOtherActivityHint), 9123, false, AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE, null);
}
Settings.considerDone(Settings.constVersion143StartOtherProgramConfigEditHint);
Settings.writeSettings(Miscellaneous.getAnyContext());
}
Settings.serviceStartDone = true;
Settings.deviceStartDone = true;
}

View File

@ -213,7 +213,7 @@ public class ReceiverCoordinator
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.screenState))
ScreenStateReceiver.startScreenStateReceiver(AutomationService.getInstance());
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.calendarEvent) && ActivityPermissions.isPermissionDeclaredInManifest(AutomationService.getInstance(), Manifest.permission.READ_CALENDAR) && ActivityPermissions.havePermission(Manifest.permission.READ_CALENDAR, AutomationService.getInstance()))
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.calendarEvent) && ActivityPermissions.isPermissionDeclaratedInManifest(AutomationService.getInstance(), Manifest.permission.READ_CALENDAR) && ActivityPermissions.havePermission(Manifest.permission.READ_CALENDAR, AutomationService.getInstance()))
CalendarReceiver.startCalendarReceiver(AutomationService.getInstance());
}
@ -470,7 +470,7 @@ public class ReceiverCoordinator
}
}
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.calendarEvent) && ActivityPermissions.isPermissionDeclaredInManifest(AutomationService.getInstance(), Manifest.permission.READ_CALENDAR) && ActivityPermissions.havePermission(Manifest.permission.READ_CALENDAR, AutomationService.getInstance()))
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.calendarEvent) && ActivityPermissions.isPermissionDeclaratedInManifest(AutomationService.getInstance(), Manifest.permission.READ_CALENDAR) && ActivityPermissions.havePermission(Manifest.permission.READ_CALENDAR, AutomationService.getInstance()))
{
if(!CalendarReceiver.getInstance().isListenerRunning())
CalendarReceiver.getInstance().startListener(AutomationService.getInstance());

View File

@ -21,7 +21,6 @@ public class Settings implements SharedPreferences
public static final String constNewsOptInDone ="newsOptInDone";
public static final String constNotificationChannelCleanupApk118 ="notificationChannelCleanupApk118";
public static final String constVersion143StartOtherProgramConfigEditHint = "constVersion143StartOtherProgramConfigEditHint";
public static long minimumDistanceChangeForGpsUpdate;
public static long minimumDistanceChangeForNetworkUpdate;

View File

@ -1665,7 +1665,7 @@ public class Trigger
try
{
Class testClass = Class.forName(ActivityManageRule.activityDetectionClassPath);
if (ActivityPermissions.isPermissionDeclaredInManifest(Miscellaneous.getAnyContext(), "com.google.android.gms.permission.ACTIVITY_RECOGNITION"))
if (ActivityPermissions.isPermissionDeclaratedInManifest(Miscellaneous.getAnyContext(), "com.google.android.gms.permission.ACTIVITY_RECOGNITION"))
{
// This type doesn't have an activate/deactivate equivalent, at least not yet.
returnString.append(Miscellaneous.runMethodReflective(ActivityManageRule.activityDetectionClassPath, "getDescription", new Object[]{getActivityDetectionType()}));

View File

@ -1135,10 +1135,28 @@ public class XmlFileInterface
// *** deprecated
//else
if(actionNameString.equals("turnUsbTetheringOn"))
if(actionNameString.equals("turnWifiOn"))
newAction.setAction(Action_Enum.turnWifiOn);
else if(actionNameString.equals("turnWifiOff"))
newAction.setAction(Action_Enum.turnWifiOff);
else if(actionNameString.equals("turnBluetoothOn"))
newAction.setAction(Action_Enum.turnBluetoothOn);
else if(actionNameString.equals("turnBluetoothOff"))
newAction.setAction(Action_Enum.turnBluetoothOff);
else if(actionNameString.equals("turnUsbTetheringOn"))
newAction.setAction(Action_Enum.turnUsbTetheringOn);
else if(actionNameString.equals("turnUsbTetheringOff"))
newAction.setAction(Action_Enum.turnUsbTetheringOff);
else if(actionNameString.equals("turnWifiTetheringOn"))
newAction.setAction(Action_Enum.turnWifiTetheringOn);
else if(actionNameString.equals("turnWifiTetheringOff"))
newAction.setAction(Action_Enum.turnWifiTetheringOff);
else if(actionNameString.equals("enableScreenRotation"))
newAction.setAction(Action_Enum.enableScreenRotation);
else if(actionNameString.equals("disableScreenRotation"))
newAction.setAction(Action_Enum.disableScreenRotation);
else if(actionNameString.equals("disableScreenRotation"))
newAction.setAction(Action_Enum.disableScreenRotation);
else if(actionNameString.equals("playMusic"))
{
newAction.setAction(Action_Enum.controlMediaPlayback);
@ -1157,7 +1175,31 @@ public class XmlFileInterface
else if (name.equals("ActionParameter1"))
{
// exclusion for deprecated types
if(newAction.getAction().equals(Action_Enum.turnUsbTetheringOn))
if(newAction.getAction().equals(Action_Enum.turnWifiOn))
{
newAction.setAction(Action_Enum.setWifi);
newAction.setParameter1(true);
readTag(parser, "ActionParameter1"); //read the tag for the parser to head on
}
else if(newAction.getAction().equals(Action_Enum.turnWifiOff))
{
newAction.setAction(Action_Enum.setWifi);
newAction.setParameter1(false);
readTag(parser, "ActionParameter1"); //read the tag for the parser to head on
}
else if(newAction.getAction().equals(Action_Enum.turnBluetoothOn))
{
newAction.setAction(Action_Enum.setBluetooth);
newAction.setParameter1(true);
readTag(parser, "ActionParameter1"); //read the tag for the parser to head on
}
else if(newAction.getAction().equals(Action_Enum.turnBluetoothOff))
{
newAction.setAction(Action_Enum.setBluetooth);
newAction.setParameter1(false);
readTag(parser, "ActionParameter1"); //read the tag for the parser to head on
}
else if(newAction.getAction().equals(Action_Enum.turnUsbTetheringOn))
{
newAction.setAction(Action_Enum.setUsbTethering);
newAction.setParameter1(true);
@ -1169,6 +1211,36 @@ public class XmlFileInterface
newAction.setParameter1(false);
readTag(parser, "ActionParameter1"); //read the tag for the parser to head on
}
else if(newAction.getAction().equals(Action_Enum.turnWifiTetheringOn))
{
newAction.setAction(Action_Enum.setWifiTethering);
newAction.setParameter1(true);
readTag(parser, "ActionParameter1"); //read the tag for the parser to head on
}
else if(newAction.getAction().equals(Action_Enum.turnWifiTetheringOff))
{
newAction.setAction(Action_Enum.setWifiTethering);
newAction.setParameter1(false);
readTag(parser, "ActionParameter1"); //read the tag for the parser to head on
}
else if(newAction.getAction().equals(Action_Enum.enableScreenRotation))
{
newAction.setAction(Action_Enum.setDisplayRotation);
newAction.setParameter1(true);
readTag(parser, "ActionParameter1"); //read the tag for the parser to head on
}
else if(newAction.getAction().equals(Action_Enum.disableScreenRotation))
{
newAction.setAction(Action_Enum.setDisplayRotation);
newAction.setParameter1(false);
readTag(parser, "ActionParameter1"); //read the tag for the parser to head on
}
else if(newAction.getAction().equals(Action_Enum.disableScreenRotation))
{
newAction.setAction(Action_Enum.setDisplayRotation);
newAction.setParameter1(false);
readTag(parser, "ActionParameter1"); //read the tag for the parser to head on
}
else if(newAction.getAction().equals(Action_Enum.turnScreenOnOrOff) && newAction.getParameter1())
{
/*

View File

@ -78,7 +78,7 @@ public class CellLocationChangedReceiver extends PhoneStateListener
{
for(Action action : Rule.getLastActivatedRule().getActionSet())
{
if(action.getAction() == Action.Action_Enum.setWifi && action.getParameter1())
if(action.getAction() == Action.Action_Enum.turnWifiOn)
{
// we will be using wifiReceiver, deactivate AccelerometerTimer if applicable
SensorActivity.stopAccelerometerTimer();
@ -88,7 +88,7 @@ public class CellLocationChangedReceiver extends PhoneStateListener
catch(NullPointerException ne)
{
// Nothing to do, there is no last activated rule. Wifi hasn't been activated so we don't
// deactivate accelerometer receiver.
// deactive accelerometer receiver.
}
}
else

View File

@ -2,8 +2,8 @@
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_margin="@dimen/default_margin"
android:layout_weight="30">
android:layout_weight="30"
android:layout_margin="@dimen/default_margin" >
<LinearLayout
android:layout_width="match_parent"
@ -19,7 +19,6 @@
<TimePicker
android:id="@+id/tpTimeFrameStart"
android:descendantFocusability="blocksDescendants"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
@ -32,7 +31,6 @@
<TimePicker
android:id="@+id/tpTimeFrameStop"
android:descendantFocusability="blocksDescendants"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
@ -82,9 +80,9 @@
<TextView
android:id="@+id/tvDaysHint"
android:layout_marginVertical="@dimen/default_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="@dimen/default_margin"
android:textColor="@color/red" />
<CheckBox
@ -148,20 +146,20 @@
<EditText
android:id="@+id/etRepeatEvery"
android:layout_marginLeft="@dimen/default_margin"
android:minWidth="75dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/default_margin"
android:enabled="false"
android:inputType="numberSigned"
android:minWidth="75dp" />
android:inputType="numberSigned" />
</LinearLayout>
<Button
android:id="@+id/bSaveTimeFrame"
android:layout_marginTop="@dimen/default_margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/default_margin"
android:text="@string/save" />
</LinearLayout>

View File

@ -947,6 +947,4 @@
<string name="notCharging">not charging</string>
<string name="triggerChargingComment">The type will only be evaluated if the device is charging. If not charging is chosen, it will fire at any previous charging type. If you want to evaluate that, consider using the variables trigger/action.</string>
<string name="helpTextProfiles">A profile is a collection of settings for ringtones, volumes and other audio related settings that you can have applied from rules or apply it manually.\n\nIt is also possible to query for the last activated profile as a trigger. In the normal case it will only query if the profile was the last activated one (regardless if specific audio settings have been changed in the meantime). But you can also have the individual settings compared.</string>
<string name="version143StartOtherActivityHint">In version 1.8.2 it was necessary to revise the way actions to start other programs were saved. Compatibility could not be ensured. Please check and edit your start other activity actions to make sure they are still working.</string>
<string name="importChooseFolderNotice">In the following dialog do not try to select specific files, but choose the folder in which the Automation backup files reside. If the choose button is disabled, you have found an Android limitation. In that case try moving the files to a subdirectory first.</string>
</resources>

View File

@ -1,2 +0,0 @@
* Fixed: Start other program action revised, editing of your actions may be necessary to continue working
* Fixed: Action type menu would in some cases pick up another action than selected