Compare commits
5 Commits
b6015a3f2e
...
49d272be1e
Author | SHA1 | Date | |
---|---|---|---|
|
49d272be1e | ||
|
d9e54c7780 | ||
|
170dbbc7e8 | ||
3fc1dd1a26 | |||
|
0acb52099c |
@ -11,8 +11,8 @@ android {
|
|||||||
compileSdkVersion 31
|
compileSdkVersion 31
|
||||||
buildToolsVersion '29.0.2'
|
buildToolsVersion '29.0.2'
|
||||||
useLibrary 'org.apache.http.legacy'
|
useLibrary 'org.apache.http.legacy'
|
||||||
versionCode 127
|
versionCode 129
|
||||||
versionName "1.7.12"
|
versionName "1.7.13"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,8 @@
|
|||||||
<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-permission android:name="android.permission.CALL_PHONE" />
|
||||||
<uses-permission android:name="android.permission.ANSWER_PHONE_CALLS" />
|
<uses-permission android:name="android.permission.ANSWER_PHONE_CALLS" />
|
||||||
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||||
|
<uses-permission android:name="android.permission.READ_CALL_LOG" />
|
||||||
|
|
||||||
<uses-feature
|
<uses-feature
|
||||||
android:name="android.hardware.telephony"
|
android:name="android.hardware.telephony"
|
||||||
|
@ -66,6 +66,8 @@
|
|||||||
<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-permission android:name="android.permission.CALL_PHONE" />
|
||||||
<uses-permission android:name="android.permission.ANSWER_PHONE_CALLS" />
|
<uses-permission android:name="android.permission.ANSWER_PHONE_CALLS" />
|
||||||
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||||
|
<uses-permission android:name="android.permission.READ_CALL_LOG" />
|
||||||
|
|
||||||
<uses-feature
|
<uses-feature
|
||||||
android:name="android.hardware.telephony"
|
android:name="android.hardware.telephony"
|
||||||
|
@ -64,6 +64,8 @@
|
|||||||
<uses-permission android:name="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"/>
|
<uses-permission android:name="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"/>
|
||||||
<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.SYSTEM_ALERT_WINDOW" />
|
||||||
|
<uses-permission android:name="android.permission.READ_CALL_LOG" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
@ -25,6 +25,8 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import com.jens.automation2.receivers.NotificationListener;
|
import com.jens.automation2.receivers.NotificationListener;
|
||||||
|
|
||||||
|
import org.w3c.dom.DOMImplementationSource;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -48,6 +50,7 @@ public class ActivityPermissions extends Activity
|
|||||||
private static final int requestCodeForPermissionsDeviceAdmin = 12047;
|
private static final int requestCodeForPermissionsDeviceAdmin = 12047;
|
||||||
private static final int requestCodeForPermissionsBatteryOptimization = 12048;
|
private static final int requestCodeForPermissionsBatteryOptimization = 12048;
|
||||||
private static final int requestCodeForPermissionNotificationAccessAndroid13 = 12049;
|
private static final int requestCodeForPermissionNotificationAccessAndroid13 = 12049;
|
||||||
|
private static final int requestCodeForPermissionsManageOverlay = 12050;
|
||||||
protected String[] specificPermissionsToRequest = null;
|
protected String[] specificPermissionsToRequest = null;
|
||||||
|
|
||||||
public static String intentExtraName = "permissionsToBeRequested";
|
public static String intentExtraName = "permissionsToBeRequested";
|
||||||
@ -297,6 +300,10 @@ public class ActivityPermissions extends Activity
|
|||||||
String packageName = context.getApplicationContext().getPackageName();
|
String packageName = context.getApplicationContext().getPackageName();
|
||||||
return pm.isIgnoringBatteryOptimizations(packageName);
|
return pm.isIgnoringBatteryOptimizations(packageName);
|
||||||
}
|
}
|
||||||
|
else if (s.equals(Manifest.permission.SYSTEM_ALERT_WINDOW))
|
||||||
|
{
|
||||||
|
return android.provider.Settings.canDrawOverlays(Miscellaneous.getAnyContext());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int res = context.checkCallingOrSelfPermission(s);
|
int res = context.checkCallingOrSelfPermission(s);
|
||||||
@ -315,6 +322,11 @@ public class ActivityPermissions extends Activity
|
|||||||
return active;
|
return active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void requestOverlay()
|
||||||
|
{
|
||||||
|
Intent intent = new Intent(android.provider.Settings.ACTION_MANAGE_OVERLAY_PERMISSION);
|
||||||
|
ActivityPermissions.getInstance().startActivityForResult(intent, requestCodeForPermissionsManageOverlay);
|
||||||
|
}
|
||||||
public static void requestDeviceAdmin()
|
public static void requestDeviceAdmin()
|
||||||
{
|
{
|
||||||
if(!haveDeviceAdmin())
|
if(!haveDeviceAdmin())
|
||||||
@ -473,6 +485,7 @@ public class ActivityPermissions extends Activity
|
|||||||
case phoneCall:
|
case phoneCall:
|
||||||
addToArrayListUnique(Manifest.permission.READ_PHONE_STATE, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.READ_PHONE_STATE, requiredPermissions);
|
||||||
addToArrayListUnique(Manifest.permission.PROCESS_OUTGOING_CALLS, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.PROCESS_OUTGOING_CALLS, requiredPermissions);
|
||||||
|
addToArrayListUnique(Manifest.permission.READ_CALL_LOG, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case pointOfInterest:
|
case pointOfInterest:
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
||||||
@ -634,6 +647,8 @@ public class ActivityPermissions extends Activity
|
|||||||
// action.getParameter2().contains("eu.faircode.netguard.STOP_PORT_FORWARD")
|
// action.getParameter2().contains("eu.faircode.netguard.STOP_PORT_FORWARD")
|
||||||
// )
|
// )
|
||||||
// addToArrayListUnique("net.kollnig.missioncontrol.permission.ADMIN", requiredPermissions);
|
// addToArrayListUnique("net.kollnig.missioncontrol.permission.ADMIN", requiredPermissions);
|
||||||
|
if(Build.VERSION.SDK_INT >= 29)
|
||||||
|
addToArrayListUnique(Manifest.permission.SYSTEM_ALERT_WINDOW, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case triggerUrl:
|
case triggerUrl:
|
||||||
addToArrayListUnique(Manifest.permission.INTERNET, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.INTERNET, requiredPermissions);
|
||||||
@ -863,6 +878,7 @@ public class ActivityPermissions extends Activity
|
|||||||
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.PROCESS_OUTGOING_CALLS:
|
case Manifest.permission.PROCESS_OUTGOING_CALLS:
|
||||||
|
case Manifest.permission.READ_CALL_LOG:
|
||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.phoneCall))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.phoneCall))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
break;
|
break;
|
||||||
@ -890,6 +906,10 @@ public class ActivityPermissions extends Activity
|
|||||||
for(String ruleName : getRulesUsing(Action.Action_Enum.startPhoneCall))
|
for(String ruleName : getRulesUsing(Action.Action_Enum.startPhoneCall))
|
||||||
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.SYSTEM_ALERT_WINDOW:
|
||||||
|
for(String ruleName : getRulesUsing(Action.Action_Enum.startOtherActivity))
|
||||||
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
|
break;
|
||||||
case Manifest.permission.ANSWER_PHONE_CALLS:
|
case Manifest.permission.ANSWER_PHONE_CALLS:
|
||||||
for(String ruleName : getRulesUsing(Action.Action_Enum.stopPhoneCall))
|
for(String ruleName : getRulesUsing(Action.Action_Enum.stopPhoneCall))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
@ -988,6 +1008,10 @@ public class ActivityPermissions extends Activity
|
|||||||
if (requestCode == requestCodeForPermissionsBatteryOptimization)
|
if (requestCode == requestCodeForPermissionsBatteryOptimization)
|
||||||
if(havePermission(Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, ActivityPermissions.this))
|
if(havePermission(Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, ActivityPermissions.this))
|
||||||
requestPermissions(cachedPermissionsToRequest, true);
|
requestPermissions(cachedPermissionsToRequest, true);
|
||||||
|
|
||||||
|
if (requestCode == requestCodeForPermissionsManageOverlay)
|
||||||
|
if(havePermission(Manifest.permission.SYSTEM_ALERT_WINDOW, ActivityPermissions.this))
|
||||||
|
requestPermissions(cachedPermissionsToRequest, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1051,7 +1075,22 @@ public class ActivityPermissions extends Activity
|
|||||||
cachedPermissionsToRequest = requiredPermissions;
|
cachedPermissionsToRequest = requiredPermissions;
|
||||||
Intent intent = new Intent(android.provider.Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS);
|
Intent intent = new Intent(android.provider.Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS);
|
||||||
startActivityForResult(intent, requestCodeForPermissionsNotificationPolicy);
|
startActivityForResult(intent, requestCodeForPermissionsNotificationPolicy);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (s.equalsIgnoreCase(Manifest.permission.SYSTEM_ALERT_WINDOW))
|
||||||
|
{
|
||||||
|
AlertDialog diag = Miscellaneous.messageBox(getResources().getString(R.string.info), getResources().getString(R.string.overlayPermissionHint), ActivityPermissions.this);
|
||||||
|
diag.setOnDismissListener(new DialogInterface.OnDismissListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onDismiss(DialogInterface dialogInterface)
|
||||||
|
{
|
||||||
|
requiredPermissions.remove(s);
|
||||||
|
cachedPermissionsToRequest = requiredPermissions;
|
||||||
|
requestOverlay();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
diag.show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (s.equalsIgnoreCase(Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE))
|
else if (s.equalsIgnoreCase(Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE))
|
||||||
|
@ -3,11 +3,9 @@ package com.jens.automation2.receivers;
|
|||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.bluetooth.BluetoothDevice;
|
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Parcelable;
|
|
||||||
import android.service.notification.NotificationListenerService;
|
import android.service.notification.NotificationListenerService;
|
||||||
import android.service.notification.StatusBarNotification;
|
import android.service.notification.StatusBarNotification;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
@ -6,10 +6,15 @@ import android.content.BroadcastReceiver;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
|
import android.net.ConnectivityManager;
|
||||||
|
import android.os.Build;
|
||||||
import android.telephony.PhoneStateListener;
|
import android.telephony.PhoneStateListener;
|
||||||
|
import android.telephony.TelephonyCallback;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.RequiresApi;
|
||||||
|
|
||||||
import com.jens.automation2.ActivityPermissions;
|
import com.jens.automation2.ActivityPermissions;
|
||||||
import com.jens.automation2.AutomationService;
|
import com.jens.automation2.AutomationService;
|
||||||
import com.jens.automation2.Miscellaneous;
|
import com.jens.automation2.Miscellaneous;
|
||||||
@ -22,6 +27,7 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
public class PhoneStatusListener implements AutomationListenerInterface
|
public class PhoneStatusListener implements AutomationListenerInterface
|
||||||
{
|
{
|
||||||
|
static int problematicAndroidLevel = 29;
|
||||||
protected static String lastPhoneNumber="";
|
protected static String lastPhoneNumber="";
|
||||||
protected static int lastPhoneDirection = -1; //0=incoming, 1=outgoing
|
protected static int lastPhoneDirection = -1; //0=incoming, 1=outgoing
|
||||||
protected static int currentState = -1;
|
protected static int currentState = -1;
|
||||||
@ -70,7 +76,76 @@ public class PhoneStatusListener implements AutomationListenerInterface
|
|||||||
return currentState;
|
return currentState;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class IncomingCallsReceiver extends PhoneStateListener
|
public static interface IncomingCallsReceiver
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static void workWithIncomingCallData(int state, String incomingNumber)
|
||||||
|
{
|
||||||
|
if(lastPhoneDirection == 2 && currentState != TelephonyManager.CALL_STATE_IDLE)
|
||||||
|
{
|
||||||
|
// This status update is actually for an outgoing call
|
||||||
|
setCurrentState(state);
|
||||||
|
|
||||||
|
if(incomingNumber != null && incomingNumber.length() > 0) // check for null in case call comes in with suppressed number.
|
||||||
|
setLastPhoneNumber(incomingNumber);
|
||||||
|
|
||||||
|
switch(state)
|
||||||
|
{
|
||||||
|
case TelephonyManager.CALL_STATE_IDLE:
|
||||||
|
Miscellaneous.logEvent("i", "Call state", "New call state: CALL_STATE_IDLE", 4);
|
||||||
|
break;
|
||||||
|
case TelephonyManager.CALL_STATE_OFFHOOK:
|
||||||
|
Miscellaneous.logEvent("i", "Call state", "New call state: CALL_STATE_OFFHOOK", 4);
|
||||||
|
break;
|
||||||
|
case TelephonyManager.CALL_STATE_RINGING:
|
||||||
|
Miscellaneous.logEvent("i", "Call state", String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.outgoingCallTo), incomingNumber), 4);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.phoneCall);
|
||||||
|
for(int i=0; i<ruleCandidates.size(); i++)
|
||||||
|
{
|
||||||
|
AutomationService asInstance = AutomationService.getInstance();
|
||||||
|
if(asInstance != null)
|
||||||
|
if(ruleCandidates.get(i).getsGreenLight(asInstance))
|
||||||
|
ruleCandidates.get(i).activate(asInstance, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setCurrentState(state);
|
||||||
|
setLastPhoneDirection(1);
|
||||||
|
|
||||||
|
if (incomingNumber != null && incomingNumber.length() > 0) // check for null in case call comes in with suppressed number.
|
||||||
|
setLastPhoneNumber(incomingNumber);
|
||||||
|
|
||||||
|
switch (state)
|
||||||
|
{
|
||||||
|
case TelephonyManager.CALL_STATE_IDLE:
|
||||||
|
Miscellaneous.logEvent("i", "Call state", "New call state: CALL_STATE_IDLE", 4);
|
||||||
|
break;
|
||||||
|
case TelephonyManager.CALL_STATE_OFFHOOK:
|
||||||
|
Miscellaneous.logEvent("i", "Call state", "New call state: CALL_STATE_OFFHOOK", 4);
|
||||||
|
break;
|
||||||
|
case TelephonyManager.CALL_STATE_RINGING:
|
||||||
|
Miscellaneous.logEvent("i", "Call state", String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.incomingCallFrom), incomingNumber), 4);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.phoneCall);
|
||||||
|
for (int i = 0; i < ruleCandidates.size(); i++)
|
||||||
|
{
|
||||||
|
AutomationService asInstance = AutomationService.getInstance();
|
||||||
|
if (asInstance != null)
|
||||||
|
if (ruleCandidates.get(i).getsGreenLight(asInstance))
|
||||||
|
ruleCandidates.get(i).activate(asInstance, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class IncomingCallsReceiverOld extends PhoneStateListener implements IncomingCallsReceiver
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onCallStateChanged(int state, String incomingNumber)
|
public void onCallStateChanged(int state, String incomingNumber)
|
||||||
@ -86,65 +161,42 @@ public class PhoneStatusListener implements AutomationListenerInterface
|
|||||||
If the last call was outgoing the state has not changed to idle this is kind of a fake alert.
|
If the last call was outgoing the state has not changed to idle this is kind of a fake alert.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(lastPhoneDirection == 2 && currentState != TelephonyManager.CALL_STATE_IDLE)
|
workWithIncomingCallData(state, incomingNumber);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.S)
|
||||||
|
public static class IncomingCallsReceiverNew extends BroadcastReceiver implements IncomingCallsReceiver
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
this code detects both incoming and outgoing,
|
||||||
|
if the state changes idle => ringing you know it's an incoming call,
|
||||||
|
if the state changes idle => offhook, you know it's an outgoing call
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!intent.getAction().equals(Intent.ACTION_NEW_OUTGOING_CALL))
|
||||||
{
|
{
|
||||||
// This status update is actually for an outgoing call
|
String stateStr = intent.getExtras().getString(TelephonyManager.EXTRA_STATE);
|
||||||
setCurrentState(state);
|
int state = 99;
|
||||||
|
|
||||||
if(incomingNumber != null && incomingNumber.length() > 0) // check for null in case call comes in with suppressed number.
|
switch(stateStr)
|
||||||
setLastPhoneNumber(incomingNumber);
|
|
||||||
|
|
||||||
switch(state)
|
|
||||||
{
|
{
|
||||||
case TelephonyManager.CALL_STATE_IDLE:
|
case "RINGING":
|
||||||
Miscellaneous.logEvent("i", "Call state", "New call state: CALL_STATE_IDLE", 4);
|
state = TelephonyManager.CALL_STATE_RINGING;
|
||||||
break;
|
break;
|
||||||
case TelephonyManager.CALL_STATE_OFFHOOK:
|
case "IDLE":
|
||||||
Miscellaneous.logEvent("i", "Call state", "New call state: CALL_STATE_OFFHOOK", 4);
|
state = TelephonyManager.CALL_STATE_IDLE;
|
||||||
break;
|
break;
|
||||||
case TelephonyManager.CALL_STATE_RINGING:
|
case "OFFHOOK":
|
||||||
Miscellaneous.logEvent("i", "Call state", String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.outgoingCallTo), incomingNumber), 4);
|
state = TelephonyManager.CALL_STATE_OFFHOOK;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.phoneCall);
|
String number = intent.getExtras().getString(TelephonyManager.EXTRA_INCOMING_NUMBER);
|
||||||
for(int i=0; i<ruleCandidates.size(); i++)
|
Log.i("test", "test");
|
||||||
{
|
|
||||||
AutomationService asInstance = AutomationService.getInstance();
|
|
||||||
if(asInstance != null)
|
|
||||||
if(ruleCandidates.get(i).getsGreenLight(asInstance))
|
|
||||||
ruleCandidates.get(i).activate(asInstance, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setCurrentState(state);
|
|
||||||
setLastPhoneDirection(1);
|
|
||||||
|
|
||||||
if (incomingNumber != null && incomingNumber.length() > 0) // check for null in case call comes in with suppressed number.
|
|
||||||
setLastPhoneNumber(incomingNumber);
|
|
||||||
|
|
||||||
switch (state)
|
|
||||||
{
|
|
||||||
case TelephonyManager.CALL_STATE_IDLE:
|
|
||||||
Miscellaneous.logEvent("i", "Call state", "New call state: CALL_STATE_IDLE", 4);
|
|
||||||
break;
|
|
||||||
case TelephonyManager.CALL_STATE_OFFHOOK:
|
|
||||||
Miscellaneous.logEvent("i", "Call state", "New call state: CALL_STATE_OFFHOOK", 4);
|
|
||||||
break;
|
|
||||||
case TelephonyManager.CALL_STATE_RINGING:
|
|
||||||
Miscellaneous.logEvent("i", "Call state", String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.incomingCallFrom), incomingNumber), 4);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.phoneCall);
|
|
||||||
for (int i = 0; i < ruleCandidates.size(); i++)
|
|
||||||
{
|
|
||||||
AutomationService asInstance = AutomationService.getInstance();
|
|
||||||
if (asInstance != null)
|
|
||||||
if (ruleCandidates.get(i).getsGreenLight(asInstance))
|
|
||||||
ruleCandidates.get(i).activate(asInstance, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -201,7 +253,12 @@ public class PhoneStatusListener implements AutomationListenerInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(incomingCallsReceiverInstance == null)
|
if(incomingCallsReceiverInstance == null)
|
||||||
incomingCallsReceiverInstance = new IncomingCallsReceiver();
|
{
|
||||||
|
// if(Build.VERSION.SDK_INT >= 31)
|
||||||
|
// incomingCallsReceiverInstance = new IncomingCallsReceiverNew();
|
||||||
|
// else
|
||||||
|
incomingCallsReceiverInstance = new IncomingCallsReceiverOld();
|
||||||
|
}
|
||||||
|
|
||||||
if(outgoingCallsReceiverInstance == null)
|
if(outgoingCallsReceiverInstance == null)
|
||||||
outgoingCallsReceiverInstance = new OutgoingCallsReceiver();
|
outgoingCallsReceiverInstance = new OutgoingCallsReceiver();
|
||||||
@ -211,8 +268,17 @@ public class PhoneStatusListener implements AutomationListenerInterface
|
|||||||
if(!incomingCallsReceiverActive)
|
if(!incomingCallsReceiverActive)
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", "PhoneStatusListener", "Starting PhoneStatusListener->incomingCallsReceiver", 4);
|
Miscellaneous.logEvent("i", "PhoneStatusListener", "Starting PhoneStatusListener->incomingCallsReceiver", 4);
|
||||||
TelephonyManager tm = (TelephonyManager)automationService.getSystemService(Context.TELEPHONY_SERVICE);
|
// if(Build.VERSION.SDK_INT >= problematicAndroidLevel)
|
||||||
tm.listen(incomingCallsReceiverInstance, PhoneStateListener.LISTEN_CALL_STATE);
|
// {
|
||||||
|
// IntentFilter callsFilter = new IntentFilter();
|
||||||
|
// callsFilter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
|
||||||
|
// automationService.registerReceiver((IncomingCallsReceiverNew)incomingCallsReceiverInstance, callsFilter);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
TelephonyManager tm = (TelephonyManager) automationService.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
|
tm.listen((IncomingCallsReceiverOld)incomingCallsReceiverInstance, PhoneStateListener.LISTEN_CALL_STATE);
|
||||||
|
// }
|
||||||
incomingCallsReceiverActive = true;
|
incomingCallsReceiverActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,8 +302,15 @@ public class PhoneStatusListener implements AutomationListenerInterface
|
|||||||
if(incomingCallsReceiverActive)
|
if(incomingCallsReceiverActive)
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", "PhoneStatusListener", "Stopping phoneStatusListener", 4);
|
Miscellaneous.logEvent("i", "PhoneStatusListener", "Stopping phoneStatusListener", 4);
|
||||||
TelephonyManager tm = (TelephonyManager)automationService.getSystemService(Context.TELEPHONY_SERVICE);
|
// if(Build.VERSION.SDK_INT >= 31)
|
||||||
tm.listen(incomingCallsReceiverInstance, PhoneStateListener.LISTEN_NONE);
|
// {
|
||||||
|
// automationService.unregisterReceiver((IncomingCallsReceiverNew)incomingCallsReceiverInstance);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
TelephonyManager tm = (TelephonyManager) automationService.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
|
tm.listen((IncomingCallsReceiverOld)incomingCallsReceiverInstance, PhoneStateListener.LISTEN_NONE);
|
||||||
|
// }
|
||||||
incomingCallsReceiverActive = false;
|
incomingCallsReceiverActive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -793,4 +793,7 @@
|
|||||||
<string name="wifiMonitoringAlsoRequiresThis">Diese Berechtigung wird auch benötigt, wenn man die aktuelle WLAN Verbindung auslesen möchte.</string>
|
<string name="wifiMonitoringAlsoRequiresThis">Diese Berechtigung wird auch benötigt, wenn man die aktuelle WLAN Verbindung auslesen möchte.</string>
|
||||||
<string name="copyTextToClipboard">Text in die Zwischenablage kopieren</string>
|
<string name="copyTextToClipboard">Text in die Zwischenablage kopieren</string>
|
||||||
<string name="textToCopy">Text, der kopiert werden soll</string>
|
<string name="textToCopy">Text, der kopiert werden soll</string>
|
||||||
|
<string name="android.permission.SYSTEM_ALERT_WINDOW">Über anderen Anwendungen anzeigen</string>
|
||||||
|
<string name="overlayPermissionHint">Nachdem Sie auf OK geklickt haben, werden Sie zu einem Systemdialog weitergeleitet. Bitte wählen Sie dort Automation aus und erlauben Sie die Anzeige über anderen Apps.</string>
|
||||||
|
<string name="overlayPermissionHint">Nachdem Sie auf OK geklickt haben, werden Sie zu einem Systemdialog weitergeleitet. Bitte wählen Sie dort Automatisierung aus und lassen Sie das Zeichnen über andere Apps zu.</string>
|
||||||
</resources>
|
</resources>
|
@ -792,4 +792,6 @@
|
|||||||
<string name="wifiMonitoringAlsoRequiresThis">Este permiso también es necesario si el disparador está utilizando la conexión wifi actual.</string>
|
<string name="wifiMonitoringAlsoRequiresThis">Este permiso también es necesario si el disparador está utilizando la conexión wifi actual.</string>
|
||||||
<string name="copyTextToClipboard">Copiar texto al portapapeles</string>
|
<string name="copyTextToClipboard">Copiar texto al portapapeles</string>
|
||||||
<string name="textToCopy">Texto para copiar</string>
|
<string name="textToCopy">Texto para copiar</string>
|
||||||
|
<string name="android.permission.SYSTEM_ALERT_WINDOW">Dibujar encima otras aplicaciones</string>
|
||||||
|
<string name="overlayPermissionHint">Después de hacer cliquear en Aceptar, se le enviará a un cuadro de diálogo del sistema. Seleccione Automation allí y permita dibujar encima otras aplicaciones.</string>
|
||||||
</resources>
|
</resources>
|
@ -792,4 +792,6 @@
|
|||||||
<string name="wifiMonitoringAlsoRequiresThis">Cette autorisation est également requise si le déclencheur utilise la connexion wifi actuelle.</string>
|
<string name="wifiMonitoringAlsoRequiresThis">Cette autorisation est également requise si le déclencheur utilise la connexion wifi actuelle.</string>
|
||||||
<string name="copyTextToClipboard">Copier du texte dans le presse-papiers</string>
|
<string name="copyTextToClipboard">Copier du texte dans le presse-papiers</string>
|
||||||
<string name="textToCopy">Texte à copier</string>
|
<string name="textToCopy">Texte à copier</string>
|
||||||
|
<string name="android.permission.SYSTEM_ALERT_WINDOW">Dessiner sur d\'autres applications</string>
|
||||||
|
<string name="overlayPermissionHint">Après avoir cliqué sur OK, vous serez redirigé vers une boîte de dialogue système. Veuillez sélectionner Automatisation et autoriser le tirage sur d\'autres applications.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -793,4 +793,6 @@
|
|||||||
<string name="wifiMonitoringAlsoRequiresThis">Questa autorizzazione è necessaria anche se il trigger utilizza la connessione wifi corrente.</string>
|
<string name="wifiMonitoringAlsoRequiresThis">Questa autorizzazione è necessaria anche se il trigger utilizza la connessione wifi corrente.</string>
|
||||||
<string name="copyTextToClipboard">Copiare testo negli appunti</string>
|
<string name="copyTextToClipboard">Copiare testo negli appunti</string>
|
||||||
<string name="textToCopy">Testo da copiare</string>
|
<string name="textToCopy">Testo da copiare</string>
|
||||||
|
<string name="android.permission.SYSTEM_ALERT_WINDOW">Disegna su altre app</string>
|
||||||
|
<string name="overlayPermissionHint">Dopo aver fatto clic su OK, verrai indirizzato a una finestra di dialogo di sistema. Seleziona Automazione lì e consenti il disegno su altre app.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -791,5 +791,7 @@
|
|||||||
<string name="wifiMonitoringAlsoRequiresThis">Deze toestemming is ook vereist als de trigger de huidige wifi-verbinding gebruikt.</string>
|
<string name="wifiMonitoringAlsoRequiresThis">Deze toestemming is ook vereist als de trigger de huidige wifi-verbinding gebruikt.</string>
|
||||||
<string name="copyTextToClipboard">Tekst naar klembord kopiëren</string>
|
<string name="copyTextToClipboard">Tekst naar klembord kopiëren</string>
|
||||||
<string name="textToCopy">Tekst om te kopiëren</string>
|
<string name="textToCopy">Tekst om te kopiëren</string>
|
||||||
|
<string name="android.permission.SYSTEM_ALERT_WINDOW">Tekenen over andere apps</string>
|
||||||
|
<string name="overlayPermissionHint">Nadat u op OK hebt geklikt, wordt u naar een systeemdialoogvenster gestuurd. Selecteer daar Automatisering en sta tekenen toe over andere apps.</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -850,4 +850,6 @@
|
|||||||
<string name="wifiMonitoringAlsoRequiresThis">Это разрешение также требуется, если триггер использует текущее соединение Wi-Fi.</string>
|
<string name="wifiMonitoringAlsoRequiresThis">Это разрешение также требуется, если триггер использует текущее соединение Wi-Fi.</string>
|
||||||
<string name="copyTextToClipboard">Копирование текста в буфер обмена</string>
|
<string name="copyTextToClipboard">Копирование текста в буфер обмена</string>
|
||||||
<string name="textToCopy">Текст для копирования</string>
|
<string name="textToCopy">Текст для копирования</string>
|
||||||
|
<string name="android.permission.SYSTEM_ALERT_WINDOW">Рисование поверх других приложений</string>
|
||||||
|
<string name="overlayPermissionHint">После нажатия кнопки «ОК» вы попадете в системный диалог. Пожалуйста, выберите там «Автоматизация» и разрешите рисовать поверх других приложений.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -882,4 +882,6 @@
|
|||||||
<string name="wifiMonitoringAlsoRequiresThis">This permission is also required if the trigger is using the current wifi connection.</string>
|
<string name="wifiMonitoringAlsoRequiresThis">This permission is also required if the trigger is using the current wifi connection.</string>
|
||||||
<string name="copyTextToClipboard">Copy text to clipboard</string>
|
<string name="copyTextToClipboard">Copy text to clipboard</string>
|
||||||
<string name="textToCopy">Text to copy</string>
|
<string name="textToCopy">Text to copy</string>
|
||||||
|
<string name="android.permission.SYSTEM_ALERT_WINDOW">Draw over other apps</string>
|
||||||
|
<string name="overlayPermissionHint">After clicking OK you\'ll be sent to a system dialog. Please select Automation there and allow "draw over other apps".</string>
|
||||||
</resources>
|
</resources>
|
2
fastlane/metadata/android/en-US/changelogs/129.txt
Normal file
2
fastlane/metadata/android/en-US/changelogs/129.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
* Fixed: Introduced overlay permission to enable startActivity() to work from the background
|
||||||
|
* Fixed: Phone number available as variable again (permission READ_CALL_LOGS required)
|
Loading…
Reference in New Issue
Block a user