forked from jens/Automation
Phone Listener changed.
This commit is contained in:
parent
191ad904a3
commit
3844079781
@ -609,13 +609,11 @@ public class Rule implements Comparable<Rule>
|
|||||||
{
|
{
|
||||||
//if(PhoneStatusListener.isInACall() == oneTrigger.getTriggerParameter())
|
//if(PhoneStatusListener.isInACall() == oneTrigger.getTriggerParameter())
|
||||||
if(
|
if(
|
||||||
elements[0].equals(Trigger.triggerPhoneCallStateAny)
|
(elements[0].equals(Trigger.triggerPhoneCallStateRinging) && PhoneStatusListener.getCurrentState() == TelephonyManager.CALL_STATE_RINGING)
|
||||||
||
|
||
|
||||||
(elements[0].equals(Trigger.triggerPhoneCallStateRinging) && PhoneStatusListener.getLastState() == TelephonyManager.CALL_STATE_RINGING)
|
(elements[0].equals(Trigger.triggerPhoneCallStateStarted) && PhoneStatusListener.getCurrentState() == TelephonyManager.CALL_STATE_OFFHOOK)
|
||||||
||
|
||
|
||||||
(elements[0].equals(Trigger.triggerPhoneCallStateStarted) && PhoneStatusListener.getLastState() == TelephonyManager.CALL_STATE_OFFHOOK)
|
(elements[0].equals(Trigger.triggerPhoneCallStateStopped) && PhoneStatusListener.getCurrentState() == TelephonyManager.CALL_STATE_IDLE)
|
||||||
||
|
|
||||||
(elements[0].equals(Trigger.triggerPhoneCallStateStopped) && PhoneStatusListener.getLastState() == TelephonyManager.CALL_STATE_IDLE)
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if(
|
if(
|
||||||
@ -1362,28 +1360,28 @@ public class Rule implements Comparable<Rule>
|
|||||||
return ruleCandidates;
|
return ruleCandidates;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<Rule> findRuleCandidatesByPhoneCall(boolean triggerParameter)
|
// public static ArrayList<Rule> findRuleCandidatesByPhoneCall()
|
||||||
{
|
// {
|
||||||
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
// ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
||||||
|
//
|
||||||
for(Rule oneRule : ruleCollection)
|
// for(Rule oneRule : ruleCollection)
|
||||||
{
|
// {
|
||||||
innerloop:
|
// innerloop:
|
||||||
for(Trigger oneTrigger : oneRule.getTriggerSet())
|
// for(Trigger oneTrigger : oneRule.getTriggerSet())
|
||||||
{
|
// {
|
||||||
if(oneTrigger.getTriggerType() == Trigger.Trigger_Enum.phoneCall)
|
// if(oneTrigger.getTriggerType() == Trigger.Trigger_Enum.phoneCall)
|
||||||
{
|
// {
|
||||||
if(oneTrigger.getTriggerParameter() == triggerParameter)
|
// if(oneTrigger.getTriggerParameter() == triggerParameter)
|
||||||
{
|
// {
|
||||||
ruleCandidates.add(oneRule);
|
// ruleCandidates.add(oneRule);
|
||||||
break innerloop; //we don't need to search the other triggers in the same rule
|
// break innerloop; //we don't need to search the other triggers in the same rule
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return ruleCandidates;
|
// return ruleCandidates;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public static ArrayList<Rule> findRuleCandidatesByNfc()
|
public static ArrayList<Rule> findRuleCandidatesByNfc()
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,7 @@ public class ActivityManageTriggerPhoneCall extends Activity
|
|||||||
ProgressDialog progressDialog = null;
|
ProgressDialog progressDialog = null;
|
||||||
|
|
||||||
EditText etTriggerPhoneCallPhoneNumber;
|
EditText etTriggerPhoneCallPhoneNumber;
|
||||||
RadioButton rbTriggerPhoneCallStateAny, rbTriggerPhoneCallStateRinging, rbTriggerPhoneCallStateStarted, rbTriggerPhoneCallStateStopped, rbTriggerPhoneCallDirectionAny, rbTriggerPhoneCallDirectionIncoming, rbTriggerPhoneCallDirectionOutgoing;
|
RadioButton rbTriggerPhoneCallStateRinging, rbTriggerPhoneCallStateStarted, rbTriggerPhoneCallStateStopped, rbTriggerPhoneCallDirectionAny, rbTriggerPhoneCallDirectionIncoming, rbTriggerPhoneCallDirectionOutgoing;
|
||||||
Button bSaveTriggerPhoneCall, bTriggerPhoneCallImportFromContacts;
|
Button bSaveTriggerPhoneCall, bTriggerPhoneCallImportFromContacts;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -29,7 +29,6 @@ public class ActivityManageTriggerPhoneCall extends Activity
|
|||||||
setContentView(R.layout.activity_manage_trigger_phone_call);
|
setContentView(R.layout.activity_manage_trigger_phone_call);
|
||||||
|
|
||||||
etTriggerPhoneCallPhoneNumber = (EditText)findViewById(R.id.etTriggerPhoneCallPhoneNumber);
|
etTriggerPhoneCallPhoneNumber = (EditText)findViewById(R.id.etTriggerPhoneCallPhoneNumber);
|
||||||
rbTriggerPhoneCallStateAny = (RadioButton)findViewById(R.id.rbTriggerPhoneCallStateAny);
|
|
||||||
rbTriggerPhoneCallStateRinging = (RadioButton)findViewById(R.id.rbTriggerPhoneCallStateRinging);
|
rbTriggerPhoneCallStateRinging = (RadioButton)findViewById(R.id.rbTriggerPhoneCallStateRinging);
|
||||||
rbTriggerPhoneCallStateStarted = (RadioButton)findViewById(R.id.rbTriggerPhoneCallStateStarted);
|
rbTriggerPhoneCallStateStarted = (RadioButton)findViewById(R.id.rbTriggerPhoneCallStateStarted);
|
||||||
rbTriggerPhoneCallStateStopped = (RadioButton)findViewById(R.id.rbTriggerPhoneCallStateStopped);
|
rbTriggerPhoneCallStateStopped = (RadioButton)findViewById(R.id.rbTriggerPhoneCallStateStopped);
|
||||||
@ -46,9 +45,7 @@ public class ActivityManageTriggerPhoneCall extends Activity
|
|||||||
{
|
{
|
||||||
String tp2Result = "";
|
String tp2Result = "";
|
||||||
|
|
||||||
if(rbTriggerPhoneCallStateAny.isChecked())
|
if(rbTriggerPhoneCallStateRinging.isChecked())
|
||||||
tp2Result += Trigger.triggerPhoneCallStateAny;
|
|
||||||
else if(rbTriggerPhoneCallStateRinging.isChecked())
|
|
||||||
tp2Result += Trigger.triggerPhoneCallStateRinging;
|
tp2Result += Trigger.triggerPhoneCallStateRinging;
|
||||||
else if(rbTriggerPhoneCallStateStarted.isChecked())
|
else if(rbTriggerPhoneCallStateStarted.isChecked())
|
||||||
tp2Result += Trigger.triggerPhoneCallStateStarted;
|
tp2Result += Trigger.triggerPhoneCallStateStarted;
|
||||||
@ -101,9 +98,7 @@ public class ActivityManageTriggerPhoneCall extends Activity
|
|||||||
{
|
{
|
||||||
String[] parts = editedPhoneCallTrigger.getTriggerParameter2().split(triggerParameter2Split);
|
String[] parts = editedPhoneCallTrigger.getTriggerParameter2().split(triggerParameter2Split);
|
||||||
|
|
||||||
if(parts[0].equals(Trigger.triggerPhoneCallStateAny))
|
if(parts[0].equals(Trigger.triggerPhoneCallStateRinging))
|
||||||
rbTriggerPhoneCallStateAny.setChecked(true);
|
|
||||||
else if(parts[0].equals(Trigger.triggerPhoneCallStateRinging))
|
|
||||||
rbTriggerPhoneCallStateRinging.setChecked(true);
|
rbTriggerPhoneCallStateRinging.setChecked(true);
|
||||||
else if(parts[0].equals(Trigger.triggerPhoneCallStateStarted))
|
else if(parts[0].equals(Trigger.triggerPhoneCallStateStarted))
|
||||||
rbTriggerPhoneCallStateStarted.setChecked(true);
|
rbTriggerPhoneCallStateStarted.setChecked(true);
|
||||||
|
@ -80,7 +80,6 @@ public class Trigger
|
|||||||
public static String triggerPhoneCallStateRinging = "ringing";
|
public static String triggerPhoneCallStateRinging = "ringing";
|
||||||
public static String triggerPhoneCallStateStarted = "started";
|
public static String triggerPhoneCallStateStarted = "started";
|
||||||
public static String triggerPhoneCallStateStopped = "stopped";
|
public static String triggerPhoneCallStateStopped = "stopped";
|
||||||
public static String triggerPhoneCallStateAny = "any";
|
|
||||||
public static String triggerPhoneCallDirectionIncoming = "incoming";
|
public static String triggerPhoneCallDirectionIncoming = "incoming";
|
||||||
public static String triggerPhoneCallDirectionOutgoing = "outgoing";
|
public static String triggerPhoneCallDirectionOutgoing = "outgoing";
|
||||||
public static String triggerPhoneCallDirectionAny = "any";
|
public static String triggerPhoneCallDirectionAny = "any";
|
||||||
@ -370,9 +369,7 @@ public class Trigger
|
|||||||
|
|
||||||
returnString.append(" ");
|
returnString.append(" ");
|
||||||
|
|
||||||
if(elements[0].equals(Trigger.triggerPhoneCallStateAny))
|
if(elements[0].equals(Trigger.triggerPhoneCallStateRinging))
|
||||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.any) + " " + Miscellaneous.getAnyContext().getResources().getString(R.string.state));
|
|
||||||
else if(elements[0].equals(Trigger.triggerPhoneCallStateRinging))
|
|
||||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.ringing));
|
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.ringing));
|
||||||
else if(elements[0].equals(Trigger.triggerPhoneCallStateStarted))
|
else if(elements[0].equals(Trigger.triggerPhoneCallStateStarted))
|
||||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.started));
|
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.started));
|
||||||
|
@ -260,8 +260,8 @@ public class XmlFileInterface
|
|||||||
serializer.text(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getProcessName());
|
serializer.text(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getProcessName());
|
||||||
else if(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getTriggerType() == Trigger_Enum.batteryLevel)
|
else if(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getTriggerType() == Trigger_Enum.batteryLevel)
|
||||||
serializer.text(String.valueOf(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getBatteryLevel()));
|
serializer.text(String.valueOf(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getBatteryLevel()));
|
||||||
else if(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getTriggerType() == Trigger_Enum.phoneCall)
|
// else if(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getTriggerType() == Trigger_Enum.phoneCall)
|
||||||
serializer.text(String.valueOf(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getPhoneDirection()) + "," + String.valueOf(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getPhoneNumber()));
|
// serializer.text(String.valueOf(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getPhoneDirection()) + "," + String.valueOf(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getPhoneNumber()));
|
||||||
else if(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getTriggerType() == Trigger_Enum.nfcTag)
|
else if(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getTriggerType() == Trigger_Enum.nfcTag)
|
||||||
serializer.text(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getNfcTagId());
|
serializer.text(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getNfcTagId());
|
||||||
else if(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getTriggerType() == Trigger_Enum.activityDetection)
|
else if(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getTriggerType() == Trigger_Enum.activityDetection)
|
||||||
@ -275,6 +275,8 @@ public class XmlFileInterface
|
|||||||
serializer.text(String.valueOf(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getHeadphoneType()));
|
serializer.text(String.valueOf(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getHeadphoneType()));
|
||||||
else if(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getTriggerType() == Trigger_Enum.notification)
|
else if(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getTriggerType() == Trigger_Enum.notification)
|
||||||
serializer.text(String.valueOf(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getTriggerParameter2()));
|
serializer.text(String.valueOf(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getTriggerParameter2()));
|
||||||
|
else
|
||||||
|
serializer.text(String.valueOf(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getTriggerParameter2()));
|
||||||
serializer.endTag(null, "TriggerParameter2");
|
serializer.endTag(null, "TriggerParameter2");
|
||||||
serializer.endTag(null, "Trigger");
|
serializer.endTag(null, "Trigger");
|
||||||
}
|
}
|
||||||
@ -925,7 +927,7 @@ public class XmlFileInterface
|
|||||||
else if(newTrigger.getTriggerType() == Trigger_Enum.phoneCall)
|
else if(newTrigger.getTriggerType() == Trigger_Enum.phoneCall)
|
||||||
{
|
{
|
||||||
String[] elements = triggerParameter2.split(",");
|
String[] elements = triggerParameter2.split(",");
|
||||||
if(elements.length < 3) //old format
|
if(elements.length > 3 && elements.length < 3) //old format
|
||||||
{
|
{
|
||||||
// 0/1/2,number
|
// 0/1/2,number
|
||||||
int direction = Integer.parseInt(elements[0]);
|
int direction = Integer.parseInt(elements[0]);
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
package com.jens.automation2.receivers;
|
package com.jens.automation2.receivers;
|
||||||
|
|
||||||
|
import android.app.Service;
|
||||||
import android.content.BroadcastReceiver;
|
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.provider.Telephony;
|
|
||||||
import android.telecom.Call;
|
|
||||||
import android.telephony.PhoneStateListener;
|
import android.telephony.PhoneStateListener;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -21,11 +20,11 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
public class PhoneStatusListener implements AutomationListenerInterface
|
public class PhoneStatusListener implements AutomationListenerInterface
|
||||||
{
|
{
|
||||||
protected static int currentStateIncoming = -1;
|
// protected static int currentStateIncoming = -1;
|
||||||
protected static int currentStateOutgoing = -1;
|
// protected static int currentStateOutgoing = -1;
|
||||||
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 lastState = -1;
|
protected static int currentState = -1;
|
||||||
|
|
||||||
protected static boolean incomingCallsReceiverActive = false;
|
protected static boolean incomingCallsReceiverActive = false;
|
||||||
protected static boolean outgoingCallsReceiverActive = false;
|
protected static boolean outgoingCallsReceiverActive = false;
|
||||||
@ -62,9 +61,14 @@ public class PhoneStatusListener implements AutomationListenerInterface
|
|||||||
return lastPhoneNumber;
|
return lastPhoneNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getLastState()
|
public static void setCurrentState(int currentState)
|
||||||
{
|
{
|
||||||
return lastState;
|
PhoneStatusListener.currentState = currentState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getCurrentState()
|
||||||
|
{
|
||||||
|
return currentState;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class IncomingCallsReceiver extends PhoneStateListener
|
public static class IncomingCallsReceiver extends PhoneStateListener
|
||||||
@ -74,39 +78,45 @@ public class PhoneStatusListener implements AutomationListenerInterface
|
|||||||
{
|
{
|
||||||
// Miscellaneous.logEvent("i", "Call state", "New call state: " + String.valueOf(state), 4);
|
// Miscellaneous.logEvent("i", "Call state", "New call state: " + String.valueOf(state), 4);
|
||||||
|
|
||||||
lastState = state;
|
setCurrentState(state);
|
||||||
|
|
||||||
if(incomingNumber != null && incomingNumber.length() > 0) // check for null in case call comes in with suppressed number.
|
if(incomingNumber != null && incomingNumber.length() > 0) // check for null in case call comes in with suppressed number.
|
||||||
setLastPhoneNumber(incomingNumber);
|
setLastPhoneNumber(incomingNumber);
|
||||||
|
|
||||||
|
lastPhoneDirection = 1;
|
||||||
|
|
||||||
switch(state)
|
switch(state)
|
||||||
{
|
{
|
||||||
case TelephonyManager.CALL_STATE_IDLE:
|
case TelephonyManager.CALL_STATE_IDLE:
|
||||||
Miscellaneous.logEvent("i", "Call state", "New call state: CALL_STATE_IDLE", 4);
|
Miscellaneous.logEvent("i", "Call state", "New call state: CALL_STATE_IDLE", 4);
|
||||||
if(currentStateIncoming == TelephonyManager.CALL_STATE_OFFHOOK)
|
// if(currentStateIncoming == TelephonyManager.CALL_STATE_OFFHOOK)
|
||||||
setCurrentStateIncoming(state);
|
// setCurrentStateIncoming(state);
|
||||||
else if(currentStateOutgoing == TelephonyManager.CALL_STATE_OFFHOOK)
|
// else if(currentStateOutgoing == TelephonyManager.CALL_STATE_OFFHOOK)
|
||||||
setCurrentStateOutgoing(state);
|
// setCurrentStateOutgoing(state);
|
||||||
else
|
// else
|
||||||
currentStateIncoming = state;
|
// currentStateIncoming = state;
|
||||||
currentStateOutgoing = state;
|
// currentStateOutgoing = state;
|
||||||
break;
|
break;
|
||||||
case TelephonyManager.CALL_STATE_OFFHOOK:
|
case TelephonyManager.CALL_STATE_OFFHOOK:
|
||||||
Miscellaneous.logEvent("i", "Call state", "New call state: CALL_STATE_OFFHOOK", 4);
|
Miscellaneous.logEvent("i", "Call state", "New call state: CALL_STATE_OFFHOOK", 4);
|
||||||
if(currentStateIncoming == TelephonyManager.CALL_STATE_RINGING)
|
// if(currentStateIncoming == TelephonyManager.CALL_STATE_RINGING)
|
||||||
setCurrentStateIncoming(state);
|
// setCurrentStateIncoming(state);
|
||||||
else if(currentStateOutgoing == TelephonyManager.CALL_STATE_RINGING)
|
// else if(currentStateOutgoing == TelephonyManager.CALL_STATE_RINGING)
|
||||||
setCurrentStateOutgoing(state);
|
// setCurrentStateOutgoing(state);
|
||||||
break;
|
break;
|
||||||
case TelephonyManager.CALL_STATE_RINGING:
|
case TelephonyManager.CALL_STATE_RINGING:
|
||||||
String number = "unknown";
|
Miscellaneous.logEvent("i", "Call state", String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.incomingCallFrom), incomingNumber), 4);
|
||||||
if(incomingNumber != null && incomingNumber.length() > 0)
|
|
||||||
number = incomingNumber;
|
|
||||||
Miscellaneous.logEvent("i", "Call state", String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.incomingCallFrom), number), 4);
|
|
||||||
|
|
||||||
setCurrentStateIncoming(state);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.phoneCall);
|
||||||
|
AutomationService asInstance = AutomationService.getInstance();
|
||||||
|
for(int i=0; i<ruleCandidates.size(); i++)
|
||||||
|
{
|
||||||
|
if(asInstance != null)
|
||||||
|
if(ruleCandidates.get(i).applies(asInstance))
|
||||||
|
ruleCandidates.get(i).activate(asInstance, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,23 +125,36 @@ public class PhoneStatusListener implements AutomationListenerInterface
|
|||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent)
|
public void onReceive(Context context, Intent intent)
|
||||||
{
|
{
|
||||||
lastState = TelephonyManager.CALL_STATE_RINGING;
|
|
||||||
lastPhoneDirection = 2;
|
lastPhoneDirection = 2;
|
||||||
setCurrentStateOutgoing(2); // das kommt hier auch bei nur klingeln
|
// setCurrentStateOutgoing(2); // das kommt hier auch bei nur klingeln
|
||||||
|
|
||||||
|
TelephonyManager tm = (TelephonyManager)context.getSystemService(Service.TELEPHONY_SERVICE);
|
||||||
|
setCurrentState(tm.getCallState());
|
||||||
|
|
||||||
setLastPhoneNumber(intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER));
|
setLastPhoneNumber(intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER));
|
||||||
Miscellaneous.logEvent("i", "Call state", String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.outgoingCallFrom), getLastPhoneNumber()), 4);
|
Miscellaneous.logEvent("i", "Call state", String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.outgoingCallFrom), getLastPhoneNumber()), 4);
|
||||||
|
|
||||||
|
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).applies(asInstance))
|
||||||
|
ruleCandidates.get(i).activate(asInstance, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isInACall()
|
public static boolean isInACall()
|
||||||
{
|
{
|
||||||
if(isInIncomingCall() | isInOutgoingCall())
|
return getCurrentState() != TelephonyManager.CALL_STATE_IDLE;
|
||||||
return true;
|
// if(isInIncomingCall() | isInOutgoingCall())
|
||||||
|
// return true;
|
||||||
return false;
|
//
|
||||||
|
// return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isInIncomingCall()
|
/* public static boolean isInIncomingCall()
|
||||||
{
|
{
|
||||||
// Miscellaneous.logEvent("i", "Incoming call state", String.valueOf(currentStateIncoming), 5);
|
// Miscellaneous.logEvent("i", "Incoming call state", String.valueOf(currentStateIncoming), 5);
|
||||||
switch(currentStateIncoming)
|
switch(currentStateIncoming)
|
||||||
@ -245,7 +268,7 @@ public class PhoneStatusListener implements AutomationListenerInterface
|
|||||||
public static int getCurrentStateOutgoing()
|
public static int getCurrentStateOutgoing()
|
||||||
{
|
{
|
||||||
return currentStateOutgoing;
|
return currentStateOutgoing;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Apps that redirect outgoing calls should use the android.telecom.CallRedirectionService API. Apps that perform call screening should use the android.telecom.CallScreeningService API.
|
Apps that redirect outgoing calls should use the android.telecom.CallRedirectionService API. Apps that perform call screening should use the android.telecom.CallScreeningService API.
|
||||||
|
@ -36,17 +36,11 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" >
|
android:layout_height="wrap_content" >
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/rbTriggerPhoneCallStateAny"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:checked="true"
|
|
||||||
android:text="@string/any" />
|
|
||||||
|
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:id="@+id/rbTriggerPhoneCallStateRinging"
|
android:id="@+id/rbTriggerPhoneCallStateRinging"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:checked="true"
|
||||||
android:text="@string/ringing" />
|
android:text="@string/ringing" />
|
||||||
|
|
||||||
<RadioButton
|
<RadioButton
|
||||||
|
Loading…
Reference in New Issue
Block a user