Compare commits

..

No commits in common. "900aaf3c8cb6c1362b5a59afae6577cd26d3b635" and "759e8076c341415869e519c18efcbadc9cf17839" have entirely different histories.

9 changed files with 9 additions and 187 deletions

View File

@ -66,8 +66,6 @@
<uses-permission android:name="com.wireguard.android.permission.CONTROL_TUNNELS"/> <uses-permission android:name="com.wireguard.android.permission.CONTROL_TUNNELS"/>
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/> <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/> <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-feature <uses-feature
android:name="android.hardware.telephony" android:name="android.hardware.telephony"
@ -173,7 +171,6 @@
<activity android:name=".ActivityManageTriggerTethering" /> <activity android:name=".ActivityManageTriggerTethering" />
<activity android:name=".ActivityManageActionWakeLock" /> <activity android:name=".ActivityManageActionWakeLock" />
<activity android:name=".ActivityManageTriggerSubSystemState" /> <activity android:name=".ActivityManageTriggerSubSystemState" />
<activity android:name=".ActivityManageMakePhoneCall" />
<activity <activity
android:name=".ActivityMainTabLayout" android:name=".ActivityMainTabLayout"
android:launchMode="singleTask"> android:launchMode="singleTask">

View File

@ -64,7 +64,6 @@
<uses-permission android:name="com.wireguard.android.permission.CONTROL_TUNNELS"/> <uses-permission android:name="com.wireguard.android.permission.CONTROL_TUNNELS"/>
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/> <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/> <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-feature <uses-feature
android:name="android.hardware.telephony" android:name="android.hardware.telephony"
@ -170,7 +169,6 @@
<activity android:name=".ActivityManageTriggerTethering" /> <activity android:name=".ActivityManageTriggerTethering" />
<activity android:name=".ActivityManageActionWakeLock" /> <activity android:name=".ActivityManageActionWakeLock" />
<activity android:name=".ActivityManageTriggerSubSystemState" /> <activity android:name=".ActivityManageTriggerSubSystemState" />
<activity android:name=".ActivityManageMakePhoneCall" />
<activity <activity
android:name=".ActivityMainTabLayout" android:name=".ActivityMainTabLayout"
android:launchMode="singleTask"> android:launchMode="singleTask">

View File

@ -6,6 +6,8 @@ import android.os.Build;
import android.util.Log; import android.util.Log;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.RequiresApi;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpGet;
@ -52,7 +54,6 @@ public class Action
sendBroadcast, sendBroadcast,
runExecutable, runExecutable,
wakelock, wakelock,
makePhoneCall,
sendTextMessage; sendTextMessage;
public String getFullName(Context context) public String getFullName(Context context)
@ -129,8 +130,6 @@ public class Action
return context.getResources().getString(R.string.runExecutable); return context.getResources().getString(R.string.runExecutable);
case wakelock: case wakelock:
return context.getResources().getString(R.string.keepDeviceAwake); return context.getResources().getString(R.string.keepDeviceAwake);
case makePhoneCall:
return context.getResources().getString(R.string.makePhoneCall);
default: default:
return "Unknown"; return "Unknown";
} }
@ -280,9 +279,6 @@ public class Action
case wakelock: case wakelock:
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.keepDeviceAwake) + " (" + String.valueOf(getParameter1()) + ")"); returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.keepDeviceAwake) + " (" + String.valueOf(getParameter1()) + ")");
break; break;
case makePhoneCall:
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.makePhoneCall) + " (" + String.valueOf(getParameter2()) + ")");
break;
default: default:
returnString.append(action.toString()); returnString.append(action.toString());
} }
@ -594,9 +590,6 @@ public class Action
else else
Actions.wakeLockStop(); Actions.wakeLockStop();
break; break;
case makePhoneCall:
Actions.makePhoneCall(context, this.getParameter2());
break;
default: default:
Miscellaneous.logEvent("w", "Action", context.getResources().getString(R.string.unknownActionSpecified), 3); Miscellaneous.logEvent("w", "Action", context.getResources().getString(R.string.unknownActionSpecified), 3);
break; break;

View File

@ -10,10 +10,13 @@ import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothProfile; import android.bluetooth.BluetoothProfile;
import android.content.ActivityNotFoundException; import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.media.AudioManager; import android.media.AudioManager;
import android.media.MediaPlayer; import android.media.MediaPlayer;
import android.media.session.MediaController;
import android.media.session.MediaSessionManager;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.net.Uri; import android.net.Uri;
import android.net.wifi.WifiManager; import android.net.wifi.WifiManager;
@ -23,6 +26,7 @@ import android.os.PowerManager.WakeLock;
import android.os.VibrationEffect; import android.os.VibrationEffect;
import android.os.Vibrator; import android.os.Vibrator;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification; import android.service.notification.StatusBarNotification;
import android.telephony.SmsManager; import android.telephony.SmsManager;
import android.telephony.SubscriptionManager; import android.telephony.SubscriptionManager;
@ -32,6 +36,7 @@ import android.view.KeyEvent;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import androidx.legacy.content.WakefulBroadcastReceiver;
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;
@ -39,6 +44,7 @@ import com.jens.automation2.location.WifiBroadcastReceiver;
import com.jens.automation2.receivers.ConnectivityReceiver; import com.jens.automation2.receivers.ConnectivityReceiver;
import com.jens.automation2.receivers.NotificationListener; import com.jens.automation2.receivers.NotificationListener;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.HttpClient; import org.apache.http.client.HttpClient;
import org.apache.http.conn.ClientConnectionManager; import org.apache.http.conn.ClientConnectionManager;
@ -65,6 +71,7 @@ import java.util.Calendar;
import java.util.Collections; import java.util.Collections;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -2185,12 +2192,4 @@ public class Actions
Miscellaneous.logEvent("i", "WakeLockStart", "Requesting stop.", 4); Miscellaneous.logEvent("i", "WakeLockStart", "Requesting stop.", 4);
wakeLockStopRequested = true; wakeLockStopRequested = true;
} }
public static void makePhoneCall(Context context, String phoneNumber)
{
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneNumber));
// intent.setClassName("com.android.phone","com.android.phone.OutgoingCallBroadcaster");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
context.startActivity(intent);
}
} }

View File

@ -1,54 +0,0 @@
package com.jens.automation2;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import androidx.annotation.Nullable;
import org.apache.commons.lang3.StringUtils;
public class ActivityManageMakePhoneCall extends Activity
{
EditText etTargetPhoneNumber;
Button bActionMakePhoneCallSave;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_manage_action_make_phone_call);
etTargetPhoneNumber = (EditText)findViewById(R.id.etTargetPhoneNumber);
bActionMakePhoneCallSave = (Button) findViewById(R.id.bActionMakePhoneCallSave);
Intent input = getIntent();
/*if(input.hasExtra(ActivityManageRule.intentNameActionParameter1))
rbActionWifiOn.setChecked(input.getBooleanExtra(ActivityManageRule.intentNameActionParameter1, true));
*/
if(input.hasExtra(ActivityManageRule.intentNameActionParameter2))
etTargetPhoneNumber.setText(input.getStringExtra(ActivityManageRule.intentNameActionParameter2));
bActionMakePhoneCallSave.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
if(!StringUtils.isEmpty(etTargetPhoneNumber.getText()))
{
Intent response = new Intent();
response.putExtra(ActivityManageRule.intentNameActionParameter1, false);
response.putExtra(ActivityManageRule.intentNameActionParameter2, etTargetPhoneNumber.getText().toString());
setResult(RESULT_OK, response);
finish();
}
else
Toast.makeText(ActivityManageMakePhoneCall.this, getResources().getText(R.string.enterPhoneNumber), Toast.LENGTH_SHORT).show();
}
});
}
}

View File

@ -133,8 +133,6 @@ public class ActivityManageRule extends Activity
final static int requestCodeActionWakeLockEdit = 820; final static int requestCodeActionWakeLockEdit = 820;
final static int requestCodeTriggerSubSystemStateAdd = 821; final static int requestCodeTriggerSubSystemStateAdd = 821;
final static int requestCodeTriggerSubSystemStateEdit = 822; final static int requestCodeTriggerSubSystemStateEdit = 822;
final static int requestCodeActionMakePhoneCallAdd = 823;
final static int requestCodeActionMakePhoneCallEdit = 824;
public static ActivityManageRule getInstance() public static ActivityManageRule getInstance()
{ {
@ -418,12 +416,6 @@ public class ActivityManageRule extends Activity
activityEditRunExecutableIntent.putExtra(intentNameActionParameter2, a.getParameter2()); activityEditRunExecutableIntent.putExtra(intentNameActionParameter2, a.getParameter2());
startActivityForResult(activityEditRunExecutableIntent, requestCodeActionRunExecutableEdit); startActivityForResult(activityEditRunExecutableIntent, requestCodeActionRunExecutableEdit);
break; break;
case makePhoneCall:
Intent activityEditMakePhoneCallIntent = new Intent(ActivityManageRule.this, ActivityManageMakePhoneCall.class);
activityEditMakePhoneCallIntent.putExtra(intentNameActionParameter1, a.getParameter1());
activityEditMakePhoneCallIntent.putExtra(intentNameActionParameter2, a.getParameter2());
startActivityForResult(activityEditMakePhoneCallIntent, requestCodeActionMakePhoneCallEdit);
break;
case setWifi: case setWifi:
Intent activityEditSetWifiIntent = new Intent(ActivityManageRule.this, ActivityManageActionWifi.class); Intent activityEditSetWifiIntent = new Intent(ActivityManageRule.this, ActivityManageActionWifi.class);
activityEditSetWifiIntent.putExtra(intentNameActionParameter1, a.getParameter1()); activityEditSetWifiIntent.putExtra(intentNameActionParameter1, a.getParameter1());
@ -1590,17 +1582,6 @@ public class ActivityManageRule extends Activity
this.refreshActionList(); this.refreshActionList();
} }
} }
else if(requestCode == requestCodeActionMakePhoneCallAdd)
{
if(resultCode == RESULT_OK)
{
newAction.setParentRule(ruleToEdit);
newAction.setParameter1(data.getBooleanExtra(intentNameActionParameter1, false));
newAction.setParameter2(data.getStringExtra(intentNameActionParameter2));
ruleToEdit.getActionSet().add(newAction);
this.refreshActionList();
}
}
else if(requestCode == requestCodeActionWakeLockAdd) else if(requestCode == requestCodeActionWakeLockAdd)
{ {
if(resultCode == RESULT_OK) if(resultCode == RESULT_OK)
@ -1711,21 +1692,6 @@ public class ActivityManageRule extends Activity
this.refreshActionList(); this.refreshActionList();
} }
} }
else if(requestCode == requestCodeActionMakePhoneCallEdit)
{
if(resultCode == RESULT_OK)
{
ruleToEdit.getActionSet().get(editIndex).setParentRule(ruleToEdit);
if(data.hasExtra(intentNameActionParameter1) && data.hasExtra(intentNameActionParameter2))
{
ruleToEdit.getActionSet().get(editIndex).setParameter1(data.getBooleanExtra(intentNameActionParameter1, false));
ruleToEdit.getActionSet().get(editIndex).setParameter2(data.getStringExtra(intentNameActionParameter2));
}
this.refreshActionList();
}
}
else if(requestCode == requestCodeActionSetWifiEdit) else if(requestCode == requestCodeActionSetWifiEdit)
{ {
if(resultCode == RESULT_OK) if(resultCode == RESULT_OK)
@ -2005,8 +1971,6 @@ public class ActivityManageRule extends Activity
items.add(new Item(typesLong[i].toString(), R.drawable.coffee)); items.add(new Item(typesLong[i].toString(), R.drawable.coffee));
else if(types[i].toString().equals(Action_Enum.runExecutable.toString())) else if(types[i].toString().equals(Action_Enum.runExecutable.toString()))
items.add(new Item(typesLong[i].toString(), R.drawable.script)); items.add(new Item(typesLong[i].toString(), R.drawable.script));
else if(types[i].toString().equals(Action_Enum.makePhoneCall.toString()))
items.add(new Item(typesLong[i].toString(), R.drawable.phone));
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))
@ -2179,12 +2143,6 @@ public class ActivityManageRule extends Activity
Intent intent = new Intent(ActivityManageRule.this, ActivityManageActionRunExecutable.class); Intent intent = new Intent(ActivityManageRule.this, ActivityManageActionRunExecutable.class);
startActivityForResult(intent, requestCodeActionRunExecutableAdd); startActivityForResult(intent, requestCodeActionRunExecutableAdd);
} }
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.makePhoneCall.toString()))
{
newAction.setAction(Action_Enum.makePhoneCall);
Intent intent = new Intent(ActivityManageRule.this, ActivityManageMakePhoneCall.class);
startActivityForResult(intent, requestCodeActionMakePhoneCallAdd);
}
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.wakelock.toString())) else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.wakelock.toString()))
{ {
newAction.setAction(Action_Enum.wakelock); newAction.setAction(Action_Enum.wakelock);

View File

@ -679,9 +679,6 @@ public class ActivityPermissions extends Activity
else else
addToArrayListUnique(Manifest.permission.BIND_DEVICE_ADMIN, requiredPermissions); addToArrayListUnique(Manifest.permission.BIND_DEVICE_ADMIN, requiredPermissions);
break; break;
case makePhoneCall:
addToArrayListUnique(Manifest.permission.CALL_PHONE, requiredPermissions);
break;
default: default:
break; break;
} }

View File

@ -1,63 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_margin="@dimen/default_margin" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_span="2"
android:textSize="25dp"
android:textStyle="bold"
android:layout_marginBottom="@dimen/default_margin"
android:text="@string/makePhoneCall"/>
<TextView
android:id="@+id/tvMakePhoneCallExplanation1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/makePhoneCallExplanation1" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/default_margin"
android:stretchColumns="1"
android:shrinkColumns="1" >
<TableRow
android:layout_marginTop="@dimen/default_margin">
<TextView
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/default_margin"
android:text="@string/phoneNumber" />
<EditText
android:id="@+id/etTargetPhoneNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
</TableLayout>
<Button
android:id="@+id/bActionMakePhoneCallSave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/default_margin"
android:text="@string/save" />
</LinearLayout>
</ScrollView>

View File

@ -851,7 +851,4 @@
<string name="type">Type</string> <string name="type">Type</string>
<string name="cable">Cable</string> <string name="cable">Cable</string>
<string name="tetheringBluetoothNotPossible">Bluetooth tethering can currently not be detected. Only the other means of connection will activate this trigger.</string> <string name="tetheringBluetoothNotPossible">Bluetooth tethering can currently not be detected. Only the other means of connection will activate this trigger.</string>
<string name="makePhoneCall">Make phone call</string>
<string name="android.permission.CALL_PHONE">Make phone call</string>
<string name="makePhoneCallExplanation1">Here you can enter a phone number that will be called without further prompts. You may use this to make settings like making adjustments to call routing, etc.. Please search for the codes required for this on your own.</string>
</resources> </resources>